Skip to main content

API keys

Create the key your own systems use to call the tweak.email API, and keep it safe.

API access is included in every paid plan: Starter, Pro and Business. On the Free plan, or after a free trial ends, every endpoint except GET /me answers with a 403 error with the code plan_required and the plan you need; GET /me still answers, so your integration can see why.

Create your first key

  1. Open Settings → API.
  2. In the API key card, choose Generate Key.
  3. Copy the key straight away. It is shown only once.

On the Free plan the page shows that API access is part of every paid plan, with a link to the plans. The Billing page also links to Settings → API while your plan includes the API.

Only team owners and admins can generate keys. The key starts with lt_ and gives access to everything the API offers for your team.

Regenerate Key creates a new key and stops the old one immediately, so update your systems at the same moment. It also revokes every key created through the API, because whoever held the old key could have used it to create more. Create new scoped keys with the new main key afterwards.

Use the key

Send it with every request, in either header:

Authorization: Bearer lt_your_key_here
X-Api-Key: lt_your_key_here

Try it with the endpoint that tells you what the key can reach:

curl https://tweak.email/api/v1/me -H "Authorization: Bearer $TWEAK_API_KEY"

Scoped keys for each integration

With the first key you can create further keys through the API, each limited to the scopes it needs and optionally with an expiry date. Give every integration its own key, so you can revoke one without touching the others. A team can have up to 25 active keys.

A key can only create keys that expire no later than itself: a key with an expiry date passes it on to the keys it creates (as their expiry when you give none), and a later date is refused. A key without an expiry imposes none. A key must have at least one scope; an empty scope list is refused.

Settings → API lists the keys created through the API that still work, with their scopes and when each was last used. Owners and admins can revoke one there with Revoke.

Scope Allows
contacts:read Read contacts, lists, tags, segments and contact fields
contacts:write Create and change contacts, lists, tags, segments and contact fields
campaigns:read Read campaigns, templates and sequences
campaigns:write Create and change campaigns, templates and sequences (a sequence is activated in the app)
campaigns:send Launch, schedule and cancel campaign sends
events:read Read delivery events and campaign reports
events:write Report delivery events for mail you send outside tweak.email
suppressions:read Read the suppression list
suppressions:write Add and remove suppressions
transactional:send Send transactional e-mail
ai:write Run the AI polish, subject line and deliverability tools
webhooks:read Read webhook endpoints and their delivery history
webhooks:write Create and change webhook endpoints
keys:manage List, create and revoke API keys

A :write scope includes the matching :read. Sending is a scope of its own, so a key that drafts campaigns cannot send them. A key cannot create another key with more scopes than it has itself.

Create, list and revoke keys with POST /api-keys, GET /api-keys and DELETE /api-keys/{id}. These need the keys:manage scope, which the main key and keys created without a scope list have. A key can revoke itself, or another key whose scopes it all holds; it cannot revoke a key with more access than its own. See the API reference.

Keep keys safe

  • Treat a key like a password. Store it in your server's secret settings, never in a website's front-end code or a public repository.
  • If a key may have leaked, revoke it (or regenerate the main key) right away.
  • Errors such as "API key has been revoked" or "Invalid API key" (codes api_key_revoked and invalid_api_key) mean the key is no longer valid. A key that keeps failing from one address is answered with 429 (too_many_failed_auth_attempts) for the rest of the minute; your other keys are not affected.