Skip to main content

Leads: Fetch, create, update & delete

This guide covers the API endpoints that handle leads.

Jump to section:


 POST /leads/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/leads/fetch

Headers:

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

Every request must include userEmail and furthestDate in the body.

User email: userEmail should be a valid email address of an Easy PV Pro team member who has access to the project. 

Furthest date: furthestDate 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/leads/fetch' \
      -H 'x-api-key: YOUR_API_KEY_HERE'
      -d '{
            "userEmail": "saira.noor@midsummerenergy.co.uk",
            "furthestDate": "2025-09-10"
          }'
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": "7 Erdiston Ct, Bude, EX23 8HE",
            "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: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@midsummerenergy.co.uk",
            "fields": {
              "address": "123 main st"
            }
          }'
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@midsummerenergy.co.uk"
          }'
Response

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