Skip to main content

Leads: Fetch, create, update & delete

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/fetchLeadsleads/fetch

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/fetchLeadsleads/fetch

Headers:

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

YouEvery canrequest alsomust include auserEmail and startDatefurthestDate andin endDatethe to fetch leads within a specified date range.body.

(Optional)User Start date:email: startDateuserEmail should be ina valid email address of an Easy PV Pro team member who has access to the formatproject. (YYYY-MM-DD)

(Optional) EndFurthest date: endDatefurthestDate 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 POST 'https://easy-pv.co.uk/api/v1/sqt/fetchLeads'leads/fetch' \
      -H 'x-api-key: YOUR_API_KEY_HERE'

Here is an example that uses startDate and endDate:

curl
      -Xd 'https://easy-pv.{
            "userEmail": "saira.noor@midsummerenergy.co.uk/api/v1/sqt/fetchLeads?startDate=uk"
            "furthestDate": "2025-03-21&endDate=2025-08-10'09-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",
    },
  ...
]


POST /leads/create

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

Authentication

Endpoint:  

POST https://[DOMAIN]/api/v1/leads/create

Headers:

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

The request body can take the following parameters:

  • address can include the postcode.
  • postcode 
  • customerEmail
  • customerName
  • customerPhone
  • lat and lng in decimal degrees format.
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 POST 'https://easy-pv.co.uk/api/v1/leads/create' \
      -H 'x-api-key: YOUR_API_KEY_HERE' \
      -d '{
            "address": "123 Main St",
            "customerName": "John Doe",
            "customerEmail": "john.doe@example.com",
            "customerPhone": "1234567890"
          }'
Response

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


POST /leads/update

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/leads/update

Headers:

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

Every request must include the following in the request body:

  • Lead ID: The leadID of the lead you want to update.
  • User email: userEmail should be a valid email address of an Easy PV Pro team member who has access to the project. 
  • Fields object: A fields object containing the information to be updated. See the projects/create endpoint documentation for the list of meta fields that can be updated.
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 POST 'https://easy-pv.co.uk/api/v1/leads/update' \
      -H 'x-api-key: YOUR_API_KEY_HERE' \
      -d '{
            "leadID": "1001"
            "userEmail": "saira.noor+pro@midsummerenergy.co.uk",
            "fields": {
              "postcode": "CB24 6YU"
            }
          }'
Response

If the request is successful you will receive a 204 success response.


DELETE /leads/delete

Use this endpoint to delete leads from your Leads dashboard.

Authentication

Endpoint:  

DELETE https://[DOMAIN]/api/v1/leads/delete

Headers:

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

Every request must include the following in the request body:

  • Lead ID: The leadID of the lead you want to update.
  • User email: userEmail should be a valid email address of an Easy PV Pro team member who has access to the project.
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 DELETE 'https://easy-pv.co.uk/api/v1/leads/delete' \
      -H 'x-api-key: YOUR_API_KEY_HERE' \
      -d '{
            "leadID": "1001"
            "userEmail": "saira.noor+pro@midsummerenergy.co.uk"
          }'
Response

If the request is successful you will receive a 200 success response.