Skip to Content
StagePayDocs v2

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

ItemRule
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 amountsamount is a display (major unit) number. Do not use it in calculations
CurrencyUppercase ISO 4217 or USDT. For decimal places, see the currency table
DatesISO 8601 (UTC as Z or +00:00). Query parameters are also sent in ISO 8601
PeriodsA settlement period is the half-open interval [periodStart, periodEnd)

Response formats

There are two formats, depending on the endpoint group.

Transactions, products, apps (v1 format)
{
  "success": true,
  "data": [ { "...": "..." } ],
  "pagination": { "page": 1, "limit": 20, "total": 134, "totalPages": 7 }
}
Settlement (v2 format)
{
  "data": [ { "...": "..." } ],
  "total": 12
}

Pagination

GroupParametersDefaultMaximum
Transactions, products, appspage (starting at 1), limitpage=1, limit=20—
Settlement batch listskip, limitskip=0, limit=50limit=500
Settlement linesskip, limitskip=0, limit=200limit=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.

Reading all settlement lines
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"
}
FieldDescription
statusCodeHTTP status code
errorStatus name (Bad Request, Unauthorized …)
messageHuman-readable message. For input validation errors, this may be an array of strings
requestIdRequest correlation ID. Include it when you contact support
path / timestampRequest path (excluding the query) / time of the error

Status codes

HTTPMeaningRetry
200 / 201Success—
400Input error, business rule violationNo — fix the request
401Authentication failedNo — check your key
403Insufficient scope, IP not allowedNo
404Not found, or a resource of another appNo
409Concurrent modification conflictYes — after a short wait
429Rate limitYes — after Retry-After
5xxServer errorYes — 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.

On this page