MisarMisar Docs
MisarMailMisarBlogMisarReachMisarPostMisarDevMisarCoderMisarSEOMisar PlatformMisar SSO
Getting Started

API Keys

Create, manage, and secure your MisarMail API keys

All MisarMail API requests authenticate with an API key. Keys are scoped, revocable, and tied to your account.

Format: msk_ + 64 hex chars. Header: Authorization: Bearer msk_.... Create in Settings → API Keys. Key shown once — store it immediately.

Key Format

msk_a1b2c3d4e5f6...   # 68 characters total: msk_ + 64 hex

Creating a Key

Give your key a name (e.g., "Production", "MisarDev Integration")

Choose the scopes your integration requires (see table below)

The full key is shown exactly once. Copy it to a password manager or secrets vault immediately.

You cannot retrieve the key secret after creation. If lost, revoke it and create a new one.

Available Scopes

ScopeAccess
sendSend transactional and marketing emails
send:transactionalSend transactional emails only
send:marketingSend marketing/campaign emails only
contactsFull contact CRUD
campaignsCampaign management
templatesTemplate management
automationsAutomation workflows
analyticsAnalytics and reporting
validateEmail validation
trackEvent and purchase tracking
track:eventsCustom event tracking only
track:purchasePurchase event tracking only
inboundInbound email domain management
inbound:readRead inbound config
inbound:writeCreate/update inbound config
ipsDedicated IP management
ips:readRead IP config
ips:writeManage IPs
sandboxSandbox mode access
monetizationTip/monetization features
readRead-only access to contacts and tests

Use the most restrictive scopes needed for your integration. A key used only for sending transactional emails should have send:transactional, not the broader send scope.

Using a Key

Include the key in every request using the Authorization: Bearer header:

curl https://api.misar.io/mail/v1/send \
  -H "Authorization: Bearer msk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{...}'
const res = await fetch("https://api.misar.io/mail/v1/send", {
  headers: {
    Authorization: `Bearer ${process.env.MISARMAIL_API_KEY}`,
    "Content-Type": "application/json",
  },
  method: "POST",
  body: JSON.stringify({ /* ... */ }),
});
import os, requests

requests.post(
    "https://api.misar.io/mail/v1/send",
    headers={"Authorization": f"Bearer {os.environ['MISARMAIL_API_KEY']}"},
    json={ /* ... */ },
)

OAuth 2.0 (Authorization Code + PKCE)

For third-party integrations that act on behalf of a MisarMail user — such as ChatGPT Actions and Google Gemini — MisarMail supports the OAuth 2.0 Authorization Code flow with PKCE. Use this instead of a static msk_ key when a user grants a connected app access to their account.

EndpointURL
Authorizationhttps://api.misar.io/mail/oauth/authorize
Tokenhttps://api.misar.io/mail/oauth/token

The flow is the standard Authorization Code + PKCE exchange: redirect the user to the authorization endpoint with a code_challenge, then exchange the returned code for an access token at the token endpoint using the matching code_verifier. The resulting bearer token is sent the same way as an API key:

curl https://api.misar.io/mail/v1/send \
  -H "Authorization: Bearer <oauth_access_token>" \
  -H "Content-Type: application/json" \
  -d '{...}'

OAuth Scopes

ScopeAccess
sendSend emails on behalf of the user
send:transactionalSend transactional emails only
send:marketingSend marketing campaigns only
readRead inbox, emails, and campaign analytics
writeCreate and manage campaigns, templates
contactsManage contact lists
validateValidate email addresses
inboundFull inbound email domain management
inbound:readRead inbound domains
inbound:writeCreate and delete inbound domains
ipsFull dedicated IP management
ips:readRead dedicated IP details
ips:writeRequest and update dedicated IPs
analyticsRead analytics and reporting data
sandboxSend to sandbox (test mode)

Listing and Revoking Keys

Key management endpoints require a Supabase session cookie — use them from the MisarMail settings UI, not from external apps.

MethodEndpointPurpose
GET/api/v1/keysList your keys (prefix only — secret never returned)
POST/api/v1/keysCreate a new key
DELETE/api/v1/keys?id=<uuid>Revoke a key immediately

Security Best Practices

Environment Variables

Store keys in .env files. Never hardcode in source code.

One Key Per App

Use separate keys for dev, staging, and production environments.

Rotate Regularly

Revoke old keys and create new ones periodically.

Git Ignore

Add .env and .env.local to .gitignore.

Error Responses

401 — Invalid Key

{
  "success": false,
  "error": "Invalid or missing API key. Use: Authorization: Bearer msk_..."
}

403 — Wrong Sender

{
  "success": false,
  "error": "'from.email' is not a verified account for this API key"
}

403 — Missing Scope

{
  "success": false,
  "error": "API key does not have 'send' scope"
}