Skip to content

App tokens

CompozyOS App tokens HTTP endpoints.

4 endpoints32 pages in API Reference

Endpoints4

GET/api/app-tokens

List app tokens without their bearer secrets

httpuds

Query parameters

state?string

Token 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
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
  1. body
name*string
origins?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
Request
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*string

App token id

Request body

JSON request body

application/json
  1. body
name?string|null
origins?array<string>|null

Responses

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
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*string

App 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
Request
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}