Build on Agent360
A documented REST API and signed webhooks, so your website forms, lead portals and tools work with your CRM.
$ curl -X POST /api/v1/leads \MCP server
Connect your own AI agents to Agent360.
Reference
API reference
Getting started
The Agent360 API lets external tools read and write leads, notes, and tasks in your account using a per-account API key.
- Sign in, open Admin → API Keys and click Create API Key. Only Admins and Owners can create or manage keys.
- Choose the permissions the integration needs (see Permissions) and, optionally, an expiration date.
- Copy the key immediately: it's shown only once and can't be retrieved later. Store it securely in the integration you're connecting.
- Test it:
GET /api/v1/mewith your key returns your account and key info, includingapiKeyId(this key's id) androle(the role the key acts with: its creator's).
Authentication
Every request must include an Authorization header with a valid API key. All API traffic must use HTTPS.
Authorization: Bearer ak_xxxxxxxxxxxxxxxxxxxxxxxxKeys are scoped to the account that created them and inherit the role of the issuing user. A key created by an Agent can only see or do what that Agent can. A request that targets a record the key isn't allowed to see returns 403 (or 404 where revealing the record's existence would itself be a disclosure).
Permissions
Each key is granted one or more permission scopes at creation time. Requests using a key without the required scope for an endpoint are rejected with 403.
| Scope | Grants |
|---|---|
| leads:read | Read leads and their notes |
| leads:write | Create and update leads, add notes |
| leads:delete | Delete leads |
| tasks:read | Read tasks |
| tasks:write | Create and update tasks |
| tasks:delete | Delete tasks |
| appointments:read | Read appointments |
| appointments:write | Create and update appointments |
| appointments:delete | Delete appointments |
| deals:read / deals:write / deals:delete | Deal pipeline access |
| users:read / users:write | Team member directory access (users:read: GET /users) |
| organizations:read | Read account/organization details |
| files:read / files:write / files:delete | File attachment access |
| webhooks:read | List webhook endpoints (GET /webhooks) |
| webhooks:write | Register and delete webhook endpoints (POST /webhooks, DELETE /webhooks/{id}) |
The webhook scopes are only granted when you tick them on a key. Managing webhooks also requires a key created by an Admin or Owner, the same rule as in the app.
Partner sync preset. When creating a key, the Partner sync preset button selects the scopes a two-way sync needs in one click: leads:read, leads:write, tasks:read, tasks:write, appointments:read, appointments:write, users:read, webhooks:read, webhooks:write. It only ticks those boxes; you can adjust them before saving.
Conventions
| Base URL | /api/v1 |
| Versioning | Path-based (/v1). Breaking changes ship under a new version. |
| Format | JSON request and response bodies. Send Content-Type: application/json on writes. |
| Dates | 2026-06-12T14:30:00Z |
| IDs | Integer. Treat as opaque: don't assume a format or rely on ordering. |
Pagination
List endpoints are paginated with limit (default 25, max 100) and offset. Responses include a _metadata block with a nextLink. Follow it until it's null rather than computing offsets yourself.
{
"leads": [ /* ... */ ],
"_metadata": {
"total": 1342,
"limit": 25,
"offset": 0,
"nextLink": "/api/v1/leads?limit=25&offset=25"
}
}Cursor pagination for sync (leads). Pass sort=updatedAt on GET /leads to page through leads oldest-change-first (ordered by updatedAt, then id) with an opaque cursor instead of an offset. The response adds _metadata.nextCursor. Send it back as cursor (or just follow nextLink) until it's null. Records changed while you page are never skipped, and leads sharing the same updatedAt are never repeated. offset is ignored in this mode. Store the last cursor to resume an incremental sync later.
GET /api/v1/leads?sort=updatedAt&limit=100
{
"leads": [ /* ... */ ],
"_metadata": {
"total": 1342,
"limit": 100,
"offset": 0,
"nextLink": "/api/v1/leads?sort=updatedAt&limit=100&cursor=eyJ1Ijoi...",
"nextCursor": "eyJ1Ijoi..."
}
}Rate limits
Every response carries rate-limit headers, enforced per API key on a rolling 10-second window. Exceeding the limit returns 429 with a Retry-After header. Back off and retry with exponential backoff and jitter.
X-RateLimit-Limit: 250
X-RateLimit-Remaining: 248
X-RateLimit-Reset: 7Idempotency
For POST/PUT/PATCH/DELETE requests, pass an Idempotency-Key header (any unique string you generate, e.g. a UUID) to make retries safe. If a request with the same key and the same body is repeated (after a timeout, for example), the original response is replayed instead of the request being executed again.
curl -X POST /api/v1/tasks \
-H "Authorization: Bearer ak_xxxx" \
-H "Idempotency-Key: 7b1e2c1a-6f2a-4b7e-9c3a-2f6b8e1d4a90" \
-H "Content-Type: application/json" \
-d '{"title": "Follow up"}'Reusing a key with a different request body returns 409. Keys are remembered for 24 hours. Successful and validation-error responses are replayed; a 5xx is treated as transient and is not cached. Retry it with the same key to get a fresh attempt.
If a retry arrives while the original request with the same key is still running, it gets 409 with error code idempotency_in_progress and a Retry-After: 2 header instead of running twice. Wait and resend the identical request to receive the original response.
Secrets are never stored for replay. A replayed POST /webhooks response has "secret": null, "secretShownOnce": true and a secretNote: the signing secret is only in the original response (rotate it in the app if it was lost).
Errors
Standard HTTP status codes. Error bodies share one shape:
{
"error": {
"code": "validation_error",
"message": "Request body failed validation",
"details": [{ "field": "email", "issue": "email is required" }]
}
}| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request | Malformed request / unparseable JSON |
| 401 | unauthorized | Missing, invalid, or revoked key |
| 403 | forbidden | Key valid but lacks permission for this resource |
| 404 | not_found | Resource doesn't exist (or is hidden from this key) |
| 409 | conflict | e.g. an Idempotency-Key reused with a different request body |
| 409 | idempotency_in_progress | A request with the same Idempotency-Key is still running, retry after Retry-After |
| 422 | validation_error | Body parsed but failed validation |
| 429 | rate_limited | Too many requests, see Retry-After |
| 500 | server_error | Our problem, safe to retry later |
Leads (Contacts)
The central entity: represents a lead or client. Externally called Contact to match common CRM API naming; inside Agent360 this is your Lead record.
{
"id": 8241,
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@example.com",
"phone": "+14165551234",
"source": "Website",
"timeFrame": "3-6 months",
"price": "800k-1.1M",
"background": null,
"status": "NEW",
"stage": 3,
"assignedAgentId": 512,
"labels": ["VIP", "Hot Lead"],
"customFields": { "approved_amount": "500000" },
"consent": {
"smsOptedOut": false,
"smsOptedOutAt": null,
"smsConsent": true,
"smsConsentAt": "2026-06-12T14:30:00Z",
"emailUnsubscribed": false,
"emailMarketingConsent": null,
"needsMortgage": true
},
"createdAt": "2026-06-12T14:30:00Z",
"updatedAt": "2026-06-12T14:30:00Z"
}| Method | Path | Description |
|---|---|---|
| GET | /leads | List/search leads |
| POST | /leads | Create a lead |
| GET | /leads/{id} | Retrieve one |
| PUT | /leads/{id} | Update firstName/lastName/email/phone/timeFrame/assignedAgentId/labels/customFields/status (partial: send only changed fields) |
| DELETE | /leads/{id} | Delete |
| POST | /leads/{id}/archive | Archive (same as Archive in the app). Body: optional reason, actorName. Idempotent. |
Filters on GET /leads: q (free-text search), stage, source, assignedAgentId, updatedSince (for incremental sync). Add sort=updatedAt + cursor for cursor pagination (see Pagination). customFields are omitted from GET /leads list responses (only on a single-lead GET/POST/PUT). Opt in to more per lead with include (comma separated): labels (label names, loaded in one batched query per page), assignees (assignedAgentIds: every assigned agent; assignedAgentId stays the first one) and journeyStep, e.g. GET /leads?sort=updatedAt&include=labels,assignees.
consent — read-only on every lead response; set with these optional fields on PUT /leads/{id}: smsOptedOut (only true), emailUnsubscribed (only true), smsConsent, emailMarketingConsent, needsMortgage (booleans) and consentSource (free text recorded with the change; default api). Opt-outs are sticky: sending false for smsOptedOut or emailUnsubscribed returns 422 ("opt-outs can only be cleared in the app"). An SMS opt-out stops every SMS the app sends to the lead; an email unsubscribe adds the address to the account's unsubscribe list, exactly like the unsubscribe link. smsConsent: true does not clear an existing SMS opt-out. Changes fire lead.consent_changed.
labels — read-only array of label names. Write with {"add": ["VIP"], "remove": ["Cold"]} on PUT /leads/{id} or POST /events; an unknown add name is created, an unknown remove name is a no-op.
customFields — object keyed by the field's key (set up under Admin → Custom Fields), not its internal id. An unrecognized key is silently ignored rather than rejected.
phone — on POST /leads and POST /events, an unparseable phone number never blocks the lead from being created. It's saved as null instead, and the response includes a top-level warning string naming the rejected value. A lead in this state is automatically excluded from outbound SMS/call actions (they require a phone number). A parseable phone is normalized to E.164 as usual.
status — optional on PUT /leads/{id}, one of NEW, PENDING, CONTACTED, QUALIFIED, CONVERTED, CLOSED, ARCHIVED. Leaving it out leaves the status unchanged. Setting ARCHIVED is the same as archiving the lead in the app (it needs the delete-leads permission and fires lead.deleted); any other change is logged on the lead's activity and fires lead.updated. Setting the status the lead already has does nothing. An archived lead can't be moved to another status through the API: that returns 422 (restore it in the app).
PUT /leads/{id} checks everything first (lead visibility, archive permission, consent rules), so a 4xx never leaves the lead half-updated. A request that changes fields, status and/or labels fires one lead.updated covering all of them (consent changes fire lead.consent_changed).
POST /leads/{id}/archive — body {"reason": "Duplicate", "actorName": "Jane (Partner CRM)"} (both optional). Archives through the app's own Archive action (needs the delete-leads permission, fires lead.deleted) and records the reason and who on the lead's timeline, marked as coming from the API. Returns { "id": 8241, "status": "ARCHIVED", "archived": true }; an already archived lead returns 200 with "archived": false and records nothing.
Activities (SMS, calls, emails)
Read a lead's SMS, call and email history, and log ones that happened in another system. Every activity has one shape, here and in the activity.created webhook:
{
"id": "sms:90211",
"leadId": 8241,
"type": "sms",
"direction": "outbound",
"externalId": "msg_123",
"occurredAt": "2026-06-12T14:30:00.000Z",
"body": "See you at 3pm",
"subject": null,
"durationSeconds": null,
"fromNumber": "+14165550000",
"toNumber": "+14165551234",
"agentId": 512,
"source": "api",
"updatedAt": "2026-06-12T14:30:00.000Z"
}id is sms:<n>, call:<n> or email:<n>. type is sms | call | email; direction is inbound | outbound; source is api (logged through this API; externalId is then your id) or app (externalId null). subject is for emails, durationSeconds for calls; for emails fromNumber/toNumber hold the addresses.
| Method | Path | Description |
|---|---|---|
| GET | /leads/{id}/activities | A lead's activities (filters: type, since; limit, cursor). Scope leads:read |
| POST | /leads/{id}/activities | Log an SMS, call or email that already happened (record-only). Scope leads:write |
| GET | /activities | Org-wide feed for sync (filters: updatedSince, type; limit, cursor). Scope leads:read |
Lists are ordered by updatedAt (then type and id) and cursor-paged: the response is { "activities": [...], "_metadata": { "limit", "nextCursor", "nextLink" } }. Follow nextCursor/nextLink until it's null. since / updatedSince are inclusive lower bounds on updatedAt. An SMS is never edited after it's recorded, so its updatedAt is when it was recorded; a call's changes when e.g. its duration arrives. Emails are the ones on the lead's Email tab that Agent360 has saved (sent from Agent360, synced from Gmail, or logged via the API); every email type other than received mail is reported as outbound. Keys created by an Agent only see activities on their assigned leads.
Logging an activity. POST /leads/{id}/activities with type, direction, externalId (your id, up to 200 characters), occurredAt, and optionally body, subject, durationSeconds, fromNumber, toNumber, agentId. It is record-only: it shows on the lead's timeline but never sends an SMS or email, places a call, touches an SMS conversation, triggers AI replies or automations, or marks anything unread. It's idempotent on (lead, type, externalId): the first call returns 201 with { "activity": {...}, "created": true }, a repeat returns 200 with the existing activity and "created": false. Calls are attributed to agentId, or to the key's creator if omitted.
Notes
A timeline note attached to a lead. Requires the leads:read/leads:write scope. There is no separate notes scope.
| Method | Path | Description |
|---|---|---|
| GET | /leads/{id}/notes | List a lead's notes |
| POST | /leads/{id}/notes | Add a note (title + body) |
| DELETE | /leads/{id}/notes/{noteId} | Delete a note |
Tasks
{
"id": 5501,
"title": "Send pre-approval checklist",
"description": null,
"dueAt": "2026-06-14T13:00:00Z",
"leadId": 8241,
"assignedAgentId": 512,
"status": "open",
"createdAt": "2026-06-12T15:12:00Z",
"updatedAt": "2026-06-12T15:12:00Z"
}| Method | Path | Description |
|---|---|---|
| GET | /tasks | List tasks |
| POST | /tasks | Create |
| GET | /tasks/{id} | Retrieve |
| PUT | /tasks/{id} | Update (incl. marking complete via status) |
| DELETE | /tasks/{id} | Delete |
Filters on GET /tasks: leadId, status (open or completed), assignedAgentId, dueBefore, dueAfter.
Appointments
Showings and meetings.
{
"id": 3312,
"title": "Showing: 100 King St W #1204",
"startTime": "2026-06-20T17:00:00Z",
"endTime": "2026-06-20T17:30:00Z",
"location": "100 King St W, Toronto",
"description": null,
"type": "showing",
"meetingLink": null,
"leadId": 8241,
"assignedAgentId": 512,
"status": "scheduled",
"createdAt": "2026-06-12T15:12:00Z",
"updatedAt": "2026-06-12T15:12:00Z"
}| Method | Path | Description |
|---|---|---|
| GET | /appointments | List (filters: assignedAgentId, leadId, status, startAfter, startBefore) |
| POST | /appointments | Create (requires title, startTime, endTime, leadId) |
| GET | /appointments/{id} | Retrieve |
| PUT | /appointments/{id} | Update |
| DELETE | /appointments/{id} | Delete |
status is a simplified, computed field: scheduled, completed, cancelled, or no_show, derived from the appointment's internal state and elapsed time. Only scheduled and cancelled can be set directly on write; completed/no_show are read-only.
Known limitation: appointments created or updated via the API are not currently synced to Google Calendar. That sync only happens for appointments booked through the Agent360 UI.
Events: pushing leads in
The fastest way for an external source (website form, portal, ad lead) to get a lead into Agent360. A single POST /events upserts a lead, matched on email address within your account, and logs the activity on their timeline, so you don't have to check-then-create. This is the recommended entry point for lead-gen integrations.
curl -X POST /api/v1/events \
-H "Authorization: Bearer ak_xxxx" \
-H "Content-Type: application/json" \
-d '{
"type": "inquiry",
"source": "buy.ca",
"message": "Interested in 100 King St W #1204",
"person": {
"firstName": "Jane",
"lastName": "Doe",
"emails": [{ "value": "jane@example.com" }],
"phones": [{ "value": "+14165551234" }]
},
"labels": { "add": ["VIP"] },
"customFields": { "approved_amount": "500000" }
}'labels and customFields are optional and apply to the upserted lead the same way as on PUT /leads/{id} — see the Leads section above for their shape.
Users
Your account's team members, for mapping your own users to Agent360 agents (e.g. to set assignedAgentId). Requires the users:read scope. Client portal accounts are not included. Deactivated team members are, since leads can still be assigned to them: check status.
{
"id": 512,
"firstName": "Sam",
"lastName": "Lee",
"email": "sam@example.com",
"role": "AGENT",
"status": "ACTIVE"
}| Method | Path | Description |
|---|---|---|
| GET | /users | List team members (limit/offset pagination) |
Webhooks
Instead of polling, subscribe to events and Agent360 will POST them to your URL in real time. Register an endpoint in the app under Admin → API Docs: pick a URL and the events you want, and you'll get a signing secret shown once (rotatable any time).
| Event type | Fires when |
|---|---|
| lead.created / lead.updated / lead.deleted | A lead is created, changed (fields, status, labels, assigned agents, journey step), or removed |
| lead.consent_changed | A lead's SMS opt-out, email unsubscribe or consent changed, from any source (app, STOP reply, unsubscribe link, API). Payload: { id, consent } |
| activity.created | An SMS or call is recorded on a lead (sent or received in the app, or logged via the API). Payload: the activity |
| note.created | A note is added to a lead |
| note.updated / note.deleted | A note is edited or deleted |
| task.created / task.completed | A task is created or marked complete |
| appointment.scheduled / appointment.updated | An appointment is booked or changed |
Every delivery is a POST with a JSON body and these headers:
Content-Type: application/json
X-Agent360-Event: lead.created
X-Agent360-Signature: sha256=5f9a3...
X-Agent360-Delivery: 8831
X-Agent360-Event-Id: 3f0c6a52-8a0e-4d0b-9a57-0f6f2d7a1c44
X-Agent360-Timestamp: 1781280000
X-Agent360-Signature-V2: t=1781280000,v1=9c1e0...
X-Agent360-Origin: api_key:42| Header | Meaning |
|---|---|
| X-Agent360-Event | Event type |
| X-Agent360-Delivery | Numeric delivery id |
| X-Agent360-Event-Id | Unique id of this event delivery, the same on every retry. Use it to ignore duplicates. |
| X-Agent360-Timestamp | Unix time (seconds) when this attempt was sent |
| X-Agent360-Signature | sha256=HMAC-SHA256(secret, raw body), hex. Kept for existing integrations. |
| X-Agent360-Signature-V2 | t=<timestamp>,v1=HMAC-SHA256(secret, "<timestamp>.<raw body>"), hex. Recommended: also lets you reject old replayed deliveries. |
| X-Agent360-Origin | Who made the change: api_key:<id> (a write through this API, with that key; compare with apiKeyId from GET /me to skip echoes of your own writes), user:<id> (a user in the app), or unknown (nobody's request started it: inbound SMS and calls, schedules, imports, background jobs). |
X-Agent360-Signature is an HMAC-SHA256 hex digest of the raw JSON body, computed with your endpoint's secret. Verify it with a timing-safe comparison before trusting the payload:
const crypto = require("crypto");
function isValidSignature(rawBody, signatureHeader, secret) {
const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(signatureHeader);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Or, preferably, verify the timestamped V2 signature and reject stale deliveries:
const crypto = require("crypto");
function isValidSignatureV2(rawBody, header, secret, toleranceSec = 300) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
const t = Number(parts.t);
if (!Number.isInteger(t) || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = crypto.createHmac("sha256", secret).update(t + "." + rawBody).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Payload versions. By default (payloadVersion: 1) the body is the event's data object itself. Endpoints registered with payloadVersion: 2 receive an envelope with the same data inside:
{
"id": "3f0c6a52-8a0e-4d0b-9a57-0f6f2d7a1c44",
"type": "lead.updated",
"occurredAt": "2026-06-12T14:30:00.000Z",
"orgId": 85,
"origin": { "kind": "api_key", "apiKeyId": 42, "userId": 512 },
"data": { "id": 8241, "firstName": "Jane", "changes": { /* ... */ } }
}id equals the X-Agent360-Event-Id header. origin.kind is api_key, user, or unknown. An endpoint only receives the event types it subscribed to, so existing endpoints never start receiving newly added event types on their own.
How origin is decided. The origin is the request that started the chain of changes: the API key, or the signed-in user in the app. Side effects of that request carry the same origin, including automations it triggers (e.g. adding a label through the API fires a "tag added" automation that reassigns the lead: that lead.updated also has your key as its origin). Changes no request started have unknown.
lead.updated payload. Edits of a lead's fields carry changes as { "firstName": { "from": "Jan", "to": "Jane" } } (unchanged since this event was introduced). Every other change (labels, assigned agents, journey step, merges) sends { id, firstName, lastName, email, phone, status, changes } with changes as a list of names, e.g. ["labels"], ["assignedAgentIds"], ["journeyStep"]. Both include changedFields, always a list of names: use it to handle both forms the same way. Bulk imports (CSV upload, migration) don't send lead.created per lead; use GET /leads?updatedSince= after an import. activity.created can very rarely repeat for the same activity: dedupe on its id.
Managing endpoints through the API. With the webhooks:read / webhooks:write scopes (key created by an Admin or Owner):
| Method | Path | Description |
|---|---|---|
| GET | /webhooks | List this account's endpoints (never includes secrets) |
| POST | /webhooks | Register an endpoint: url (HTTPS, public host), events, optional name and payloadVersion (1 or 2, default 1). Returns the endpoint and its signing secret, shown only once. |
| DELETE | /webhooks/{id} | Delete an endpoint |
curl -X POST /api/v1/webhooks \
-H "Authorization: Bearer ak_xxxx" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/agent360", "events": ["lead.updated", "note.created"], "payloadVersion": 2}'
# 201
# { "webhook": { "id": 7, "url": "...", "events": [...], "isActive": true, "payloadVersion": 2,
# "createdByApiKeyId": 42, ... },
# "secret": "4be1..." }On failure (non-2xx, timeout, or connection error), delivery is retried with exponential backoff. Return a 2xx quickly, process the payload asynchronously on your end rather than blocking the response. Deliveries can occasionally arrive more than once or out of order: dedupe on X-Agent360-Event-Id.
Code examples
Node (fetch): create a lead:
const res = await fetch("/api/v1/leads", {
method: "POST",
headers: {
"Authorization": "Bearer ak_xxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
firstName: "Jane",
lastName: "Doe",
email: "jane@example.com",
phone: "+14165551234",
}),
});
if (!res.ok) throw new Error(`Agent360 ${res.status}`);
const { lead } = await res.json();Python (requests): paginate all leads updated since a date:
import requests
BASE = "/api/v1"
HEADERS = {"Authorization": "Bearer ak_xxxx"}
def all_leads(updated_since):
url = f"{BASE}/leads"
params = {"updatedSince": updated_since, "limit": 100}
while url:
r = requests.get(url, headers=HEADERS, params=params)
r.raise_for_status()
body = r.json()
yield from body["leads"]
url = body["_metadata"]["nextLink"]
params = None