Proxy a PUT request to an integration with server-side credential injection

High-value endpoint. Accepts an upstream HTTP request and forwards it to the upstream API after injecting the stored credentials server-side. Credentials never leave Appstrate.

Authentication: bearer only — an API key or an OIDC-issued JWT (device-flow access token for the interactive CLI, dashboard access token for second-party apps). Cookie sessions are rejected. Session binding pins the X-Session-Id to the first principal (API key or JWT user) that used it.

Two permissions govern it; credential-proxy:call implies credential-proxy:call-own. For a run (X-Run-Id): requires credential-proxy:call — launching runs (agents:run) does not grant it; the header names the caller's own in-flight run that the caller executes itself (a remote run), and the call reaches the connections that run bound, a connection another member shared into the space included. Outside a run (no X-Run-Id): with credential-proxy:call the call reaches the connections usable in the space, the caller's own and those shared into it, through the resolver's cascade without agent pins (org defaults included): the rows a run in the space binds for that caller. With credential-proxy:call-own alone it reaches the caller's OWN connections only: a connection another member shared into the space is out of reach, and so is every connection of an integration governed by an enforced org default; a call for a run is refused. GET /api/credential-proxy/connections lists the candidates of a call outside a run and, per row, what such a call would still refuse.

Optional Appstrate-User header (API-key auth only) makes that end-user the caller: outside a run the call reaches the end-user's own connections, and with credential-proxy:call those a member shared into the space.

URL and headers can contain {{credential_field}} placeholders substituted against the integration's credential schema, each value encoded for the place it takes: percent-encoded as one URL component (a placeholder that starts the URL is a base URL, inserted as is), a header value as is. Set X-Substitute-Body: 1 to substitute the request body too (verbs that carry one), each value escaped for the body's Content-Type: JSON (a value inside a string literal is escaped, a bare {{field}} becomes a JSON string), form, XML, multipart (a value holding a line break or the boundary delimiter is refused; in a part header a placeholder must sit inside a quoted string, where a value holding " or \ is refused) or text/plain (as is). A body holding a placeholder under any other Content-Type, under none, or under one that itself holds a placeholder, is a 400 invalid_request, as is one header name written twice in different case; a body with no placeholder is sent untouched. A value its place cannot carry (a line break in a header, a character outside RFC 6265 cookie-octet in a Cookie header, a path segment rendered . or ..) is a credential_unusable naming the placeholder, never encoded around. So is a path segment a field leaves empty (/x/{{field}} with an unset optional field): either the connection lacks the value or the target should not use it.

Boolean control headers (X-Substitute-Body, X-Stream-Request, X-Stream-Response) take 1 or 0; any other value is a 400.

An Idempotency-Key header is the upstream's here (Stripe's, for one): it is relayed with the caller's other headers, whatever the verb. The platform de-duplicates nothing on it, so it is not a parameter of this operation and no Idempotent-Replayed is answered.

Every response carries RFC 9209 Proxy-Status: appstrate; received-status=<n> on an upstream response relayed whatever its status (a relayed 401 carries no platform WWW-Authenticate challenge — it is the upstream refusing the connection's credential), appstrate; error=<type> on a response the proxy produced itself, whose problem code names the cause.

PUT/api/credential-proxy/proxy

Authorization

AuthorizationBearer <token>

API key authentication. Use Authorization: Bearer apst_... header. The org is resolved from the key — no X-Org-Id header needed. A key is apst_ + 30 base62 characters + a 6-character base62 CRC32 of those 30, so a malformed key is refused without a lookup.

In: header

Header Parameters

X-Space-Id*string

Space id (spc_…) the API key is scoped to.

X-Integration-Id*string

Scoped integration package name (e.g. @afps/gmail).

X-Target*string

Upstream endpoint: an absolute URL, or one whose {{credential_field}} placeholders (e.g. {{site_url}}/wp-json/…) the platform substitutes from the connection before any check; the substituted URL must be absolute. It must match the integration manifest auth's authorized_uris (rendered for the connection) unless allow_all_uris: true. allow_all_uris is ignored when a {{credential_field}} placeholder appears in this URL, a header, or a substituted body: the target and every redirect hop must then match authorized_uris, and the call is refused when that list is empty.

X-Session-Id*string

Caller-chosen session id; scopes the cookie jar. Fresh UUID per CLI invocation is typical.

X-Substitute-Body?string

When 1, the request body is decoded as UTF-8 and {{field}} placeholders are substituted, each value escaped for the body's Content-Type, which must then be JSON, form, XML, multipart or text/plain. Ignored on verbs that do not carry a body (GET, DELETE).

Value in"0" | "1"
Appstrate-User?string

Impersonation header — the end-user is the caller: outside a run the call reaches their own connections, and with credential-proxy:call those a member shared into the space.

Match^eu_
X-Stream-Request?string

When 1, forward the request body as a stream instead of buffering. Required for uploads larger than the buffered body cap; the upstream content length is still validated against CREDENTIAL_PROXY_LIMITS.max_request_bytes. Ignored on verbs that do not carry a body (GET, DELETE).

Value in"0" | "1"
X-Stream-Response?string

When 1, stream the upstream response body through the 100 MB streaming cap instead of buffering it. Skips the buffered max_response_bytes truncation, so X-Truncated is not emitted; an oversized stream is aborted rather than truncated.

Value in"0" | "1"
X-Max-Response-Size?string

Optional cap (in bytes) on the buffered upstream response before truncation. Clamped to CREDENTIAL_PROXY_LIMITS.max_response_bytes. Ignored when X-Stream-Response: 1 is set.

X-Run-Id?string

Optional run id (run_…) of the run this call acts for — sent by a runner executing it (appstrate run --report). Requires credential-proxy:call. Must name an in-flight run of the calling actor in this space, executed by the caller (runOrigin: remote): an unknown id or one of another space is a 404, another actor's run or a run the platform executes a 403, a finished run a 400. It binds the call to the run's snapshot: the call reaches ONLY the connections the run's kickoff bound to the integration (every layer applied, agent-level ones included — admin pins, enforced defaults, launch overrides, member pins): one bound connection is used; several require X-Connection-Id naming one of them (409 must_choose_connection when absent, 400 connection_not_in_run when it names another); none is a 404, and so is a bound one no longer reachable (deleted or unshared); a bound one that needs reconnecting is a 409 needs_reconnection. Without it the call is made outside a run and reaches what X-Connection-Id describes.

X-Connection-Id?string

Optional explicit connection UUID. With X-Run-Id, it must name a connection the run bound (see X-Run-Id). Without it, what is reachable depends on the caller's permissions.

credential-proxy:call-own without credential-proxy:call: only the caller's own connections (user or end-user) usable in the request's space are candidates — no org default applies, a soft one included — in this order: (1) an integration governed by an ENFORCED org default answers 403 call_permission_required whatever is named; (2) a named connection is used when it is one of the caller's own, of the requested integration; any other id — another member's connection, shared into the space or not, or an unknown id — is one and the same 404 credential_not_found; (3) nothing named: exactly one own connection is used, none is a 404 credential_not_found, several a 409 must_choose_connection listing them.

With credential-proxy:call: the candidates are the caller's own connections and those another member shared into the space, in this order: (1) an ENFORCED org default of the integration binds its set — a named id must be a member (400 connection_not_in_org_default otherwise, whatever the id names); (2) a named connection is used when it is one of the candidates, of the requested integration; any other id — a connection not shared into the space or an unknown id — is one and the same 404 credential_not_found; (3) a SOFT org default binds its set; (4) nothing named and no default: exactly one own connection is used; several, or none while a shared one is a candidate, is a 409 must_choose_connection listing the candidates — a shared connection is used only when named or designated by an org default; no candidate at all is a 404 credential_not_found. A default set of one is used, several are a 409 must_choose_connection over the set (an enforced default then takes one of its members, a soft one any candidate). With nothing named, a default's whole set is checked as a run's would be, before any choice is offered: a member the caller cannot reach answers 409 pinned_connection_unavailable and one that needs reconnecting 409 needs_reconnection, even when another member would serve; a named member that passes those checks is used.

Either way a connection that would be used and needs reconnecting, a default's member included, is a 409 needs_reconnection, and a non-uuid value a 400.

Formatuuid

Request Body

application/octet-stream

Forwarded as-is to the upstream. Optional placeholder substitution via X-Substitute-Body.

curl -X PUT "https://your-instance/api/credential-proxy/proxy" \  -H "X-Space-Id: string" \  -H "X-Integration-Id: string" \  -H "X-Target: string" \  -H "X-Session-Id: string"
Empty
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "https://docs.appstrate.dev/errors/rate-limited",
  "title": "Rate Limited",
  "status": 429,
  "detail": "Too many requests. Please try again shortly.",
  "code": "rate_limited",
  "request_id": "req_abc123",
  "retry_after": 30
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "line": 1,
      "column": 1,
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true,
          "scopes_granted": [
            "string"
          ],
          "missing_scopes": [
            "string"
          ]
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "remedy": "new_connection",
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "source": "admin_pin",
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}
Empty