---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/api-key

Get started

# Create an API key

Sending and managing use one key. Reading emails uses another, created in a different place. Pick the one that fits what you are building.

## Which key do you need?

mail.sendcorex.comgraph.sendcorex.com

Mail & Graph

### Send and manage

For sending email and for everything else in the API: domains, contacts, tracking, senders and logs.

Created in

Dashboard, Developer page

[Open the Developer page](https://app.sendcorex.com/dashboard/developer)

g.sendcorex.comOne per account

Read emails

### Read a mailbox

For reading, searching and organizing the emails of one email account.

Created in

Webmail, Settings of each email account

[Open Webmail](https://webmail.sendcorex.com/)

Mail & Graph

## Send and manage

One key from the Developer page works on mail.sendcorex.com and graph.sendcorex.com.

1. 1
Open the Developer page
Sign in at app.sendcorex.com and go to the Developer page of the dashboard.
[Open Developer page](https://app.sendcorex.com/dashboard/developer)
2. 2
Create a key
Generate a new key there and copy it. Keep it somewhere safe.
[Create API key](https://app.sendcorex.com/dashboard/developer)
3. 3
Send it with every request
Pass it in the Authorization header on mail.sendcorex.com and graph.sendcorex.com.

Request header

```
Authorization: Bearer YOUR_API_KEY
```

Read emails

## Read a mailbox

These keys are created inside Webmail, one for each email account, and used on g.sendcorex.com.

1. 1
Open Webmail
Go to webmail.sendcorex.com and sign in with the email account you want to read.
[Open Webmail](https://webmail.sendcorex.com/)
2. 2
Go to Settings
Open the Settings section of that email account.
3. 3
Generate the key
Create the API key there and copy it. Every email account has its own.

First request

```
curl -s https://g.sendcorex.com/v1 \
  -H "Authorization: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"commands":[{"command":"list_folders"}]}'
```

Refresh the token

```
curl -s https://g.sendcorex.com/v1/token/refresh \
  -H "Content-Type: application/json" \
  -d "{\"refresh_token\":\"$REFRESH\"}"
```

Send the token as `Authorization: <token>` or `Authorization: Bearer <token>`. Tokens start with `S.C.G.` and the refresh token with `R.S.C.G.`

One mailbox per key

The key decides whose emails you read. No argument in a request can pick another owner.

Tokens expire

An expired token returns TOKEN_EXPIRED. Rotate the pair with Refresh Token. The refresh token you used stops working right away.

Revoked keys

A token is cached for up to 1 hour, so a revoked token can keep working until that cache runs out.

Rate limit

15 requests per second and 15 at the same time, per IP and mailbox. Above that you get 429 RATE_LIMITED with a Retry-After header.

## Auth errors

What the read emails API returns when the key is the problem.

| Code | HTTP | When |
| --- | --- | --- |
| `MISSING_AUTH_HEADER` | 401 | The request has no Authorization header. |
| `INVALID_TOKEN` | 401 | Wrong format, unknown token or revoked. |
| `TOKEN_EXPIRED` | 401 | The token is past its expiry. Use the refresh token. |
| `RATE_LIMITED` | 429 | More than 15 requests per second or 15 in flight. |
| `AUTH_UNAVAILABLE` | 503 | Authentication is temporarily unavailable. |

[NextSend your first email](https://docs.sendcorex.com/api-reference/email/send) [NextRead your emails](https://docs.sendcorex.com/api-reference/receive-emails)
