Everything you need to integrate with the ClauseHub Energy API. Endpoints, authentication, response formats, and more.
The ClauseHub Energy API provides standardised access to UK energy tariff data in JSON:API format. All requests and responses use the application/vnd.api+json content type.
All authenticated endpoints require a valid Supabase JWT token passed as a Bearer token in the Authorization header. Tokens are issued by the ClauseHub authentication service and encode the user's role and permissions.
The API enforces role-based access control with three roles:
GET /energy/suppliers HTTP/1.1 Host: api.clausehub.net Accept: application/vnd.api+json Authorization: Bearer <your-jwt-token>
If the token is missing or invalid, the API returns a 401 Unauthorized error. If the token is valid but the user lacks permission for the requested operation, the API returns 403 Forbidden.
All endpoints are relative to the base URL https://api.clausehub.net/energy.
| Method | Endpoint | Description |
|---|---|---|
| Health & Schema | ||
| GET | /health | Health check |
| GET | /schema | OpenAPI specification |
| Suppliers | ||
| GET | /suppliers | List all suppliers |
| POST | /suppliers | Create a supplier |
| GET | /suppliers/{id} | Get a single supplier |
| PATCH | /suppliers/{id} | Update a supplier |
| DELETE | /suppliers/{id} | Delete a supplier |
| GET | /suppliers/{id}/versions | List supplier version history |
| Tariffs | ||
| GET | /suppliers/{id}/tariffs | List tariffs for a supplier |
| POST | /suppliers/{id}/tariffs | Create a tariff |
| GET | /suppliers/{id}/tariffs/{tariffId} | Get a single tariff |
| PATCH | /suppliers/{id}/tariffs/{tariffId} | Update a tariff |
| DELETE | /suppliers/{id}/tariffs/{tariffId} | Delete a tariff |
| POST | /suppliers/{id}/tariffs/bulk | Bulk create tariffs |
| GET | /suppliers/{id}/tariffs/{tariffId}/versions | List tariff version history |
| Search | ||
| GET | /tariffs/search | Search tariffs (authenticated) |
| GET | /tariffs/search/public | Search tariffs (public, no auth) |
| GET | /tariffs/recent | List recently updated tariffs |
| Lookup Tables | ||
| GET | /tariff-types | List tariff types |
| POST | /tariff-types | Create a tariff type |
| GET | /tariff-types/{id} | Get a tariff type |
| PATCH | /tariff-types/{id} | Update a tariff type |
| DELETE | /tariff-types/{id} | Delete a tariff type |
| GET | /tariff-types/{id}/versions | Tariff type version history |
| GET | /fuel-types | List fuel types |
| POST | /fuel-types | Create a fuel type |
| GET | /fuel-types/{id} | Get a fuel type |
| PATCH | /fuel-types/{id} | Update a fuel type |
| DELETE | /fuel-types/{id} | Delete a fuel type |
| GET | /fuel-types/{id}/versions | Fuel type version history |
| GET | /payment-types | List payment types |
| POST | /payment-types | Create a payment type |
| GET | /payment-types/{id} | Get a payment type |
| PATCH | /payment-types/{id} | Update a payment type |
| DELETE | /payment-types/{id} | Delete a payment type |
| GET | /payment-types/{id}/versions | Payment type version history |
| GET | /regions | List regions |
| POST | /regions | Create a region |
| GET | /regions/{id} | Get a region |
| PATCH | /regions/{id} | Update a region |
| DELETE | /regions/{id} | Delete a region |
| GET | /regions/{id}/versions | Region version history |
All responses conform to the JSON:API specification. List endpoints return a top-level links object for pagination alongside a data array.
{
"links": {
"self": "/energy/suppliers?page[number]=1&page[size]=20",
"first": "/energy/suppliers?page[number]=1&page[size]=20",
"last": "/energy/suppliers?page[number]=3&page[size]=20",
"next": "/energy/suppliers?page[number]=2&page[size]=20",
"prev": null
},
"data": [
{
"type": "suppliers",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"name": "Octopus Energy",
"version": 1,
"status": "active",
"createdAt": "2025-10-15T09:30:00Z",
"updatedAt": "2025-10-15T09:30:00Z"
}
}
]
}
Single-resource endpoints return the same structure, but data is an object rather than an array.
The Energy API implements immutable versioning for full audit traceability. Every resource carries a version field that increments on each change.
active./versions endpoint.archived. No data is physically deleted. The full history remains available.Every resource type exposes a /versions endpoint that returns the complete version history, ordered by version number descending. This provides a full audit trail of every change made to the resource.
GET /energy/suppliers/a1b2c3d4/versions # Returns all versions of this supplier, newest first
Errors follow the JSON:API error format. The response body contains an errors array with one or more error objects:
{
"errors": [
{
"status": "422",
"title": "Unprocessable Entity",
"detail": "The field 'name' is required.",
"source": {
"pointer": "/data/attributes/name"
}
}
]
}
| Code | Meaning | Description |
|---|---|---|
| 401 | Unauthorized | Missing or invalid JWT token. |
| 403 | Forbidden | Valid token, but insufficient permissions for this operation. |
| 404 | Not Found | The requested resource does not exist. |
| 409 | Conflict | A resource with the same unique identifier already exists. |
| 415 | Unsupported Media Type | Request Content-Type must be application/vnd.api+json. |
| 422 | Unprocessable Entity | Validation failed. Check the detail and source fields. |
| 429 | Too Many Requests | Rate limit exceeded. Wait and retry. |
| 500 | Internal Server Error | An unexpected error occurred on the server. |