Ukigai

Access by invitation

Developers

Public API (v1)

Read and write your organization's CRM data — accounts, leads, opportunities, and tasks — from an external system, and follow what changes through the activity feed and webhooks. Generate an API key from CRM → Settings → API access inside your Ukigai organization, then follow the flow below.

All examples below use https://app.ukigai.com — replace it with your own Ukigai URL.

Scope

This page covers the CRM API: Accounts, Leads, Opportunities, Tasks, owner lookup, research notes, email sequences, the CRM's reference data, the activity feed and webhooks. Tickets have their own API and key — see the Ticketing API; the activity feed and webhooks serve both.

Authentication

Getting access is a two-step exchange:

  1. An organization admin generates an API key from CRM → Settings → API access. The raw key (uak_...) is shown exactly once — store it somewhere safe.
  2. Your integration exchanges that key for a short-lived access token (uat_...), valid for 1 hour, and sends the access token — not the API key — on every other request.

There is no refresh-token flow. When a token expires, call the token endpoint again with your API key to get a new one.

POST /api/public/v1/auth/token

curl -X POST https://app.ukigai.com/api/public/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{"api_key": "uak_your_api_key_here"}'
{
  "access_token": "uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "token_type": "Bearer",
  "expires_in": 3600,
  "request_id": "b3f2..."
}

Every other endpoint requires this token:

Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Your organization is always resolved from this token — there is no organization id to pass in the URL or body.

Requests & responses

  • Every response — success or error — includes a request_id in the JSON body and as an X-Request-Id header. Send your own X-Request-Id header on a request and it's echoed back, so you can correlate a call across your own logs and ours if you need support.
  • A create endpoint returns the canonical resource. POST responses also include created: true (a new record was made) or created: false (an idempotent replay or an existing external-identity match was returned instead — see below).

Lists, filtering & pagination

Every CRM list (/crm/accounts, /crm/leads, /crm/opportunities, /crm/activity) works the same way:

  • No filter is required. With none, you get every record, oldest first.
  • Stable order: created_at ascending, then id. Records never move between pages, so walking the cursor never skips or repeats a record, even while records are being edited.
  • Pagination: limit (default 50, max 200) and cursor. Pass the next_cursor of one page as cursor to get the next; null means you have reached the end. Treat the cursor as opaque.
  • Filters combine with AND. A filter we can't use — an unknown status, a malformed id or date — is a 400 INVALID_FILTER naming the parameter, never silently ignored.
  • Dates: created_after, created_before and updated_after take ISO 8601 (2026-01-31T00:00:00Z, or a bare 2026-01-31, which means midnight UTC). after/before are exclusive. URL-encode an offset (%2B02:00); an unencoded + is tolerated.
  • Owner: owner_id matches an employee or a business-partner owner (see GET /crm/owners).
  • Archived records are included; filter with archived=false (or true).

For an incremental sync, store the time you started a sync and next time ask for updated_after=<that time>.

Search (q)

q is a tolerant search, available on all three lists:

  • case- and accent-insensitive — gonzalez finds González, PEREZ finds Pérez;
  • partial — const finds Constructora;
  • word by word — every word must appear, in any order, so a last name alone works (q=gonzalez finds María José González), and q=maria gonzalez narrows it.

It searches an account's or opportunity's name, and a lead's first name, last name and email. q needs at least 2 characters.

curl "https://app.ukigai.com/api/public/v1/crm/leads?q=gonzalez&status=working&limit=100" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Durable external identity & idempotent create

If you're importing or syncing records from another system, two things matter more than they might on a first pass: retrying a create that timed out shouldn't produce a duplicate, and re-running an import against the same external record shouldn't silently overwrite data someone in the CRM has since edited by hand. Accounts and leads support both.

external_source / external_id (optional, on account/lead create): external_source names your integration (e.g. sodtrack_research); external_id is any opaque id you assign (e.g. domain:example.com, person:98213). Provide both or neither. They're unique per organization — creating with an external_source/external_id pair that already exists:

  • matches the account/lead you have on record if every field you sent this time agrees with what's currently stored → returns that record, 200, created: false.
  • conflicts if any field you sent disagrees with what's currently stored (e.g. you send a different name for the same external_id) → 409 EXTERNAL_ID_CONFLICT. Nothing is overwritten. Fields you don't send are never part of this check — reassigning the owner in the CRM UI, for instance, never trips a conflict on a later re-import.

Idempotency-Key header (optional, on account/lead create): a client- generated key (a UUID is fine) unique to one logical create attempt. A retried request with the same key and the same body replays the original result instead of creating a second record; the same key reused with a different body is a client bug and returns 409 IDEMPOTENCY_KEY_CONFLICT. Only successful creates are remembered under a key — if a request fails, fix it and retry with the same key.

POST /api/public/v1/crm/accounts
Idempotency-Key: 8b297cf0-1234-4a3b-9abc-1234567890ab
Content-Type: application/json

{
  "external_source": "sodtrack_research",
  "external_id": "domain:example.com",
  "name": "Example"
}

Accounts

POST /api/public/v1/crm/accounts

Requires scope crm:write.

curl -X POST https://app.ukigai.com/api/public/v1/crm/accounts \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8b297cf0-1234-4a3b-9abc-1234567890ab" \
  -d '{
    "external_source": "sodtrack_research",
    "external_id": "domain:example.com",
    "name": "Acme Corp",
    "industry": "Manufacturing",
    "website": "https://acme.example.com",
    "phone": "+1 555 0100"
  }'
FieldTypeRequired
namestringyes
industrystringno
websitestringno
phonestringno
billing_addressobjectno
status"active" | "inactive"no (default active)
owner_employee_idstring (uuid)no
external_sourcestring (slug, e.g. sodtrack_research)no — both or neither with external_id
external_idstringno — both or neither with external_source

Returns 201 (new) or 200 (idempotent replay / existing external-identity match, created: false) with the account. 409 on a conflict (see above).

The response also carries likely_duplicates: existing accounts that look like the same company (see Duplicate detection below). Creating is never blocked by a look-alike — you decide what to do with it.

GET /api/public/v1/crm/accounts/:id

Requires scope crm:read.

curl https://app.ukigai.com/api/public/v1/crm/accounts/ACCOUNT_ID \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

GET /api/public/v1/crm/accounts

Requires scope crm:read. Lists accounts — every one, or filtered. See Lists, filtering & pagination above.

FilterMatches
qtolerant name search (see Search above)
statusactive | inactive
customer_statusprospect | customer | former_customer
owner_idowned by this employee or business partner
created_after, created_before, updated_afterISO 8601
archivedtrue | false
idexact account id
external_sourceaccounts your integration created; add external_id for one
domainthe account's email domains (e.g. example.com)
namecase-insensitive exact name match
cursor, limitpagination (limit default 50, max 200)

Accounts have no source; source= here is a 400.

curl "https://app.ukigai.com/api/public/v1/crm/accounts?external_source=sodtrack_research&external_id=domain%3Aexample.com" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
{
  "data": [ { "id": "...", "name": "Acme Corp", "...": "..." } ],
  "next_cursor": null,
  "request_id": "b3f2..."
}

Pass next_cursor back as cursor to fetch the following page; null means there are no more results.

POST /api/public/v1/crm/accounts/upsert

Requires scope crm:write. Updates the account on a domain, or creates it — one call, no duplicate. Accepts an Idempotency-Key header.

curl -X POST https://app.ukigai.com/api/public/v1/crm/accounts/upsert \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 4f1c…" \
  -d '{ "domain": "acme.com", "name": "Acme Corp", "industry": "Manufacturing" }'
  • The key is domain, or — if you leave it out — the host of website. An account matches when the domain is in its email_domains or is its website's host (www. and paths ignored; acme.com.br is not acme.com). Archived accounts match too.
  • Found → the fields you sent are updated (PATCH semantics: omitted fields stay, null clears). 200, created: false, result: "updated". external_source, external_id and identification_number are set only on create; on update they are left as stored and listed in ignored_fields.
  • Not found → created (name required), with the domain stored in email_domains so the next upsert finds it. 201, created: true, result: "created", plus likely_duplicates (same company under another name or domain).
  • email_domains, if you send it, must include the domain — otherwise the next upsert couldn't find this account (400 DOMAIN_NOT_IN_EMAIL_DOMAINS).

Fields: domain, plus the account fields of POST /crm/accounts and customer_status, priority, headquarters_country, operation_countries, email_domains, owner_business_partner_id. Anything else is 400 FIELD_NOT_ALLOWED.

StatusCodeWhen
409AMBIGUOUS_MATCHMore than one account is on the domain. details.matches lists them; update the right one by id. Nothing is changed.
409UPSERT_IN_PROGRESSAnother upsert for the same domain is running. Retry after Retry-After (1 s).
409IDEMPOTENCY_KEY_CONFLICTThe key was used with a different body.
400MISSING_DOMAIN, INVALID_DOMAINNo usable domain or website.

Never a duplicate: concurrent upserts of the same domain are serialized — one creates, the other gets UPSERT_IN_PROGRESS and, on retry, updates. An idempotent replay returns 200 with the original result and replayed: true.

GET /api/public/v1/crm/accounts/duplicates

Requires scope crm:read. Accounts that look like the one you describe — check before creating, or audit an existing account.

Parameter
namethe company name
domain or websiteits domain (a website's host is used)
exclude_idan account to leave out (the one you're checking)

At least name or a domain. Returns up to 10, most likely first:

{
  "data": [
    {
      "account": { "id": "…", "name": "Constructora Pérez S.A.", "…": "…" },
      "match_reasons": ["same_name"],
      "similarity": 0.82
    }
  ],
  "request_id": "b3f2..."
}

Duplicate detection

Ukigai flags records that are likely the same, without blocking you:

ReasonMeans
same_domainThe accounts share an email domain or website host.
same_nameThe account names are equal once case, accents, punctuation and legal suffixes (S.A., Ltda., Inc., GmbH…) are ignored: "Constructora Pérez S.A." = "constructora perez".
similar_nameThe names are very close (similarity ≥ 0.6) — typos and spelling variants: "Construtora Peres".
same_emailThe leads share an email, primary or alternate (case-insensitive).
same_name_and_accountSame first + last name (case- and accent-insensitive) on the same account.

You get them from GET /crm/accounts/duplicates and GET /crm/leads/duplicates, and as likely_duplicates on account/lead create and on upserts that create. (A second lead with an email already in use is not a likely duplicate — it is refused with 409 LEAD_EMAIL_CONFLICT.)

Leads

The lead object

Every lead endpoint — create, get, list, update — returns the same shape:

{
  "id": "...",
  "account_id": "...",
  "first_name": "Jane",
  "last_name": "Doe",
  "email": "jane@acme.example.com",
  "alternate_emails": ["j.doe@acme.example.com"],
  "phone": "+56 9 1234 5678",
  "job_title": "VP Sales",
  "lead_role": "economic_buyer",
  "department": "Sales",
  "linkedin_url": "https://www.linkedin.com/in/jane-doe",
  "country": "CL",
  "preferred_locale": "es",
  "source": "referral",
  "source_notes": "Introduced by Acme's CTO at SaaSConf",
  "status": "working",
  "owner_employee_id": "...",
  "external_source": "sodtrack_research",
  "external_id": "person:98213",
  "created_at": "2026-01-01T00:00:00Z",
  "updated_at": "2026-01-02T00:00:00Z"
}

A field the lead doesn't have is null rather than absent, except alternate_emails, which is [].

The CRM also stores a national identification number on a lead. It is not part of this shape and is never returned by the API, so a crm:read token can't be used to pull identity documents out of the CRM.

FieldTypeNotes
emailstringThe primary address. Must be unique across the leads in your organization, counting alternates.
alternate_emailsarray of stringAliases for the same person. Lowercased, trimmed and de-duplicated on write; an entry equal to email is dropped. Inbound and outbound email matching uses these as well as email.
lead_rolestringThe person's role in the buying decision — see Reference data below. Free text is accepted for roles outside that set.
departmentstringFree text.
linkedin_urlstringStored as given. Search normalizes it — see the list filters below.
countrystringISO 3166-1 alpha-2, uppercased (CL, US). Anything else is stored as null.
preferred_localeen | es | ptThe language marketing campaigns write to this person in. null means no preference, so the campaign default is used. Anything else is stored as null.
sourcestringHow the lead reached you — see Reference data below. An unknown value is a 400.
source_notesstringFree text for referral or campaign provenance ("who referred them", "which booth").
statusnew | working | qualified | disqualifiedAn unknown value is a 400.

POST /api/public/v1/crm/leads

Requires scope crm:write. A lead always belongs to an existing account. Supports the same external_source/external_id/Idempotency-Key behavior as accounts, compared against account_id, first_name, last_name, email, phone, job_title, source, status.

curl -X POST https://app.ukigai.com/api/public/v1/crm/leads \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "ACCOUNT_ID",
    "external_source": "sodtrack_research",
    "external_id": "person:98213",
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@acme.example.com",
    "alternate_emails": ["j.doe@acme.example.com"],
    "job_title": "VP Sales",
    "lead_role": "economic_buyer",
    "linkedin_url": "https://www.linkedin.com/in/jane-doe",
    "country": "CL",
    "preferred_locale": "es",
    "source": "referral",
    "source_notes": "Introduced by their CTO at SaaSConf"
  }'
FieldTypeRequired
account_idstring (uuid)yes
first_namestringyes
last_namestringyes
emailstringno
alternate_emailsarray of stringno
phonestringno
job_titlestringno
lead_rolestringno
departmentstringno
linkedin_urlstringno
countrystring (ISO alpha-2)no
preferred_locale"en" | "es" | "pt"no
sourcestringno
source_notesstringno
status"new" | "working" | "qualified" | "disqualified"no (default new)
owner_employee_idstring (uuid)no
external_source / external_idsee Accountsno

Returns 201 (new) or 200 (replay/existing match, created: false) with the lead. 409 on a conflict, including LEAD_EMAIL_CONFLICT when any of the addresses you sent already belongs to another lead in your organization.

PATCH /api/public/v1/crm/leads/:id

Requires scope crm:write. A partial update: a field you omit is left alone, and an explicit null clears it. Moving a lead to a different account is an ordinary account_id update.

curl -X PATCH https://app.ukigai.com/api/public/v1/crm/leads/LEAD_ID \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "qualified",
    "lead_role": "champion",
    "alternate_emails": ["j.doe@acme.example.com", "jane.doe@acme.example.com"],
    "source_notes": null
  }'

Updatable: account_id, first_name, last_name, email, alternate_emails, phone, job_title, lead_role, department, linkedin_url, country, preferred_locale, source, source_notes, status, owner_employee_id, owner_business_partner_id.

Any other field in the body is a 400 FIELD_NOT_UPDATABLE listing what it rejected, rather than a silent no-op — including external_source and external_id, which are fixed at create time so the mapping you reconcile against can't move under you.

Note that alternate_emails replaces the list rather than appending to it; send the full set you want the lead to end up with.

Returns 200 with the lead. 404 LEAD_NOT_FOUND if it isn't yours, 409 LEAD_EMAIL_CONFLICT if an address now collides with another lead, 400 EMPTY_PATCH if the body has no updatable field at all.

GET /api/public/v1/crm/leads/:id

Requires scope crm:read.

GET /api/public/v1/crm/leads

Requires scope crm:read. Lists leads — every one, or filtered. See Lists, filtering & pagination above.

FilterMatches
qtolerant search on first name, last name and email — q=gonzalez finds "María González" (see Search above)
statusnew | working | qualified | disqualified
sourcecase-insensitive exact (see lead_sources in /crm/metadata)
owner_idowned by this employee or business partner
account_idleads on that account
created_after, created_before, updated_afterISO 8601
archivedtrue | false
idexact lead id
external_sourceleads your integration created; add external_id for one
emailnormalized exact match against the lead's primary or alternate email
linkedin_urlthe same LinkedIn profile, matched on the /in/<slug> segment
first_namecase-insensitive exact match
last_namecase-insensitive exact match
cursor, limitpagination (limit default 50, max 200)

email, linkedin_url and the name filters are there for duplicate prevention: check before you create, rather than finding out from a 409.

linkedin_url compares profile slugs, so every way the URL might have been saved — with or without https://, www., a locale subdomain, a trailing slash, or tracking parameters — finds the same person, while jane-doe and jane-doe-2 stay distinct. It must be a profile URL (linkedin.com/in/<slug>); a company page or a bare name is a 400 INVALID_FILTER.

curl "https://app.ukigai.com/api/public/v1/crm/leads?linkedin_url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fjane-doe" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

POST /api/public/v1/crm/leads/upsert

Requires scope crm:write. Updates the lead with this email, or creates it. Accepts an Idempotency-Key header.

curl -X POST https://app.ukigai.com/api/public/v1/crm/leads/upsert \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@acme.com",
    "account_id": "ACCOUNT_ID",
    "first_name": "Jane",
    "last_name": "Doe",
    "job_title": "CTO"
  }'
  • The key is email (required), matched case-insensitively against every lead's primary and alternate addresses.
  • Found → the fields you sent are updated (omitted fields stay, null clears; the lead's primary email is not rewritten when it was found through an alternate). 200, created: false, result: "updated", and ignored_fields for create-only fields (external_source, external_id, identification_number).
  • Not found → created; then account_id, first_name and last_name are required, as on POST /crm/leads. 201, created: true, result: "created", plus likely_duplicates (same name on the same account).

Fields: the lead fields of POST /crm/leads. Anything else is 400 FIELD_NOT_ALLOWED. Errors as for the account upsert — AMBIGUOUS_MATCH (two leads already share the email), UPSERT_IN_PROGRESS, IDEMPOTENCY_KEY_CONFLICT — plus MISSING_EMAIL and INVALID_EMAIL. Concurrent upserts of one email never create two leads.

GET /api/public/v1/crm/leads/duplicates

Requires scope crm:read. Leads that look like the person you describe.

Parameter
emailmatched against primary and alternate emails
first_name + last_name + account_idsame name, case- and accent-insensitive, on that account
exclude_ida lead to leave out

Send the email, the full name with the account, or both. Each result is { "lead": {…}, "match_reasons": ["same_email" | "same_name_and_account"] }.

POST /crm/leads also returns likely_duplicates (same name on the same account).

Sequences

An AI-planned email cadence on a lead. Every step after the first goes through the same hold-window review the CRM UI already uses (visible and editable for a window before it auto-sends) — starting a sequence is the only fully autonomous part.

POST /api/public/v1/crm/leads/:leadId/sequences

Requires scope crm:write. Can take a while (AI research + generation, and possibly a real send) — allow up to 5 minutes.

If the lead already has a prior outbound email, the cadence threads onto it — nothing is sent by this call.

If it doesn't, this sends the opening email itself, through the lead's current owner's connected Gmail, before planning the cadence:

  • The owner must have Gmail connected with send permission, or this fails with a clear error (OPENING_SEND_FAILED) and nothing is created.
  • The lead's email is checked first with a syntax + MX-record lookup (not a bounce guarantee — see the Lead page's "Validate" action for the same check). A bad address returns 422 LEAD_EMAIL_INVALID and nothing is sent.
  • Pass subject + bodyText to send that verbatim, or omit both to have the AI draft the opening email from approachContext.
curl -X POST https://app.ukigai.com/api/public/v1/crm/leads/LEAD_ID/sequences \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "approachContext": "Reach out about their multi-country installation workforce and offer a scoping call."
  }'
FieldTypeRequired
approachContextstring (max 4000 chars)yes
objectivestring (max 500 chars)no
subjectstring (max 300 chars)no — both or neither with bodyText; only used when there's no prior email
bodyTextstring (max 8000 chars)no — both or neither with subject
holdWindowHoursintegerno (org default)
maxStepsintegerno (org default)

Returns 201 with the sequence (id, status, steps) plus sent_opening_email (true if this call sent it) and research_stale. 409 SEQUENCE_ALREADY_ACTIVE if the lead already has a draft/active/paused sequence — stop it in the CRM UI before starting another.

GET /api/public/v1/crm/leads/:leadId/sequences

Requires scope crm:read. Lists sequences on a lead, newest first — poll this after creating one to watch generation finish and steps get planned.

GET /api/public/v1/crm/leads/:leadId/sequences/:sequenceId

Requires scope crm:read.

Owners

GET /api/public/v1/crm/owners

Requires scope crm:read. Lists who's a valid owner_employee_id / owner_business_partner_id for account/lead create — active employees and business partners with CRM access, by default.

curl "https://app.ukigai.com/api/public/v1/crm/owners?status=active" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
{
  "data": [
    {
      "kind": "employee",
      "id": "...",
      "display_name": "Jane Smith",
      "email": "jane@yourcompany.com",
      "active": true,
      "crm_eligible": true
    }
  ],
  "request_id": "b3f2..."
}

status is active (default) or all. An employee id maps to owner_employee_id; a partner id maps to owner_business_partner_id.

Research notes

POST /api/public/v1/crm/notes

Requires scope crm:write. Attaches a note with cited evidence to an account or lead — it shows up immediately in that record's normal CRM timeline. Source URLs are stored as given and are never fetched by Ukigai.

curl -X POST https://app.ukigai.com/api/public/v1/crm/notes \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "subject_type": "account",
    "subject_id": "ACCOUNT_ID",
    "body": "Operates a multi-country installation workforce...",
    "source_urls": ["https://example.com/operations"]
  }'
FieldTypeRequired
subject_type"account" | "lead"yes
subject_idstring (uuid)yes
bodystring (max 20,000 chars)yes
titlestring (max 200 chars)no (default "Research note")
source_urlsarray of http(s) URLs (max 20)no

Returns 201 with the created note.

Opportunities

POST /api/public/v1/crm/opportunities

Requires scope crm:write. An opportunity belongs to an account and must link to at least one lead on that same account. (Opportunities don't yet support external identity or idempotent create — that's accounts and leads only, for now.)

curl -X POST https://app.ukigai.com/api/public/v1/crm/opportunities \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "ACCOUNT_ID",
    "lead_id": "LEAD_ID",
    "name": "Acme — annual contract",
    "amount": 24000,
    "currency": "USD",
    "stage": "prospecting"
  }'
FieldTypeRequired
account_idstring (uuid)yes
lead_ids (or lead_id)array of string / stringyes — at least one
namestringyes
amountnumberno
currencystring (ISO code)no (default USD)
stageprospecting | qualification | proposal | negotiation | closed_won | closed_lostno (default prospecting)
close_datestring (YYYY-MM-DD)no
probabilitynumber (0–100)no
owner_employee_idstring (uuid)no

Returns 201 with the created opportunity.

GET /api/public/v1/crm/opportunities/:id

Requires scope crm:read.

GET /api/public/v1/crm/opportunities

Requires scope crm:read. Lists and searches opportunities. See Lists, filtering & pagination above.

FilterMatches
name or qtolerant name search — renovacion finds "Renovación anual"
account_idopportunities of that account
stageprospecting | qualification | pilot | proposal | negotiation | closed_won | closed_lost
statusopen | won | lost
owner_idowned by this employee or business partner
lead_idopportunities linked to that lead
close_date_from, close_date_toYYYY-MM-DD, inclusive
created_after, created_before, updated_afterISO 8601
archivedtrue | false
idexact opportunity id
cursor, limitpagination (limit default 50, max 200)
# Open deals of one owner closing this quarter
curl "https://app.ukigai.com/api/public/v1/crm/opportunities?owner_id=EMPLOYEE_ID&status=open&close_date_from=2026-10-01&close_date_to=2026-12-31" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Opportunities have no source; source= here is a 400.

Tasks

Follow-ups on a lead, an opportunity or an account — a call to make, an email to write, a meeting to hold. A task you create here is the same task a person creates in Ukigai: it shows on the lead's, opportunity's or account's page and in its owner's My Tasks, and the owner gets the usual reminder on the day it's due.

Nothing is ever sent to the lead or anyone outside your organization. A task of type email is a reminder to write one, not an email. The only notification is Ukigai's own due-date reminder to the owner (email and Slack, employees only).

The task object

{
  "id": "6bce4082-ad5e-4f70-9b92-bd2e3f405162",
  "title": "Send the revised proposal",
  "description": "They asked for the 3-year option.",
  "due_date": "2026-12-01T18:00:00.000Z",
  "status": "open",
  "priority": "high",
  "type": "follow_up",
  "owner_employee_id": "EMPLOYEE_ID",
  "owner_business_partner_id": null,
  "lead_id": "LEAD_ID",
  "account_id": "ACCOUNT_ID",
  "opportunity_id": "OPPORTUNITY_ID",
  "completed_at": null,
  "created_by": { "type": "api_key", "id": "API_KEY_ID", "source": "public_api" },
  "external_source": "sales_agent",
  "external_id": "followup:98213",
  "created_at": "2026-11-27T14:03:11.204Z",
  "updated_at": "2026-11-27T14:03:11.204Z",
  "request_id": "b3f2..."
}
Field
titlerequired, up to 300 characters
descriptionfree text, or null
due_dateISO 8601 with a time zone — 2026-12-01T15:00:00-03:00 or …Z. A bare date (2026-12-01) means any time that day. Returned in UTC.
statusopen | in_progress | done | canceled (default open)
prioritylow | normal | high (default normal)
typecall | email | meeting | follow_up | other — and the app's own whatsapp, reminder, demo, internal (default other)
owner_employee_id / owner_business_partner_idwho works the task — one or the other (see GET /crm/owners). Omitted on create, the task goes to the owner of the record it's about.
lead_id, account_id, opportunity_idwhat the task is about — at least one is required (see below)
completed_atread-only: set when the status becomes done or canceled, cleared when it goes back to open or in_progress
created_byread-only: api_key (your key's id) for tasks made through the API, user for tasks made in the app
external_source + external_idyour own id for the task; set on create only

What a task is about. In Ukigai a task belongs to one record, and its account follows from it:

  • lead_id → on the lead; account_id is the lead's account. Add opportunity_id to tie it to one of the lead's opportunities (the lead must be linked to it).
  • opportunity_id alone → on the opportunity; account_id is its account.
  • account_id alone → on the account.

An account_id sent with a lead or opportunity must be that record's account (400 SUBJECT_MISMATCH). An id that isn't in your organization is 400 INVALID_SUBJECT.

POST /api/public/v1/crm/tasks

Requires scope crm:write. Accepts an Idempotency-Key header.

curl -X POST https://app.ukigai.com/api/public/v1/crm/tasks \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 5b1d…" \
  -d '{
    "title": "Send the revised proposal",
    "description": "They asked for the 3-year option.",
    "lead_id": "LEAD_ID",
    "opportunity_id": "OPPORTUNITY_ID",
    "due_date": "2026-12-01T15:00:00-03:00",
    "priority": "high",
    "type": "follow_up",
    "external_source": "sales_agent",
    "external_id": "followup:98213"
  }'

Returns 201 with the task and created: true. Safe retries work as for accounts and leads: the same external_source/external_id again returns the existing task (200, created: false) when title, description and type match it, or 409 EXTERNAL_ID_CONFLICT when they don't; an Idempotency-Key replays the first result.

GET /api/public/v1/crm/tasks

Requires scope crm:read. Every task — made in the app or through the API — oldest first, limit default 50 (max 200), cursor as on every list.

FilterMatches
lead_idtasks on that lead
account_idtasks on the account and on its leads and opportunities
opportunity_idtasks on the opportunity, and lead tasks tied to it
owner_employee_idowned by that employee (owner_id matches an employee or a business partner)
statusone status, or several comma-separated: status=open,in_progress
priority, typeexact
due_before, due_afterISO 8601; tasks without a due date never match
created_after, updated_afterISO 8601
external_source (+ external_id)your own ids
# One owner's open follow-ups due this week
curl "https://app.ukigai.com/api/public/v1/crm/tasks?owner_employee_id=EMPLOYEE_ID&status=open,in_progress&due_before=2026-12-07T00:00:00-03:00" \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
{
  "data": [ { "id": "…", "title": "Send the revised proposal", "status": "open", "…": "…" } ],
  "next_cursor": null,
  "request_id": "b3f2..."
}

GET /api/public/v1/crm/tasks/:id

Requires scope crm:read. One task. An id that is a note or an email, or not in your organization, is 404 TASK_NOT_FOUND.

PATCH /api/public/v1/crm/tasks/:id

Requires scope crm:write. Send only what changes; null clears a field. Returns the updated task.

# Mark it done
curl -X PATCH https://app.ukigai.com/api/public/v1/crm/tasks/TASK_ID \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "status": "done" }'
{
  "id": "TASK_ID",
  "title": "Send the revised proposal",
  "status": "done",
  "completed_at": "2026-11-28T13:20:44.019Z",
  "…": "…",
  "request_id": "b3f2..."
}
  • status moves completed_at with it. A person ticking the task off in the app shows up here as done; reopening it, as open.
  • Sending any of lead_id, account_id, opportunity_id moves the task: the ones you send are its whole new subject.
  • external_source/external_id can't be changed (400 FIELD_NOT_UPDATABLE).

DELETE /api/public/v1/crm/tasks/:id

Requires scope crm:write. Removes the task for good, with any files attached to it in the app, and returns it as it was, with deleted: true. To take a task off everyone's list but keep the record, PATCH it to "status": "canceled" instead.

Errors

StatusCode
400VALIDATION_ERRORa field has the wrong value (the message names it), e.g. a due_date without a time zone
400FIELD_NOT_ALLOWED / FIELD_NOT_UPDATABLEan unknown field on create / a field PATCH won't change; details.fields lists them
400MISSING_SUBJECT, INVALID_SUBJECT, SUBJECT_MISMATCHsee "What a task is about"
400INVALID_OWNERnot an employee of your organization or a partner with CRM access
400EMPTY_PATCHnothing to change
404TASK_NOT_FOUND
409EXTERNAL_ID_CONFLICT, IDEMPOTENCY_KEY_CONFLICTas for accounts and leads

Reference data

GET /api/public/v1/crm/metadata

Requires scope crm:read. The value sets the CRM accepts, so you can validate before sending (or build a picker) without hard-coding a copy that goes stale when we add a source or a role.

{
  "lead_statuses": ["new", "working", "qualified", "disqualified"],
  "lead_sources": ["referral", "inbound", "outbound", "event", "partner", "marketing", "social_media", "other"],
  "lead_roles": ["decision_maker", "economic_buyer", "champion", "influencer", "gatekeeper", "technical_evaluator", "end_user", "procurement", "legal_compliance"],
  "preferred_locales": ["en", "es", "pt"],
  "countries": [{ "code": "CL", "name": "Chile" }],
  "request_id": "b3f2..."
}

lead_roles is the canonical set, but lead_role also accepts free text for a role outside it — that's what the CRM's own "Other (specify)" writes. Every other list is enforced on write: an unknown source or status is a 400, while an unknown preferred_locale or country is stored as null.

These lists are the same for every organization; the labels your users see in the CRM UI are localized from these ids.

Activity feed

GET /api/public/v1/crm/activity

Requires scope crm:read or ticketing:read — each token sees the events its scopes cover: CRM events with crm:read, ticket events with ticketing:read (a Ticketing API key reads its ticket events here too).

What changed, oldest first:

typeWhen
account.created, lead.created, opportunity.createdA record was created — in the app, through the API, or by an import or sync.
account.updated, lead.updated, opportunity.updatedFields changed. changes.fields lists which.
account.status_changed, lead.status_changedchanges: { "field": "status", "from": "new", "to": "working" }.
opportunity.stage_changedchanges: { "field": "stage", "from": …, "to": … }.
note.addedA note on a lead, opportunity or account. data: subject_type, subject_id, title.
sequence.reply_receivedThe lead answered an AI email sequence. data.lead_id.
ticket.created, ticket.updated, ticket.status_changedTicket events (ticketing:read).
ticket.message_addedA reply or internal note on a ticket. data: message_id, internal.

A status or stage change also produces the .updated event.

Parameter
sinceISO 8601. Where to start. Required on the first call.
cursorThe next_cursor of your previous call. Takes precedence over since.
entity_typeaccount | lead | opportunity | note | sequence | ticket
typeone event type
limitdefault 50, max 200
{
  "data": [
    {
      "id": "6a1e…",
      "type": "lead.status_changed",
      "action": "status_changed",
      "entity_type": "lead",
      "entity_id": "LEAD_ID",
      "actor": { "type": "api_key", "id": "API_KEY_ID" },
      "changes": { "field": "status", "from": "new", "to": "working" },
      "data": {},
      "occurred_at": "2026-11-27T14:03:11.204Z"
    }
  ],
  "next_cursor": "eyJzIjo0MTJ9",
  "has_more": false,
  "request_id": "b3f2..."
}
  • Polling: next_cursor is always returned. Store it, and next time call with cursor=<it> to get exactly what happened since — no gaps, no repeats. Call again at once while has_more is true.
  • Actor: api_key (the key's id), user (a Ukigai user's id), or unknown (background jobs, and some in-app changes that don't record who made them).
  • Events say which fields changed, never their values — read the record for those. An event about a record you then can't find means it was deleted.
  • Events appear about 5 seconds after the change and are kept for 90 days.

Webhooks

Instead of polling, have the events pushed to you. A webhook subscription belongs to the API key that created it: only that key can see or delete it, and revoking the key stops it.

Requires scope crm:read or ticketing:read; you can subscribe to the events your scopes cover — the event types of the activity feed above.

POST /api/public/v1/webhooks

curl -X POST https://app.ukigai.com/api/public/v1/webhooks \
  -H "Authorization: Bearer uat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/ukigai/webhooks",
    "events": ["lead.created", "lead.updated", "opportunity.stage_changed", "sequence.reply_received"],
    "description": "Sync to our warehouse"
  }'
{
  "id": "SUBSCRIPTION_ID",
  "url": "https://example.com/ukigai/webhooks",
  "events": ["lead.created", "lead.updated", "opportunity.stage_changed", "sequence.reply_received"],
  "description": "Sync to our warehouse",
  "status": "active",
  "secret": "whsec_…",
  "…": "…"
}

secret is shown only here. Store it to verify signatures. The URL must be https and reach a public address. At most 10 webhooks per key. Errors: 400 INVALID_URL, 400 INVALID_EVENTS, 403 INSUFFICIENT_SCOPE (e.g. ticket events with a CRM key), 409 WEBHOOK_LIMIT_REACHED.

GET /api/public/v1/webhooks, GET /api/public/v1/webhooks/:id

Your key's subscriptions, with their health: status (active/disabled), disabled_reason, consecutive_failures, last_delivery_at, last_failure_at, last_error.

PATCH /api/public/v1/webhooks/:id

Change url, events or description, or set "status": "active" to re-enable a disabled subscription (or "disabled" to pause it).

DELETE /api/public/v1/webhooks/:id

Stops the subscription at once; queued deliveries are dropped. Returns { "id": "…", "deleted": true }.

What you receive

One POST per event, Content-Type: application/json:

{
  "id": "DELIVERY_ID",
  "type": "lead.updated",
  "created_at": "2026-11-27T14:03:11.204Z",
  "data": { "id": "…", "type": "lead.updated", "entity_type": "lead", "entity_id": "…", "actor": {…}, "changes": { "fields": ["job_title"] }, "data": {}, "occurred_at": "…" }
}

data is the event exactly as the activity feed returns it. Headers:

Header
Ukigai-Signaturet=<unix seconds>,v1=<hex HMAC-SHA256>
Ukigai-Webhook-Idthe delivery id — the same on every retry; dedupe on it
Ukigai-Event-Id, Ukigai-Event-Typethe event

Verify every delivery before trusting it: compute HMAC-SHA256 of <t>.<raw request body> with your secret, compare it to v1 in constant time, and reject a t more than 5 minutes old.

import crypto from 'node:crypto'

function verifyUkigaiWebhook(rawBody, signatureHeader, secret) {
  const parts = Object.fromEntries(signatureHeader.split(',').map((p) => p.split('=')))
  const t = Number(parts.t)
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false
  const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex')
  const given = Buffer.from(parts.v1 ?? '', 'hex')
  return given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'))
}

Use the raw body: re-serialized JSON won't match.

Delivery and retries. Answer with any 2xx within 10 seconds — do the work afterwards. Anything else (another status, a timeout, a redirect — redirects are not followed) is retried after about 1 min, 5 min, 30 min, 2 h, 6 h and 12 h (7 attempts over ~21 hours), then given up. After 20 events in a row have been given up, the subscription is disabled; fix the endpoint and PATCH it back to active. Deliveries can arrive more than once and out of order: dedupe on Ukigai-Webhook-Id, and order by the event's occurred_at. To recover anything missed, read the activity feed.

Errors

Errors are a JSON object with error (human-readable), code (stable, machine-readable), and request_id:

{ "error": "Invalid or expired token", "code": "INVALID_TOKEN", "request_id": "b3f2..." }

Common status codes: 400 invalid input, 401 missing/invalid/expired token, 403 insufficient scope or the CRM module is disabled for your organization, 404 the resource doesn't exist (or doesn't belong to your organization), 409 EXTERNAL_ID_CONFLICT, IDEMPOTENCY_KEY_CONFLICT, LEAD_EMAIL_CONFLICT, SEQUENCE_ALREADY_ACTIVE, AMBIGUOUS_MATCH, UPSERT_IN_PROGRESS or WEBHOOK_LIMIT_REACHED (see above), 422 LEAD_EMAIL_INVALID (starting a sequence with no prior email on a lead whose address fails the syntax/MX check), 429 rate limited, 503 RATE_LIMIT_UNAVAILABLE (retry after Retry-After).

400 codes worth handling specifically on lead writes:

CodeMeaning
FIELD_NOT_UPDATABLEThe PATCH body carried a field that endpoint won't write. details.fields lists them, details.updatable lists what it accepts.
EMPTY_PATCHThe PATCH body had no updatable field at all.
INVALID_FILTERA filter or list parameter couldn't be used — an unknown status/stage, a malformed id or date, a linkedin_url that isn't a profile URL, external_id without external_source, source on accounts or opportunities. error names the parameter.
FIELD_NOT_ALLOWEDAn upsert body carried a field the endpoint doesn't accept. details.fields lists them.

(Lists used to require at least one filter and answer MISSING_FILTER without one. They no longer do.)

Rate limits

  • POST /auth/token: 20 requests per minute, per IP.
  • All other endpoints (CRM, Marketing, Social, Ticketing): 600 requests per 60 seconds per API key, over a sliding window. All tokens minted from one key share it.

Every response carries the current state:

Header
X-RateLimit-Limitthe budget (600)
X-RateLimit-Remainingrequests left in the current window
X-RateLimit-Resetseconds until the window has fully refilled

Over the budget, you get 429 with a Retry-After header — the seconds until a request slot frees up — and a body saying so:

{
  "error": "Rate limit exceeded: 600 requests per 60 seconds per API key. Retry after 12 seconds.",
  "code": "RATE_LIMITED",
  "details": { "limit": 600, "window_seconds": 60, "retry_after_seconds": 12 },
  "request_id": "b3f2..."
}

Wait Retry-After seconds before retrying; slow down when X-RateLimit-Remaining gets low. If the limiter itself is briefly unavailable you get 503 RATE_LIMIT_UNAVAILABLE with a short Retry-After — retry, it is not counted against you.