{"openapi":"3.1.0","info":{"title":"ZigCRM Public API","version":"1.0.0","description":"Build on ZigCRM: the Public API for contacts and outbound webhooks. Guides: https://api.zigcrm.com/docs"},"servers":[{"url":"https://api.zigcrm.com","description":"Production"},{"url":"https://zigcrm-apis.staff-b0c.workers.dev","description":"Staging"}],"security":[{"apiKeyAuth":[]}],"tags":[{"name":"Account"},{"name":"Contacts"}],"paths":{"/api/v1/me":{"get":{"summary":"Check an API key","description":"Returns the account the key belongs to and the scopes it has. Use it to verify a key while setting up an integration.","tags":["Account"],"security":[{"apiKeyAuth":[]}],"x-scope":"any","x-docs-group":"Account","responses":{"200":{"description":"The key is valid","content":{"application/json":{"example":{"tenant":{"id":"5eb926c1-ffa8-4179-b262-e6bed554326d","name":"Acme Traders"},"api_key":{"name":"ERP sync","prefix":"zig_live_3fa","scopes":["contacts:read","contacts:write"],"expires_at":null}}}}},"401":{"$ref":"#/components/responses/PublicApiError"},"429":{"$ref":"#/components/responses/PublicApiError"}}}},"/api/v1/contacts":{"get":{"summary":"List and search contacts","description":"Newest first by default. Use `updated_after` with `sort=updated_at&order=asc` to sync changes incrementally.","tags":["Contacts"],"security":[{"apiKeyAuth":[]}],"x-scope":"contacts:read","x-docs-group":"Contacts","parameters":[{"in":"query","name":"q","schema":{"type":"string"},"description":"Search first/last name, email, phone and company"},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"per_page","schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":"Values above 100 are capped at 100"},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"source","schema":{"type":"string"}},{"in":"query","name":"assigned_to","schema":{"type":"string"},"description":"User id, or \"unassigned\""},{"in":"query","name":"category_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"created_after","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"created_before","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"updated_after","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["created_at","updated_at","first_name","last_activity_at"],"default":"created_at"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"A page of contacts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublicContact"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"per_page":{"type":"integer","example":25},"total":{"type":"integer","example":132},"total_pages":{"type":"integer","example":6}}}}}}}},"401":{"$ref":"#/components/responses/PublicApiError"},"403":{"$ref":"#/components/responses/PublicApiError"},"422":{"$ref":"#/components/responses/PublicApiError"},"429":{"$ref":"#/components/responses/PublicApiError"}}},"post":{"summary":"Create a contact","description":"Requires `first_name` and an email or phone. Fires the contact.created (and contact.assigned) webhooks.","tags":["Contacts"],"security":[{"apiKeyAuth":[]}],"x-scope":"contacts:write","x-docs-group":"Contacts","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicContactInput"},"example":{"first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Nair Textiles","job_title":"Purchase Manager","address":"12 MG Road, Kochi","gender":"female","source":"website","tags":["vip","expo-2026"],"custom_fields":{"budget":50000}}}}},"responses":{"201":{"description":"Created. The `Location` header points to the new contact.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicContact"}}}}}},"400":{"$ref":"#/components/responses/PublicApiError"},"401":{"$ref":"#/components/responses/PublicApiError"},"403":{"$ref":"#/components/responses/PublicApiError"},"409":{"$ref":"#/components/responses/PublicApiError"},"422":{"$ref":"#/components/responses/PublicApiError"},"429":{"$ref":"#/components/responses/PublicApiError"}}}},"/api/v1/contacts/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a contact","tags":["Contacts"],"security":[{"apiKeyAuth":[]}],"x-scope":"contacts:read","x-docs-group":"Contacts","responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicContact"}}}}}},"400":{"$ref":"#/components/responses/PublicApiError"},"401":{"$ref":"#/components/responses/PublicApiError"},"403":{"$ref":"#/components/responses/PublicApiError"},"404":{"$ref":"#/components/responses/PublicApiError"}}},"patch":{"summary":"Update a contact","description":"Partial update — only the fields sent change. Fires contact.updated (and contact.assigned when the owner changes). Status-change auto-messages are not sent for API updates.","tags":["Contacts"],"security":[{"apiKeyAuth":[]}],"x-scope":"contacts:write","x-docs-group":"Contacts","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicContactInput"},"example":{"phone":"+919812345678","company_name":"Nair Textiles Pvt Ltd","status":"qualified","tags":["vip","repeat-customer"],"custom_fields":{"budget":75000}}}}},"responses":{"200":{"description":"The updated contact","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicContact"}}}}}},"400":{"$ref":"#/components/responses/PublicApiError"},"401":{"$ref":"#/components/responses/PublicApiError"},"403":{"$ref":"#/components/responses/PublicApiError"},"404":{"$ref":"#/components/responses/PublicApiError"},"409":{"$ref":"#/components/responses/PublicApiError"},"422":{"$ref":"#/components/responses/PublicApiError"}}},"delete":{"summary":"Delete a contact","description":"Refused with 409 while deals, tasks or notes are linked to the contact. Fires contact.deleted.","tags":["Contacts"],"security":[{"apiKeyAuth":[]}],"x-scope":"contacts:delete","x-docs-group":"Contacts","responses":{"204":{"description":"Deleted"},"400":{"$ref":"#/components/responses/PublicApiError"},"401":{"$ref":"#/components/responses/PublicApiError"},"403":{"$ref":"#/components/responses/PublicApiError"},"404":{"$ref":"#/components/responses/PublicApiError"},"409":{"$ref":"#/components/responses/PublicApiError"}}}}},"webhooks":{"contact.created":{"post":{"summary":"Contact created","description":"A new contact was added.\n\nSent when:\n- A user adds a contact in the ZigCRM web or mobile app.\n- A visitor submits your website contact widget.\n- A lead arrives from Facebook Lead Ads or a new WhatsApp conversation.\n- Your integration creates a contact through the Public API (`POST /api/v1/contacts`).\n\nIf the new contact already has an owner, a `contact.assigned` event is sent as well.","tags":["Contacts"],"x-delivery":"single","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contact.created"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"contact":{"description":"The new contact — see Contact object."}}}}},"example":{"event":"contact.created","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"contact":{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"}}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"contact.updated":{"post":{"summary":"Contact updated","description":"A contact's details changed.\n\nSent when:\n- A user edits a contact in the web or mobile app.\n- Your integration updates a contact through the Public API (`PATCH /api/v1/contacts/{id}`).\n\nSaving a contact without changing anything sends no event. A change of owner is reported as `contact.assigned` (and, if other fields changed too, `contact.updated`).","tags":["Contacts"],"x-delivery":"single","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contact.updated"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"contact":{"description":"The contact after the change — see Contact object."},"changed_fields":{"description":"Names of the fields that changed, sorted. Housekeeping fields such as `updated_at` are not listed."}}}}},"example":{"event":"contact.updated","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"contact":{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders Pvt Ltd","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"qualified","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-07T11:02:40.019Z"},"changed_fields":["company_name","status"]}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"contact.deleted":{"post":{"summary":"Contact deleted","description":"A single contact was deleted.\n\nSent when:\n- A user deletes one contact in the web or mobile app.\n- Your integration deletes a contact through the Public API (`DELETE /api/v1/contacts/{id}`).\n\nDeleting several contacts at once sends `contacts.bulk_deleted` instead.","tags":["Contacts"],"x-delivery":"single","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contact.deleted"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"contact":{"description":"The contact as it was just before deletion — see Contact object."}}}}},"example":{"event":"contact.deleted","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"contact":{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"}}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"contact.assigned":{"post":{"summary":"Contact assigned","description":"A contact got a new owner.\n\nSent when:\n- A contact is created with an owner.\n- A contact's owner changes to another user (in the apps or through the Public API).\n\nRemoving the owner (unassigning) does not send this event.","tags":["Contacts"],"x-delivery":"single","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contact.assigned"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"contact":{"description":"The contact, with its new `assigned_to` — see Contact object."},"previous_assigned_to":{"description":"The previous owner's user id, or `null` if the contact had none (e.g. just created)."}}}}},"example":{"event":"contact.assigned","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"contact":{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"},"previous_assigned_to":null}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"contacts.bulk_imported":{"post":{"summary":"Contacts bulk imported","description":"Contacts were imported in bulk.\n\nSent when:\n- A user imports a CSV file in the web app.\n- A user imports contacts from their phone in the mobile app.\n\nImported contacts do **not** also send `contact.created` or `contact.assigned`. Rows skipped by the import (duplicates, invalid data) are not included. Each chunk has its own `event_id`; use `batch_id` + `chunk` to reassemble an import.","tags":["Bulk operations"],"x-delivery":"batch","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contacts.bulk_imported"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"batch_id":{"description":"Shared by every chunk of the same import (`bat_…`)."},"chunk":{"description":"This chunk's number, starting at 1."},"chunk_count":{"description":"How many chunks this import was split into."},"count":{"description":"Number of contacts in this chunk (at most 100)."},"contacts":{"description":"The imported contacts — see Contact object."}}}}},"example":{"event":"contacts.bulk_imported","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":null,"actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"batch_id":"bat_9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","chunk":1,"chunk_count":3,"count":100,"contacts":[{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"},"… 99 more"]}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"contacts.bulk_deleted":{"post":{"summary":"Contacts bulk deleted","description":"Several contacts were deleted at once.\n\nSent when:\n- A user selects several contacts in the web or mobile app and deletes them.\n\nContacts that could not be deleted (still linked to deals, tasks or notes) are not included. No `contact.deleted` event is sent for contacts deleted this way.","tags":["Bulk operations"],"x-delivery":"batch","x-subscribable":true,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"contacts.bulk_deleted"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"batch_id":{"description":"Shared by every chunk of the same delete (`bat_…`)."},"chunk":{"description":"This chunk's number, starting at 1."},"chunk_count":{"description":"How many chunks this delete was split into."},"count":{"description":"Number of contacts in this chunk (at most 100)."},"contacts":{"description":"The contacts as they were just before deletion — see Contact object."}}}}},"example":{"event":"contacts.bulk_deleted","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":null,"actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"batch_id":"bat_1d2c3b4a-5f6e-4d7c-8b9a-0f1e2d3c4b5a","chunk":1,"chunk_count":1,"count":2,"contacts":[{"id":"3f6b2a4e-9c1d-4e8a-a7b2-5d0c9e1f2a3b","first_name":"Asha","last_name":"Nair","email":"asha@example.com","phone":"+919876543210","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"},{"id":"7c8d9e0f-1a2b-4c3d-9e4f-5a6b7c8d9e0f","first_name":"Ravi","last_name":"Menon","email":"ravi@example.com","phone":"+919812345678","company_name":"Acme Traders","job_title":"Purchase Manager","profession":null,"address":"MG Road, Kochi, Kerala","gst_no":null,"gender":"female","status":"new","source":"website","tags":"expo-2026,vip","assigned_to":"8d2e4f6a-1b3c-4d5e-9f0a-2b4c6d8e0f1a","category_ids":[],"custom_fields":{"budget":50000},"lead_score":35,"created_at":"2026-10-06T09:15:22.481Z","updated_at":"2026-10-06T09:15:22.481Z"}]}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}},"webhook.test":{"post":{"summary":"Test event","description":"A test delivery you triggered.\n\nSent when:\n- You click **Send test** on a webhook in Settings → Webhooks.\n\nAlways sent, whichever events the webhook is subscribed to. A failing test never counts toward auto-pause.","tags":["Testing"],"x-delivery":"single","x-subscribable":false,"parameters":[{"in":"header","name":"X-ZigCRM-Signature","required":true,"schema":{"type":"string"},"description":"sha256=HMAC-SHA256(secret, timestamp + \".\" + raw body), hex."},{"in":"header","name":"X-ZigCRM-Timestamp","required":true,"schema":{"type":"string"},"description":"Unix seconds the request was signed."},{"in":"header","name":"X-ZigCRM-Event-Id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","event_id","occurred_at","tenant_id","actor","data"],"properties":{"event":{"type":"string","const":"webhook.test"},"event_id":{"type":"string","description":"Unique id of this event (`evt_…`). Identical on a retry — use it to ignore duplicates. Also sent as `X-ZigCRM-Event-Id` and `Idempotency-Key`."},"occurred_at":{"type":"string","format":"date-time"},"tenant_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"actor":{"type":"object","properties":{"user_id":{"type":["string","null"],"format":"uuid"}}},"data":{"type":"object","properties":{"message":{"description":"A fixed message confirming the endpoint is reachable."}}}}},"example":{"event":"webhook.test","event_id":"evt_2c1f9b3e-7a4d-4f8e-b6c5-0d9e8f7a6b5c","occurred_at":"2026-10-06T09:15:23.102Z","tenant_id":"5eb926c1-ffa8-4179-b262-e6bed554326d","contact_id":null,"actor":{"user_id":"e5b46ecb-b7d6-484f-a903-809fe34b9548"},"data":{"message":"This is a test event from ZigCRM. Your webhook endpoint is reachable."}}}}},"responses":{"2XX":{"description":"Return any 2xx status to acknowledge the event."}}}}},"components":{"schemas":{"PublicContactInput":{"type":"object","description":"Only these fields are accepted; any other field is rejected with 422. Strings are trimmed, and \"\" clears a field.","properties":{"first_name":{"type":"string","maxLength":100,"description":"Required on create"},"last_name":{"type":["string","null"],"maxLength":100},"email":{"type":["string","null"],"maxLength":254,"description":"Email or phone is required"},"phone":{"type":["string","null"],"maxLength":32,"description":"International format, e.g. +919876543210"},"company_name":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":120},"profession":{"type":["string","null"],"maxLength":120},"address":{"type":["string","null"],"maxLength":1000},"gst_no":{"type":["string","null"],"maxLength":15},"gender":{"type":["string","null"],"enum":["male","female","other"]},"status":{"type":["string","null"],"description":"Status key or name; your account's default when omitted on create"},"source":{"type":["string","null"],"maxLength":100,"description":"Defaults to \"api\" on create"},"tags":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}],"description":"Array or comma-separated string"},"assigned_to":{"type":["string","null"],"format":"uuid","description":"Must be a user of your account"},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Replaces the whole list; unknown ids are dropped"},"custom_fields":{"type":"object","additionalProperties":true,"description":"{ field_key: value } — merged into existing values; send \"\" to clear one"}}},"PublicContact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"first_name":{"type":"string","example":"Asha"},"last_name":{"type":["string","null"],"example":"Nair"},"email":{"type":["string","null"],"example":"asha@example.com"},"phone":{"type":["string","null"],"example":"+919876543210"},"company_name":{"type":["string","null"]},"job_title":{"type":["string","null"]},"profession":{"type":["string","null"]},"address":{"type":["string","null"]},"gst_no":{"type":["string","null"]},"gender":{"type":["string","null"],"enum":["male","female","other"]},"status":{"type":["string","null"],"description":"Your account's status key, e.g. new"},"source":{"type":["string","null"],"example":"api"},"tags":{"type":"array","items":{"type":"string"},"example":["vip","expo-2026"]},"assigned_to":{"type":["string","null"],"format":"uuid","description":"User id of the owner"},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"custom_fields":{"type":"object","additionalProperties":true,"example":{"budget":50000}},"lead_score":{"type":"integer","example":42},"lead_priority":{"type":["string","null"],"example":"Warm"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"last_activity_at":{"type":["string","null"],"format":"date-time"}}},"PublicApiError":{"type":"object","description":"Every non-2xx response from /api/v1 has this shape. The codes are listed at /docs/errors (generated from API_ERROR_CODES in src/utils/apiError.js).","properties":{"error":{"type":"object","properties":{"code":{"type":"string","example":"validation_failed","enum":["bad_request","unauthorized","invalid_api_key","insufficient_scope","quota_exceeded","not_found","duplicate","conflict","validation_failed","rate_limited","internal_error"]},"message":{"type":"string","example":"The contact is invalid."},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":["string","null"],"example":"email"},"message":{"type":"string","example":"Invalid email format"}}}}}}}}},"responses":{"PublicApiError":{"description":"Error — see the PublicApiError schema for codes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiError"}}}}},"securitySchemes":{"apiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"zig_live_…","description":"Tenant API key from Settings → API Keys, sent as `Authorization: Bearer zig_live_…` (or `X-API-Key: zig_live_…`)."}}}}