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

# Authentication

> Authenticate Bpay Checkout API requests using Basic Auth or an access token.

All Bpay Checkout API requests require authentication. Use **HTTP Basic Authentication** (API Key and Secret) or pass an **access token** in the `Authorization` header.

Use one method per request — not both.

<Info>
  Checkout **callbacks** are inbound webhooks from Bpay to your server. They may include an optional `beem-secure-token` header you supplied in the original request — not your API credentials. See [Callbacks](/guides/payments-checkout/callbacks).
</Info>

***

## Generate credentials

API Key and Secret are available from **BPAY → API Setup** in the Beem dashboard.

<Warning>
  Your API Secret is displayed **only once**. Store it securely, as it cannot be viewed again.
</Warning>

***

## Authentication methods

<Tabs>
  <Tab title="API Key & Secret">
    | Header          | Value                              |
    | --------------- | ---------------------------------- |
    | `Authorization` | `Basic base64(api_key:secret_key)` |
    | `Content-Type`  | `application/json`                 |

    * **Username:** API Key
    * **Password:** API Secret

    Optional header for checkout requests:

    | Header              | Description                                            |
    | ------------------- | ------------------------------------------------------ |
    | `beem-secure-token` | Client validation token — returned in callback headers |

    ```http theme={null}
    GET /v1/checkout?amount=1200&reference_number=SAMPLE-12345&transaction_id=96f9cc09-afa0-40cf-928a-d7e2b27b2408 HTTP/1.1
    Host: checkout.beem.africa
    Authorization: Basic <base64-encoded-api_key:secret_key>
    Content-Type: application/json
    beem-secure-token: <secure-token>
    ```
  </Tab>

  <Tab title="Access Token">
    | Header          | Value              |
    | --------------- | ------------------ |
    | `Authorization` | `<access-token>`   |
    | `Content-Type`  | `application/json` |

    Pass your access token directly — **do not** use a `Bearer` prefix.

    ```http theme={null}
    GET /v1/checkout?amount=1200&reference_number=SAMPLE-12345&transaction_id=96f9cc09-afa0-40cf-928a-d7e2b27b2408 HTTP/1.1
    Host: checkout.beem.africa
    Authorization: <access-token>
    Content-Type: application/json
    beem-secure-token: <secure-token>
    ```
  </Tab>
</Tabs>

<Warning>
  Never expose your API Key, API Secret, or access token in frontend applications or public repositories.
</Warning>

***

## Authentication errors

| HTTP Status | Code  | Message                           |
| ----------- | ----- | --------------------------------- |
| `401`       | `120` | Invalid Authentication Parameters |
| `400`       | —     | No authorization headers          |

See [Error codes](/guides/payments-checkout/error-codes) for additional checkout errors.
