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.
REST API v1 is used by the merchant server to query StagePay data (transactions, products, apps, settlement) and to create payments.
| Item | Value |
|---|---|
| Base URL | https://api.stagepay.io/api/v1 |
| Format | JSON (UTF-8). Settlement lines also support CSV |
| Authentication | Authorization: Bearer <keyId>:<secret> |
| Specification | OpenAPI 3.1 — https://api.stagepay.io/api/v1/openapi.json |
Issuing API keys
- In the console API keys menu, create a New key.
- Specify a name, the target app, scopes, and (optionally) an expiry date and allowed IPs.
- Save the key ID (
sk_+ 32 hexadecimal characters) and the secret shown right after creation. The secret cannot be viewed again (reissue the key if lost).
A key can only access data for the app it was issued for. Requesting another app's resources returns 404.
Authentication header
GET /api/v1/settlements HTTP/1.1
Host: api.stagepay.io
Authorization: Bearer sk_1f2e3d4c5b6a79880123456789abcdef:3b9f0c...e1
X-Request-Id: 9b2f0c1e-6c1a-4d3e-9f20-3b1f0a8e7d11- After
Bearer, joinkeyID:secretwith a colon. - If you send
X-Request-Id(optional), the same value appears in the response headers and server logs, making it easier to trace when you contact support. If you don't send it, the server generates one and returns it in the response header. - If you need stronger integrity, also use request signing.
curl https://api.stagepay.io/api/v1/settlements \
-H "Authorization: Bearer $STAGEPAY_KEY_ID:$STAGEPAY_KEY_SECRET"Scopes
| Scope | Allows |
|---|---|
read:transactions | Listing and viewing transactions |
write:transactions | Creating payments |
read:products | Viewing products (active products only) |
write:products | Creating and updating products |
read:apps | Viewing app information |
read:users | Viewing user information |
settlement:read | Querying settlement batches and lines |
refunds:write | Calling the Refund API with a REST key (not included in read:all) |
read:all | All read:* scopes (excluding settlement) |
Grant only the scopes you need. If a scope is missing, 403 is returned.
Security settings
| Setting | Description |
|---|---|
| Allowed IPs | If set, only requests from those IPs are allowed. Always set this for production keys |
| Expiry date | After it passes, the key status becomes expired and 401 is returned |
| Rotation | Rotating a key in the console issues a new key with the same settings. Disable the old key after deploying |
| Usage records | Every call is recorded in the API log (time, endpoint, status code, response time, IP) and can be viewed in the console |
Rate limits
The number of requests per minute is limited per key (600 requests/minute by default, adjustable by contract). If exceeded, 429 Too Many Requests is returned with a Retry-After header; some v1 endpoints return 403 Rate limit exceeded instead. Check the remaining count with the X-RateLimit-Limit and X-RateLimit-Remaining response headers.
Authentication errors
| HTTP | Message | Cause |
|---|---|---|
| 401 | Missing or invalid authorization header | No header, or the Bearer prefix is missing |
| 401 | Invalid API key format | Not in keyID:secret format |
| 401 | Invalid or expired API key | Key/secret mismatch, inactive, or expired |
| 403 | Insufficient permissions | Insufficient scope |
| 403 / 429 | Rate limit exceeded | Rate limit exceeded |
Refund API
How to fully or partially refund KCP and Stripe payments with POST /refund, including authentication headers, request fields, and error codes.
Pagination and Errors
The REST API v1 response formats, pagination parameters, conventions for amounts and dates, and the common error response format.