Skip to content

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. 1Create an account, then choose a package and review its current terms
  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/api/v1/whatsapp/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 approved WhatsApp template messages
whatsapp:otpSend and verify OTPs for the assigned project and template
whatsapp:otplessCreate and poll OTPless sessions for the assigned project
whatsapp:templates:manageList, create, and delete WhatsApp templates on the assigned senders
contacts:writeCreate and update contacts (no delete — contacts are not removed via the API)
contacts:readRead contact data
conversations:readRead conversation threads and message history
leads:readRead leads and pipeline stages
campaigns:readRead campaign data
pipelines:readRead pipelines and deal boards

Webhook management (register, list, delete /api/v1/webhooks) is authorized by any valid API key — it does not use a separate scope. OTP and OTPless keys additionally restrict sends to their assigned project and template.

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