Leads & schedules
Read-only endpoints to query the store's capture records: /api2/leads for leads and /api2/schedules (with the /api2/agendamentos alias) for schedules. They are designed for external integrations — n8n flows, CRMs and BI — that need to read captures with filters, UTMs and deterministic pagination without accessing the admin.
Overview
The capture resources expose two independent GET contracts. Leads returns contacts captured in forms and landing pages; Schedules returns appointment requests by unit. Both are read-only — there is no create, update or delete through this API — and share the same pagination, sorting and date rules.
limit.limit is omitted.utm_source, utm_medium and utm_campaign.Authorization: Bearer {token} and the integration must have read permission for capture granted in the admin. Parameters may be sent via query string or JSON body on GET, at the integrator's convenience.General rules
Conventions shared by both capture resources. Base URL in the examples: /api2. Every query requires Authorization: Bearer {{token}}.
- Filters accept query string or JSON body on
GET. When the same field exists in both, the query string value wins. - Text filters (
email,phone,name) are exact-match, case-insensitive. There is no partial search. - Default pagination:
page=1,limit=20. Max limit:200. Useinclude_pagination=1to receivetotal,last_pageandhas_nextin the body. - Dates use
YYYY-MM-DDorYYYY-MM-DD HH:MM:SS. Invalid formats return400. - Sorting: use
sortanddirection(ascordesc). Default:sort=created_at,direction=desc. - A lookup by
idreturns a single record; when there is no match, the response is404.
Leads
Query of contacts captured in forms, landing pages and campaigns, with attribution data (UTMs), origin and linked coupon.
List leads with filters and deterministic pagination.
404.created_at_from and created_at_to. Accepts date or datetime.page=1, limit=20 (max 200). With include_pagination=1, returns total, last_page and has_next.id, created_at, name, email, store_id. Default created_at desc.Example — query string
GET /api2/leads?page=1&limit=50&include_pagination=1&created_from=2026-06-01&created_to=2026-06-30&sort=created_at&direction=desc
Authorization: Bearer {{token}}
Response — example
{
"success": true,
"page": 1,
"limit": 50,
"total": 1,
"last_page": 1,
"has_next": false,
"leads": [
{
"id": 123,
"store_id": 10,
"name": "Maria Silva",
"email": "[email protected]",
"phone": "11999999999",
"created_at": "2026-06-20 14:30:00",
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "avaliacao",
"utm_term": null,
"utm_content": null,
"origin": "landing_page",
"coupon_id": 5,
"coupon_used": "CAMPANHA_123",
"promoters_name": "Promotor A"
}
]
}
total, last_page and has_next metadata only appear when include_pagination=1 is sent.Look up a specific lead by ID. The response returns the full record inside leads.
GET /api2/leads?id=123
Authorization: Bearer {{token}}
Schedules
Query of appointment requests by unit, with date and time, requested treatment, attribution (UTMs) and sync status with external systems. Available at /api2/schedules and the Portuguese alias /api2/agendamentos — both with the same contract.
List schedules with filters and deterministic pagination.
404.date).14:30 format.1 Pending, 2 Synced, 3 Error. Accepts a comma-separated list, e.g. 1,3.page=1, limit=20 (max 200). With include_pagination=1, returns total, last_page and has_next.id, created_at, date, time, name, email, unity_id, status_gester. Default created_at desc.Example — query string
GET /api2/schedules?page=1&limit=50&include_pagination=1&date_from=2026-06-01&date_to=2026-06-30&status_gester=1,3
Authorization: Bearer {{token}}
Response — example
{
"success": true,
"page": 1,
"limit": 50,
"total": 1,
"last_page": 1,
"has_next": false,
"schedules": [
{
"id": 456,
"name": "Ana Costa",
"email": "[email protected]",
"phone": "11988888888",
"date": "2026-06-25",
"time": "15:00",
"unity_id": 10,
"treatment": "Free evaluation",
"created_at": "2026-06-20 16:10:00",
"utm_source": "instagram",
"utm_medium": "social",
"utm_campaign": "agenda",
"utm_term": null,
"utm_content": null,
"origin": "C",
"campanha_interna": "https://example.com/lp",
"campanha_interna_id": null,
"codigo_gester": "ABC123",
"status_gester": 2,
"status_gester_label": "Synced",
"mensagem_erro_gester": null
}
]
}
Look up a specific schedule by ID. Also available via the /api2/agendamentos?id=456 alias.
GET /api2/schedules?id=456
Authorization: Bearer {{token}}
Schedule sync status
The status_gester field reflects the schedule's sync stage with the external system. The status_gester_label field carries the human-readable description and mensagem_erro_gester details the failure when present.
| Value | Label | Meaning |
|---|---|---|
1 | Pending | Awaiting sync with the external system. |
2 | Synced | Successfully sent to the external system. |
3 | Error | Sync failure — check mensagem_erro_gester. |
Reprocessing
To monitor pending and failed records, filter by status_gester=1,3 and sort by created_at. This lets the flow identify records that still need to be synced or reprocessed.
Supported usage patterns
Tested and certified combinations for leads and schedules.
GET /api2/leads?include_pagination=1&sort=created_at&direction=descGET /api2/leads?created_from=2026-06-01&created_to=2026-06-30GET /api2/leads?utm_source=google&utm_campaign=avaliacaoGET /api2/leads?id=123GET /api2/schedules?unity_id=10&date_from=2026-06-01&date_to=2026-06-30GET /api2/schedules?status_gester=1,3&include_pagination=1GET /api2/agendamentos?id=456Integration recommendations
Consolidated best practices for n8n, CRM and BI flows that sync captures with the Yep Platform.
Recommended
- Use
include_pagination=1when the flow needs to iterate pages untilhas_next=false. - For incremental loads, prefer windows by
created_from/created_toand store the last processed timestamp in the flow itself to avoid duplicates. - Combine
limit=100+include_pagination=1+sort=created_at&direction=ascto paginate with a predictable stop criterion and order. - Use
store_id(leads) orunity_id(schedules) for deterministic results in multi-unit operations.
Avoid
- Expecting partial search by name, e-mail or phone — text filters are exact-match.
- Trying to create, update or delete captures through this API — the endpoints are read-only.
- Relying on implicit ordering across pages — always provide
sortanddirection.
Tip for n8n flows
For incremental loads, fire the query with the created_from window equal to the last processed checkpoint, paginate until has_next=false and persist the largest returned created_at as the new checkpoint. Because the endpoints are GET and bypass the write audit queue, they are safe for frequent polling.
Common errors
| Status | Example body | When it happens |
|---|---|---|
400 | {"error":"Campo de ordenação inválido."} | Invalid parameter, invalid JSON or unsupported sort field. |
401 | {"error":"Token ausente ou malformado."} | Token missing, malformed, invalid, revoked or expired. |
403 | {"error":"Acesso negado para este recurso da API."} | Valid token, but without read permission for capture. |
404 | {"error":"Lead não encontrado."} | Lookup by id with no matching record. |