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

# Introduction

> Overview of the Retain API for identifying users and tracking events

## Overview

The Retain API lets you send user and event data from your application. Use it to power churn prevention, health scores, and customer analytics.

## Endpoints

| Method | Endpoint    | Description                |
| ------ | ----------- | -------------------------- |
| POST   | `/identify` | Register or update a user  |
| POST   | `/track`    | Record an event for a user |

## Flow

1. **Identify** users when they sign up or when their profile changes.
2. **Track** events as users interact with key features of your product.

<Tip>
  Always call `/identify` before `/track`. Events can only be recorded for users
  that have been identified.
</Tip>

## Authentication

To authenticate, add an `Authorization` header with the value `Basic rk-xxxxxxxxx`, where `rk-xxxxxxxxx` is your [**Project Token**](https://retain.so/dashboard/settings?tab=project-token).

```
Authorization: Basic rk-xxxxxxxxx
```

See the [authentication guide](/docs/guides/authentication) for details.

## Response codes

Retain uses standard HTTP codes to indicate the success or failure of your requests.

In general, `2xx` codes correspond to success, `4xx` codes are for client errors (invalid request, auth, or resource not found), and `5xx` codes are for server issues.

| Status | Description                                                             |
| ------ | ----------------------------------------------------------------------- |
| `201`  | Successful request.                                                     |
| `400`  | Invalid body, missing required fields, or invalid format.               |
| `401`  | Missing or invalid Project Token.                                       |
| `404`  | User not found. Identify the user first using `/identify` (track only). |
| `429`  | Rate limit exceeded.                                                    |
| `5xx`  | Indicates an error with Retain servers.                                 |

<Info>
  Check [Errors](/docs/api-reference/errors) for a comprehensive breakdown of all
  possible API errors, including the response format and error codes.
</Info>

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/docs/guides/authentication">
    Get and use your Project Token.
  </Card>

  <Card title="Identify" icon="user" href="/docs/guides/identify">
    Identify users in Retain.
  </Card>
</CardGroup>
