Skip to content
Console
Menu

Alerts and status pages

App store purchases

Credits

Knowledge

KV

Notifications

Organizations

Storage

Workflows

API reference

Getting Started

Authentication

KV Store

Exchange read token on a trust policy

Exchanges the caller's Access grant for a read-only GitHub App installation token.

Exchanges the caller's Access grant for a read-only GitHub App installation token. Requires the explicit broker:exchange:read scope on this policy, with the same subject, actor, Connection and repository checks as ExchangeToken. Every resolved permission must be read-only: omitting permissions inherits the policy and is refused if it has writes. The provider's returned permissions must confirm the requested ceiling. Writes one TokenExchange audit record; broker:read cannot issue tokens.

  • Path POST https://api.sylphx.com/v1/orgs/acme/trust_policies/trust-policy:exchangeReadToken
  • Scope broker:exchange:read
  • Effect write — a successful call changes state.
  • Collection trust_policies

#Request

FieldTypeWhat it is
namestringThe trust policy to exchange under. Required.
permissionsmap<string, string>The permissions this call needs, at most the policy's; empty means the policy's. Every resolved permission must be read-only.
repositoriesstring[]The one repository this call needs, owner/name, one of the policy's. Required.
ttldurationHow long the credential should live, at most the policy's max_ttl. A GitHub installation token always lives one hour: unset or 3600s.

#Response

FieldTypeWhat it is
tokenstringThe provider credential. Never logged, persisted, or cached by the caller beyond expire_time. Never returned again.
credential_kindCredentialKindWhat token is. One of access_token, runner_registration, vapid_assertion.
expire_timetimestampWhen the credential stops working.
permissionsmap<string, string>The permissions the credential carries.
repositoriesstring[]The one repository the credential covers.
token_exchangestringThe record of this credential, orgs/{org}/trust_policies/{trust_policy}/token_exchanges/{token_exchange}: the name to revoke it by.
connectionstringThe Connection the credential was issued on, the policy's.
issuerstringThe provider identity that signed the credential: for GitHub, github-apps/{app_id} of the installation it was minted against.

#Errors

  • UNAUTHENTICATED — No valid key or token was presented.
  • PERMISSION_DENIED — The key lacks the method's permission.
  • RESOURCE_NOT_FOUND — The named Resource does not exist or is not visible.
  • INVALID_FIELD — A field failed validation.
  • INVALID_STATE — The Resource is in a state that forbids the call.
  • RATE_LIMITED — The rate limit is reached; see Retry-After.
  • UNAVAILABLE — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.

Every error arrives in the body Errors describes.

#Examples

curl -X POST "https://api.sylphx.com/v1/orgs/acme/trust_policies/trust-policy:exchangeReadToken" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"repositories":["…"]}'