# AgentSend > Cold email infrastructure for AI agents: sending domains and inboxes, warmup, campaigns built from > templates, reply handling and analytics, all through one HTTP API. Prepaid credits pay a monthly workspace fee > and a charge per contact reached; prices at GET /v1/prices. Base URL: https://api.useagentsend.com/v1 Dashboard for people: https://app.useagentsend.com (it calls this same API) OpenAPI 3.1: https://api.useagentsend.com/openapi.json (request schemas are the ones the server validates with) MCP: https://api.useagentsend.com/mcp (Streamable HTTP; send the same `Authorization: Bearer ak_live_…` header). One tool per endpoint below, named after it (`POST /templates/{id}/preview` → `post_templates_id_preview`); arguments are the path parameters, the query parameters, `body`, `workspace_id` and, for writes, `idempotency_key`. Terms: https://api.useagentsend.com/terms (using the API, including through an agent, binds the account holder) · Privacy: https://api.useagentsend.com/privacy ## Authentication - Send `Authorization: Bearer ak_live_…` on every request. - Get a key one of two ways: 1. Your human creates one in the dashboard (https://app.useagentsend.com, API keys) and gives it to you. 2. Sign up yourself: `POST /v1/signup {"principal_email","org_name","agent_name"}` returns `api_key`, `workspace_id` and `claim_url`. Give `claim_url` to the human at principal_email; they sign in with Google to own the account. - A key acts in one workspace. Account-wide keys work in every workspace of the account; name one with `X-Workspace-Id: ws_…` (GET /v1/workspaces lists them). - A key has scopes (e.g. campaigns:write, billing:spend); a missing scope returns 403 `missing_scope`. GET /v1/me shows the key's workspace and scopes. ## Conventions - JSON in and out. Money is a string in USD with 2 decimals ("12.50"), or more for sub-cent prices. - Every POST except /v1/signup needs a unique `Idempotency-Key` header. Retrying with the same key and body is safe and returns the first result; the same key with a different body returns 422 `idempotency_mismatch`. - Errors: `{"error":{"type","code","message","fix","requires_human","next_action"}}`. Read `fix`: it says what to do next. `next_action {"method","path","tool"}` is the endpoint it names (and its MCP tool). `requires_human: true` means only a person can clear it (a tier, credits, a key with more scopes): ask your human instead of retrying. - Lists return `{"data":[…]}`; long ones add `next_cursor`: pass it as `?cursor=` for the next page, with `?limit=` (≤ 100). - Long work returns 202 with a job: poll GET /v1/jobs/{id}. ## Tiers A new workspace is T0: it can set up (templates, quotes) but not send cold email. T1+ can send, with daily caps (GET /v1/workspace shows tier, caps and balance). During the beta the AgentSend team moves workspaces up. ## The path to a first campaign Start every run with `GET /v1/workspace/next-actions` (MCP `get_workspace_next_actions`): every blocker and next step across the workspace, blockers first, each with a fix, `requires_human` and the call to make next. It is built for an agent that doesn't remember its last run. 1. `GET /v1/workspace`: tier, caps, credit balance. 2. Sending infrastructure: `POST /v1/infrastructure` with `{"domains":{"names":["acme-mail.com"]}, "inboxes_per_domain":2,"personas":[{"first_name":"Sam","last_name":"Rivera"}],"timezone":"America/New_York", "dry_run":true}` returns a quote; send again with `"dry_run":false` to buy (job). Domains and inboxes then verify and warm up: `GET /v1/domains`, `GET /v1/inboxes`. Personas take turns across inboxes; one person can hold several (george.witwer@, george@, g.witwer@ …), or name them with `"usernames"`. The quote lists the exact addresses. More inboxes later on a verified domain: `POST /v1/inboxes {"domain","first_name","last_name","username"?}`. 3. Copy: `POST /v1/templates {"name","steps":[{"delay":0,"variants":[{"subject","body"}]},{"delay":3,"variants":[{"body"}]}]}`. Merge fields: `{{first_name}}`, `{{last_name}}`, `{{company_name}}`, `{{title}}`, `{{sender_name}}`, and any `custom_variables` key every lead carries. The response includes lint findings with fixes. See what one person would get: `POST /v1/templates/{id}/preview {"lead":{"email","first_name",…,"custom_variables":{}}}` (changes nothing). New versions: `POST /v1/templates/{id}/versions`. All mail is sent from templates; there is no raw send. 4. Campaign: `POST /v1/campaigns {"name","template_id","email_list":["inbox id or address"],"daily_limit":50, "campaign_schedule":{"timezone","days":[1,2,3,4,5],"from":"09:00","to":"17:00"}}` (or inline `"sequences":[{"steps":[…]}]` instead of template_id). `PATCH /v1/campaigns/{id}` changes the name or template pin while draft, paused or rejected. 5. Leads: `POST /v1/leads {"campaign_id","leads":[{"email","first_name","company_name","custom_variables":{}}]}` (≤ 1000 per call). People who already know the sender: `POST /v1/warm-audience` (same shape plus "relationship"). 6. Check first: `GET /v1/campaigns/{id}/lint` runs every free launch check (copy rules, tier, leads, inboxes, sender address) and returns each issue with a fix; nothing changes. Activate: `POST /v1/campaigns/{id}/activate` (`{"dry_run":true}` to preview). Leads are verified, copy passes rule and AI review, and a canary runs. Then `GET /v1/campaigns/{id}/sending-status` says what is sending, what is blocked and why, with a fix. 7. Results: `GET /v1/campaigns/{id}/analytics` (totals, rates, by step and variant, lead states) and `/analytics/daily?timezone=&days=`. Opens and clicks are not tracked, by design. 8. Pause and resume: `POST /v1/campaigns/{id}/pause {"reason"}` stops sending within seconds (status "pausing", then "paused"); `POST /v1/campaigns/{id}/resume` restarts it. Leads keep their place. Copy and name can change while paused. GET /v1/campaigns/{id} returns `status` (what is happening) and `desired` (what you asked for); "paused_by_system" means a safety check stopped it, which resume does not override. 9. Replies: `GET /v1/emails` lists what recipients wrote back, newest first, each with a `label` (interested, not_interested, wrong_person, unsubscribe, angry, out_of_office, auto_reply, bounce_notice). By default it leaves out automatic mail; `?mode=all` shows everything, `?label=interested` only that label. `GET /v1/emails/{id}` returns the reply with the whole conversation. Unsubscribes and angry replies are suppressed for you, and any reply stops that lead's sequence. 10. Lead discovery (preview, enabled per workspace; others get 403 lead_discovery_not_enabled): `POST /v1/lead-searches` describes who to find in words, with `filters` (countries, employees, exclude, roles), `contacts_per_company`, `target_contacts` and `max_spend_usd`, a hard cap. Agents find companies, check each site, and pick verified people with the roles asked for. `GET /v1/lead-searches/{id}` shows status, spend and each query's yield; `GET /v1/lead-searches/{id}/companies` shows why each company fits or was dropped, with its contacts. Review, then `POST /v1/lead-searches/{id}/leads {"campaign_id"}` puts the picked contacts into a campaign with the same checks as an upload. ## Webhooks Instead of polling for replies, subscribe: `POST /v1/webhooks {"url":"https://…","events":["reply.received"]}` (or `["*"]`; also `campaign.ready`, `campaign.rejected`). The response carries `secret` once: store it. Each event is POSTed as `{"id","type","created_at","workspace_id","data"}`; for `reply.received`, `data.reply_id` is the id for `GET /v1/emails/{id}`. Answer any 2xx within 10 s; otherwise it is retried with backoff for 72 hours, so deduplicate on `id` (also in the `AgentSend-Event-Id` header). `POST /v1/webhooks/{id}/test` sends a `webhook.test` event now and returns your status code; `GET /v1/webhooks/{id}/deliveries` shows every attempt. Verify `AgentSend-Signature` (`t=,v1=`, HMAC-SHA256 of `t + "." + raw body` with the secret) before trusting a delivery: const [t, v1 = ''] = req.headers['agentsend-signature'].split(',').map((p) => p.split('=')[1]); const mac = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex'); const fresh = Math.abs(Date.now() - Number(t)) < 5 * 60_000; if (!fresh || v1.length !== mac.length || !crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(v1))) return res.sendStatus(400); res.sendStatus(200); // then handle JSON.parse(rawBody), once per id ## Endpoints Account - POST /v1/account/claim-link: A fresh claim link while the account has no owner - GET /v1/me: Who is calling: the key (workspace, scopes) or the person (accounts, workspaces, roles) - POST /v1/signup {"principal_email","org_name","agent_name"}: Sign up as an agent: returns an API key, a T0 workspace and a claim link for your human - GET /v1/workspace: This workspace: tier, caps, credit balance - GET /v1/workspace/next-actions: Every blocker and next step across the workspace, blockers first: each with a fix, whether your human is needed, and the call to make - GET /v1/workspaces: Workspaces the caller can open - POST /v1/workspaces {"name","account_id","principal"}: Create a workspace (sub-account); needs workspaces:write on the account - PATCH /v1/workspaces/{id} {"name","sender"}: Rename a workspace or set its sender (business name, postal address) Keys and people - GET /v1/api-keys: API keys of this workspace (and account-wide keys, for account admins) - POST /v1/api-keys {"label","scopes","account_wide"}: Create a key; the secret is returned once; never more scopes than the caller holds - DELETE /v1/api-keys/{id}: Revoke a key - GET /v1/audit-log: Who did what in this workspace, people and keys - GET /v1/invitations: Open invitations - POST /v1/invitations {"email","role","level"}: Invite someone; returns an invite_url to pass on - DELETE /v1/invitations/{id}: Revoke an invitation - GET /v1/me/sessions: Your signed-in sessions (people only) - DELETE /v1/me/sessions/{id}: Sign out one of your sessions - POST /v1/me/sessions/revoke-others: Sign out every session but this one - GET /v1/members: People who can open this workspace - PATCH /v1/members/{id} {"role"}: Change a member's role - DELETE /v1/members/{id}: Remove a member Credits - GET /v1/billing/balance: Credit balance: total, held for purchases, available - GET /v1/billing/ledger: Credit movements, newest first - POST /v1/billing/transfers {"from_workspace_id","to_workspace_id","amount","note"}: Move credits between two workspaces of one account (billing:spend in both) - GET /v1/prices: The price list in force - GET /v1/usage?from=&to=&group_by=: Usage and spend, grouped by meter and/or day Sending - GET /v1/domains: Sending domains - GET /v1/inboxes: Inboxes, with the scheduler's latest report - POST /v1/inboxes {"domain","first_name","last_name","title","username","timezone"}: Add an inbox to a verified domain you have; one person can hold several (george.witwer@, george@, …) - POST /v1/infrastructure {"domains","inboxes_per_domain","personas","timezone","dry_run"}: Quote (dry_run) or buy sending domains and inboxes; returns a job - GET /v1/jobs/{id}: A long-running job Templates - GET /v1/templates: Template library - POST /v1/templates {"name","steps","shared"}: Create a template (version 1); returns lint findings - GET /v1/templates/{id}: A template's latest version - PATCH /v1/templates/{id} {"name","status"}: Rename or archive a template - POST /v1/templates/{id}/preview {"version","lead","sender_name"}: Render every variant for a sample person (changes nothing); lists the fields they lack - POST /v1/templates/{id}/versions {"steps"}: Save a new immutable version - GET /v1/templates/{id}/versions/{v}: One version of a template Campaigns - GET /v1/campaigns: Campaigns, newest first - POST /v1/campaigns {"name","sequences","template_id","template_version","campaign_schedule","email_list","daily_limit","prioritize_new_leads"}: Create a campaign from a template (or inline sequences) - GET /v1/campaigns/{id}: A campaign - PATCH /v1/campaigns/{id} {"name","template_id","template_version"}: Rename or move the template pin (draft, paused or rejected) - POST /v1/campaigns/{id}/activate {"dry_run"}: Verify leads, review copy, run the canary, then send - GET /v1/campaigns/{id}/analytics: Totals, rates, by step and variant, lead states - GET /v1/campaigns/{id}/analytics/daily?timezone=&days=: Counters by day - GET /v1/campaigns/{id}/lint: Run every free launch check without activating: copy, leads, inboxes, sender, tier; each issue with a fix - POST /v1/campaigns/{id}/pause {"reason"}: Pause sending; status reads "pausing" until the data plane confirms (seconds). Works while activating too - POST /v1/campaigns/{id}/resume {"reason"}: Resume a campaign you paused (never lifts a safety pause) - GET /v1/campaigns/{id}/sending-status: What is sending, what is blocked and why, with a fix - GET /v1/leads?campaign_id=&state=&verify_status=&kind=&q=: Leads (imported at activation); with campaign_id, where each is in that sequence - POST /v1/leads {"campaign_id","leads"}: Add leads to a campaign (≤ 1000 per call) - POST /v1/warm-audience {"campaign_id","leads"}: Add people who already know the sender Replies - GET /v1/emails?campaign_id=&lead_id=&label=&mode=: Replies, newest first, classified (interested, not_interested, unsubscribe, …) - GET /v1/emails/{id}: A reply with its whole conversation, whether it can be answered, and the answers asked for - POST /v1/emails/{id}/reply {"text"}: Answer a reply, in its thread (plain text, ≤ 300 words; never to unsubscribed or automatic mail) Webhooks - GET /v1/webhooks: Webhooks of this workspace - POST /v1/webhooks {"url","events"}: Subscribe an https URL to events (or ["*"]); returns the signing secret once; at most 10 - DELETE /v1/webhooks/{id}: Delete a webhook; pending deliveries stop - GET /v1/webhooks/{id}/deliveries: Deliveries of a webhook, newest first: attempts, last status, next retry - POST /v1/webhooks/{id}/test: Send a signed webhook.test event now; returns the status code your endpoint answered Lead discovery (preview) - GET /v1/lead-searches: Lead searches, newest first, each with its yield and spend - POST /v1/lead-searches {"description","filters","contacts_per_company","target_contacts","max_spend_usd","seed_queries","query_style"}: Start a lead search: describe who to find, with filters, contacts per company, a target and a hard spending cap - GET /v1/lead-searches/{id}: A lead search: status, spend, companies and contacts found, and the yield of each query - GET /v1/lead-searches/{id}/companies?fit=: The companies a search checked: why each fits or was dropped, its source, cost and picked contacts - POST /v1/lead-searches/{id}/leads {"campaign_id","company_ids"}: Put a search's picked contacts into a campaign (all fitting companies, or the ones listed), with the same checks as POST /leads ## Rules that never bend - Mail goes out only through campaigns built from templates, after rule and AI review. - Every email carries a working unsubscribe link and the sender's postal address; unsubscribes and bounces are suppressed permanently. - Daily caps and warmup ramps apply per tier and per inbox; sending-status explains any hold. ## Pricing Credits (GET /v1/billing/balance) pay for: - the workspace fee, every 30 days from the workspace's first inbox, warmup included; it includes 5 inboxes; - each inbox beyond 5, every 30 days from its creation; - each contact reached: the first email of a sequence to a lead. Follow-ups and verification are included, and the price falls above a monthly volume; - domains, per year, held at purchase and charged for what was bought. Sends and verification appear in GET /v1/usage at $0. A purchase needs credits for the domains and the first month's fees; quote first with `"dry_run": true` (free).