Skip to Content
StagePayDocs v2

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.

ItemValue
Base URLhttps://api.stagepay.io/api/v1
FormatJSON (UTF-8). Settlement lines also support CSV
AuthenticationAuthorization: Bearer <keyId>:<secret>
SpecificationOpenAPI 3.1 — https://api.stagepay.io/api/v1/openapi.json

Issuing API keys

  1. In the console API keys menu, create a New key.
  2. Specify a name, the target app, scopes, and (optionally) an expiry date and allowed IPs.
  3. 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 , join keyID:secret with 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

ScopeAllows
read:transactionsListing and viewing transactions
write:transactionsCreating payments
read:productsViewing products (active products only)
write:productsCreating and updating products
read:appsViewing app information
read:usersViewing user information
settlement:readQuerying settlement batches and lines
refunds:writeCalling the Refund API with a REST key (not included in read:all)
read:allAll read:* scopes (excluding settlement)

Grant only the scopes you need. If a scope is missing, 403 is returned.

Security settings

SettingDescription
Allowed IPsIf set, only requests from those IPs are allowed. Always set this for production keys
Expiry dateAfter it passes, the key status becomes expired and 401 is returned
RotationRotating a key in the console issues a new key with the same settings. Disable the old key after deploying
Usage recordsEvery 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

HTTPMessageCause
401Missing or invalid authorization headerNo header, or the Bearer prefix is missing
401Invalid API key formatNot in keyID:secret format
401Invalid or expired API keyKey/secret mismatch, inactive, or expired
403Insufficient permissionsInsufficient scope
403 / 429Rate limit exceededRate limit exceeded

On this page