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

# Token

Exchange authorization code for access token\
\
Validates the authorization code and creates a JWT access token for the holder
------------------------------------------------------------------------------

> Creates a new access token using an authorization code

```json
{"openapi":"3.0.0","info":{"title":"issuer-service","version":"1.0.0-rc2"},"servers":[{"url":"/"}],"security":[],"paths":{"/api/v1/tokens":{"post":{"operationId":"CreateAccessToken","responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessTokenResponseDto"}}}},"400":{"description":"Bad Request - Invalid or missing authorization code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Not Found - Authorization request not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"description":"Creates a new access token using an authorization code","summary":"Exchange authorization code for access token\n\nValidates the authorization code and creates a JWT access token for the holder","tags":["Token"],"parameters":[],"requestBody":{"description":"Request containing the authorization code","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccessTokenRequestDto","description":"Request containing the authorization code"}}}}}}},"components":{"schemas":{"AccessTokenResponseDto":{"description":"Response DTO for access token operations","properties":{"access_token":{"type":"string","description":"JWT access token"},"token_type":{"type":"string","description":"Token type (always \"Bearer\")"},"expires_in":{"type":"number","format":"double","description":"Token expiration time in seconds","minimum":0}},"required":["access_token","token_type","expires_in"],"type":"object","additionalProperties":false},"ErrorResponseDto":{"description":"Extended error response with HTTP details","properties":{"name":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"code":{"type":"number","format":"double","description":"Error code"},"statusCode":{"type":"number","format":"double","description":"HTTP status code"},"httpCode":{"type":"number","format":"double","description":"HTTP code"},"method":{"type":"string","description":"HTTP method"},"path":{"type":"string","description":"Request path"},"stack":{"type":"string","description":"Stack trace (tylko w środowisku deweloperskim)"}},"required":["name","message","code","statusCode","httpCode","method","path"],"type":"object","additionalProperties":false},"CreateAccessTokenRequestDto":{"description":"Request DTO for creating a new access token","properties":{"authorization_code":{"type":"string","description":"Authorization code received from the authorization request\nThe code must be a non-empty string in format of [A-Za-z0-9-_] with length between 32 and 128 characters"}},"required":["authorization_code"],"type":"object","additionalProperties":false}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.empe.io/develop/issuer/api-reference/token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
