> ## 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 USSD API requests using HTTP Basic Authentication or an access token.

USSD balance checks use the shared **Topup API** (`apitopup.beem.africa`). Authenticate with **HTTP Basic Authentication** (API Key and Secret) or an **access token** in the `Authorization` header.

Use one method per request — not both.

***

## Authentication methods

<Tabs>
  <Tab title="API Key & Secret">
    Authenticate using HTTP Basic Authentication.

    | Header          | Value                              |
    | --------------- | ---------------------------------- |
    | `Authorization` | `Basic base64(api_key:secret_key)` |
    | `Content-Type`  | `application/json`                 |

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

    Generate credentials from the Beem dashboard under your USSD product API setup.

    ```http theme={null}
    GET /v1/credit-balance?app_name=USSD HTTP/1.1
    Host: apitopup.beem.africa
    Authorization: Basic <base64-encoded-api_key:secret_key>
    Content-Type: application/json
    ```
  </Tab>

  <Tab title="Access token">
    Pass your access token directly in the `Authorization` header. Do **not** use a `Bearer` prefix.

    ```http theme={null}
    GET /v1/credit-balance?app_name=USSD HTTP/1.1
    Host: apitopup.beem.africa
    Authorization: <access_token>
    Content-Type: application/json
    ```
  </Tab>
</Tabs>

***

## USSD callback authentication

Your USSD callback endpoint is hosted on **your server**. Beem POSTs session events to the callback URL you configure in the dashboard. Secure that endpoint with HTTPS and your own access controls (IP allowlisting, shared secret, etc.) as required by your security policy.

See [Receive USSD session callback](/api-reference/ussd/receive-ussd-session-callback) for the request and response format.
