The API is live

Build on Agent360

A documented REST API and signed webhooks, so your website forms, lead portals and tools work with your CRM.

Create a lead
$ curl -X POST /api/v1/leads \

Reference

API reference

Getting started

Available now

The Agent360 API lets external tools read and write leads, notes, and tasks in your account using a per-account API key.

  1. Sign in, open Admin → API Keys and click Create API Key. Only Admins and Owners can create or manage keys.
  2. Choose the permissions the integration needs (see Permissions) and, optionally, an expiration date.
  3. Copy the key immediately: it's shown only once and can't be retrieved later. Store it securely in the integration you're connecting.
  4. Test it: GET /api/v1/me with your key returns your account and key info, including apiKeyId (this key's id) and role (the role the key acts with: its creator's).
Get your API key

Authentication

Available now

Every request must include an Authorization header with a valid API key. All API traffic must use HTTPS.

http
Authorization: Bearer ak_xxxxxxxxxxxxxxxxxxxxxxxx

Keys 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

Available now

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.

ScopeGrants
leads:readRead leads and their notes
leads:writeCreate and update leads, add notes
leads:deleteDelete leads
tasks:readRead tasks
tasks:writeCreate and update tasks
tasks:deleteDelete tasks
appointments:readRead appointments
appointments:writeCreate and update appointments
appointments:deleteDelete appointments
deals:read / deals:write / deals:deleteDeal pipeline access
users:read / users:writeTeam member directory access (users:read: GET /users)
organizations:readRead account/organization details
files:read / files:write / files:deleteFile attachment access
webhooks:readList webhook endpoints (GET /webhooks)
webhooks:writeRegister 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

Available now
Base URL/api/v1
VersioningPath-based (/v1). Breaking changes ship under a new version.
FormatJSON request and response bodies. Send Content-Type: application/json on writes.
Dates2026-06-12T14:30:00Z
IDsInteger. Treat as opaque: don't assume a format or rely on ordering.

Pagination

Available now

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.

json
{
  "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.

json
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

Available now

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.

http
X-RateLimit-Limit: 250
X-RateLimit-Remaining: 248
X-RateLimit-Reset: 7

Idempotency

Available now

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.

bash
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

Available now

Standard HTTP status codes. Error bodies share one shape:

json
{
  "error": {
    "code": "validation_error",
    "message": "Request body failed validation",
    "details": [{ "field": "email", "issue": "email is required" }]
  }
}
StatusCodeMeaning
400bad_requestMalformed request / unparseable JSON
401unauthorizedMissing, invalid, or revoked key
403forbiddenKey valid but lacks permission for this resource
404not_foundResource doesn't exist (or is hidden from this key)
409conflicte.g. an Idempotency-Key reused with a different request body
409idempotency_in_progressA request with the same Idempotency-Key is still running, retry after Retry-After
422validation_errorBody parsed but failed validation
429rate_limitedToo many requests, see Retry-After
500server_errorOur problem, safe to retry later

Leads (Contacts)

Available now

The central entity: represents a lead or client. Externally called Contact to match common CRM API naming; inside Agent360 this is your Lead record.

json
{
  "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"
}
MethodPathDescription
GET/leadsList/search leads
POST/leadsCreate 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}/archiveArchive (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)

Available now

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:

json
{
  "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.

MethodPathDescription
GET/leads/{id}/activitiesA lead's activities (filters: type, since; limit, cursor). Scope leads:read
POST/leads/{id}/activitiesLog an SMS, call or email that already happened (record-only). Scope leads:write
GET/activitiesOrg-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

Available now

A timeline note attached to a lead. Requires the leads:read/leads:write scope. There is no separate notes scope.

MethodPathDescription
GET/leads/{id}/notesList a lead's notes
POST/leads/{id}/notesAdd a note (title + body)
DELETE/leads/{id}/notes/{noteId}Delete a note

Tasks

Available now
json
{
  "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"
}
MethodPathDescription
GET/tasksList tasks
POST/tasksCreate
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

Available now

Showings and meetings.

json
{
  "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"
}
MethodPathDescription
GET/appointmentsList (filters: assignedAgentId, leadId, status, startAfter, startBefore)
POST/appointmentsCreate (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

Available now

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.

bash
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

Available now

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.

json
{
  "id": 512,
  "firstName": "Sam",
  "lastName": "Lee",
  "email": "sam@example.com",
  "role": "AGENT",
  "status": "ACTIVE"
}
MethodPathDescription
GET/usersList team members (limit/offset pagination)

Webhooks

Available now

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 typeFires when
lead.created / lead.updated / lead.deletedA lead is created, changed (fields, status, labels, assigned agents, journey step), or removed
lead.consent_changedA lead's SMS opt-out, email unsubscribe or consent changed, from any source (app, STOP reply, unsubscribe link, API). Payload: { id, consent }
activity.createdAn SMS or call is recorded on a lead (sent or received in the app, or logged via the API). Payload: the activity
note.createdA note is added to a lead
note.updated / note.deletedA note is edited or deleted
task.created / task.completedA task is created or marked complete
appointment.scheduled / appointment.updatedAn appointment is booked or changed

Every delivery is a POST with a JSON body and these headers:

http
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
HeaderMeaning
X-Agent360-EventEvent type
X-Agent360-DeliveryNumeric delivery id
X-Agent360-Event-IdUnique id of this event delivery, the same on every retry. Use it to ignore duplicates.
X-Agent360-TimestampUnix time (seconds) when this attempt was sent
X-Agent360-Signaturesha256=HMAC-SHA256(secret, raw body), hex. Kept for existing integrations.
X-Agent360-Signature-V2t=<timestamp>,v1=HMAC-SHA256(secret, "<timestamp>.<raw body>"), hex. Recommended: also lets you reject old replayed deliveries.
X-Agent360-OriginWho 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:

javascript
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:

javascript
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:

json
{
  "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):

MethodPathDescription
GET/webhooksList this account's endpoints (never includes secrets)
POST/webhooksRegister 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
bash
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

Available now

Node (fetch): create a lead:

javascript
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:

python
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
Need help connecting an integration? Email hello@agent360.io.
Ready to get started?Sign up in 2 minutes · No credit card required
API Docs | Agent360 CRM