ErgOpsDocs

API reference

Reference for the ErgOps Embedded API v1, generated from the authoritative OpenAPI specification.

New to the API? Start with Send your first API calculation, then read Create and manage API keys, Idempotency and Error handling.

Base URL#

https://api.ergops.com/v1

Test and Live are selected by the API key, not by the hostname. The API is server-to-server; browser cross-origin requests are not enabled.

Authentication#

Send your API key as an HTTP bearer token: Authorization: Bearer <API key>. Key format: ergops_test_* or ergops_live_*. See Authentication and API keys.

POST /emissions/logistics#

Calculate customer-attributed logistics emissions

Authentication
API key (Bearer)
Required scope
emissions:calculate
Operation ID
calculateLogisticsEmissions

Parameters#

NameInTypeRequiredDescription
Idempotency-KeyheaderstringYesStable retry key for one logical write. Reuse with a different material payload returns 409. At least 1 characters. Up to 200 characters.

Request body#

application/json · LogisticsRequest

FieldTypeRequiredDescription
customer_referencestringYesUp to 120 characters.
external_referencestringYesUp to 120 characters.
modestringYesOne of: ROAD, SEA, AIR.
originPlaceYesProvide at least one of: code or label. Unknown fields are rejected.
origin.codestringNoUp to 20 characters.
origin.labelstringNoUp to 200 characters.
origin.countrystringNoExactly 2 characters.
destinationPlaceYesProvide at least one of: code or label. Unknown fields are rejected.
destination.codestringNoUp to 20 characters.
destination.labelstringNoUp to 200 characters.
destination.countrystringNoExactly 2 characters.
cargoobjectYesUnknown fields are rejected.
cargo.valuenumberYesGreater than 0.
cargo.unitstringYesAlways tonne.
distanceobjectYesUnknown fields are rejected.
distance.valuenumberYesGreater than 0.
distance.unitstringYesAlways km.
activity_datestring (date)Yes
business_contextstringNoOne of: upstream, downstream. Default upstream.
factor_referencestringYesExisting governed factor key; direct factor values are not accepted.

Example request#

curl -X POST "https://api.ergops.com/v1/emissions/logistics" \
  -H "Authorization: Bearer $ERGOPS_API_KEY" \
  -H "Idempotency-Key: YOUR_IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customer_reference":"CUSTOMER_REFERENCE","external_reference":"EXTERNAL_REFERENCE","mode":"ROAD","origin":{"code":"CODE","label":"LABEL","country":"GB"},"destination":{"code":"CODE","label":"LABEL","country":"GB"},"cargo":{"value":1,"unit":"tonne"},"distance":{"value":1,"unit":"km"},"activity_date":"2026-01-31","factor_reference":"FACTOR_REFERENCE"}'

Responses#

StatusMeaningBody
200The same logical calculation was replayed idempotently
Headers: X-Request-Id, Idempotent-Replayed
—
201A new canonical calculation was created
Headers: X-Request-Id
Calculation
400Invalid requestError
401InvalidError
403EntitlementError
404Tenant-safe not foundError
409Idempotency conflictError
422ValidationError
429Technical throughput or hard contract capacity limit
Headers: Retry-After
Error
201 response fields · Calculation
FieldTypeRequiredDescription
idstring (uuid)Yes
external_referencestringYes
statusstringYesAlways succeeded.
environmentstringYesOne of: test, live.
customerobjectYes
customer.referencestringYes
activityobjectYes
activity.valuenumberYes
activity.unitstringYesAlways tkm.
emissionsobjectYes
emissions.valuenumberYes
emissions.unitstringYesAlways kgCO2e.
methodologyobjectYes
factorobjectYes
created_atstring (date-time)Yes

Example shape, generated from the schema:

{
  "id": "00000000-0000-4000-8000-000000000000",
  "external_reference": "EXTERNAL_REFERENCE",
  "status": "succeeded",
  "environment": "test",
  "customer": {
    "reference": "REFERENCE"
  },
  "activity": {
    "value": 0,
    "unit": "tkm"
  },
  "emissions": {
    "value": 0,
    "unit": "kgCO2e"
  },
  "methodology": {},
  "factor": {},
  "created_at": "2026-01-31T12:00:00Z"
}

GET /calculations/{id}#

Read a calculation from the credential's organization and environment

Authentication
API key (Bearer)
Required scope
emissions:read or emissions:calculate
Operation ID
getCalculation

Parameters#

NameInTypeRequiredDescription
idpathstring (uuid)Yes

Example request#

curl "https://api.ergops.com/v1/calculations/CALCULATION_ID" \
  -H "Authorization: Bearer $ERGOPS_API_KEY"

Responses#

StatusMeaningBody
200CalculationCalculation
401InvalidError
403EntitlementError
404Tenant-safe not foundError
429Technical throughput or hard contract capacity limit
Headers: Retry-After
Error
200 response fields · Calculation
FieldTypeRequiredDescription
idstring (uuid)Yes
external_referencestringYes
statusstringYesAlways succeeded.
environmentstringYesOne of: test, live.
customerobjectYes
customer.referencestringYes
activityobjectYes
activity.valuenumberYes
activity.unitstringYesAlways tkm.
emissionsobjectYes
emissions.valuenumberYes
emissions.unitstringYesAlways kgCO2e.
methodologyobjectYes
factorobjectYes
created_atstring (date-time)Yes

Example shape, generated from the schema:

{
  "id": "00000000-0000-4000-8000-000000000000",
  "external_reference": "EXTERNAL_REFERENCE",
  "status": "succeeded",
  "environment": "test",
  "customer": {
    "reference": "REFERENCE"
  },
  "activity": {
    "value": 0,
    "unit": "tkm"
  },
  "emissions": {
    "value": 0,
    "unit": "kgCO2e"
  },
  "methodology": {},
  "factor": {},
  "created_at": "2026-01-31T12:00:00Z"
}

GET /customers/{customerReference}#

Read a customer using its organization-scoped external reference

Authentication
API key (Bearer)
Required scope
customers:read
Operation ID
getCustomer

Parameters#

NameInTypeRequiredDescription
customerReferencepathstringYesUp to 120 characters. Pattern ^[A-Za-z0-9][A-Za-z0-9._:/-]*$.

Example request#

curl "https://api.ergops.com/v1/customers/CUSTOMER_REFERENCE" \
  -H "Authorization: Bearer $ERGOPS_API_KEY"

Responses#

StatusMeaningBody
200Customer-safe metadataCustomer
401InvalidError
403EntitlementError
404Tenant-safe not foundError
429Technical throughput or hard contract capacity limit
Headers: Retry-After
Error
200 response fields · Customer
FieldTypeRequiredDescription
referencestringYes
namestringYes
statusstringYes
country_codestring | nullNo
analyticsobject | nullNo

Example shape, generated from the schema:

{
  "reference": "REFERENCE",
  "name": "NAME",
  "status": "STATUS"
}

GET /customers/{customerReference}/emissions#

Read environment-isolated customer calculation aggregates

Authentication
API key (Bearer)
Required scope
customers:read + customer-analytics:read
Operation ID
getCustomerEmissions

Parameters#

NameInTypeRequiredDescription
customerReferencepathstringYesUp to 120 characters. Pattern ^[A-Za-z0-9][A-Za-z0-9._:/-]*$.

Example request#

curl "https://api.ergops.com/v1/customers/CUSTOMER_REFERENCE/emissions" \
  -H "Authorization: Bearer $ERGOPS_API_KEY"

Responses#

StatusMeaningBody
200Customer analyticsCustomer
401InvalidError
403EntitlementError
404Tenant-safe not foundError
429Technical throughput or hard contract capacity limit
Headers: Retry-After
Error
200 response fields · Customer
FieldTypeRequiredDescription
referencestringYes
namestringYes
statusstringYes
country_codestring | nullNo
analyticsobject | nullNo

Example shape, generated from the schema:

{
  "reference": "REFERENCE",
  "name": "NAME",
  "status": "STATUS"
}

POST Webhook: calculationEvent#

Signed calculation lifecycle event delivered to a configured endpoint

ErgOps sends this request to your endpoint. Verify it before processing — see Verify webhook signatures.

Headers#

HeaderTypeDescription
X-ErgOps-Webhook-Idstring (uuid)
X-ErgOps-Webhook-Timestampstring
X-ErgOps-Webhook-SignaturestringPattern ^v1=[a-f0-9]{64}$.

Body#

FieldTypeRequiredDescription
idstring (uuid)Yes
typestringYesOne of: calculation.succeeded, calculation.failed.
created_atstring (date-time)Yes
environmentstringYesOne of: test, live.
dataobjectYesCustomer-safe calculation result or stable error reference.

Errors#

Every error uses the same envelope. Always log request_id when contacting support.

{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "MESSAGE",
    "request_id": "00000000-0000-4000-8000-000000000000"
  }
}

Error codes defined in the contract:

  • INVALID_API_KEY
  • API_KEY_REVOKED
  • API_KEY_EXPIRED
  • INSUFFICIENT_SCOPE
  • FEATURE_NOT_ENTITLED
  • ORGANIZATION_NOT_ACTIVE
  • CUSTOMER_NOT_FOUND
  • CUSTOMER_ACCESS_DENIED
  • INVALID_REQUEST
  • IDEMPOTENCY_KEY_REQUIRED
  • IDEMPOTENCY_KEY_REUSED
  • FACTOR_NOT_FOUND
  • CALCULATION_FAILED
  • USAGE_LIMIT_REACHED
  • RATE_LIMITED
  • INTERNAL_ERROR

See Error handling for guidance.

Download the specification#

openapi.yaml (OpenAPI 3.1.0) is the authoritative contract. Use it to generate clients or import into API tools.