# 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: 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.empe.io/develop/issuer/api-reference/token.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.
