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

# Authenticate API Key

> Verify that the PCI Booking service is available and your API key is valid.

This method lets you verify that the PCI Booking service is available and that your API key is valid.

> [card] [Authentication Guide](https://developers.pcibooking.net/getting-started/authentication.md#api-key)
>
> Learn about API key authentication

## Error Responses

| HTTP Status | Error Code | Description |
| - | - | - |
| 401 | none | Not authenticated. The API key is missing, malformed, or not valid. The response body is empty. |
| 403 | -1003 | Your IP address is not in your account's allowed IP list. `message` names the reason. See [Authentication and Permission Failures](https://developers.pcibooking.net/reference/error-handling.md#authentication-and-permission-failures). |
| 500 | -150 | The API key belongs to a user that has been closed. |

Both `POST` and `GET` methods are supported:

```text theme={null}
GET https://service.pcibooking.net/api/accounts/authenticate/
```

### Error detail

The condition below gives the exact response, why it happens and how to resolve it. The full set is on the [Error Handling](https://developers.pcibooking.net/reference/error-handling.md) page.

> [accordion] 401 with an empty body - authentication failed
>
> **HTTP status:** `401`
>
> **Response body:** empty. There is no `code`, `message` or `moreInfo`.
>
> **Reason.** PCI Booking could not identify the caller. The response is the same for every cause:
>
> * The `Authorization` header (or the `x-pcibooking-api-key` header) is missing, badly formatted, or has no `APIKEY` keyword.
> * The API key is not valid, or it belongs to the other environment (sandbox or production).
> * The `sessionToken` is not valid or has expired.
> * The `accessToken` is not valid, has expired, has an expiration time further ahead than the maximum allowed, or was already used. An access token works once only, so reloading a page that uses it, such as a card display iframe, also returns this response.
>
> **How to resolve.**
>
> 1. Confirm the `APIKEY` prefix is present and there is a single space between it and the key.
> 2. Confirm the key belongs to the same environment as the host you called. Sandbox and production keys are not interchangeable.
> 3. If you use a session token, check it has not expired and start a new session if it has.
> 4. If you use an access token, generate a new one for every request, including every reload of an iframe.
> 5. Check that your HTTP client does not drop the `Authorization` header on a redirect. Most clients remove it after a 301 or 302.
>
> **See also:** [Authentication](https://developers.pcibooking.net/getting-started/authentication.md), [Authentication and Permission Failures](https://developers.pcibooking.net/reference/error-handling.md#authentication-and-permission-failures)

## Parameters

### Authentication

**API key only.** This endpoint does not accept access tokens or session tokens.

**Authorization** `string` *required*

Your API key prefixed with `APIKEY`. Example: `APIKEY your-api-key`. The `x-pcibooking-api-key` header is also accepted. See the [Authentication guide](https://developers.pcibooking.net/getting-started/authentication.md).

```javascript Node.js theme={null}
const response = await fetch('https://service.pcibooking.net/api/accounts/authenticate/', {
  method: 'POST',
  headers: {
    'Authorization': 'APIKEY your-api-key'
  }
});

console.log(response.status); // 200 if valid
```

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

response = requests.post(
    'https://service.pcibooking.net/api/accounts/authenticate/',
    headers={
        'Authorization': 'APIKEY your-api-key'
    }
)

print(response.status_code)  # 200 if valid
```

## Response

```json 200 theme={null}
// Empty body. The API key is valid and the service is available.
```

```text 401 theme={null}
Empty response body.
Authentication failed: the API key, session token or access token is missing or was not accepted.
See "Authentication and Permission Failures" on the Error Handling page.
```


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