Skip to main content

Leads: Save & Fetch

This guide covers the 2 API endpoints that handle leads.

Jump to section:


POST /sqt/saveLead

Use this endpoint to insert a lead that comes from sources that aren't Speedy PV.

Authentication

Endpoint:  

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

Headers:

  • X-API-KEY: [YOUR_API_KEY] (Replace [YOUR_API_KEY] with your actual API key.)

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 leads contact details.

  • name - Full name of the lead.
  • email - Email address of the lead.
  • phone - Phone number of the lead.

Please ensure valid contact details are provided, otherwise the lead may not be stored properly. All fields are required.

Example API request and response
Example API Request

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

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

A successful call will return a JSON object containing a leadId.


GET /sqt/fetchLeads

Use this endpoint to get all the leads from your leads dashboard so you can see them in your CRM.

Authentication

Endpoint:  

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

Headers:

  • X-API-KEY: [YOUR_API_KEY] (Replace [YOUR_API_KEY] with your actual API key.)

Request structure

You can also include a startDate and endDate to fetch leads within a specified date range.

(Optional) Start date: startDate should be in the format (YYYY-MM-DD)

(Optional) End date: endDate should be in the format (YYYY-MM-DD)

Example API request and response
Example API Request

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

curl  -X 'https://easy-pv.co.uk/api/v1/sqt/fetchLeads' \
      -H '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' \
      -H 'x-api-key: YOUR_API_KEY_HERE'
Response

A successful call will return a JSON array of lead objects, that looks like this:

[
    {
        "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",
    },
  ...
]