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

# Authentication

All requests to the Stablecoin Payments API require an API key.

## Create an API Key

Generate an API key by calling the Create API Key endpoint.

```http theme={null}
POST/create-api-key
```

```json theme={null}
Request Body
{
  "merchant_name": "ABC Brick Suppliers"
}
```

```json theme={null}
Response Body
{
  "merchant_name": "ABC Brick Suppliers",
  "api_key": "sk_test_xxxxxxxxxxxxxxxxxxxxxxx"
}
```

Important: Store your API key securely. It is shown only when it is created.

## Send the API Key

Include your API key in the X-API-Key header for every authenticated request.

```text theme={null}
x-api-key: sk_test_xxxxxxxxxxxxxxxxxxxxxxx
```

```json theme={null}
curl -X 'GET' \
  'https://vaayuapi.onrender.com/balance/0x7E9B85417beC02A0Ef03A01c5973526xxxxxxxxx' \
  -H 'accept: application/json' \
  -H 'x-api-key: sk_test_xxxxxxxxxxxxxxxxxxxxxxx'
```

## Authentication Errors

If the API key is missing or invalid, the API returns:

```text theme={null}
401 Unauthorized
```

Response:

```json theme={null}
{
  "detail": "Invalid API Key"
}
```

## Security Best Practices

* Never expose your API key in client-side applications.
* Store API keys in environment variables or a secure secret manager.
* Do not commit API keys to GitHub.
* Rotate API keys immediately if you suspect they have been compromised.
