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

# Administration

> Create and manage user accounts.

> [!NOTE]
>
> See also the [API reference](https://doc.agentfirst.dev/endpoints/reference/users.md) for more detail.

## Usage

**Agent First's** administration service lets you support your whitelabel customers. The service
has a RESTful interface that accepts `GET`, `POST`, `PATCH`, and `DELETE` requests at
**https\://‍api.agentfirst.dev/users**.

> [!WARNING]
>
> This endpoint is rate limited; if you receive a `429` response, pause for the
> backoff time required by the `Retry-After` header before making another request.

### New customers

You can provision a user by specifying their email address and, optionally, the API credits to
preload their account with:

```shell theme={null}
curl -X POST 'https://api.agentfirst.dev/users' \
-H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "email": "user@example.com",
  "credits": 1000
}'
```

The user's secret API token will be returned, along with their normalized email address and any
credits:

```json theme={null}
{
  "email": "user@example.com",
  "token": "a1-0dF6qKHYD7SNU5kAtjOmwHpH3iFgpylA",
  "credits": 1000
}
```

Here are the provisioning request keys and values:

| Key | Required | Value |
| :- | :- | :- |
| `email` | ✅ | The email address of the user to create an account for; the address is case insensitive and can be up to 255 characters, regardless of character encoding |
| `credits` | | The number of API credits to preload the account with |

Here are the response keys and values:

| Key | Value |
| :- | :- |
| `email` | The email address of the new account as recorded by the API |
| `token` | The bearer token issued to the account for authentication |
| `credits` | The number of initial credits granted to the account |

### Customer deactivation

Disable an account with the associated email address:

```shell theme={null}
curl -X DELETE 'https://api.agentfirst.dev/users' \
-H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "email": "user@example.com" }'
```

The API will confirm that account no longer has credits:

```json theme={null}
{
  "email": "user@example.com",
  "credits": 0
}
```

This is the deprovisioning request key and value:

| Key | Required | Value |
| :- | :- | :- |
| `email` | ✅ | The (case-insensitive) email address of the user whose account to deactivate |

These are the response keys and values:

| Key | Value |
| :- | :- |
| `email` | The email address of the deactivated account |
| `credits` | The zeroed-out credits as confirmed by the API |


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