Cercula API Specification (0.1.143)

Download OpenAPI specification:Download

License: MIT

Introduction

This spec covers the REST APIs that powers Cercula's own frontend, which is also available to third-parties for building integrations.

This documentation is generated from the main specification definition, available on GitHub.

For more information about the API, contact Cercula.

Data Model

The following describes the data model of Cercula's core entities, which power the user-facing frontend web app as well as any API-driven flows.

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│     ___                 _        ___     _   _ _          ___     _      _   _             _    _        ___  _                             │
│    / __|___ _ _ __ _  _| |__ _  | __|_ _| |_(_) |_ _  _  | _ \___| |__ _| |_(_)___ _ _  __| |_ (_)_ __  |   \(_)__ _ __ _ _ _ __ _ _ __     │
│   | (__/ -_) '_/ _| || | / _` | | _|| ' \  _| |  _| || | |   / -_) / _` |  _| / _ \ ' \(_-< ' \| | '_ \ | |) | / _` / _` | '_/ _` | '  \    │
│    \___\___|_| \__|\_,_|_\__,_| |___|_||_\__|_|\__|\_, | |_|_\___|_\__,_|\__|_\___/_||_/__/_||_|_| .__/ |___/|_\__,_\__, |_| \__,_|_|_|_|   │
│                                                    |__/                                          |_|                |___/                   │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
                                                                                                                                               
                                                                                                                                               
                                                                                                                                               
                           ┌────────┐              ╱┌────────┐         ╱┌────────┐      ╱┌──────────┐                                          
                           │Project │┼───────────┼──│ Report │┼○─────┼──│ Batch  │┼○───○─│GWP Search│                                          
                           └────────┘              ╲└────────┘         ╲└────────┘      ╲└──────────┘                                          
                               ╲│╱                                           ┼                 ┼                                               
                                ○                                            │                 │                                               
                                │                                            │                 │                                               
                                │                                            │                 │                                               
                                ┼                                            │                 ○                                               
                         ┌────────────┐                                      ┼                 ┼                                               
                         │Organisation│                                  ┌───────┐       ╱┌────────┐                                           
                         └────────────┘                                  │ Stack │┼─────○─│  Row   │                                           
                                ┼                                        └───────┘       ╲└────────┘                                           
                                │                                                                                                              
                                ┼                                                                                                              
                               ╱│╲                                                                                                             
                           ┌────────┐                                                                                                          
                           │  User  │                                                                                                          
                           └────────┘                                                                                                          

Projects and Reports

The Cercula data model is primarily oriented around the notion of construction "projects", each of which may contain one or more "reports". An organisation may have multiple projects, where a project represents the construction project being built (a house or block of houses, an apartment building, a school, or a highway, for example). Some core properties of a project, like gross internal floor area (GIFA), will affect the carbon values.

For one project, the organisation may choose to upload multiple reports (to compare carbon values across different designs).

GWP (Global Warming Potential)

A GWP calculation is broken into multiple steps, each with an intermediate data type.

  • In the case of a spreadsheet upload, the spreadsheet is parsed into a "stack", which is the user's uploaded Bill of Quantities/Bill of Materials spreadsheet broken into "row" objects
  • A "report" is created (with a UUID that relates it to a project, as above)
  • A "batch" is created and associated with the report
  • Every "row" (from the stack, generated from the spreadsheet input) is evaluated and searched for in the database
  • The report is updated with the search results, and the batch is marked as completed

Therefore the relations can be described as:

  • a report can have many batches; a batch has zero-to-one report
  • a batch has many rows; a row-search is associated with zero-to-one batch

Authentication

All endpoints expect an Authorization header containing a Bearer token. For example, Authorization: Bearer <TOKEN>.

bearer

Bearer token authentication

Security Scheme Type: HTTP
HTTP Authorization Scheme: bearer
Bearer format: JWT

carbon

Takes in material description, and returns the total carbon of the closest match we could find

Authorizations:
bearer
Request Body schema: application/json
description
required
string

Description of the material the GWP will be calulated for

quantity
number > 0

Quantity of the material

unit
required
string

Quantity of the material

length
number > 0

Length of the material (mm)

width
number > 0

Width of the material (mm)

height
number > 0

Height/thickness of the material (mm)

batchUuid
string <uuid>

The UUID of the batch associated with this search

originPostcode
string

The postcode of the construction project

gifa
number > 0

The "gross internal floor area" of the building

object or null

Responses

Request samples

Content type
application/json
{
  • "description": "blockwork internal walls",
  • "quantity": 72,
  • "unit": "m2",
  • "length": 0,
  • "width": 0,
  • "height": 0,
  • "batchUuid": "fc04296f-170f-455b-bff8-c6d7a5e9f76f",
  • "originPostcode": "string",
  • "gifa": 0,
  • "metaData": {
    }
}

Response samples

Content type
application/json
{
  • "matchDescription": "100 mm thickness wall, single skin AAC concrete block, average strength, inc. mortar, Not inc. construction waste",
  • "materialId": 0,
  • "unit": "m2",
  • "estimatedMaterialClass": {
    },
  • "description": "blockwork internal walls",
  • "quantity": 72,
  • "length": 0,
  • "width": 0,
  • "height": 0,
  • "batchUuid": "fc04296f-170f-455b-bff8-c6d7a5e9f76f",
  • "originPostcode": "string",
  • "gifa": 0,
  • "metaData": {
    },
  • "gwp": 1219.372785413016,
  • "gwpAbsoluteUncertainty": 0,
  • "gwpRelativeUncertainty": 0,
  • "a1A3": 0,
  • "a4": 0,
  • "a5": 0,
  • "b1": 0,
  • "b2": 0,
  • "b3": 0,
  • "b4": 0,
  • "c2": 0,
  • "c3": 0,
  • "c4": 0,
  • "d": 0,
  • "a1A3Uncertainty": 0,
  • "a4Uncertainty": 0,
  • "a5Uncertainty": 0,
  • "b1Uncertainty": 0,
  • "b2Uncertainty": 0,
  • "b3Uncertainty": 0,
  • "b4Uncertainty": 0,
  • "c2Uncertainty": 0,
  • "c3Uncertainty": 0,
  • "c4Uncertainty": 0,
  • "dUncertainty": 0,
  • "assumedDensity": 0,
  • "assumedHeight": 0,
  • "assumedWidth": 0,
  • "assumedLength": 0,
  • "assumedServiceLife": 0,
  • "roadTransportDistanceKM": 0,
  • "roadTransportCarbonFactor": 0,
  • "seaTransportCarbonFactor": 0,
  • "seaTransportDistanceKM": 0,
  • "landfillRatio": 0,
  • "landfillAssumedTransportDistance": 0,
  • "incinerationRatio": 0,
  • "incinerationAssumedTransportDistance": 0,
  • "recyclingOffSiteRatio": 0,
  • "recyclingOffSiteAssumedTransportDistance": 0,
  • "recyclingOnSiteAssumedTransportDistance": 0,
  • "recyclingOnSiteRatio": 0,
  • "c3DisposalEmissionFactor": 0,
  • "c4DisposalEmissionFactor": 0
}

Start a batch

Returns a batch uuid to associate with further batch requests

Authorizations:
bearer
Request Body schema: application/json
object
Default: {}

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "batchUuid": "fc04296f-170f-455b-bff8-c6d7a5e9f76f"
}

Completes batch with supplied uuid

Authorizations:
bearer
query Parameters
uuid
required
string <uuid>
Request Body schema: application/json
object
Default: {}

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "complete": true
}

project

Get list of projects from a user's organisation

Authorizations:
bearer

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Creates a new project

Authorizations:
bearer
Request Body schema: application/json
name
required
string
ribaStage
required
number
Enum: 0 1 2 3 4 5 6 7
sector
required
string
floors
required
number
gifa
required
number
valueOfWorks
required
number
country
required
string
city
required
string
address1
required
string
postcode
required
string
estimatedCompletionDate
required
string <date-time>

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "ribaStage": 0,
  • "sector": "string",
  • "floors": 0,
  • "gifa": 0,
  • "valueOfWorks": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "postcode": "string",
  • "estimatedCompletionDate": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
"string"

Updates the data of a project

Authorizations:
bearer
path Parameters
uuid
required
string
Request Body schema: application/json
name
string
ribaStage
number
Enum: 0 1 2 3 4 5 6 7
sector
string
floors
number
country
string
city
string
address1
string
postcode
string
estimatedCompletionDate
string <date-time>

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "ribaStage": 0,
  • "sector": "string",
  • "floors": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "postcode": "string",
  • "estimatedCompletionDate": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "createdAt": "2019-08-24T14:15:22Z",
  • "deleted": true,
  • "gifa": 0,
  • "id": 0,
  • "latitude": 0,
  • "longitude": 0,
  • "name": "string",
  • "organisationUuid": "string",
  • "postcode": "string",
  • "reports": [
    ],
  • "ribaStage": 0,
  • "sector": "string",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "uuid": "string",
  • "validated": true,
  • "valueOfWorks": 0,
  • "floors": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "estimatedCompletionDate": "2019-08-24T14:15:22Z"
}

Get all reports for the given project

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get project carbon totals

Gets an array of project data within an organisation - including the highest GWP for data visualisation on the frontend

Authorizations:
bearer

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a project by UUID

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Delete a project by UUID

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
1

report

Get the details of a carbon report

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
{
  • "batchUuid": "string",
  • "fileLocation": "string",
  • "fileName": "string",
  • "gifa": 0,
  • "latitude": 0,
  • "logoUrl": "string",
  • "longitude": 0,
  • "name": "string",
  • "projectName": "string",
  • "organisationUuid": "string",
  • "postcode": "string",
  • "floors": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "report": {
    },
  • "uuid": "string",
  • "valueOfWorks": 0
}

Update some fields of a carbon report

Authorizations:
bearer
path Parameters
uuid
required
string
Request Body schema: application/json
name
string
longitude
number or null
latitude
number or null
postcode
string
valueOfWorks
number

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "longitude": 0,
  • "latitude": 0,
  • "postcode": "string",
  • "valueOfWorks": 0
}

Response samples

Content type
application/json
{
  • "batchUuid": "string",
  • "fileLocation": "string",
  • "fileName": "string",
  • "gifa": 0,
  • "latitude": 0,
  • "logoUrl": "string",
  • "longitude": 0,
  • "name": "string",
  • "projectName": "string",
  • "organisationUuid": "string",
  • "postcode": "string",
  • "floors": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "report": {
    },
  • "uuid": "string",
  • "valueOfWorks": 0
}

Delete a carbon report

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
1

Get report with assumptions

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
{
  • "fileUrl": "string"
}

Start report from Stack array

Authorizations:
bearer
Request Body schema: application/json
uuid
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "uuid": "string",
  • "stack": [
    ]
}

Response samples

Content type
application/json
{
  • "batchUuid": "string",
  • "fileLocation": "string",
  • "fileName": "string",
  • "gifa": 0,
  • "latitude": 0,
  • "logoUrl": "string",
  • "longitude": 0,
  • "name": "string",
  • "projectName": "string",
  • "organisationUuid": "string",
  • "postcode": "string",
  • "floors": 0,
  • "country": "string",
  • "city": "string",
  • "address1": "string",
  • "report": {
    },
  • "uuid": "string",
  • "valueOfWorks": 0
}

Update report

Authorizations:
bearer
Request Body schema: application/json
uuid
required
string <uuid>
required
Array of objects
batchUuid
required
string <uuid>

Responses

Request samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "output": [
    ],
  • "batchUuid": "fc04296f-170f-455b-bff8-c6d7a5e9f76f"
}

Response samples

Content type
application/json
0
0

Create a report

Authorizations:
bearer
Request Body schema: application/json
projectId
required
number
fileName
required
string
file
required
string
name
string

Responses

Request samples

Content type
application/json
{
  • "projectId": 0,
  • "fileName": "string",
  • "file": "string",
  • "name": "string"
}

Response samples

Content type
application/json
1

Mark a report as validated

Authorizations:
bearer
Request Body schema: application/json
uuid
required
string
validated
required
boolean

Responses

Request samples

Content type
application/json
{
  • "uuid": "string",
  • "validated": true
}

Response samples

Content type
application/json
1

Trigger a report to be emailed

Authorizations:
bearer
Request Body schema: application/json
link
required
string
fileName
required
string
organisation
required
string
to
required
Array of strings <email> [ items <email > ]

Responses

Request samples

Content type
application/json
{
  • "link": "string",
  • "fileName": "string",
  • "organisation": "string",
  • "to": [
    ]
}

Response samples

Content type
application/json
{ }

Get all reports for the current user's org

Authorizations:
bearer

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a report batch

Authorizations:
bearer
query Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Build a report batch

Authorizations:
bearer
query Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
1

user

Get details of current user

Authorizations:
bearer

Responses

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Create a new user

Authorizations:
bearer
Request Body schema: application/json
name
required
string

The user's name

email
required
string <email>

The user's email address, also used as the login username

isOrgAdmin
required
boolean

Whether or not the user is an admin of their organisation

organisationId
required
number

The organisation ID for the organisation with which the user is associated

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "email": "user@example.com",
  • "isOrgAdmin": true,
  • "organisationId": 0
}

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Activate a user (generates a password and allows a user access to the platform)

Authorizations:
bearer
Request Body schema: application/json
uuid
required
string

The user's uuid

name
required
string

The user's name

email
required
string

The user's email address

Responses

Request samples

Content type
application/json
{
  • "uuid": "string",
  • "name": "string",
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Updates the the logged in user

Authorizations:
bearer
Request Body schema: application/json
name
required
string
email
required
string <email>
isOrgAdmin
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "email": "user@example.com",
  • "isOrgAdmin": true
}

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Updates the a specified user

Authorizations:
bearer
path Parameters
uuid
required
string
Request Body schema: application/json
name
required
string
email
required
string <email>
isOrgAdmin
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "email": "user@example.com",
  • "isOrgAdmin": true
}

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Updates the password of the logged in user

Authorizations:
bearer
Request Body schema: application/json
oldPassword
required
string
newPassword
required
string

Responses

Request samples

Content type
application/json
{
  • "oldPassword": "string",
  • "newPassword": "string"
}

Response samples

Content type
application/json
{
  • "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  • "name": "string",
  • "email": "string",
  • "isOrgAdmin": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "organisation": {
    }
}

Deletes a user

Authorizations:
bearer
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
1

internal

Get ricswords and units from Carbon API

Authorizations:
bearer

Responses

Response samples

Content type
application/json
{
  • "units": [
    ],
  • "ricswords": [
    ]
}

misc

Get an augmented bill-of-quantities

Authorizations:
bearer
Request Body schema: application/json
staging
required
boolean

If true, staging (non-production) data will be used

fileId
required
string <uuid>
fileType
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "staging": true,
  • "fileId": "a1c6a2ab-4b01-4253-b4c9-70e04b3b48fc",
  • "fileType": "string",
  • "batch": [
    ]
}

Response samples

Content type
application/json
{
  • "statusCode": 401,
  • "payload": {
    }
}

Get a report PDF

Authorizations:
bearer
Request Body schema: application/json
template
required
string
required
object

Responses

Request samples

Content type
application/json
{
  • "template": "string",
  • "report": {
    }
}

Response samples

Content type
application/json
"string"