# Access Token Retrieval

An `accessToken` is required to trigger a tokenization payment and retrieve the details of the latest payment. By making a request to this service, you can obtain the necessary `accessToken`.

{% hint style="info" %}
The generated `accessToken` is valid for **5 minutes**.
{% endhint %}

### Access Token Retrieval

<mark style="color:green;">`POST`</mark> `https://api.iyzipay.com/v1/pay-with-iyzico/third-party-session/retrieve/access-token`<br>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Authorization`    |

### Request Parameters

<table><thead><tr><th width="178.2308349609375">Parameter</th><th>Type</th><th>Required</th><th width="316.64501953125">Description</th></tr></thead><tbody><tr><td><code>sessionToken</code></td><td>String</td><td>Yes</td><td>This is the session key information that the Member pays in the same payment type.</td></tr><tr><td><code>memberIdentifier</code></td><td>String</td><td>Yes</td><td>Member unique key information. This key is used for member information in payment transactions.</td></tr><tr><td><code>locale</code></td><td>String</td><td>No</td><td>Used to set the language of the texts returned as a result of iyzico request. The default value is en. can be used as en.</td></tr><tr><td><code>conversationId</code></td><td>String</td><td>No</td><td>A value that you can send during the request and receive at the end can be used to match request/response. The most common use case is the merchant's order number.</td></tr></tbody></table>

### Request

```json
{
    "sessionToken": "{{sessionToken}}",
    "memberIdentifier": "{{memberIdentifier}}",
    "locale": "en",
    "conversationId": "test"
}
```

### Response

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "success",
    "locale": "en",
    "systemTime": 1749027862133,
    "conversationId": "test",
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiItIiwic2NvcGUiOlsidGhpcmRQYXJ0eVNlc3Npb24iXSwic2Vzc2lvblRva2VuIjoiZDUzZWRiNzItNTNmMy00NmY0LTk5NWQtNDM1NzBhOTdiZDg4IiwiZXhwIjoxNzQ5MDI4MjIyLCJhdXRob3JpdGllcyI6WyJwd2lfdHBfc2Vzc2lvbl9jYXJkX2F1dGgiLCJwd2lfdHBfc2Vzc2lvbl9pbml0M2RzX2F1dGgiLCJwd2lfdHBfc2Vzc2lvbl9sYXN0X3BheW1lbnRfcmV0cmlldmUiLCJwd2lfdHBfc2Vzc2lvbl9mdW5kX2F1dGgiXSwianRpIjoiMTUwODdmNTgtZGE4Yy00OTFhLWFjN2QtYmYyODI2ODNmMGRlIiwiY2xpZW50X2lkIjoidGhpcmRQYXJ0eVNlc3Npb25DbGllbnQifQ.YC5McE1SdXrPeCpljrMU1X3kzc3FV7I8DoZ5G0qcS30"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "failure",
    "errorCode": "260016",
    "errorMessage": "Session token could not be found.",
    "locale": "en",
    "systemTime": 1750250353523
}
```

{% endtab %}
{% endtabs %}

### Response Parameters

| Parameter        | Type   | Description                                                                                                                 |
| ---------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| `status`         | String | Refers to the request result. success or failure values can be returned.                                                    |
| `locale`         | String | Refers to the language of the returned response.                                                                            |
| `systemTime`     | Long   | The current unix timestamp of the returned result.                                                                          |
| `conversationId` | String | The value sent during the request is returned.                                                                              |
| `accessToken`    | String | The bearer token information for the Member to trigger payments through services.                                           |
| `errorCode`      | String | If the operation was failed, this is the code that indicates the failure.                                                   |
| `errorMessage`   | String | If the operation is failed, this is a message detailing the error, with language support according to the locale parameter. |


---

# 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.iyzico.com/en/payment-methods/tokenization/tokenization-integration/access-token-retrieval.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.
