Exchange a Service Account Key for a short-lived access token bound to a specified Identity.
POST /api/v1/forward/identities/{identity_id}/service_account_tokens
Issue a Service Account Token that represents a specified end user (Identity). The caller uses the token to access Forward APIs in that Identity's context, such as creating a Session or querying the Identity's configuration. This is suitable for issuing a token to a single end-user session in an enterprise product.
To manage enterprise resources such as Templates and Identities, use Create a Service Account Token, which issues a token with an administrator subject.
Request headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer <Service Account Key> |
| Content-Type | Yes | application/json |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| identity_id | string | Yes | Forward Identity ID. |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| ttl_seconds | integer | No | Token lifetime in seconds, from 1 to 43200 (12 hours maximum). The platform default is used when omitted. |
| metadata | object | No | Business metadata that identifies the token's purpose for auditing. |
Example request
Example response
HTTP 201 Created
Response fields
| Field | Type | Description |
|---|---|---|
| type | string | Always service_account_token. |
| access_token | string | Short-lived access token. It is returned only in this response; store it securely. |
| token_type | string | Always Bearer. |
| expires_in | integer | Lifetime in seconds. |
| expires_at | string | Expiration time in RFC 3339 format. |
| auth_token_id | string | Unique token identifier used to revoke the token. |
| service_account_id | string | ID of the Service Account that issued the token. |
| credential_id | string | ID of the Service Account Key that issued the token. |
| subject_type | string | Token subject type. This endpoint returns identity. |
| identity_id | string | ID of the Identity bound to the token. |
Errors
| HTTP | Type | Code | Condition |
|---|---|---|---|
| 400 | invalid_request_error | - | identity_id is empty, the request body is invalid, or ttl_seconds is outside 1–43200. |
| 401 | authentication_error | - | The Service Account Key is invalid or expired, or another credential type was used. |
| 403 | permission_error | - | The target Identity is disabled. |
| 404 | not_found_error | - | The target Identity does not exist. |
| 503 | api_error | - | The token issuance service is temporarily unavailable. Try again later. |
Notes
- The token is bound to the Identity. Its holder can act only as that Identity and cannot operate on another Identity's data.
- Business requests using the token are rejected after the Identity is disabled or deleted.
- Issue one token per end-user session and choose a
ttl_secondsvalue that matches the session duration.