Skip to content

Leads

The Leads resource is available via both the REST API (bearer token) and the Dashboard (session auth).

REST API Endpoints

Bulk Create Leads

POST/api/web/1.0/leads🔒 Bearer Token — CREATE LEADS

Create multiple leads in a single request. Maximum 1,000 leads per request.

Request Body:

FieldTypeRequiredDescription
leadsarrayYesArray of lead objects (max 1,000)
leads.*.phonestringYesPhone number (7–100 chars)
leads.*.full_namestringYesFull name (3–100 chars)
leads.*.citystringNoCity name (3–100 chars)
leads.*.areastringNoArea/district (3–100 chars)
leads.*.addressstringNoAddress (5–100 chars)
leads.*.dataarrayNoCustom key-value pairs (max 100)
leads.*.data.*.keystringNoCustom field key (1–100 chars)
leads.*.data.*.valuestringNoCustom field value (1–100 chars)
leads.*.productsarrayYesProducts array (min 1, max 100)
leads.*.products.*.skustringYesProduct SKU — must exist in your account
leads.*.products.*.quantitynumberYesQuantity (1–999)
leads.*.products.*.pricenumberYesPrice per unit (1–999,999)

Example Request:

bash
curl -X POST "https://your-domain.com/api/web/1.0/leads" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "leads": [
      {
        "phone": "+212600000001",
        "full_name": "Ahmed Benali",
        "city": "Casablanca",
        "address": "123 Boulevard Mohammed V",
        "products": [
          { "sku": "PROD-001", "quantity": 2, "price": 199 }
        ],
        "data": [
          { "key": "source", "value": "facebook-ad" }
        ]
      },
      {
        "phone": "+212600000002",
        "full_name": "Fatima Zahra",
        "city": "Rabat",
        "products": [
          { "sku": "PROD-002", "quantity": 1, "price": 349 }
        ]
      }
    ]
  }'

Example Response (201):

json
{
  "message": "Leads created successfully."
}

Important

The sku in each product must match an active product in your account. If any SKU is invalid, the entire request is rejected.

List Leads

GET/api/web/1.0/leads🔒 Bearer Token — VIEW LEADS

Retrieve a paginated list of leads.

Query Parameters:

ParameterTypeRequiredDescription
search_bystringNoField to search: reference, phone, full_name, city
keyWordstringNoSearch keyword
per_pagenumberNoResults per page

Example Request:

bash
curl -X GET "https://your-domain.com/api/web/1.0/leads?per_page=25&search_by=phone&keyWord=0600" \
  -H "Authorization: Bearer {token}" \
  -H "Accept: application/json"

Example Response (200):

json
{
  "data": [
    {
      "reference": "LD-00001",
      "full_name": "Ahmed Benali",
      "phone": "+212600000001",
      "city": "Casablanca",
      "status": "new",
      "created_at": "2025-01-15T10:30:00Z"
    }
  ],
  "links": { "next": "...", "prev": null },
  "meta": { "current_page": 1, "last_page": 5, "per_page": 25, "total": 120 }
}

Show Lead

GET/api/web/1.0/leads/{reference}/show🔒 Bearer Token — VIEW LEADS

Retrieve a single lead by its reference.

Path Parameters:

ParameterTypeDescription
referencestringThe lead reference (e.g., LD-00001)

Example Request:

bash
curl -X GET "https://your-domain.com/api/web/1.0/leads/LD-00001/show" \
  -H "Authorization: Bearer {token}" \
  -H "Accept: application/json"

Update Leads (Bulk)

PUT/api/web/1.0/leads🔒 Bearer Token — UPDATE LEADS

Update statuses for multiple leads. Maximum 1,000 per request.

Request Body:

FieldTypeRequiredDescription
leadsarrayYesArray of lead updates (max 1,000)
leads.*.referencestringYesLead reference
leads.*.statusstringYesNew status (see statuses below)
leads.*.action_datestringNoDate in ISO 8601 format (Y-m-d\TH:i:sP). Required for certain statuses

Example Request:

bash
curl -X PUT "https://your-domain.com/api/web/1.0/leads" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "leads": [
      {
        "reference": "LD-00001",
        "status": "confirmed",
        "action_date": "2025-01-15T14:00:00+01:00"
      }
    ]
  }'

Delete Leads (Bulk)

DELETE/api/web/1.0/leads🔒 Bearer Token — DELETE LEADS

Delete multiple leads by their references. Only leads with a deletable status can be removed.

Request Body:

FieldTypeRequiredDescription
referencesarrayYesArray of lead reference strings

Example Request:

bash
curl -X DELETE "https://your-domain.com/api/web/1.0/leads" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "references": ["LD-00001", "LD-00002"]
  }'

INFO

Only leads with a status that is open to deletion can be removed. Attempting to delete a lead with a protected status will result in a validation error.


Dashboard Endpoints

These endpoints require session authentication and enforce policy-based authorization.

List Leads

GET/leads🔒 Session — can viewAny

Paginated list of leads with filters.

Supports filtering via LeadQueryFilterService. Results are paginated with perPage parameter.

Roles: Admin (all account leads), Seller (own account leads)

Create Lead

POST/leads/store🔒 Session — can create

Create a single lead from the dashboard.

FieldTypeRequiredDescription
namestringYesPhone number (unique per account)
statusstringYesInitial lead status

Show Lead

GET/leads/{lead}/show🔒 Session — can view

View a single lead with full details.

Update Lead

PATCH/leads/{lead}/update🔒 Session — can update

Update lead details.

FieldTypeRequiredDescription
statusstringYesLead status
full_namestringYesFull name
phonestringYesPhone number
city_idstringNoCity ID (must exist)

Delete Leads (Bulk)

DELETE/leads/delete🔒 Session — can delete

Bulk delete leads by IDs. Also removes associated LeadHistory records.

FieldTypeRequiredDescription
idsarrayYesArray of lead IDs to delete

Import Leads

POST/leads/import🔒 Session — can import

Import leads from an Excel/CSV file. Processed asynchronously via background queue.

FieldTypeRequiredDescription
filefileYes.xlsx or .csv file. Required columns: phone, sku

Export Leads

POST/leads/export🔒 Session — can export

Export filtered leads to a file. Processed asynchronously via background queue.

FieldTypeRequiredDescription
file_extensionstringYesExport format

Applies the same filters as the list endpoint.

Lead Statuses

Leads progress through the following statuses. The exact values are defined by LeadStatus enum:

StatusDescription
newFreshly created lead
confirmedAgent confirmed the lead
wrongInvalid/wrong number
call_laterCustomer asked to call back
no_answerNo response from customer
duplicateDuplicate lead
canceledLead canceled

WedoCOD Documentation