Segment: Add Async
This is the async endpoint. You can create a segment synchronously using the standard Add Segment endpoint.
Adds a new segment to a project asynchronously. This is useful if you want to add segments that will require Thrust Carbon to make slow external lookups (e.g. flight number to aircraft type lookups). Your account manager should be able to advise if you should consider this endpoint.
Your request should be a 'Segment Request' payload. You can see examples of all the segment requests here.
Your response will be a validation exception, or a {'status': 'success'} response.
Once the segment is created, you will receive a webhook containing the segment payload.
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/async" \ -H "Content-Type: application/json" \ -d '{ "type": "air", "origin": { "iata": "LHR" }, "destination": { "iata": "JFK" }, "travel_class": "business", "emitted_at": "2020-01-01" }'{ "status": "success"}