> ## Documentation Index
> Fetch the complete documentation index at: https://docs.strails.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> How to create and use sandbox API keys for the Strails Mock Sandbox environment.

## Creating a Sandbox API Key

Sandbox keys are created using the production `createsandboxapikey` endpoint with a **production API key**:

```http theme={null}
POST https://sandbox.stablesrail.io/v1/createsandboxapikey
Content-Type: application/json
x-api-key: <production-api-key>
```

Response:

```json theme={null}
{
  "status": "Success",
  "response_code": "00",
  "message": "Sandbox API key created successfully",
  "data": {
    "apiKey": "sandbox_3fe455526c844f91886ea",
    "fintechId": "c8fe1911-d292-4f84-aa88-e34ceeea5b65",
    "createdAt": "2026-07-29T14:39:03.804Z",
    "note": "This key is valid only for the mock sandbox environment."
  }
}
```

> The returned API key must be saved immediately; it is shown only once.

## Using a Sandbox API Key

Include the key in the `x-api-key` header on every request to the sandbox:

```http theme={null}
POST https://sandbox.stablesrail.io/v1/onboarduser
Content-Type: application/json
x-api-key: sandbox_3fe455526c844f91886ea

{
  "bvn": "12345678901"
}
```

## Validation Behavior

The sandbox validates the **full API key** against the `sandboxApiKeys` stored key.

Keys that:

* Are missing or do not start with `sandbox_`
* Are not registered in our datastore
* Have been revoked or expired

will receive a `401 Unauthorized` response.
