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

# Authentication

> Send an API key with every request.

TapAce authenticates requests with API keys. Create and revoke them in the dashboard under **Developers → API keys**.

## Send your key

Put the key in the `Authorization` header as a Bearer token:

```bash theme={null}
Authorization: Bearer tapace_live_xxxxxxxxxxxx
```

The key also decides the environment. Keys starting with `tapace_test_` work in test mode and keys starting with `tapace_live_` work in live mode. See [Test and live](/environments).

<Warning>
  Keep API keys on your server. Never put them in a website, mobile app or anything else a customer can download.
</Warning>

## Check a key

Call [`GET /v1/me`](/api-reference/me) to see which organization and environment a key belongs to:

```bash theme={null}
curl https://api.tapace.lk/v1/me \
  -H "Authorization: Bearer tapace_test_xxxxxxxxxxxx"
```

```json theme={null}
{
  "organizationId": "org_2tQpA8kLmN3vX",
  "environment": "test"
}
```

## Failed authentication

A missing, malformed, unknown or revoked key gets the same `401` response, so a key's status can't be probed:

```json theme={null}
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key."
  },
  "requestId": "req_8f3a2c1d9e7b6a54"
}
```


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