Buckets Leads Status API
The Buckets Leads Status API allows authorized systems to retrieve lead data for a givenΒ bucket and affiliate, using emails and/or client IDs, with optional filtering, pagination, and flexible response structure.
These endpoints are read-only and implemented as POST to support bulk lookups.
π Base path
/api/public
π Authentication
Method: Token-based via Authorization header
Authorization: <API_TOKEN>
-
No Bearer prefix
-
Token must be passed as-is
Required permission:
π Buckets: View Own
If authentication fails:
401 Unauthorized
{
"message": "Access with the provided credentials is incorrect. CODE: X-0005",
"statusCode": 401
}
βοΈ Common behavior
-
Method: POST
-
Format: JSON
-
Client type: Server-to-server
-
Supports pagination via
limitandoffset
π¦ Endpoint: Leads by bucket & affiliate
POST /buckets/{bucketId}/{affiliateID}/leads
π§ Description
Returns lead data for clients identified by:
-
emails
-
client IDs
-
or both
Includes validation:
-
Bucket existence
-
Bucket ownership by affiliate
π Path parameters
-
bucketIdβ bucket identifier -
affiliateIDβ affiliate identifier
π₯ Request headers
-
Content-Type: application/json
-
Authorization:
<API_TOKEN>
π€ Request body
{
"emails": ["user1@example.com"],
"ids": ["69ce524d741e8f2238329fff"],
"keyBy": "email",
"filters": {
"createdDate": ["1676172330450", "1776172330450"]
},
"limit": 100,
"offset": 0
}
π§© Fields
-
emailsβ array of emails (optional) -
idsβ array of client IDs (optional) -
keyByβ"email"(default) or"id" -
filters.createdDateβ optional created date range (epoch ms strings) -
limitβ number of records to return (default: 100) -
offsetβ number of records to skip (default: 0)
β οΈ Notes
-
If both
emailsandidsare empty β returns data based on filters only -
keyBy = "id":-
uses client
_idas key -
falls back to email if
_idis missing
-
-
Pagination is applied after filtering
β Successful response
200 OK
Response is an object keyed by email or id (based on keyBy).
{
"user1@example.com": {
"id": "69ce524d741e8f2238329fff",
"email": "user1@example.com",
"affiliateID": "1234567890",
"status": "active",
"createdDate": "2021-01-01T00:00:00.000Z",
"ftd": "2021-01-01T00:00:00.000Z"
}
}
β Errors
400 Bad Request
-
Bucket with corresponding affiliateID doesn't exist
-
Provided bucketId does not belong to the provided affiliateID
-
Invalid or missing token
-
Missing required permissions
π§© Endpoint: Leads by bucket, affiliate & source
POST /buckets/{bucketId}/{affiliateID}/leads/{sourceId}
π§ Description
Same as previous endpoint, with an additional source validation step.
Used for source-level access control.
π Path parameters
-
bucketIdβ bucket identifier -
affiliateIDβ affiliate identifier -
sourceIdβ source identifier
π€ Request body
Same as previous endpoint.
β οΈ Source validation behavior
-
If
sourceIdis provided β system checks that bucket has a source assigned -
If validation fails β request is rejected
β Successful response
Same structure as previous endpoint.
β Errors
400 Bad Request
All previous errors, plus:
-
Provided sourceId does not belong to bucket
Same as previous endpoint.
π§ Example requests
Without sourceId
curl -X POST "(CRM origin)/api/public/buckets/<bucketId>/<affiliateID>/leads" \
-H "Content-Type: application/json" \
-H "Authorization: <API_TOKEN>" \
-d '{
"emails": ["user1@example.com"],
"ids": ["69ce524d741e8f2238329fff"],
"limit": 50,
"offset": 0
}'
With sourceId
curl -X POST "(CRM origin)/api/public/buckets/<bucketId>/<affiliateID>/leads/<sourceId>" \
-H "Content-Type: application/json" \
-H "Authorization: <API_TOKEN>" \
-d '{
"filters": {
"createdDate": ["1676172330450", "1776172330450"]
}
}'