Pagination and Errors
The REST API v1 response formats, pagination parameters, conventions for amounts and dates, and the common error response format.
Amounts and dates
| Item | Rule |
|---|---|
| Amounts | *Minor fields are integers in the currency's smallest unit. Where values can get large, such as in the settlement API, they are sent as strings ("12000"). In JavaScript, read them with BigInt |
| Display amounts | amount is a display (major unit) number. Do not use it in calculations |
| Currency | Uppercase ISO 4217 or USDT. For decimal places, see the currency table |
| Dates | ISO 8601 (UTC as Z or +00:00). Query parameters are also sent in ISO 8601 |
| Periods | A settlement period is the half-open interval [periodStart, periodEnd) |
Response formats
There are two formats, depending on the endpoint group.
{
"success": true,
"data": [ { "...": "..." } ],
"pagination": { "page": 1, "limit": 20, "total": 134, "totalPages": 7 }
}{
"data": [ { "...": "..." } ],
"total": 12
}Pagination
| Group | Parameters | Default | Maximum |
|---|---|---|---|
| Transactions, products, apps | page (starting at 1), limit | page=1, limit=20 | — |
| Settlement batch list | skip, limit | skip=0, limit=50 | limit=500 |
| Settlement lines | skip, limit | skip=0, limit=200 | limit=5000 |
An out-of-range limit is clamped to a minimum of 1 and the maximum value. Lists are sorted in a stable order (settlement: period start descending → batch number; lines: type → tid), so you can read to the end by increasing skip.
async function* allLines(batchNo, auth) {
const limit = 1000;
for (let skip = 0; ; skip += limit) {
const res = await fetch(
`https://api.stagepay.io/api/v1/settlements/${batchNo}/lines?skip=${skip}&limit=${limit}`,
{ headers: { Authorization: auth } },
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data, total } = await res.json();
yield* data;
if (skip + data.length >= total || data.length === 0) return;
}
}Error format
All REST errors use the same JSON format. Stack traces are never included in responses.
{
"statusCode": 404,
"error": "Not Found",
"message": "정산 배치를 찾을 수 없습니다.",
"requestId": "9b2f0c1e-6c1a-4d3e-9f20-3b1f0a8e7d11",
"path": "/api/v1/settlements/STL-20260101-6650f0c2a1b2c3d4e5f60718-KRW-0001",
"timestamp": "2026-01-02T03:00:00.000Z"
}| Field | Description |
|---|---|
statusCode | HTTP status code |
error | Status name (Bad Request, Unauthorized …) |
message | Human-readable message. For input validation errors, this may be an array of strings |
requestId | Request correlation ID. Include it when you contact support |
path / timestamp | Request path (excluding the query) / time of the error |
Status codes
| HTTP | Meaning | Retry |
|---|---|---|
| 200 / 201 | Success | — |
| 400 | Input error, business rule violation | No — fix the request |
| 401 | Authentication failed | No — check your key |
| 403 | Insufficient scope, IP not allowed | No |
| 404 | Not found, or a resource of another app | No |
| 409 | Concurrent modification conflict | Yes — after a short wait |
| 429 | Rate limit | Yes — after Retry-After |
| 5xx | Server error | Yes — with exponential backoff |
When retrying a create request (e.g. creating a payment), send a unique value such as a UUID in the Idempotency-Key header. Supporting endpoints process retries with the same key only once. Whether an endpoint supports this is defined by the Endpoint reference; for endpoints that do not support it, first check with a lookup API whether the request was already processed before retrying.
REST API Authentication
The StagePay REST API v1 base URL, issuing API keys and the Bearer authentication format, scopes, the IP allowlist, and rate limits.
Request Signing (Optional)
The optional X-StagePay-Signature request signing specification for preventing REST API body tampering and replay attacks, with Node.js, PHP, and Python examples.