Getting-started

How to create, limit and revoke an API key

Short answer

To create a Mailcandor API key, open API keys in the dashboard, choose Create API key, name it, pick Sending only or Full access, and copy the mc_live_ key shown once. Sending-only keys can be limited to one domain. You can also create keys with POST /v1/api-keys using a full-access key, and revoke any key at once from the list or with DELETE /v1/api-keys/{id}.

Last checked 16 November 2026

An API key lets your app send email and call the Mailcandor API. Every key starts with mc_live_ and is shown once, when you create it.

Key types

Type Can do Use it for
Sending only POST /v1/emails, /v1/emails/batch, /v1/emails/check, GET /v1/whoami, the SMTP relay and the SendGrid and Postmark compatible endpoints App servers, SMTP clients, anything that only sends
Full access Every endpoint, including domains, keys, webhooks, logs and broadcasts Scripts and tools that manage your account

A sending-only key can also be limited to one domain. It then refuses to send from any other domain with 403 restricted_api_key.

To create a key in the dashboard

  1. Open API keys and choose Create API key.
  2. Name: up to 50 characters. Name it after where it will live, such as Production server.
  3. Pick Sending only (the default) or Full access.
  4. For a sending-only key, optionally choose a domain under Limit to one domain. Leave it on Any domain on this team to allow all of them.
  5. Choose Create key.
  6. Copy the key with Copy, store it in your secrets manager, then choose I’ve copied it. It is not shown again.

To create a key with the API

Use a full-access key. permission defaults to full here, so set it explicitly:

curl https://api.mailcandor.com/v1/api-keys \
  -H "Authorization: Bearer $MAILCANDOR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Billing service", "permission": "sending", "domain_id": "DOMAIN_ID" }'

The answer is 201 with token, the new key. domain_id is only allowed with "permission": "sending". Get domain ids from GET /v1/domains.

To check which key you are using

curl https://api.mailcandor.com/v1/whoami -H "Authorization: Bearer $MAILCANDOR_KEY"

It returns your team name, the key name and its permission. Any key type can call it.

To revoke a key

In the dashboard: open API keys, choose Revoke on the key, then Revoke key. Anything still using it stops working at once. This cannot be undone.

With the API, using a different full-access key:

curl -X DELETE https://api.mailcandor.com/v1/api-keys/KEY_ID \
  -H "Authorization: Bearer $MAILCANDOR_KEY"

You cannot revoke the key that makes the request. Use another key or the dashboard.

To rotate a key safely

  1. Create a new key with the same permission.
  2. Deploy it to your app.
  3. Watch Last used on the old key in the API keys list. When it stops changing, revoke it.

If it does not work

  • 401 invalid_api_key: the key was revoked, mistyped or has spaces around it. Check with /v1/whoami.
  • 403 restricted_api_key: a sending-only key called an endpoint that needs full access, or a domain-limited key sent from another domain.
  • 403 forbidden when creating or revoking keys with the API: the person who created the calling key is no longer an admin or developer. Use a key made by a current admin or developer.
  • No Create API key button: your role is viewer or billing. Ask an admin to change your role on the Team page.
  • A domain-limited key disappeared: deleting a domain also deletes keys limited to it.

More in Error codes reference and at docs.mailcandor.com.

Questions

I lost my API key. Can I see it again?

No. Mailcandor keeps only a fingerprint of each key. Create a new key, update your app, then revoke the old one.

Which key type should my app server use?

Sending only. It can send email and nothing else, so a leaked key cannot read your logs, add domains or create more keys.

Who can create API keys?

Admins and developers on the team. Viewers and billing members can see the list but cannot create or revoke keys.

Does a key stop working when the person who made it leaves the team?

No. Keys keep working until revoked. A key whose creator is no longer an admin or developer can still send, but cannot create or revoke other keys.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.