# UserApiToken

## Retrieves API tokens for the current user.

> Returns token metadata for the authenticated administrator. Token values are not returned by this endpoint.\
> \
> Required roles: Admin.

```json
{"openapi":"3.0.1","info":{"title":"WebApi | v1","version":"1.0.0"},"tags":[{"name":"UserApiToken"}],"servers":[{"url":"https://api.safegpt.nl/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT bearer token. Example: 'Bearer {token}'.","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/v1/UserApiToken/Get":{"get":{"tags":["UserApiToken"],"summary":"Retrieves API tokens for the current user.","description":"Returns token metadata for the authenticated administrator. Token values are not returned by this endpoint.\n\nRequired roles: Admin.","responses":{"200":{"description":"OK"},"401":{"description":"Authentication is required."},"403":{"description":"The user is not authorized to access this endpoint."}}}}}}
```

## Creates a new API token for the current user.

> Validates expiry boundaries and returns the created token, including the token value for one-time display.\
> \
> Required roles: Admin.

```json
{"openapi":"3.0.1","info":{"title":"WebApi | v1","version":"1.0.0"},"tags":[{"name":"UserApiToken"}],"servers":[{"url":"https://api.safegpt.nl/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT bearer token. Example: 'Bearer {token}'.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateUserApiTokenViewModel":{"required":["expireAt"],"type":"object","properties":{"description":{"type":"string","nullable":true},"expireAt":{"type":"string","description":"UTC expiration moment for the token.","format":"date-time"}},"description":"Represents input for creating a user API token."}}},"paths":{"/v1/UserApiToken/Create":{"post":{"tags":["UserApiToken"],"summary":"Creates a new API token for the current user.","description":"Validates expiry boundaries and returns the created token, including the token value for one-time display.\n\nRequired roles: Admin.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserApiTokenViewModel"}},"text/json":{"schema":{"$ref":"#/components/schemas/CreateUserApiTokenViewModel"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/CreateUserApiTokenViewModel"}}},"required":true},"responses":{"200":{"description":"OK"},"401":{"description":"Authentication is required."},"403":{"description":"The user is not authorized to access this endpoint."}}}}}}
```

## Updates metadata for an existing API token.

> Allows token owners to update token description details.\
> \
> Required roles: Admin.

```json
{"openapi":"3.0.1","info":{"title":"WebApi | v1","version":"1.0.0"},"tags":[{"name":"UserApiToken"}],"servers":[{"url":"https://api.safegpt.nl/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT bearer token. Example: 'Bearer {token}'.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UpdateUserApiTokenViewModel":{"type":"object","properties":{"description":{"type":"string","nullable":true}},"description":"Represents input for updating user API token metadata."}}},"paths":{"/v1/UserApiToken/Update/{tokenId}":{"put":{"tags":["UserApiToken"],"summary":"Updates metadata for an existing API token.","description":"Allows token owners to update token description details.\n\nRequired roles: Admin.","parameters":[{"name":"tokenId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserApiTokenViewModel"}},"text/json":{"schema":{"$ref":"#/components/schemas/UpdateUserApiTokenViewModel"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/UpdateUserApiTokenViewModel"}}},"required":true},"responses":{"200":{"description":"OK"},"401":{"description":"Authentication is required."},"403":{"description":"The user is not authorized to access this endpoint."}}}}}}
```

## Deletes an API token owned by the current user.

> Deletes an API token owned by the current user.\
> \
> Required roles: Admin.

```json
{"openapi":"3.0.1","info":{"title":"WebApi | v1","version":"1.0.0"},"tags":[{"name":"UserApiToken"}],"servers":[{"url":"https://api.safegpt.nl/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT bearer token. Example: 'Bearer {token}'.","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/v1/UserApiToken/Delete/{tokenId}":{"delete":{"tags":["UserApiToken"],"summary":"Deletes an API token owned by the current user.","description":"Deletes an API token owned by the current user.\n\nRequired roles: Admin.","parameters":[{"name":"tokenId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"401":{"description":"Authentication is required."},"403":{"description":"The user is not authorized to access this endpoint."}}}}}}
```

## Rotates an API token while preserving metadata and expiry.

> Creates a new token value for a non-expired token and removes the old token.\
> \
> Required roles: Admin.

```json
{"openapi":"3.0.1","info":{"title":"WebApi | v1","version":"1.0.0"},"tags":[{"name":"UserApiToken"}],"servers":[{"url":"https://api.safegpt.nl/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT bearer token. Example: 'Bearer {token}'.","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/v1/UserApiToken/Rotate/{tokenId}":{"get":{"tags":["UserApiToken"],"summary":"Rotates an API token while preserving metadata and expiry.","description":"Creates a new token value for a non-expired token and removes the old token.\n\nRequired roles: Admin.","parameters":[{"name":"tokenId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"401":{"description":"Authentication is required."},"403":{"description":"The user is not authorized to access this endpoint."}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.safegpt.nl/api-en/endpoints/userapitoken.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
