Skip to main content

Leads: Save & Fetch

WeThis haveguide covers the 2 API endpoints.endpoints that handle leads.


  • You

    POST can/sqt/saveLead

    Use this endpoint to insert leadsa from your CRM into the Leads Dashboard using our Save Lead endpoint.

  • You can fetch your leads using our Fetch Leads endpoint.

Save Lead

Insert leadslead that comecomes from sources that aren't Speedy PV.

Endpoint

Authentication

Endpoint:  

POST https://[DOMAIN]/api/v1/sqt/saveLead

Headers:

Authentication

    This

  • X-API-KEY: endpoint[YOUR_API_KEY] requires(Replace [YOUR_API_KEY] with your CRMactual API keykey.)
  • passed

Request structure

Every request to update a project must contain the following. The customerContactDetails must be an object with name , email and phone as fields.

Address: The lead's address should include the postcode

Customer Contact Details: Use the customerContactDetails object to pass in the request headers. You can find this key in your Pro Account Settings

HeaderTypeRequiredDescription
x-api-keystringYesYour CRM connections API key, which can be found in your Pro Account Settings.

Request body

The request must include a JSON object with the following fields:

- lead.
  • email
  • - lead.
  • phone
  • - maynot
    KeyTypeRequiredDescription
    addressstringYesThe lead’s address. This should include a postcode.
    customerContactDetailsobjectYesThe lead’sleads contact detailsdetails.

    (see
      breakdown
    • name below).
    customerContactDetails.namestringYesFull name of the lead
    customerContactDetails.emailstringYesEmail address of the lead
    customerContactDetails.phonestringYesPhone number of the lead.

    Please ensure valid contact details are provided, otherwise the lead

    be stored properly. All fields are required.

    Example API request and response
    Example requestAPI Request

    Below is an example using curl that demonstrates how to save a lead with the require fields:

    curl  --locationX 'https://easy-pv.co.uk/api/v1/sqt/saveLead' \
          --headerH 'x-api-key: YOUR_API_KEY_HERE' \
          --headerH 'Content-Type: application/json' \
          --data-rawd '{
                "address": "123 Main St",
                "customerContactDetails": {
                "name": "John Doe",
                "email": "john.doe@example.com",
                "phone": "1234567890"
                }
              }'

    Responses

    Success (200)Response

    IfA thesuccessful lead is saved successfully, youcall will receive.return a JSON object containing a leadId.

    {
      "status": "success",
      "leadID": [the ID of your new lead]
    }
    
    x Error

    If

    something
    goes

    wrong,

    GET an error response will be returned with details in the body.

    Notes

    • /sqt/fetchLeads

      AllUse threethis fields (address, customerContactDetails, and crmRequest) are required.

    • Make sure crmRequest is setendpoint to true if you are inserting the lead from a CRM integration.

    • Ensure valid contact details are provided, otherwise the lead may not be stored properly.

    Fetch Leads

    Getget all the leads from your leads dashboard so that you can see them in your CRM!CRM.

    Endpoint

    Authentication

    Endpoint:  

    GETPOST https://[DOMAIN]/api/v1/sqt/fetchLeadsfetchLead

    Headers:

    Authentication

      This

    • X-API-KEY: endpoint[YOUR_API_KEY] requires(Replace [YOUR_API_KEY] with your CRMactual API keykey.)
    • passed
    in
    the

    request
    headers.Request structure

    You can findalso thisinclude keya instartDate yourand ProendDate Accountto Settingsfetch leads within a specified date range.

    (Optional)

    Start date: 
    startDateHeader TypeRequiredDescription
    x-api-keystringYesYour CRM connections API key, which canshould be found in your Pro Account Settings.
    Parameters
    (YYYY-MM-DD)

    (Optional)

    (YYYY-MM-DD)

    ParameterTypeRequiredDescription
    startDateDate in the format 'Year-month-day' NoTheEnd datedate: fromendDate whichshould to fetch leads
    endDateDatebe in the format 'Year-month-day'No The
    dateExample tillAPI whichrequest and response
    Example API Request

    Below is an example using curl that demonstrates how to fetch leads

    Example Requests
    leads:

    curl  -X 'https://easy-pv.co.uk/api/v1/sqt/fetchLeads' \
          -locationH 'x-api-key: YOUR_API_KEY_HERE'

    Here is an example that uses startDate and endDate:

    curl  -X 'https://easy-pv.co.uk/api/v1/sqt/fetchLeads?startDate=2025-03-21&endDate=2025-08-10' \
          --headerH 'x-api-key: YOUR_API_KEY_HERE'
    curl --location 'https://easy-pv.co.uk/api/v1/sqt/fetchLeads' \
    --header 'x-api-key: YOUR_API_KEY_HERE'

    Responses

    Success (200)Response

    IfA thesuccessful request is successful, youcall will receivereturn a JSON Arrayarray of lead objects, that looklooks like thisthis:

    [
        {
            "ID": 1,
            "dateCreated": "2025-03-11T11:03:29.000Z",
            "status": "new",
            "customerName": "John Doe",
            "address": "8 The Rowans, Milton, Cambridge, Cambridgeshire, CB24 6YU",
            "customerEmail": "test@test.com",
            "customerPhone": "07111111111",
            "origin": "https://easy-pv.co.uk/speedy-pv",
        },
      ...
    ]
    x Error

    If something goes wrong, an error response will be returned.

    {
      "status": "error",
      "message": "Failed to fetch leads."
    }