Overview

The Stax API is organized around REST, providing predictable, resource-oriented URLs and standard HTTP response codes for indicating errors. This makes it easy to integrate with, whether you're a seasoned developer or just getting started.

Getting Started

Send an authenticated request to the Stax API using your secret API key.

Base URL

All API requests should be made to the following base URL:

https://apiprod.fattlabs.com

Use this base URL with both live and sandbox API keys. A sandbox is a test environment linked to a test gateway that processes payments without using real money.

Authentication

Get your secret API key from Stax Pay > Apps > API Keys. Include it in every request's Authorization header after the Bearer prefix, separated by a space. Bearer authentication grants access to whoever holds the key.

⚠️ Keep your API key secure and never expose it in client-side code or public repositories.

Send an authenticated request

  1. Copy your secret API key from Stax Pay > Apps > API Keys. Use a sandbox API key to test without using real money.
  2. Run the following example in Bash with curl installed. Paste your key at the prompt; the prompt hides your input and keeps the key out of the command you enter in your shell history.
(
  # Copy your secret API key from Stax Pay > Apps > API Keys.
  if ! read -r -s -p "Stax secret API key: " STAX_API_KEY; then
    printf '\nCould not read the API key.\n' >&2
    exit 1
  fi
  printf '\n'

  if [[ -z "$STAX_API_KEY" ]]; then
    printf 'Enter a nonempty secret API key.\n' >&2
    exit 1
  fi

  if ! curl --fail-with-body --show-error \
    --request GET "https://apiprod.fattlabs.com/" \
    --header "Authorization: Bearer ${STAX_API_KEY}" \
    --header "Content-Type: application/json" \
    --write-out '\nHTTP status: %{http_code}\n'; then
    printf 'Request failed. Check the HTTP status and response above; for connection errors, check the curl error message.\n' >&2
    exit 1
  fi
)

The example prints the response body and HTTP status. A successful request returns 200 OK, displayed as:

HTTP status: 200

If you receive 401, check that you copied the correct secret API key. For 429, wait for the interval indicated by the Retry-After response header before retrying. See Error Handling below for other status codes.


API Features

Content-Type Header

The Content-Type header must always be set to:

application/json

This ensures the API understands your requests and responds with JSON.

HTTP Methods

The Stax API supports standard HTTP methods:

  • GET: Retrieve a resource
  • POST: Create a new resource
  • PUT: Update an existing resource
  • DELETE: Delete a resource

Important Information

Rate Limits

The API enforces a rate limit of 100 requests per minute. If you exceed this limit, you'll receive a 429 Too Many Requests response.

The Retry-After header in the response indicates when you can retry your request.

Error Handling

The Stax API uses standard HTTP status codes to indicate the success or failure of requests:

Status CodeMeaningDescription
200 OK✅ SuccessThe request was successful
400 Bad Request❌ Client ErrorInvalid request (missing parameters)
401 Unauthorized🔒 Auth ErrorAuthentication failed (missing/incorrect API key)
404 Not Found🔍 Not FoundThe requested resource does not exist
429 Too Many Requests⏰ Rate LimitedYou've exceeded the rate limit
500 Internal Server Error🔧 Server ErrorSomething went wrong on our end
Cross-Origin Resource Sharing (CORS)

The Stax API supports CORS, allowing secure interaction from client-side applications.

⚠️ Important: Never expose your secret API key in public client-side code.


Need Help?

Support & Documentation

If you have any questions or run into issues:

  • Check out our comprehensive API Documentation
  • Contact our support team for assistance
  • Review the examples and guides in this documentation