Skip to main content

Authentication & Signing

Accessing OristaPay Open APIs requires dual authentication:
  • OAuth2 Access Token — proves the caller’s identity
  • HMAC Request Signature — proves the request has not been tampered with
Every request must pass both layers of verification. Failure of either results in 401 Unauthorized.

1. Obtain Access Token

Standard OAuth2 client_credentials flow. Request
Response
Usage Constraints
  • access_token can be reused within expires_in seconds. Cache it and refresh proactively 30 seconds before expiry.
  • access_token must be issued by the OAuth client corresponding to X-Api-Key.
Using merchant A’s api_key with merchant B’s access_token will be rejected.

2. Request Signature Algorithm

String to Sign
Signature Calculation
Field Definitions Reference Implementations

3. Request Header Specification

All business requests must carry the following headers:

Request & Response Conventions

Protocol Specification

Response Envelope

All responses use a single-layer JSON { code, message, data? }, returned by the downstream business service without additional gateway wrapping. Success (Business OK) Business code code = 1, business data in data:
Business / Downstream Error Downstream business errors still return HTTP 200, with error details expressed by code / message:
When downstream gRPC is unreachable or times out, HTTP status remains 200, code is a negative integer (negated gRPC StatusCode, e.g. -14 for UNAVAILABLE), with connection error details in message. Gateway-Level Error Route not found, internal gateway errors, missing descriptors, etc. HTTP status uses the corresponding error code (e.g. 400 / 404 / 500 / 502), with response body still using {code, message}:
  • HTTP status reflects transport layer results: 2xx means the request was successfully delivered and converted; non-2xx indicates a gateway-side error
  • Business code code reflects business layer results: 1 means business success with result in data; other values are business error codes with reason in message
  • How to determine success: HTTP 2xx + business code == 1. Both conditions must be met
  • Authentication errors: Any failure in Authorization / X-Signature / X-Timestamp / X-Nonce returns HTTP 401 with {"code":401,"message":"Unauthorized"}

Error Handling

HTTP Status Codes & Business Codes

All responses use the single-layer envelope {code, message, data?}. HTTP status reflects gateway/transport results; business code code reflects business processing results.

Authentication Failure Checklist

All authentication errors return:
Troubleshoot in this order:
  1. Is the token valid? — Has it expired? Was it issued by the current api_key?
  2. Does the signature match? — Do METHOD / PATH / BODY match the actual request?
  3. Is the timestamp within the window? — Is the local clock synchronized with NTP?
  4. Is the nonce unique? — Must not be reused within 5 minutes under the same api_key.

Rate Limiting

Rate Limit Exceeded Response Example
For higher quotas, contact your account manager. Adjustments take effect the following minute.

Security Recommendations