---
title: "Create a token"
description: "Generate a JWT access token required to access all the other endpoints."
canonical: https://www.charitips.com/docs/api-reference/create-token
---

# Create a token

`POST /v1/authentication`

Generate a JWT access token required to access all the other endpoints. ⚠️ This endpoint is rate limited, it should only be called on previous token expiration which should be once per hour.

**Authentication**: Basic authentication with the client id and secret.

## Response 200

- `accessToken` (string, required)

## Errors

- 401 `Invalid credentials`: The client id or secret is wrong, or the pair belongs to the other environment: sandbox credentials start with `test_` and only work on api.sandbox.charitips.com. Send them as Basic authentication (`-u id:secret`). See https://www.charitips.com/docs/get-started/sandbox.md.
- 401 `Unauthorized`: The request has no Basic authentication header. Send the client id and secret as Basic authentication, with `-u id:secret` in cURL, not a Bearer token. See https://www.charitips.com/docs/get-started/authentication.md.
- 403 `Account closed`: The account behind these credentials is closed: no token is issued and every call is refused, reads included. Contact Charitips to reopen it. See https://www.charitips.com/docs/api-reference/troubleshooting.md#calls-answer-403-account-not-active-account-not-validated-or-account-closed.
- 403 `Account not active`: The account behind these credentials has not finished onboarding, so no token is issued. Complete the onboarding in the dashboard, or contact us. See https://www.charitips.com/docs/api-reference/troubleshooting.md#calls-answer-403-account-not-active-account-not-validated-or-account-closed.

## Example

```bash
curl -X POST https://api.sandbox.charitips.com/v1/authentication \
  -u "$CHARITIPS_CLIENT_ID:$CHARITIPS_CLIENT_SECRET"
```

```javascript
const response = await fetch('https://api.sandbox.charitips.com/v1/authentication', {
  method: 'POST',
  headers: {
    Authorization: `Basic ${btoa(`${process.env.CHARITIPS_CLIENT_ID}:${process.env.CHARITIPS_CLIENT_SECRET}`)}`,
  },
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const data = await response.json();
```

```python
import os, requests

response = requests.post(
    "https://api.sandbox.charitips.com/v1/authentication",
    auth=(os.environ["CHARITIPS_CLIENT_ID"], os.environ["CHARITIPS_CLIENT_SECRET"]),
)
response.raise_for_status()
data = response.json()
```

## Response example (200, placeholder values)

```json
{
  "accessToken": "<accessToken>"
}
```
