Developer Guidelines

Easy PV and Heatpunk have a number of API endpoints that can be used to integrate CRMs, job management platforms and other applications.  Find out how here!

Getting started

Our API for Easy PV and Heatpunk is open, and we welcome developers working on new integrations for CRMs, job management platforms and other applications. If you have an application that you would like to connect please give us a shout - we'd be really happy to help.

Documentation and testing

Live documentation for the API can be found at https://heatpunk.co.uk/api/about/. You can alternatively view the full OpenAPI schema by navigating to [DOMAIN]/api/openapi/

You can test calls from the documentation itself. It will also give example CURL calls which you can test from a command line. Platforms such as Postman or Hoppscotch are also very useful for development of an API integration.

Production and sandbox environments

In all the examples we give here we use the production API at the https://heatpunk.co.uk/ domain. If you are developing an integration with another application where you feel it would be helpful to test on a pre-prod environment we can give you access to a sandbox environment. Please ask for details.

Generating an API key

Most API endpoints that we make publicly available can only be accessed through a 'pro' team API key or an Enterprise API key. For 'Pro' team owners and admins please login and go to your 'Pro account settings' dashboard, then click on the 'CRM connections' tab. Click on the 'Generate key' button to create an API key.

It is very important that you keep the API key secure. Anyone who gains access to it will be able to access and change all data for the users in your team, including customer names and addresses. We recommend it is only used for server-server requests, and stored as an environment variable and kept out of git repositories. If you wish to keep a backup of the key, use a secure password manager.

Note that we don't keep a record of the key. If you lose it, you will need to generate a new one for your application.

If you are developing an application just for one company, you will only need to generate one key. If you have a platform that many companies use, every company will need to generate their own key and save it to their account on your platform.

Your first call - create a project

/projects/create

A common requirement is to create a new project from meta data that you already hold, such as a customer name, address and postcode.

You can create projects using the /projects/create endpoint.

Projects must have an "owner", which must be specified in the request POST. The owner email must be a member of the pro team that owns the API key. The owner can then subsequently share the project with other members of the team if they wish.

Fields you can pass across in the 'meta' object are: projectName customerName customerEmail customerPhone address postcode crmReference

crmReference can be used for your internal reference - it's likely that you will have a unique database ID that you want to be associated with the project. All fields are optional.

You can run this from the command line to try it out. Change the owner email to a user within the Easy PV team (probably your own if you want to be able to check it has been successful), and put your key in the X-API-KEY header.

curl -X 'POST'
  'https://sandbox.heatpunk.co.uk/api/v1/projects/create' 
  -H 'accept: application/json'
  -H 'X-API-KEY: **********KEY***********'
  -H 'Content-Type: application/json' -d '{
  "owner": "sales@midsummerenergy.co.uk",  
  "meta": {
      "customerName": "Joe Bloggs"
  }
}'

The endpoint will return a JSON object with a projectId property. You will almost certainly want to save this projectId within your own database.

https://heatpunk.co.uk/?project=872019

Congratulations! You've used our API to create a project. Read on to see how you can retrieve files and form data from a project.

Interacting with forms and files

Within Easy PV and Heatpunk, users complete forms and generate PDF reports. In your application you may want to view the completed files and forms associated with a project, and fetch completed form data and PDF documents.

To list forms for a project:

To get a list completed forms for a project, use the /api/v1/projects/forms/list endpoint. Provide projectId and userEmail as GET parameters. userEmail is necessary as the API key is shared amongst all members of your team, but projects aren't necessarily shared with all members of the team. When we receive the request we will check if the given email has the right to access the project.

curl -X 'GET' \
      'https://sandbox.heatpunk.co.uk/api/v1/projects/forms/list?projectId=872034&userEmail=sales%40midsummerenergy.co.uk' \
      -H 'accept: application/json' \ 
      -H 'X-API-KEY: ---KEY---'

This should return an object with completed forms and surveys.

{
    "forms": [
        {
            "id": "enaConnect"
        },
        {
            "id": "proposal"
        },
        {
            "id": "hpCommissioning"
        },
        {
            "id": "dno"
        }
    ],
    "surveys": [
        {
            "id": "survey"
        }
    ]
}

To retrieve form fields:

Use /api/v1/projects/forms/form.

You will need to provide the ID of the project, ID of the form (from the response above), and the userEmail. Here's an example:

curl -X 'GET' \
    'https://sandbox.heatpunk.co.uk/api/v1/projects/forms/form?projectId=872034&form=letterOfConsent&userEmail=andy%40midsummerenergy.co.uk&formCategory=forms' \
    -H 'accept: application/json' \
    -H 'X-API-KEY:  ---KEY---'
To list files saved to a project:

Use /api/v1/projects/files/list. Set the type property to projects, and provide the ID of the project and the userEmail as before. Files saved within Easy-PV are listed within the fileRegistry.uploads array of the response.

curl -X 'GET' \
    'https://sandbox.heatpunk.co.uk/api/v1/files/list?type=projects&id=872034&userEmail=andy%40midsummerenergy.co.uk' \
    -H 'accept: application/json' \
    -H 'X-API-KEY: ---KEY---'

This will return a list of files associated with the project:

{
    "fileRegistry": {
        "uploads": {
            "dno": [
                {
                    "name": "Clone of Tue Jul 30 2024 DNO commissioning form~DNO.pdf",
                    "size": 66967,
                    "created": "2024-11-06T09:08:52.258Z",
                    "modified": "2024-11-06T09:08:52.258Z",
                    "format": ".pdf"
                }
            ],
            "mcsComplianceCertificate": [
                {
                    "name": "Clone of Tue Jul 30 2024 MCS Compliance Certificate~MCS Compliance Certificate.pdf",
                    "size": 14452,
                    "created": "2024-11-06T09:08:48.566Z",
                    "modified": "2024-11-06T09:08:48.566Z",
                    "format": ".pdf"
                }
            ],
            "heatPumpProjectDesign": [
                {
                    "name": "Heat pump - design report - Clone of Tue Jul 30 2024~Heat Pump Project Design.pdf",
                    "size": 104281,
                    "created": "2024-11-06T09:08:56.370Z",
                    "modified": "2024-11-06T09:08:56.370Z",
                    "format": ".pdf"
                }
            ]
        }
    }
}

To download a file:

Use /api/v1/files/file.

Provide the same details as the previous request, plus the file category (uploads) and the file name.

curl -X 'GET' \
    'https://sandbox.heatpunk.co.uk/api/v1/files/file?type=projects&id=872034&userEmail=andy%40midsummerenergy.co.uk&fileCategory=uploads&file=Heat%20pump%20-%20design%20report%20-%20Clone%20of%20Tue%20Jul%2030%202024~Heat%20Pump%20Project%20Design.pdf&responseFormat=b64' \
    -H 'accept: application/json' \
    -H 'X-API-KEY: ---KEY---'

Setting responseFormat to either b64 or meta will include a meta object in the response. This includes a datetime string for when the file was created and last updated. b64 will also return the document as a base64-encoded string in the response. raw will just return the file as stored.

We have updated the attribute used by the API when specifying the email address of the user that owns the record so it is consistent across all our endpoints. We now always refer to this attribute as userEmail. If you previously used ownerEmail this will still work as it has been set up as an alias of userEmail.

Get project details

Easy PV and Heatpunk generate a full bill of materials for a project, and for our UK and Ireland sites you can very quickly place an order for the components from Midsummer. So you may like to import the shopping cart into your application and display an ordering link. Users love the ease of ordering all the kit for an installation.

The cart is based on the bill of materials generated by the software for a given project. The bill of materials for the project is refreshed every time the overview page of the project is opened by a user in Easy PV or Heatpunk.

To fetch project data, including the cart and order link, use the api/v1/projects/data endpoint. You need to pass in the project ID, and the user you are acting as. The user must have view rights to the project.

Sample request:

curl --location 'https://heatpunk.co.uk/api/v1/projects/data?projectId=[YOUR PROJECT ID]&userEmail=[YOUR USER EMAIL]' \
--header 'accept: application/json' \
--header 'X-API-KEY: [YOUR API KEY]'

What to expect in the response:

You will get back a projectData array which will include core project and customer information. For example:

{
    "status": "success",
    "projectData": {
        "lat": 52.23060119001846,
        "lng": 0.1403758374017583,
        "zoom": 21,
        "address": "91 Kings Hedges Rd, Cambridge , UK",
        "postcode": "CB4 2QD",
        "dateCreated": "2024-07-31 10:48:44",
        "dateModified": "2024-11-06 09:11:14",
        "projectName": "Clone of Tue Jul 30 2024",
        "customerName": "Mart",
        "buildDate": "pre2000",
        "customerPhone": "Ergnes",
        "customerEmail": "mart.ergnes@outlook.com",
        "projectType": "heat",
        "userID": "1316",
        "status": "Lead",
        "projectID": "25062",
        "altitude": 12.3244800567627,
        "geography": {
            "altitude": null,
            "distance": null,
            "hillSlope": null,
            "hillZone": null,
            "terrain": null,
            "topography": null,
            "windZone": null
        }
    }
}