Get started

Authentication

The two kinds of EmailMarketer.io API key, where to create them, and how to send them with each request.

EmailMarketer.io uses two kinds of key. They are not interchangeable.

Key Used for How to send it
Account API key Every account command on /api.php and /api/v1/<command> APIKey parameter in the form fields, the JSON body, or the query string of a GET
Sender API key Transactional endpoints: /api/v1/email, /api/v1/webhooks, /api/v1/events Authorization: Bearer <key> header

Account API key

Create it in the app under API & webhooks. Send it as the APIKey parameter:

curl https://app.emailmarketer.io/api.php \
  -d Command=campaigns.get \
  -d APIKey="$EM_API_KEY"

The account API key is not read from an Authorization header. Always send it as a parameter.

For PATCH requests, put every parameter, including APIKey, in a JSON body. Query and form parameters are ignored on PATCH.

You can also manage account keys through the API:

Command Path Required Optional Returns
user.apikey.create POST /api/v1/user.apikey Note BoundIPAddress APIKeyID, APIKey object
user.apikey.list GET /api/v1/user.apikeys none none APIKeys array
user.apikey.delete POST /api.php APIKeyID none Success

Examples:

# user.apikey.create
curl https://app.emailmarketer.io/api/v1/user.apikey \
  -d APIKey="$EM_API_KEY" \
  -d Note="Billing service" \
  -d BoundIPAddress=203.0.113.10

# user.apikey.list
curl -G https://app.emailmarketer.io/api/v1/user.apikeys \
  -d APIKey="$EM_API_KEY"

# user.apikey.delete
curl https://app.emailmarketer.io/api.php \
  -d Command=user.apikey.delete \
  -d APIKey="$EM_API_KEY" \
  -d APIKeyID=34

BoundIPAddress limits a key to one IP address.

Team members

A key created by a team member acts with that member’s role. When the role does not allow a command, the API returns HTTP 403 with error code 100021. Keys created by a member stop working while the member is suspended or removed.

Sender API key

Each verified sending domain has its own sender API keys. Create one in the app under Transactional, on the domain’s API keys tab. Send it as a bearer token:

curl -X POST https://app.emailmarketer.io/api/v1/email \
  -H "Authorization: Bearer $EM_SENDER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

A sender API key only works for its own domain. You can also create and rotate sender keys with the account API. See Transactional (domains and keys).

Agent keys for AI assistants

An agent key is an account API key with a limited scope (read, write, send) for AI assistants. See AI assistants (MCP).

Keep keys safe

  • Keep keys on your server. Never put them in browser or mobile app code.
  • Store them in environment variables or a secrets manager, not in source control.
  • Use one key per app or service, so you can delete one without breaking the others.
  • If a key leaks, delete it and create a new one. For sender keys, emailgateway.replaceapi swaps the key in one step.

Authentication errors

Code Meaning
99998 The key is missing or invalid
99999 The key is valid but the account does not have permission for this command
13 (HTTP 401) Invalid sender API key on a transactional endpoint