Authentication

All EmacronAI CRM API requests are authenticated using a Bearer token in the HTTP Authorization header. Your API key is the token.

Getting your API key

  1. 1Sign up for EmacronAI CRM (free, no credit card)
  2. 2Go to Settings → API Keys
  3. 3Click Create API Key, give it a name, and copy it
  4. 4Store it in your environment as OUTREACHAGENT_API_KEY

Using your API key

Include the Authorization header in every request:

Authorization: Bearer YOUR_API_KEY

cURL

curl https://api.crm.emacronai.com/v1/otp/send \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+919876543210"}'

Node.js (SDK)

import { createClient } from '@emacrontechnologies/outreachagent';

// Reads process.env.OUTREACHAGENT_API_KEY automatically
const oa = createClient(process.env.OUTREACHAGENT_API_KEY);

Environment best practices

✓Store key in environment variable: OUTREACHAGENT_API_KEY=...
✓Add .env to .gitignore to prevent accidental commits
✓Use separate keys for development and production
✕Never hardcode keys in source code
✕Never commit keys to git or expose in client-side JS
✕Never share keys in Slack, email, or screenshots

API key scopes

ScopeAllows
whatsapp:sendSend OTPs, broadcast messages, template messages
contacts:writeCreate, update, and delete contacts
contacts:readRead contact data and segments
webhooks:manageRegister and delete webhook endpoints
analytics:readRead campaign and CTwA analytics

Authentication errors

CodeNameCauseFix
401UnauthorizedMissing or invalid API keyCheck Authorization header is present and formatted as "Bearer API_KEY"
403ForbiddenKey has insufficient permissionsCheck key scopes in Settings → API Keys
429Too Many RequestsRate limit exceededRespect Retry-After header; implement exponential backoff

Next steps