Yep Platform logo
REST API · Yep Platform Technical documentation for certified integrations

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.

REST JSON Bearer Token New in 2026

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.

200
Max limitPer page in any listing via limit.
20
Default limitApplied when limit is omitted.
GET
Read-onlyQueries that bypass the write audit queue.
UTM
AttributionFilters by utm_source, utm_medium and utm_campaign.
All endpoints require 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. Use include_pagination=1 to receive total, last_page and has_next in the body.
  • Dates use YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. Invalid formats return 400.
  • Sorting: use sort and direction (asc or desc). Default: sort=created_at, direction=desc.
  • A lookup by id returns a single record; when there is no match, the response is 404.

Leads

Query of contacts captured in forms, landing pages and campaigns, with attribution data (UTMs), origin and linked coupon.

GET/api2/leads

List leads with filters and deterministic pagination.

ListingFiltersNew
id Optional
Integer. Returns a single lead by ID. Without a match, returns 404.
store_id Optional
Integer. Filters by capture unit.
email Optional
String. Exact e-mail filter, case-insensitive.
phone Optional
String. Exact phone filter.
name Optional
String. Exact name filter.
created_from / created_to Optional
Creation range. Accepted aliases: created_at_from and created_at_to. Accepts date or datetime.
utm_source / utm_medium / utm_campaign Optional
String. Exact-value attribution filters.
origin Optional
String. Origin reported in the capture form.
coupon_id Optional
Integer. ID of the coupon linked to the lead.
coupon_used Optional
String. Coupon code used or generated for the lead.
promoters_name Optional
String. Name of the promoter linked to the capture.
page / limit / include_pagination Optional
Pagination. Default page=1, limit=20 (max 200). With include_pagination=1, returns total, last_page and has_next.
sort / direction Optional
Sorting. Accepted fields: 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"
    }
  ]
}
The total, last_page and has_next metadata only appear when include_pagination=1 is sent.
GET/api2/leads?id=123by ID

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.

GET/api2/schedules

List schedules with filters and deterministic pagination.

ListingFiltersNew
id Optional
Integer. Returns a single schedule by ID. Without a match, returns 404.
unity_id Optional
Integer. Filters by the schedule's unit.
email / phone / name Optional
String. Exact-match filter, case-insensitive.
date_from / date_to Optional
Range over the appointment date (field date).
created_from / created_to Optional
Range over record creation. Accepts date or datetime.
time Optional
String. Stored time, in the 14:30 format.
treatment Optional
String. Requested treatment or service.
origin Optional
String. Origin of the schedule.
status_gester Optional
Sync status: 1 Pending, 2 Synced, 3 Error. Accepts a comma-separated list, e.g. 1,3.
codigo_gester Optional
String. Integration coupon/code of the schedule.
campanha_interna_id Optional
Integer. ID of the linked internal campaign.
utm_source / utm_medium / utm_campaign Optional
String. Exact-value attribution filters.
page / limit / include_pagination Optional
Pagination. Default page=1, limit=20 (max 200). With include_pagination=1, returns total, last_page and has_next.
sort / direction Optional
Sorting. Accepted fields: 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
    }
  ]
}
GET/api2/schedules?id=456by ID

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.

ValueLabelMeaning
1PendingAwaiting sync with the external system.
2SyncedSuccessfully sent to the external system.
3ErrorSync 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.

Recent leadsGET /api2/leads?include_pagination=1&sort=created_at&direction=desc
Leads by date rangeGET /api2/leads?created_from=2026-06-01&created_to=2026-06-30
Leads by campaign (UTM)GET /api2/leads?utm_source=google&utm_campaign=avaliacao
Lead by IDGET /api2/leads?id=123
Schedules by unitGET /api2/schedules?unity_id=10&date_from=2026-06-01&date_to=2026-06-30
Pending/error schedulesGET /api2/schedules?status_gester=1,3&include_pagination=1
Portuguese aliasGET /api2/agendamentos?id=456

Integration recommendations

Consolidated best practices for n8n, CRM and BI flows that sync captures with the Yep Platform.

Recommended

  • Use include_pagination=1 when the flow needs to iterate pages until has_next=false.
  • For incremental loads, prefer windows by created_from/created_to and store the last processed timestamp in the flow itself to avoid duplicates.
  • Combine limit=100 + include_pagination=1 + sort=created_at&direction=asc to paginate with a predictable stop criterion and order.
  • Use store_id (leads) or unity_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 sort and direction.

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

StatusExample bodyWhen 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.