# LeadTable External API v4

> REST API for agencies to manage customers, tables (campaigns), leads, webhooks, files, pages, and WhatsApp. **Authentication:** every route needs the headers `x-api-key` and `email`. **IDs:** MongoDB ObjectId strings. Timestamps are ISO-8601 unless noted. **Tables vs campaigns:** a campaign is a table. v4 uses `/table` paths. Request fields that still say `campaignID` accept a table ID. **Lead profile (`leadData`):** `GET /lead/{leadID}` adds `lead.leadData` with `mappedData` (column name → answ

- OpenAPI JSON: [/openapi.json](/openapi.json)
- Full reference (markdown): [/llms-full.txt](/llms-full.txt)
- Interactive docs: [/](/)

Server: `https://api.lead-table.com/api/v4/`

## Operations

- GET /auth: Check authentication
- GET /agency: Get the authenticated agency
- GET /customer/list: List customers
- POST /customer/create: Create a customer
- GET /customer/{customerID}: Get a customer
- POST /customer/addPage: Add a page to a customer
- DELETE /customer/{customerID}/page/{pageInstanceID}: Remove a page from a customer
- GET /table/list/{customerID}: List tables of a customer
- GET /table/{tableID}: Get a table
- GET /table/{tableID}/leads: List leads of a table
- POST /table/create: Create a table
- POST /table/create/{templateID}: Create a table from a template
- GET /table/templates/list: List table templates
- GET /status/templates/list: List status templates
- POST /lead/create: Create a lead
- GET /lead/{leadID}: Get a lead
- PUT /lead/{leadID}: Create or update a lead field
- PUT /lead/{leadID}/description: Update lead description
- GET /lead/{leadID}/files: List files of a lead
- GET /lead/{leadID}/files/{fileID}/content: Download a file of a lead
- POST /lead/addFile: Upload a file to a lead
- POST /lead/changeStatus: Change lead status
- POST /lead/move: Move or copy leads
- GET /lead/search/byEmail/{email}: Search leads by email
- POST /attachWebhook: Attach a webhook
- DELETE /removeWebhook: Detach a webhook
- GET /pollWebhook/{campaignID}/{topic}: Poll a webhook test sample
- POST /whatsapp/message/send: Send a WhatsApp message
- GET /pages/templates/list: List page templates
