Skip to main content

Documentation Index

Fetch the complete documentation index at: https://archie.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Custom APIs are HTTP routes you register on Archie’s gateway that reverse-proxy to internal services. Each route maps a public-facing URL path to a target URL and brings the target under the same auth, CORS, rate-limiting, and resilience policies as the rest of your backend. Use a Custom API when:
  • You have an existing internal service you want to expose under your project’s domain.
  • You want CORS, rate limiting, or a circuit breaker in front of a third-party endpoint.
  • You need request/response transformation that doesn’t belong in your service code.
For CRUD against the Data Model, you don’t need a Custom API — the auto-generated GraphQL and REST APIs already cover that. To open it, navigate to App Services → Custom APIs in the Backend Console. Custom API Gateway overview

Per-environment scoping

Routes are scoped per environment. Each environment has its own routes — production routes can point at production services while dev routes point at staging instances of the same service. When branching an environment with the Gateway routes copy option, every route is duplicated into the new environment. Each copy receives a new ID and can be edited independently.

Registering a route

The configuration is split across four tabs: General, Security, Request & Response, and Resilience.

General — routing logic

The General tab defines what the route catches and where it goes.
FieldPurpose
PathPublic-facing URI path clients call (e.g., /api/v1/users).
Target URLInternal destination URL where the gateway forwards the request.
MethodsHTTP verbs the route responds to: GET, POST, PUT, PATCH, DELETE.
EnabledToggle to activate or deactivate the route without deleting it.
General Configuration Form

Security — CORS and rate limiting

The Security tab controls cross-origin access and rate limits per route.

CORS

SettingWhat it does
Allow All OriginsAccept requests from any domain. Disable to use the allowlist.
Allowed OriginsWhitelist of specific domains permitted to call the route.
Allowed Methods & HeadersHTTP verbs and custom headers the gateway will accept.
Allow CredentialsWhether browsers should include cookies or auth headers.
Preflight Cache DurationHow long browsers cache the CORS preflight response.
Expose HeadersResponse headers safe to expose to the client.

Rate limiting

SettingWhat it does
AverageBaseline requests allowed per time unit.
Burst AllowanceExtra requests allowed in short spikes above the average.
Time WindowCounting period — typically per second or per minute.
Rate Limit byHow to identify unique callers — typically by IP address.
When the limit is exceeded, the gateway returns 429 Too Many Requests with a Retry-After header. Route Security Configuration For project-wide CORS and rate-limit defaults, see Backend → Settings → Network.

Request & Response — transformations

The Request & Response tab controls how data is shaped on the way through the gateway.

Custom headers

Add or override headers per route:
  • Custom request headers — sent to your backend on top of what the client sent.
  • Custom response headers — added to the response on the way back.
Each header is a name and a value. Useful for injecting service-to-service auth tokens or stamping responses with a Cache-Control policy.

Path rewriting

Modify the request path before it reaches your backend:
OperationExample
Strip prefix/v1/users/123/users/123 (strip /v1).
Add prefix/users/123/api/users/123 (add /api).
Regex pattern & replacement^/old/(.*)/new/$1 for arbitrary remapping.

Query parameter forwarding

Choose which query string parameters reach the backend:
ModeBehavior
Forward allPass the entire query string unchanged.
Allow listForward only the named parameters.
Deny listForward all parameters except those explicitly blocked.

Body size limits

SettingPurpose
Request body size limitMaximum size of incoming request bodies.
Response body size limitMaximum size of outgoing response bodies.
Exceeding either limit returns 413 Payload Too Large. Request and Response Settings

Resilience — timeouts, circuit breakers, caching

The Resilience tab keeps your route healthy when the backend doesn’t cooperate.

Custom timeout

How long the gateway waits for a response before giving up. Set between 1 and 300 seconds. Without a timeout, a slow backend can pin gateway capacity indefinitely.

Circuit breaker

Automatically stop forwarding requests to a failing backend so failures don’t cascade. Apply a preset or write a custom expression:
PresetTrips when
50% errorsError ratio crosses 0.5 over the check window.
30% errorsError ratio crosses 0.3.
High latencyp99 response time crosses the threshold.
500+ errorsSustained 5xx responses.
SettingPurpose
ExpressionCustom trip condition (e.g., NetworkErrorRatio() > 0.5).
Check (s)How often the breaker checks while open.
Fallback (s)Wait before attempting a partial close.
Recovery (s)Recovery phase duration before fully closing.

Response caching

SettingPurpose
Cache TTL (seconds)Time-to-live for GET responses. Subsequent identical requests within the TTL are served from gateway cache.
Caching applies only to safe (GET) requests. Mutations are never cached. Resilience and Reliability Settings

Programmatic management

Routes can also be created via GraphQL — useful for codifying gateway configuration alongside your data model.
mutation RegisterRoute($input: RegisterRouteInput!) {
  registerRoute(input: $input) {
    id
    path
    targetUrl
    methods
    enabled
    environment
  }
}
When you delete an environment, all routes attached to it are cleaned up automatically. To delete environment routes manually:
mutation DeleteRoutesByEnvironment($input: DeleteRoutesByEnvironmentInput!) {
  deleteRoutesByEnvironment(input: $input) {
    deletedCount
  }
}

Permissions

Custom API routes inherit the same auth and authorization model as the rest of your backend. Authenticated requests carry their roles to the route, where you can apply per-route policy. For full coverage, see Role-Based Access.

FAQ

Use a Custom API when you have an existing service to expose — the gateway adds CORS, rate limiting, and resilience without code. Use a custom function when the logic itself runs inside Archie. The two compose: a Custom API can route to a custom function the same way it routes to any backend.
Optionally — tick Gateway routes in the branching modal. Each copy gets a new ID. After branching, edits in either environment are independent.
Settings → Network sets the default CORS for the auto-generated GraphQL and REST APIs. Per-route CORS overrides that for a specific Custom API path.
No — caching only applies to GET. Caching mutations would silently return stale state to clients that expected fresh writes.
The gateway short-circuits incoming requests with a 503 Service Unavailable response without forwarding to the backend. After the recovery period, it lets a small number of probe requests through to test whether the backend has recovered before fully closing the circuit.