> ## 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.

# Create API Key

> Create an API key for authenticating requests to the Vaayu API.

# Create API Key

Create an API key for a merchant or application that will integrate with Vaayu.

API keys authenticate requests to protected Vaayu endpoints.

## Endpoint

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

## Request Body

```json theme={null}
{
  "merchant_name": "Acme Inc."
}
```

| Field | Type | Required | Description |
| - | - | - | - |
| `merchant_name` | string | Yes | Name of the merchant or application. |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "http://127.0.0.1:8000/create-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "merchant_name": "Acme Inc."
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "http://127.0.0.1:8000/create-api-key",
      json={"merchant_name": "Acme Inc."}
  )

  print(response.json())
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "api_key": "YOUR_GENERATED_API_KEY"
}
```

Store the API key securely after it is created.

## Using the API Key

Send the API key with subsequent authenticated requests using the `X-API-Key` header.

```bash theme={null}
curl "http://127.0.0.1:8000/balance/0xYourAddress" \
  -H "X-API-Key: YOUR_API_KEY"
```

## Security

Treat API keys like passwords.

* Do not commit API keys to GitHub.
* Do not put API keys in frontend JavaScript.
* Do not share API keys publicly.
* Do not include API keys in screenshots or documentation examples.

For production integrations, store API keys in a secure environment or secrets manager.

## Invalid API Key

If an invalid or missing API key is supplied to a protected endpoint:

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

The HTTP status is:

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

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="shield" href="/authentication">
    Learn how to authenticate requests using your API key.
  </Card>

  <Card title="Send Payment" icon="paper-plane" href="/send-payment">
    Use your API key to initiate a payment.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.