Segment: Batch add
This endpoint will batch add segments.
The fully qualified URI for this request is: https://app.thrustcarbon.com/api/2/calculator/projects/{projectId}
Want access to emissions data without a Thrust Calculator subscription? You should use our emissions API instead, which is a cheaper, non-persistent way to access emissions.
Limitations of batch requests
- We currently support a maximum of 100 calculations in a batch.
- You may send concurrent batch requests in order to perform more calculations at once.
- You may hit rate limits at 8 requests per-second (800 calculations per second). This is a soft-limit that can be raised by speaking to your account manager.
- Due to latency of external providers, Thrust Carbon will not perform flight number lookups on batch requests.
- If you wish to incorporate the aircraft type into your calculation, you should provide the
aircraft_typeparameter on the segment, rather than relying on a Thrust Carbon lookup. - If you do not know the
aircraft_typeand you wish for Thrust Carbon to conduct a lookup using the flight number, please using the singular POST segment endpoint.
- If you wish to incorporate the aircraft type into your calculation, you should provide the
Authorization
API Key AuthorizationBearer <token>
Your API Key must be provided as a bearer token. To do this, create an 'Authorization' header with a value of 'Bearer {your-api-key}' (e.g. "Authorization: Bearer xcvboy23idvh").
In: header
Path Parameters
projectId*string
ID of the calculator project
Format
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/segments/batch" \ -H "Content-Type: application/json" \ -d '{ "segments": [ { "type": "air", "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" } }, { "type": "air", "origin": { "iata": "CPH" }, "destination": { "iata": "JFK" } }, { "type": "air", "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" }, "passengers": "invalid" }, { "type": "air", "origin": { "iata": "CPH" }, "destination": { "iata": "JFK" } } ] }'{ "created_segments": { "0": { "id": "30a9d544-03c9-42b1-8d89-52b8c6a88196", "created_at": "2020-08-13T09:26:56.000000Z", "updated_at": "2020-08-13T09:26:56.000000Z", "type": "air", "tonnes_of_emissions": 0.8485803993418809, "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" } }, "1": { "id": "44bfb576-acb9-4f70-9200-e89ad4b4b8e0", "created_at": "2020-08-13T09:26:56.000000Z", "updated_at": "2020-08-13T09:26:56.000000Z", "type": "air", "tonnes_of_emissions": 0.9458074863536594, "origin": { "iata": "CPH" }, "destination": { "iata": "JFK" } }, "3": { "id": "74727b13-4fa7-4a15-b0be-bc3abeb263cb", "created_at": "2020-08-13T09:26:56.000000Z", "updated_at": "2020-08-13T09:26:56.000000Z", "type": "air", "tonnes_of_emissions": 0.9458074863536594, "origin": { "iata": "CPH" }, "destination": { "iata": "JFK" } } }, "invalid_segments": { "2": { "passengers": [ "The passengers must be an integer." ] } }}