> For the complete documentation index, see [llms.txt](https://docs.appetize.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appetize.io/rest-api/api-tokens.md).

# API Tokens

## List API Tokens

> Returns a paginated list of API tokens with obfuscated token IDs.

```json
{"openapi":"3.0.3","info":{"title":"Appetize V2 API Reference","version":"2"},"servers":[{"url":"https://api.appetize.io"}],"security":[{"jwt":[]},{"apiToken":[]}],"components":{"securitySchemes":{"apiToken":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"Use an API token for authentication via X-API-KEY header"}},"schemas":{"Pagination":{"type":"object","properties":{"total":{"type":"integer","format":"int32"},"nextPage":{"type":"number","nullable":true,"format":"int32"}}},"ApiTokenCollection":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/ApiToken"}}}},"ApiToken":{"type":"object","required":["id","obfuscatedToken","label","role","created","createdBy"],"properties":{"id":{"type":"string","description":"The ID of the API token."},"obfuscatedToken":{"type":"string","description":"The string representing the token obfuscated"},"label":{"type":"string","description":"The label of the API token."},"role":{"$ref":"#/components/schemas/ApiTokenRole"},"lastUsed":{"type":"string","nullable":true,"description":"The date and time the API token was last used."},"created":{"type":"string","description":"The date and time the API token was last used."},"createdBy":{"type":"string","description":"The email of the user who created the API token."}}},"ApiTokenRole":{"type":"string","description":"The role of the API token.","enum":["developer","admin","systemAdmin","systemAnalyst"]},"Error":{"type":"object","properties":{"message":{"description":"Error message.","type":"string"}}}}},"paths":{"/v2/api-tokens":{"get":{"summary":"List API Tokens","tags":["API Tokens"],"description":"Returns a paginated list of API tokens with obfuscated token IDs.","operationId":"listApiTokens","parameters":[{"in":"query","name":"page","description":"The page number of results","schema":{"type":"integer"}},{"in":"query","name":"limit","description":"The number of results to return per page","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Pagination"},{"$ref":"#/components/schemas/ApiTokenCollection"}]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Create a new API token

> Creates a new API token. Returns the full token only once. Token must be saved securely by the user.

```json
{"openapi":"3.0.3","info":{"title":"Appetize V2 API Reference","version":"2"},"servers":[{"url":"https://api.appetize.io"}],"security":[{"jwt":[]},{"apiToken":[]}],"components":{"securitySchemes":{"apiToken":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"Use an API token for authentication via X-API-KEY header"}},"schemas":{"CreateApiTokenRequest":{"type":"object","required":["label","role"],"properties":{"label":{"type":"string","description":"The label of the API token."},"role":{"$ref":"#/components/schemas/ApiTokenRole"}}},"ApiTokenRole":{"type":"string","description":"The role of the API token.","enum":["developer","admin","systemAdmin","systemAnalyst"]},"ApiTokenWithSecret":{"type":"object","required":["id","obfuscatedToken","token","label","role","created","createdBy"],"properties":{"id":{"type":"string","description":"The ID of the API token."},"obfuscatedToken":{"type":"string","description":"The string representing the token obfuscated"},"token":{"type":"string","description":"The full token string"},"accountId":{"type":"string","description":"The ID of the account."},"label":{"type":"string","description":"The label of the API token."},"createdBy":{"type":"string","description":"The email of the user who created the API token."},"created":{"type":"string","description":"The date and time the API token was created."},"lastUsed":{"type":"string","nullable":true,"description":"The date and time the API token was last used."},"role":{"$ref":"#/components/schemas/ApiTokenRole"}}},"Error":{"type":"object","properties":{"message":{"description":"Error message.","type":"string"}}}}},"paths":{"/v2/api-tokens":{"post":{"summary":"Create a new API token","tags":["API Tokens"],"description":"Creates a new API token. Returns the full token only once. Token must be saved securely by the user.","operationId":"createApiToken","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiTokenRequest"}}}},"responses":{"201":{"description":"API Token created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTokenWithSecret"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get an API token by id

> Retrieve a specific API token’s info.

```json
{"openapi":"3.0.3","info":{"title":"Appetize V2 API Reference","version":"2"},"servers":[{"url":"https://api.appetize.io"}],"security":[{"jwt":[]},{"apiToken":[]}],"components":{"securitySchemes":{"apiToken":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"Use an API token for authentication via X-API-KEY header"}},"schemas":{"ApiToken":{"type":"object","required":["id","obfuscatedToken","label","role","created","createdBy"],"properties":{"id":{"type":"string","description":"The ID of the API token."},"obfuscatedToken":{"type":"string","description":"The string representing the token obfuscated"},"label":{"type":"string","description":"The label of the API token."},"role":{"$ref":"#/components/schemas/ApiTokenRole"},"lastUsed":{"type":"string","nullable":true,"description":"The date and time the API token was last used."},"created":{"type":"string","description":"The date and time the API token was last used."},"createdBy":{"type":"string","description":"The email of the user who created the API token."}}},"ApiTokenRole":{"type":"string","description":"The role of the API token.","enum":["developer","admin","systemAdmin","systemAnalyst"]},"Error":{"type":"object","properties":{"message":{"description":"Error message.","type":"string"}}}}},"paths":{"/v2/api-tokens/{id}":{"get":{"summary":"Get an API token by id","tags":["API Tokens"],"description":"Retrieve a specific API token’s info.","operationId":"getApiToken","parameters":[{"in":"path","name":"id","description":"The id for the API token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiToken"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"API Token not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Rekove an API token

> Revoke an API token.

```json
{"openapi":"3.0.3","info":{"title":"Appetize V2 API Reference","version":"2"},"servers":[{"url":"https://api.appetize.io"}],"security":[{"jwt":[]},{"apiToken":[]}],"components":{"securitySchemes":{"apiToken":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"Use an API token for authentication via X-API-KEY header"}},"schemas":{"Error":{"type":"object","properties":{"message":{"description":"Error message.","type":"string"}}}}},"paths":{"/v2/api-tokens/{id}":{"delete":{"summary":"Rekove an API token","tags":["API Tokens"],"description":"Revoke an API token.","operationId":"rekoveApiToken","parameters":[{"in":"path","name":"id","description":"The id for the API token to revoke","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"API Token rekoved"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"API Token not found","content":{"application/json":{}}}}}}}}
```
