Skip to main content

Overview

This document outlines the authentication methods and environment setup for the StableStack API.

Base URLs

The StableStack API is available in different environments. The base URL depends on your environment:

Authentication

The StableStack API uses Bearer token authentication. All API requests must include an Authorization header with your API token.

Getting Your API Token

  1. Log in to your StableStack dashboard
  2. Navigate to Settings > API Keys
  3. Generate a new API key or use an existing one

Using the API Token

Include your API token in the Authorization header of all requests:

Environment Detection

The API automatically detects the environment based on your API token. Each token is associated with a specific environment (Production, Staging, or Development). You don’t need to specify the environment separately - just use the appropriate base URL for your environment.

Security Best Practices

  1. Never share your API token - Keep it secure and don’t commit it to version control
  2. Use environment variables to store your API token
  3. Rotate your tokens regularly for enhanced security

Example Implementation

Using Environment Variables

Making Authenticated Requests

Key Management

Create new API key via your dashboard

Business API Capabilities

An active API key and approved compliance are necessary but do not grant access to every API feature. Each business has an explicit list of enabled capabilities, shared by its test and live API keys. No capabilities are enabled by default, including for existing businesses after the capabilities migration. A platform administrator must explicitly grant access. Business classification (api_fintech or general_business) does not grant capabilities automatically. Capability checks apply to API-key endpoints, not administrator endpoints authenticated with a session token. A merchant with wallets, payments_stable, or payments_fiat but without customers may create individual and business customers using the minimal profiles described in the customer creation references. This exception applies only to the two customer-creation POST endpoints. Minimal customer creation does not onboard the customer with payment providers or approve KYC. Merchants with payments_fiat may also update customers (PUT /api/individual-customers/{id} and PUT /api/business-customers/{id}). Stable-to-fiat bank payouts and bank payout methods return HTTP 422 with missingFields until the customer profile is complete: birth_date, address and country for individuals; business_type, business_website, registration_number, address and country for businesses. Disabled features return HTTP 403:

Managing capabilities

These endpoints are hosted by the auth service, not the public API service, and require an authenticated session using Authorization: Bearer <session-token>: Example replacement request body:
The list is replaced in full, not merged. Send {"apiCapabilities":[]} to revoke all access. Missing, null, duplicate, or unknown capability values are rejected. Changes apply on the next API-key request without rotating keys or signing in again. They do not bypass compliance, key-status, or existing endpoint validation.

Deployment order

Run the auth-service migration 20261026122000_add_api_capabilities_to_users.js before deploying the new auth and API services. Grant the intended capabilities to existing merchants before enabling API-service enforcement to avoid an unplanned interruption.

Error Handling

If authentication fails, you’ll receive a 401 Unauthorized response:

Rate Limiting

API tokens are subject to rate limiting. See the Error Handling documentation for more details about rate limits and error responses.