Skip to content

Leads ​

As an Admin, you have full access to create, view, update, and delete leads via the API.

Bulk Create Leads ​

POST/leads Bearer Token — create leads

Create up to 100 leads in a single request.

Request Body:

json
{
  "data": [
    {
      "full_name": "Ahmed El Fassi",
      "phone": "0612345678",
      "city": "Casablanca",
      "address": "123 Main Street",
      "data": [
        {
          "key": "note",
          "value": "Prefers afternoon delivery"
        }
      ],
      "area": "Maarif",
      "products": [
        {
          "sku": "SKU-001",
          "quantity": 2,
          "total": 299
        }
      ]
    }
  ]
}
FieldTypeRequiredDescriptionRules
dataarrayYesArray of lead objectsmax 100 items
data.*.full_namestringYesCustomer namemin 3, max 100 characters
data.*.phonestringYesPrimary phonemin 7, max 100 characters
data.*.citystringYesCity namemin 3, max 100 characters
data.*.areastringNoArea / districtmin 3, max 100 characters
data.*.addressstringYesDelivery addressmin 5, max 100 characters
data.*.productsarrayYesProduct itemsmin 1, max 100 items
data.*.products.*.skustringYesProduct SKUmin 1, max 100 characters, must exist in your account
data.*.products.*.quantitynumberYesQuantitymin 1, max 999
data.*.products.*.totalnumberYesLine totalmin 1, max 999999
data.*.dataarrayNoCustom key/value pairs (per-lead)max 100 entries
data.*.data.*.keystringNoCustom field namemin 1, max 100 characters
data.*.data.*.valuestringNoCustom field valuemin 1, max 100 characters

Response ​

Batches of 10 items or fewer are processed synchronously (201). Larger batches return 202 and are processed asynchronously (see Error handling).

Sync success (201):

json
{
  "data": {
    "created_refs": ["LED-00001"],
    "failed_count": 0
  },
  "meta": {
    "mode": "sync",
    "total": 1
  }
}

created_refs are public references (e.g. LED-00001). Use GET /leads/{reference}/show for the full record.

Async queued (202):

json
{
  "data": {
    "batch_id": "batch_550e8400-e29b-41d4-a716-446655440000",
    "queued": true
  },
  "meta": {
    "mode": "async",
    "total": 25
  }
}

When failed_count is greater than zero in sync mode, some rows failed during processing; details are sent via webhooks for async batches.

Validation failure (422):

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The given data was invalid.",
    "fields": {
      "data.0.phone": [
        "The phone field is required."
      ],
      "data.1.full_name": [
        "The full name must be between 3 and 100 characters."
      ]
    }
  }
}

List Leads ​

GET/leads Bearer Token — view leads

Retrieve a paginated list of leads.

ParameterTypeRequiredDescription
pagenumberNoPage number
per_pagenumberNoResults per page
keywordstringNoSearch term
search_bystringNoField to search (reference by default)
match_typestringNoMatch mode: exact, partial, starts_with, ends_with
start_atdateNoFilter from date
end_atdateNoFilter to date
statusarrayNoFilter by lead status values
sub_statusstringNoSub-status filter
other_statusintegerNoAdditional status filter (1–3)
is_processingbooleanNoFilter processing leads

Response ​

Success (200):

json
{
  "data": [
    {
      "reference": "LED-00001",
      "phone": "0612345678",
      "status": "new",
      "city": "Casablanca",
      "area": "Maarif",
      "data": [],
      "products": [],
      "leadHistories": []
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "limit": 50,
      "total": 120,
      "pages": 3
    }
  }
}

Show Lead ​

GET/leads/{reference}/show Bearer Token — view leads

Retrieve a single lead by reference.

Response ​

Success (200):

json
{
  "data": {
    "full_name": "Ahmed El Fassi",
    "phone": "0612345678",
    "city": "Casablanca",
    "area": "Maarif",
    "status": "New",
    "products": [
      {
        "sku": "SKU-001",
        "quantity": 2,
        "price": "299.00 MAD",
        "total": "299.00 MAD"
      }
    ],
    "created_at": "2025-01-16T10:00:00.000000Z"
  },
  "meta": {}
}

Not found (404):

json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Lead not found."
  }
}

Update Leads (Bulk) ​

PUT/leads Bearer Token — update leads

Bulk update leads. Each item must include the lead reference and the new status.

Request Body:

json
{
  "leads": [
    {
      "reference": "LED-00001",
      "status": "confirmed"
    },
    {
      "reference": "LED-00002",
      "status": "call_later",
      "action_date": "2025-02-01T14:00:00+01:00"
    }
  ]
}
FieldTypeRequiredDescriptionRules
leadsarrayYesArray of lead update objectsmax 100 items
leads.*.referencestringYesLead referencemin 1, max 100 characters
leads.*.statusstringYesNew statusvalid lead status key (case-insensitive)
leads.*.action_datestringNoAction date (required for some statuses)ISO 8601 (YYYY-MM-DDTHH:MM:SS±HH:MM)

Response ​

Success (200):

json
{
  "data": [
    {
      "reference": "LED-00001"
    },
    {
      "reference": "LED-00002"
    }
  ],
  "meta": {
    "updated_fields": ["status", "action_date"]
  }
}

Validation error (422):

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The given data was invalid.",
    "fields": {
      "leads.0.status": [
        "The selected status is invalid."
      ],
      "leads.1.action_date": [
        "The action date is required for status cancelled."
      ]
    }
  }
}

Delete Leads (Bulk) ​

DELETE/leads Bearer Token — delete leads

Bulk delete leads by ID. Deletion is only allowed when the system permits it based on business conditions (e.g., lead status).

Request Body:

json
{
  "ids": [
    "01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "01ARZ3NDEKTSV4RRFFQ69G5FAW"
  ]
}
FieldTypeRequiredDescriptionRules
idsarrayYesArray of lead IDsmax 100 items
ids.*stringYesLead IDmin 3, max 100 characters

Response ​

Success (200):

json
{
  "data": {
    "deleted": true,
    "count": 2
  },
  "meta": {}
}

Forbidden (403):

json
{
  "error": {
    "code": "HTTP_ERROR",
    "message": "This action is unauthorized."
  }
}

WARNING

Leads can only be deleted when system conditions allow it, depending on the current lead status and business rules.


Lead Statuses ​

Reference values for status on create/update and filters. There is no GET /lead-statuses endpoint.

StatusDescription
newFresh lead, not yet contacted
confirmedCustomer confirmed the order
wrongInvalid or wrong information
testingLead is being tested
call_laterCustomer asked to be called back
no_replyNo response from customer
cancelledLead canceled
out_of_stockProduct was out of stock
duplicateDuplicate lead
expiredLead has expired
unreachableCustomer is unreachable
preparingLead is being prepared
blacklistCustomer is blacklisted
no_reply_asked_to_recallNo reply, asked to recall

wedoCOD API Documentation