ONE4ALL API

Integrate the One4All Marketplace directly into your platform. Automate digital gift card purchases, monitor your wallet balance in real-time, and retrieve order histories programmatically.

Base URLhttps://api.one4all.com/api/v1

Introduction

The One4All API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Authentication

The One4All API uses API keys to authenticate requests. You can view and manage your API keys in the Developer API tab of your control panel. Authentication is performed via the HTTP Bearer Token scheme.

http
Authorization: Bearer o4a_sk_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6

warningKeep Your Keys Safe

Your API keys carry many privileges, including the ability to deduct funds directly from your marketplace wallet. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Rate Limiting

To prevent abuse and ensure stability, all API requests are rate-limited. We return standard HTTP headers concerning your current rate limit status. If you exceed the limit, you will receive a 429 Too Many Requests response.

TierRequests/MinPurchase Limit
STANDARD60 / min5 per 10s
PROFESSIONAL300 / min5 per 10s
ENTERPRISE1000 / minCustom

Error Handling

The One4All API uses conventional HTTP response codes to indicate the success or failure of an API request. Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided. Codes in the 5xx range indicate an error with One4All's servers.

Error CodeHTTPDescription
UNAUTHORIZED401Missing or invalid API key.
FORBIDDEN403Key lacks required scope or IP is not whitelisted.
INSUFFICIENT_FUNDS402Wallet balance is too low for the purchase.
OUT_OF_STOCK409Requested quantity exceeds available stock.
STOCK_CONFLICT409Concurrent purchase conflict. Retry with exponential backoff.
WALLET_FROZEN403Your marketplace wallet is frozen. Contact support.
json
{
"success": false,
"error": {
"code": "OUT_OF_STOCK",
"message": "Not enough stock available. Requested: 5, Available: 2"
}
}

Idempotency

The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. For example, if a request to purchase a code fails due to a network connection error, you can retry the request with the same idempotency key to guarantee that only a single purchase is created.

http
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000

Idempotency keys are REQUIRED for all POST requests and remain cached for 24 hours.

Best Practices

  • Use Environment Variables: Never hardcode API keys in your application. Read from .env or a secrets manager.
  • IP Whitelisting: Always configure an IP whitelist for production API keys to limit access exclusively to your servers.
  • Handle Conflicts: Implement retry logic with exponential backoff when encountering a 409 STOCK_CONFLICT.
  • Idempotency: Always generate a unique UUID v4 for the Idempotency-Key header on every unique purchase.
  • Pre-flight Checks: Fetch /products and /wallet before committing to a purchase to avoid redundant 402/409 errors.
  • Key Rotation: Periodically rotate your keys, especially if a developer with access leaves your organization.

API Reference

Health Check

Public endpoint for monitoring API availability. No authentication required.

get/health
curl
curl -X GET https://api.one4all.com/api/v1/health
Responses

API is healthy and online.

json
{
"success": true,
"data": {
"status": "healthy",
"version": "v1",
"timestamp": "2026-02-25T12:00:00.000Z"
}
}

List Products

Scope: products:read

List all available AUTO marketplace products with real-time stock status.

get/products

Query Parameters

NameDescription
category_id
string
Filter products by a specific category ID.
in_stock
boolean
If true, only return products with available stock.
page
integer
Page number (default: 1).
limit
integer
Items per page (default: 50, max: 100).
curl
curl -X GET https://api.one4all.com/api/v1/products?in_stock=true \
-H "Authorization: Bearer o4a_sk_YOUR_SECRET_KEY"
Responses

Returns an array of categories containing available products.

json
{
"success": true,
"data": {
"categories": [
{
"id": "clxyz...",
"name": "PUBG Mobile",
"products": [
{
"id": "clxyz...",
"name": "60 UC",
"price": "0.85",
"currency": "USDT",
"stockStatus": "IN_STOCK",
"availableQuantity": 142
}
]
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 12,
"totalPages": 1
}
},
"meta": { "requestId": "req_cm7xyz..." }
}

Get Wallet Balance

Scope: wallet:read

Check your current USDT marketplace wallet balance and status. Optionally retrieve your most recent transactions.

get/wallet

Query Parameters

NameDescription
include_transactions
boolean
Include recent transactions (default: false).
transactions_limit
integer
Number of transactions to include (max 50).
curl
curl -X GET https://api.one4all.com/api/v1/wallet \
-H "Authorization: Bearer o4a_sk_YOUR_SECRET_KEY"
Responses

Returns the wallet balance and optional transaction history.

json
{
"success": true,
"data": {
"wallet": {
"balance": "1250.75",
"currency": "USDT",
"status": "ACTIVE"
},
"transactions": []
}
}

Purchase Products

Scope: orders:create

Atomically purchase AUTO marketplace codes. Deducts USDT from wallet and delivers codes in a single transaction.

post/orders/buy

Request Body

NameDescription
product_idRequired
string
The ID of the product you wish to purchase.
quantityRequired
integer
Amount to purchase (Min: 1, Max: 100).
curl
curl -X POST https://api.one4all.com/api/v1/orders/buy \
-H "Authorization: Bearer o4a_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
-d '{"product_id": "cl1234abcd", "quantity": 2}'
Responses

Purchase successful. Returns the order details and the decrypted codes.

json
{
"success": true,
"data": {
"order": {
"id": "clxyz...",
"productId": "clxyz...",
"productName": "PUBG Mobile 60 UC",
"quantity": 5,
"unitPrice": "0.85",
"totalAmount": "4.25",
"currency": "USDT",
"status": "COMPLETED"
},
"codes": [
{ "index": 1, "code": "ABCD-EFGH-IJKL-1234" },
{ "index": 2, "code": "MNOP-QRST-UVWX-5678" }
],
"wallet": {
"previousBalance": "1254.50",
"deducted": "4.25",
"currentBalance": "1250.25"
}
}
}

List Orders

Scope: orders:read

List all marketplace orders placed via the API for your store.

get/orders

Query Parameters

NameDescription
status
string
Filter by status (COMPLETED, PENDING, FAILED).
from
string
ISO 8601 date — orders created after this date.
to
string
ISO 8601 date — orders created before this date.
page
integer
Page number (default: 1).
limit
integer
Items per page (default: 20, max: 100).
curl
curl -X GET https://api.one4all.com/api/v1/orders?limit=10 \
-H "Authorization: Bearer o4a_sk_YOUR_SECRET_KEY"
Responses

Returns an array of your orders with pagination. Note: Codes are not included in the list view.

json
{
"success": true,
"data": {
"orders": [
{
"id": "clxyz...",
"productId": "clxyz...",
"productName": "PUBG Mobile 60 UC",
"quantity": 5,
"unitPrice": "0.85",
"totalAmount": "4.25",
"currency": "USDT",
"status": "COMPLETED",
"type": "AUTO",
"createdAt": "2026-02-25T12:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 156,
"totalPages": 8
}
},
"meta": { }
}

Get Order Details

Scope: orders:read

Retrieve a single order and its associated delivered codes. Use this to re-fetch codes if the initial purchase response was dropped.

get/orders/:id

Query Parameters

NameDescription
idRequired
string
The unique Order ID returned from the purchase endpoint.
curl
curl -X GET https://api.one4all.com/api/v1/orders/clxyz_abc123 \
-H "Authorization: Bearer o4a_sk_YOUR_SECRET_KEY"
Responses

Returns the order summary alongside the decrypted array of codes.

json
{
"success": true,
"data": {
"order": {
"id": "clxyz...",
"productId": "clxyz...",
"productName": "PUBG Mobile 60 UC",
"quantity": 5,
"unitPrice": "0.85",
"totalAmount": "4.25",
"currency": "USDT",
"status": "COMPLETED",
"type": "AUTO",
"createdAt": "2026-02-25T12:00:00.000Z"
},
"codes": [
{ "index": 1, "code": "ABCD-EFGH-IJKL-1234" },
{ "index": 2, "code": "MNOP-QRST-UVWX-5678" }
]
},
"meta": { }
}