Segment: Add
Adds a new segment to a project.
Your request should be a 'Segment Request' payload. You can see examples of all the segment requests here.
Your response will be a 'Segment response. You can see examples of all the segment responses here.
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.
Authorization
API Key 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
uuidRequest Body
application/json
We have a wide variety of segment request types, which can be explored here.
TypeScript Definitions
Use the request body type in TypeScript.
- This is the model for creating or updating a segment; please the Segment documentation if you are retrieving an existing segment.
- Every segment request extends the same base, we recommend reading the documentation for the segment type you are trying to create:
Note: we are constantly adding more segment request types all the time, and our documentation may lag this. Please reach out to your account manager if you believe a segment type is missing.
Response Body
curl -X POST "https://example.com/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/segments" \ -H "Content-Type: application/json" \ -d '{ "type": "air", "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" }, "travel_class": "business", "emitted_at": "2020-01-01" }'{ "id": "ec34f49e-ab0c-4ffa-854f-5cdfc230cbe1", "created_at": "2021-04-16T09:23:45.000000Z", "updated_at": "2021-04-16T09:23:45.000000Z", "type": "air", "tonnes_of_emissions": 2.4609454662444006, "distance": 5539.377540497169, "distance_adjusted": 5664.377540497169, "emitted_at": "2020-01-01", "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" }, "travel_class": "business"}