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

# Authentication

Aampe has two APIs with **different authentication methods**. Use the correct method for the API you're calling.

***

## Quick Reference

| API                        | Header                  | Example                                        | Base URL                                   |
| -------------------------- | ----------------------- | ---------------------------------------------- | ------------------------------------------ |
| **Content API** (Surfaces) | `X-API-Key`             | `X-API-Key: your_surfaces_api_key`             | `https://content.api.aampe.com`            |
| **Ingestion API** (Data)   | `Authorization: Bearer` | `Authorization: Bearer your_ingestion_api_key` | `https://ingestion.{region}.api.aampe.com` |

***

## Content API Authentication

Use the **Surfaces API key** when calling the Content API (e.g., Get Surface Content, Health).

<ParamField header="X-API-Key" type="string" required>
  Your Surfaces API key for the Content API
</ParamField>

**Base URL:** `https://content.api.aampe.com`

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET \
    'https://content.api.aampe.com/health' \
    -H 'X-API-Key: YOUR_SURFACES_API_KEY'
  ```

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

  response = requests.get(
      "https://content.api.aampe.com/health",
      headers={"X-API-Key": "YOUR_SURFACES_API_KEY"}
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://content.api.aampe.com/health', {
    headers: {
      'X-API-Key': 'YOUR_SURFACES_API_KEY'
    }
  });
  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

***

## Ingestion API Authentication

Use the **Ingestion API key** when sending events or property updates to Aampe.

<ParamField header="Authorization" type="string" required>
  Bearer token with your Ingestion API key. Format: `Authorization: Bearer YOUR_INGESTION_API_KEY`
</ParamField>

**Base URL:** `https://ingestion.{region}.api.aampe.com` (e.g., `us-east1`, `europe-west3`, `asia-southeast1`)

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
    'https://ingestion.us-east1.api.aampe.com/v1/events' \
    -H 'Authorization: Bearer YOUR_INGESTION_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "contact_id": "user123",
      "event_name": "button_click",
      "timestamp": 1638360000
    }'
  ```

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

  response = requests.post(
      "https://ingestion.us-east1.api.aampe.com/v1/events",
      headers={
          "Authorization": "Bearer YOUR_INGESTION_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "contact_id": "user123",
          "event_name": "button_click",
          "timestamp": 1638360000
      }
  )
  print(response.status_code)  # 202 = Accepted
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://ingestion.us-east1.api.aampe.com/v1/events', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_INGESTION_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      contact_id: 'user123',
      event_name: 'button_click',
      timestamp: 1638360000
    })
  });
  console.log(response.status);  // 202 = Accepted
  ```
</RequestExample>

***

## Obtaining an API Key

To find your API keys, navigate to **Integrations > API keys**

<img src="https://mintcdn.com/aameo/OJR58EOCEiXJAL1N/images/api/composer-api-key-page.png?fit=max&auto=format&n=OJR58EOCEiXJAL1N&q=85&s=505f29c32af035ea3b16b02c2583f16e" alt="Composer Api Key Page Pn" width="2958" height="1434" data-path="images/api/composer-api-key-page.png" />

You'll find two API keys:

* **Surfaces API key:** For pulling personalized content from Aampe for [Surfaces](/developer-guide/surfaces/surfaces-embed)
* **Ingestion API key:** For sending data to Aampe via the [Aampe Streaming API](/developer-guide/data-ingest/data-sources/streaming-aampe-api)

### Key Generation Steps

1. Log into your Aampe Dashboard
2. Navigate to System settings → Integrations → Aampe Endpoint
3. Copy the API Key (hidden)

***

## Configure API Playground

To test endpoints interactively:

1. Click the "Configure" button on any API endpoint page
2. Enter your API key in the appropriate field:
   * **Content API endpoints:** Use `X-API-Key` field
   * **Ingestion API endpoints:** Use Bearer token field
3. Your key will be saved locally in your browser for this session
4. Try making requests directly from the documentation

<Note>
  Your API key is stored locally in your browser and never sent to our documentation servers. It's only used for direct API calls to the Aampe API.
</Note>

***

## Security Best Practices

<Warning>
  Never expose your API key in client-side code or public repositories. Use environment variables or secure secret management for your keys. Rotate keys if you suspect they've been compromised.
</Warning>

***

## Next Steps

<CardGroup cols={2}>
  <Card icon="heart-pulse" href="/api-reference/health/get-health" title="Test the Health Endpoint">
    Verify your Content API connection is working
  </Card>

  <Card icon="layer-group" href="/api-reference/surface/get-surface-content" title="Get Surface Content">
    Retrieve personalized content for users
  </Card>

  <Card icon="arrow-right-to-bracket" href="/api-reference/aampe-ingest" title="Aampe Events Ingestion">
    Stream events to Aampe
  </Card>

  <Card icon="user-pen" href="/api-reference/aampe-property-update" title="Aampe Property Update">
    Update user properties
  </Card>
</CardGroup>
