Skip to main content
POST
Create App Token

Endpoint

Overview

Use this endpoint to generate a temporary access token (app token) using your app key. This token is required for all subsequent API calls and expires after one hour.
Tokens expire after one hour. Implement token refresh logic to avoid authentication failures.

Authentication

This endpoint requires the x-api-key header but not a Bearer token.

Request Body

object
required
Container for API data
string
required
Must be "auth"
object
required
Container for authentication attributes
string
required
The app key obtained from /auth/key endpoint

Example Request

Response

Success Response (201 Created)

Contains URLs related to the resource
object
Container for response data

Example Response

Using the Token

Include the token in all authenticated API requests:
The Authorization header must be formatted as Bearer {token} with a capital “B” and a space between “Bearer” and your token.

Code Examples

Token Management

Automatic Refresh

Implement automatic token refresh logic to avoid authentication failures:

Error Responses

Common Error Scenarios

Error: 401 UnauthorizedSolution: Verify your app key is correct. If you’ve regenerated your app key, use the new one.
Error: 401 UnauthorizedSolution: Generate a new app key using the /auth/key endpoint.
Error: 401 Unauthorized (from other endpoints)Solution: Catch 401 errors and automatically refresh the token before retrying the request.

Best Practices

Cache Tokens

Store and reuse tokens for their full 1-hour lifetime to minimize API calls

Proactive Refresh

Refresh tokens 5 minutes before expiration to avoid service interruptions

Handle 401 Errors

Implement automatic token refresh on 401 responses

Monitor Expiration

Track token expiration time and log refresh events

Next Steps

Now that you have an access token, you can start making authenticated API requests:

Create Merchant

Set up merchant accounts

Process Payment

Accept payments

List Merchants

Retrieve merchant data