App tokens
CompozyOS App tokens HTTP endpoints.
4 endpoints32 pages in API Reference
Endpoints4
- GET
/api/app-tokensList app tokens without their bearer secrets - POST
/api/app-tokensCreate an app token and reveal its bearer secret once - PATCH
/api/app-tokens/{app_token_id}Change an app token name or replace its origin allowlist - DELETE
/api/app-tokens/{app_token_id}Revoke an app token and cancel its active streams
GET/api/app-tokens
List app tokens without their bearer secrets
httpuds
Query parameters
state?stringToken state; defaults to active
Value in
"active""revoked""all"Responses
- 200
- Active tokens first, then revoked; newest first within each group
- 400
- Invalid app token state
- 403
- App-token management is restricted to local callers
- 500
- Internal server error
Response body
Active tokens first, then revoked; newest first within each group
application/json- response
app_tokens*array<>Request
curl -X GET 'http://localhost:2123/api/app-tokens'200 Active tokens first, then revoked; newest first within each group
{ "app_tokens": [ { "created_at": "2019-08-24T14:15:22Z", "id": "string", "last_used_at": "2019-08-24T14:15:22Z", "name": "string", "origins": [ "string" ], "revoked_at": "2019-08-24T14:15:22Z" } ]}POST/api/app-tokens
Create an app token and reveal its bearer secret once
httpuds
Request body
JSON request body
application/json- body
name*stringorigins?array<string>Responses
- 201
- App token created; store the secret now
- 400
- Invalid app token name or origins
- 403
- App-token management is restricted to local callers
- 409
- Active app token limit reached
- 500
- Internal server error
Response body
App token created; store the secret now
application/json- response
app_token*token*stringRequest
curl -X POST 'http://localhost:2123/api/app-tokens' \ -H 'Content-Type: application/json' \ -d '{ "name": "string"}'201 App token created; store the secret now
{ "app_token": { "created_at": "2019-08-24T14:15:22Z", "id": "string", "last_used_at": "2019-08-24T14:15:22Z", "name": "string", "origins": [ "string" ], "revoked_at": "2019-08-24T14:15:22Z" }, "token": "string"}PATCH/api/app-tokens/{app_token_id}
Change an app token name or replace its origin allowlist
httpuds
Path parameters
app_token_id*stringApp token id
Request body
JSON request body
application/json- body
name?string|nullorigins?array<string>|nullResponses
- 200
- Updated
- 400
- Invalid app token name or origins
- 403
- App-token management is restricted to local callers
- 404
- App token not found
- 409
- Revoked app tokens cannot be updated
- 500
- Internal server error
Response body
Updated
application/json- response
app_token*Request
curl -X PATCH 'http://localhost:2123/api/app-tokens/string' \ -H 'Content-Type: application/json' \ -d '{}'200 Updated
{ "app_token": { "created_at": "2019-08-24T14:15:22Z", "id": "string", "last_used_at": "2019-08-24T14:15:22Z", "name": "string", "origins": [ "string" ], "revoked_at": "2019-08-24T14:15:22Z" }}DELETE/api/app-tokens/{app_token_id}
Revoke an app token and cancel its active streams
httpuds
Path parameters
app_token_id*stringApp token id
Responses
- 200
- App token revoked; changed is false when already revoked
- 403
- App-token management is restricted to local callers
- 404
- App token not found
- 500
- Internal server error
Response body
App token revoked; changed is false when already revoked
application/json- response
app_token*canceled*integerchanged*booleanRequest
curl -X DELETE 'http://localhost:2123/api/app-tokens/string'200 App token revoked; changed is false when already revoked
{ "app_token": { "created_at": "2019-08-24T14:15:22Z", "id": "string", "last_used_at": "2019-08-24T14:15:22Z", "name": "string", "origins": [ "string" ], "revoked_at": "2019-08-24T14:15:22Z" }, "canceled": 0, "changed": true}