<!-- The markdown copy of https://oppalerts.com/docs/getting-started/create-an-api-token . All pages: https://oppalerts.com/docs/llms.txt -->

[Documentation](https://oppalerts.com/docs/) / [Getting Started](https://oppalerts.com/docs/getting-started/) / Create an API Token

# Create an API Token

Create a token so your code or AI agent can call the OppAlerts API and MCP server.

## Before you start

- You need an OppAlerts account. Log in at [oppalerts.com/login](https://oppalerts.com/login).
- Claude Code, Claude, Codex, and most other MCP clients sign in with OAuth in the browser and do not need a token. See [Use OppAlerts in Your AI Agent](https://oppalerts.com/docs/getting-started/use-oppalerts-in-your-ai-agent).
- Use a token for your own script or a client that cannot sign in with OAuth.

## Steps

1. Open [oppalerts.com/app/account/api_tokens](https://oppalerts.com/app/account/api_tokens). In the profile menu, choose **API & MCP Tokens**.
2. Complete the **Make a token** form. Check `api:write` only when the script or the agent must create or change campaigns.
3. Click **Make the token**, then **Copy**. The page shows the token only once.

[API & MCP Tokens](https://oppalerts.com/docs/account/api-tokens) explains the form fields, scopes, expiration date, token revocation, and connected apps.

## Test the token

This call does not use an index search. It shows how many calls your account has left today.

```bash
curl -X POST https://api.oppalerts.com/v1/account/calls_left \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

An invalid, expired, or revoked token returns HTTP 401.

## Use the token

- Send it in the header `Authorization: Bearer YOUR_TOKEN`.
- API: `https://api.oppalerts.com/v1/`.
- MCP server: `https://mcp.oppalerts.com/mcp`.
- Keep the token secret, just as you would a password.

## Related Pages

- [API & MCP Tokens](https://oppalerts.com/docs/account/api-tokens) Make and revoke the tokens of the MCP server and the API, and see the apps that you connected.
- [Authentication](https://oppalerts.com/docs/getting-started/authentication) Login, API tokens, OAuth, and the scopes.
- [Connect an AI Agent](https://oppalerts.com/docs/mcp/) Connect Claude Code, Codex, or another AI agent to the OppAlerts MCP server.
- [Authentication and Limits](https://oppalerts.com/docs/api/) The base URL, tokens, daily limits, and errors of the OppAlerts API.
- [Usage and Daily Limits](https://oppalerts.com/docs/getting-started/usage-and-daily-limits) Know how many calls your account has left today, and see who used them.
- [Team Members](https://oppalerts.com/docs/getting-started/team-members) Give your team and your clients permissions for your account, and choose which campaigns each person can see or change.
