Get Started

# Authentication

Every request carries an API key in the x-api-key header. Generate keys from your dashboard; the same key works on MexCheck, RFCCheck, CURPCheck, and INECheck.

Every API call is authenticated with an API key passed in the x-api-key header. Keys are bound to an account or an organization and inherit that owner's plan and balance.

MexCheck, RFCCheck, CURPCheck, and INECheck share accounts: one key calls the RFC, CFDI, CURP, and INE endpoints, on mexcheck.com, rfccheck.com, curpcheck.com, or inecheck.com, and every call draws from the same plan and balance.

## Generating a key

Open [API Keys](/dashboard/api-keys) in your dashboard and click *Create key*. Give the key a label so future-you can tell apart your CI key from your production key.

Keys are shown only once at creation time. Copy yours into a secret manager (1Password, AWS Secrets Manager, Doppler, .env, your CI provider's secrets) before navigating away. If you lose a key, delete it and create a new one. There is no way to recover it.

## Using a key

Pass the key in the x-api-key header on every request:

curl

```bash
curl -X POST https://curpcheck.com/v1/curp/lookup \
  -H "x-api-key: rfc_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"curp": "PEMJ800101HDFRRN07"}'
```

JavaScript (fetch)

```js
await fetch("https://curpcheck.com/v1/curp/lookup", {
  method: "POST",
  headers: {
    "x-api-key": process.env.CURPCHECK_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ curp: "PEMJ800101HDFRRN07" }),
});
```

Python (requests)

```python
import os, requests

requests.post(
    "https://curpcheck.com/v1/curp/lookup",
    headers={"x-api-key": os.environ["CURPCHECK_API_KEY"]},
    json={"curp": "PEMJ800101HDFRRN07"},
)
```

## Rotating keys

Rotate keys whenever a teammate leaves or a key may have been exposed. The recommended pattern: create the new key, deploy it to your secret store, switch traffic over, then delete the old key from the dashboard.

## Organization keys

Keys created inside an organization (under /org/:slug/api-keys) bill against the organization's plan and balance, not the creator's personal account. Use organization keys whenever the cost should be attributed to a team rather than an individual.

## Error responses

- `401 Unauthorized`: the key is missing, malformed, or has been deleted.
- `402 Payment Required`: the key authenticated, but the owner has no remaining credits or prepaid balance.
- `429 Too Many Requests`: rate limit exceeded. Back off and retry.

## Building with an AI assistant?

Connect Claude, Cursor, or another MCP client to the MCP server. After you log in in your browser, it can read these docs, run real checks, and create your API key, with no key to paste.

MCP

```text
https://mexcheck.com/mcp
```

Setup and the list of tools are in the [MCP server guide](https://mexcheck.com/docs/mcp).