Create Service Delegation Token
POST
/api/services/:service_name/delegation-tokenExchange the authenticated user's web/API session for a short-lived service delegation token scoped to one service, organization, and scope set. This does not create a persistent Morph API key.
Request
Path Parameters
- service_namestringrequired
application/json
Bodyrequired
- object
- audiencestring
Optional audience. When supplied it must match the target service id or name.
- client_contextobject
Additional properties may contain any value.
- idempotency_keystring
- organization_idstring
Internal or external organization id. Defaults to the authenticated user's active organization.
scopesarray of stringrequired
- Itemsstring
- audiencestring
Responses
- 200
- 400
- 401
- 402
- 403
- 404
- 429
- 500
Short-lived delegation token and redacted claim summary
application/json
Schema
- object
- access_tokenstringrequired
claimsobjectrequired
- actor_typestring
- audiencestring
- expires_atinteger
- issued_atinteger
- issuerstring
- key_idstring
- organization_idstring
scopesarray of string
- Itemsstring
- service_idstring
- service_namestring
- subjectstring
- token_idstring
- expires_atintegerrequired
policyobjectrequired
allowed_scopesarray of string
- Itemsstring
- token_typestringrequired
Request, scopes, or audience is invalid
application/json
Schema
- object
- detailstringrequired
- error_codestring
User authentication is missing or invalid
application/json
Schema
- object
- detailstringrequired
- error_codestring
Canonical billing policy denies token exchange
application/json
Schema
- object
- detailstringrequired
- error_codestring
Organization, scope, or trust-and-safety policy denies token exchange
application/json
Schema
- object
- detailstringrequired
- error_codestring
Target service does not exist
application/json
Schema
- object
- detailstringrequired
- error_codestring
Delegation exchange rate limit exceeded
application/json
Schema
- object
- detailstringrequired
- error_codestring
Delegation state could not be evaluated or token signing failed
application/json
Schema
- object
- detailstringrequired
- error_codestring