> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.epaygames.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.epaygames.io/_mcp/server.

# Create Access Token

POST https://v1/auth/token
Content-Type: application/json

### Create Access Token

The **Create Access Token** endpoint generates a Bearer token used to authenticate all other requests in this collection. Each token is valid for approximately **60 minutes** (`3600` seconds).

- Call this endpoint before making any other API requests.
- The token is automatically saved to the `token` environment variable upon a successful response, so it is immediately available across all other requests.

> For sandbox/staging, use your assigned test credentials.

Reference: https://docs.epaygames.io/epaygames-payments-disbursement-api/disbursement-api/authentication/create-access-token

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /v1/auth/token:
    post:
      operationId: Create Access Token
      summary: Create Access Token
      description: >-
        ### Create Access Token


        The **Create Access Token** endpoint generates a Bearer token used to
        authenticate all other requests in this collection. Each token is valid
        for approximately **60 minutes** (`3600` seconds).


        - Call this endpoint before making any other API requests.

        - The token is automatically saved to the `token` environment variable
        upon a successful response, so it is immediately available across all
        other requests.


        > For sandbox/staging, use your assigned test credentials.
      tags:
        - authentication
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Disbursement API_Authentication_Create
                  Access Token_Response_200
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                password:
                  type: string
              required:
                - username
                - password
servers:
  - url: https:/
    description: https://{payments_api_host}
components:
  schemas:
    V1AuthTokenPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        token:
          type: string
        type:
          type: string
        expires_in:
          type: integer
      required:
        - token
        - type
        - expires_in
      title: V1AuthTokenPostResponsesContentApplicationJsonSchemaData
    Disbursement API_Authentication_Create Access Token_Response_200:
      type: object
      properties:
        message:
          type: string
        data:
          $ref: >-
            #/components/schemas/V1AuthTokenPostResponsesContentApplicationJsonSchemaData
      required:
        - message
        - data
      title: Disbursement API_Authentication_Create Access Token_Response_200

```

## Examples



**Request**

```json
{
  "username": "test-merchant",
  "password": "p@ssw0rd01"
}
```

**Response**

```json
{
  "message": "Authenticated.",
  "data": {
    "token": "XPy8qeGESyyZanHNCyvKkNAPp2uc14lcjyGytI5g1eRunClHUeco2GKCuCgsNX3043cyBUCMUrEB2vkAaF2L6879mmd8PxO3vBZi2hLQNCz3Hd4E8Eeul6uTj04CZmK5",
    "type": "Bearer",
    "expires_in": 3601
  }
}
```

**SDK Code**

```python Disbursement API_Authentication_Create Access Token_example
import requests

url = "https://https/v1/auth/token"

payload = {
    "username": "test-merchant",
    "password": "p@ssw0rd01"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Disbursement API_Authentication_Create Access Token_example
const url = 'https://https/v1/auth/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"username":"test-merchant","password":"p@ssw0rd01"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Disbursement API_Authentication_Create Access Token_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/v1/auth/token"

	payload := strings.NewReader("{\n  \"username\": \"test-merchant\",\n  \"password\": \"p@ssw0rd01\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Disbursement API_Authentication_Create Access Token_example
require 'uri'
require 'net/http'

url = URI("https://https/v1/auth/token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"username\": \"test-merchant\",\n  \"password\": \"p@ssw0rd01\"\n}"

response = http.request(request)
puts response.read_body
```

```java Disbursement API_Authentication_Create Access Token_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/v1/auth/token")
  .header("Content-Type", "application/json")
  .body("{\n  \"username\": \"test-merchant\",\n  \"password\": \"p@ssw0rd01\"\n}")
  .asString();
```

```php Disbursement API_Authentication_Create Access Token_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/v1/auth/token', [
  'body' => '{
  "username": "test-merchant",
  "password": "p@ssw0rd01"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Disbursement API_Authentication_Create Access Token_example
using RestSharp;

var client = new RestClient("https://https/v1/auth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"username\": \"test-merchant\",\n  \"password\": \"p@ssw0rd01\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Disbursement API_Authentication_Create Access Token_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "username": "test-merchant",
  "password": "p@ssw0rd01"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/v1/auth/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```