Create calculation
POST/calculations
Calculates carbon emission for one or more transactions. If the request contains a transaction with an unsupported merchant category (MCC) the response still contains that item but without any values returned, except the reference which is echoed back.
Request
Header Parameters
Partner identification in case the request is proxied by another partner
- application/json
Body
required
Transaction information required to perform the calculation
Array [
]
cardTransactions
object[]
required
Possible values: >= 1
, <= 5000
Possible values: non-empty
and <= 100 characters
Any unique reference to the transaction to be used for mapping back with the result on the response
Possible values: non-empty
and <= 4 characters
, Value must match regular expression [0-9]{1,4}
Merchant Category Code in ISO 18245 format
amount
object
required
Expresses a monetary amount
Possible values: >= -1000000000
and <= 1000000000
Possible values: >= 3 characters
and <= 3 characters
, Value must match regular expression ^(EUR|GBP|RUB|SEK|USD)$
Currency in ISO 4217 code format; EUR, GBP, RUB, SEK or USD
Responses
- 200
- 400
- 401
- 403
- 405
- 415
- 429
- 500
- default
Calculation response
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
transactionFootprints
object[]
Possible values: non-empty
and <= 100 characters
A reference to the transaction this calculation was based on (from request)
The category ID of the transaction, can be retrieved from /categories
The transaction's CO2 emission in grams
The transaction's CO2 emission in ounces
carbonSocialCost
object
Expresses a monetary amount
Possible values: >= -1000000000
and <= 1000000000
Possible values: >= 3 characters
and <= 3 characters
, Value must match regular expression ^(EUR|GBP|RUB|SEK|USD)$
Currency in ISO 4217 code format; EUR, GBP, RUB, SEK or USD
{
"transactionFootprints": [
{
"reference": "string",
"categoryId": 0,
"carbonEmissionInGrams": 0,
"carbonEmissionInOunces": 0,
"carbonSocialCost": {
"value": 0,
"currency": "string"
}
}
]
}
Bad request
- application/json
- Schema
- Example (from schema)
Schema
Array [
BAD_REQUEST
- Malformed request, please advice the description and details fields for more informationFORBIDDEN
- Insufficient scope to access the resourceINTERNAL_SERVER_ERROR
- Unexpected server errorMETHOD_NOT_ALLOWED
- Method not allowedUNSUPPORTED_MEDIA_TYPE
- Unsupported media typeSERVICE_UNAVAILABLE
- Service is unavailable]
errors
object[]
required
Errors
Possible values: non-empty
and <= 100 characters
The application name that generated this error.
Possible values: non-empty
and <= 100 characters
A unique constant identifying the error case encountered during request processing.
Possible values: >= 10 characters
and <= 1000 characters
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Possible values: <= 5000 characters
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "Doconomy",
"reasonCode": "BAD_REQUEST",
"description": "cardTransactions[0].mcc must match \\\"[0-9]{1,4}\\\"",
"recoverable": false,
"details": "string"
}
]
}
Unauthorized client
Insufficient scope for accessing this resource
- application/json
- Schema
- Example (from schema)
Schema
Array [
BAD_REQUEST
- Malformed request, please advice the description and details fields for more informationFORBIDDEN
- Insufficient scope to access the resourceINTERNAL_SERVER_ERROR
- Unexpected server errorMETHOD_NOT_ALLOWED
- Method not allowedUNSUPPORTED_MEDIA_TYPE
- Unsupported media typeSERVICE_UNAVAILABLE
- Service is unavailable]
errors
object[]
required
Errors
Possible values: non-empty
and <= 100 characters
The application name that generated this error.
Possible values: non-empty
and <= 100 characters
A unique constant identifying the error case encountered during request processing.
Possible values: >= 10 characters
and <= 1000 characters
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Possible values: <= 5000 characters
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "Doconomy",
"reasonCode": "BAD_REQUEST",
"description": "cardTransactions[0].mcc must match \\\"[0-9]{1,4}\\\"",
"recoverable": false,
"details": "string"
}
]
}
Method not allowed
- application/json
- Schema
- Example (from schema)
Schema
Array [
BAD_REQUEST
- Malformed request, please advice the description and details fields for more informationFORBIDDEN
- Insufficient scope to access the resourceINTERNAL_SERVER_ERROR
- Unexpected server errorMETHOD_NOT_ALLOWED
- Method not allowedUNSUPPORTED_MEDIA_TYPE
- Unsupported media typeSERVICE_UNAVAILABLE
- Service is unavailable]
errors
object[]
required
Errors
Possible values: non-empty
and <= 100 characters
The application name that generated this error.
Possible values: non-empty
and <= 100 characters
A unique constant identifying the error case encountered during request processing.
Possible values: >= 10 characters
and <= 1000 characters
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Possible values: <= 5000 characters
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "Doconomy",
"reasonCode": "BAD_REQUEST",
"description": "cardTransactions[0].mcc must match \\\"[0-9]{1,4}\\\"",
"recoverable": false,
"details": "string"
}
]
}
Unsupported media type
- application/json
- Schema
- Example (from schema)
Schema
Array [
BAD_REQUEST
- Malformed request, please advice the description and details fields for more informationFORBIDDEN
- Insufficient scope to access the resourceINTERNAL_SERVER_ERROR
- Unexpected server errorMETHOD_NOT_ALLOWED
- Method not allowedUNSUPPORTED_MEDIA_TYPE
- Unsupported media typeSERVICE_UNAVAILABLE
- Service is unavailable]
errors
object[]
required
Errors
Possible values: non-empty
and <= 100 characters
The application name that generated this error.
Possible values: non-empty
and <= 100 characters
A unique constant identifying the error case encountered during request processing.
Possible values: >= 10 characters
and <= 1000 characters
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Possible values: <= 5000 characters
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "Doconomy",
"reasonCode": "BAD_REQUEST",
"description": "cardTransactions[0].mcc must match \\\"[0-9]{1,4}\\\"",
"recoverable": false,
"details": "string"
}
]
}
Too many requests, check the headers X-RateLimit-Limit-second and X-RateLimit-Remaining-second
Unexpected server error
- application/json
- Schema
- Example (from schema)
Schema
Array [
BAD_REQUEST
- Malformed request, please advice the description and details fields for more informationFORBIDDEN
- Insufficient scope to access the resourceINTERNAL_SERVER_ERROR
- Unexpected server errorMETHOD_NOT_ALLOWED
- Method not allowedUNSUPPORTED_MEDIA_TYPE
- Unsupported media typeSERVICE_UNAVAILABLE
- Service is unavailable]
errors
object[]
required
Errors
Possible values: non-empty
and <= 100 characters
The application name that generated this error.
Possible values: non-empty
and <= 100 characters
A unique constant identifying the error case encountered during request processing.
Possible values: >= 10 characters
and <= 1000 characters
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Possible values: <= 5000 characters
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "Doconomy",
"reasonCode": "BAD_REQUEST",
"description": "cardTransactions[0].mcc must match \\\"[0-9]{1,4}\\\"",
"recoverable": false,
"details": "string"
}
]
}
Default response
Response Headers
X-RateLimit-Limit-second
integer
Request limit per second
X-RateLimit-Remaining-second
integer
Number of requests left for the time window