> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/vantage-api-reference/core-resources/orders.md).

# Orders

## Create a new order

> Create a new blood, DNA, or device test order

```json
{"openapi":"3.1.1","info":{"title":"Terra Blood DNA Device API","version":"1.0"},"servers":[{"url":"https://vantage.tryterra.co"}],"paths":{"/orders":{"post":{"summary":"Create a new order","tags":["orders"],"description":"Create a new blood, DNA, or device test order","responses":{"201":{"description":"Order created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/orders.CreateOrderResponse"}}}},"400":{"description":"Bad request - invalid JSON or validation errors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/orders.CreateOrderValidationError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errors.ProblemDetail"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/orders.CreateOrderRequest"}}},"description":"Order creation request","required":true}}}},"components":{"schemas":{"orders.CreateOrderResponse":{"description":"Response containing the created order details including tracking information","type":"object","properties":{"confirmed_lab_address":{"$ref":"#/components/schemas/common.AddressDTO"},"estimated_delivery":{"type":"string"},"order_id":{"type":"string"},"order_items":{"type":"array","items":{"$ref":"#/components/schemas/orders.OrderItemResponse"}},"order_status":{"type":"string"},"recipient_id":{"type":"string"},"tracking_number":{"type":"string"}}},"common.AddressDTO":{"description":"Physical address for shipping test kits","type":"object","properties":{"address_line_1":{"type":"string","minLength":1,"maxLength":100},"address_line_2":{"type":"string","maxLength":100},"administrative_area":{"type":"string","maxLength":50},"city":{"type":"string","minLength":1,"maxLength":50},"country_code":{"type":"string","description":"ISO 3166-1 alpha-2 (e.g., \"GB\", \"US\")"},"id":{"type":"integer"},"is_validated":{"type":"boolean"},"postal_code":{"type":"string"}},"required":["address_line_1","administrative_area","city","country_code","postal_code"]},"orders.OrderItemResponse":{"description":"Individual test kit or product in the order","type":"object","properties":{"currency":{"type":"integer"},"item_status":{"type":"integer"},"lab_tracking_number":{"type":"string"},"order_id":{"type":"string"},"order_item_id":{"type":"string"},"price_per_item_cents":{"type":"integer"},"product_type_id":{"type":"string"},"quantity":{"type":"integer"},"results_status":{"type":"string"},"variant_id":{"type":"string"}}},"orders.CreateOrderValidationError":{"description":"Validation error when creating an order","type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"},"invalid_fields":{"type":"array","description":"Per-field validation errors","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"},"tag":{"type":"string"},"value":{"type":"string"}}}}},"required":["detail","instance","status","title","type"]},"errors.ProblemDetail":{"description":"Standard error response format following RFC 7807 specification","type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"}}},"orders.CreateOrderRequest":{"description":"Request body for creating a new diagnostic test order","type":"object","properties":{"client_order_reference_id":{"description":"Your unique order identifier that you generate (for idempotency and tracking)","type":"string","minLength":1,"maxLength":100},"collection_type":{"type":"string"},"items":{"description":"Only need product_variant_id and quantity completely define what was ordered","type":"array","minItems":1,"items":{"$ref":"#/components/schemas/orders.OrderItemRequest"}},"recipient":{"description":"Details of the person who ordered. Depending on the supplier recipient is not necessarily the test-taker. Although some suppliers enforce this constraint on us.","allOf":[{"$ref":"#/components/schemas/common.RecipientDTO"}]},"requested_lab_address":{"$ref":"#/components/schemas/common.AddressDTO"},"shipping_address":{"$ref":"#/components/schemas/common.AddressDTO"}},"required":["client_order_reference_id","collection_type","items","recipient"]},"orders.OrderItemRequest":{"description":"Individual product variant and quantity in an order","type":"object","properties":{"quantity":{"type":"integer","minimum":1,"maximum":100},"variant_id":{"type":"string","minLength":1}},"required":["quantity","variant_id"]},"common.RecipientDTO":{"description":"The recipient who will receive the test kit and may or may not be the test-taker (supplier-dependent)","type":"object","properties":{"country_code":{"type":"integer"},"date_of_birth":{"type":"string"},"email":{"type":"string","maxLength":100},"first_name":{"type":"string","maxLength":50},"gender_at_birth":{"type":"string","enum":["m","f","other"]},"id":{"type":"string"},"last_name":{"type":"string","maxLength":50},"phone_number":{"type":"integer"}},"required":["country_code","date_of_birth","email","first_name","gender_at_birth","last_name","phone_number"]}}}}
```

## Get order by order ID

> Returns complete order details including items, recipient, and status

```json
{"openapi":"3.1.1","info":{"title":"Terra Blood DNA Device API","version":"1.0"},"servers":[{"url":"https://vantage.tryterra.co"}],"security":[{"BasicAuth":[]}],"components":{"securitySchemes":{"BasicAuth":{"type":"http","scheme":"basic"}},"schemas":{"orders.GetOrderResponse":{"description":"Full order information including items, recipient, address, and financials","type":"object","properties":{"client_id":{"type":"string"},"client_order_reference_id":{"type":"string"},"collection_type":{"type":"string"},"confirmed_lab_address":{"$ref":"#/components/schemas/common.AddressDTO"},"items":{"type":"array","items":{"$ref":"#/components/schemas/orders.OrderItemResponse"}},"order_financials":{"$ref":"#/components/schemas/orders.OrderFinancialDTO"},"order_id":{"type":"string"},"order_status":{"type":"string"},"recipient":{"$ref":"#/components/schemas/common.RecipientDTO"},"requested_lab_address":{"$ref":"#/components/schemas/common.AddressDTO"},"shipping_address":{"$ref":"#/components/schemas/common.AddressDTO"},"supplier_id":{"type":"string"}}},"common.AddressDTO":{"description":"Physical address for shipping test kits","type":"object","properties":{"address_line_1":{"type":"string","minLength":1,"maxLength":100},"address_line_2":{"type":"string","maxLength":100},"administrative_area":{"type":"string","maxLength":50},"city":{"type":"string","minLength":1,"maxLength":50},"country_code":{"type":"string","description":"ISO 3166-1 alpha-2 (e.g., \"GB\", \"US\")"},"id":{"type":"integer"},"is_validated":{"type":"boolean"},"postal_code":{"type":"string"}},"required":["address_line_1","administrative_area","city","country_code","postal_code"]},"orders.OrderItemResponse":{"description":"Individual test kit or product in the order","type":"object","properties":{"currency":{"type":"integer"},"item_status":{"type":"integer"},"lab_tracking_number":{"type":"string"},"order_id":{"type":"string"},"order_item_id":{"type":"string"},"price_per_item_cents":{"type":"integer"},"product_type_id":{"type":"string"},"quantity":{"type":"integer"},"results_status":{"type":"string"},"variant_id":{"type":"string"}}},"orders.OrderFinancialDTO":{"description":"Price breakdown including subtotal, tax, shipping, discounts","type":"object","properties":{"currency":{"description":"@Description ISO 4217 format (e.g. 840 = USD)","type":"integer"},"discount_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0}},"required":["currency","total_cents"]},"common.RecipientDTO":{"description":"The recipient who will receive the test kit and may or may not be the test-taker (supplier-dependent)","type":"object","properties":{"country_code":{"type":"integer"},"date_of_birth":{"type":"string"},"email":{"type":"string","maxLength":100},"first_name":{"type":"string","maxLength":50},"gender_at_birth":{"type":"string","enum":["m","f","other"]},"id":{"type":"string"},"last_name":{"type":"string","maxLength":50},"phone_number":{"type":"integer"}},"required":["country_code","date_of_birth","email","first_name","gender_at_birth","last_name","phone_number"]},"errors.ProblemDetail":{"description":"Standard error response format following RFC 7807 specification","type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"}}},"errors.AuthenticationError":{"description":"Authentication error response (401)","type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"}},"required":["detail","status","title","type"]}}},"paths":{"/orders/{orderID}":{"get":{"summary":"Get order by order ID","tags":["orders"],"description":"Returns complete order details including items, recipient, and status","parameters":[{"schema":{"type":"integer","minimum":1},"name":"orderID","in":"path","description":"Order ID","required":true}],"responses":{"200":{"description":"Successfully retrieved order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/orders.GetOrderResponse"}}}},"400":{"description":"Invalid order ID format","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errors.ProblemDetail"}}}},"401":{"description":"Unauthorized - invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errors.AuthenticationError"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errors.ProblemDetail"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errors.ProblemDetail"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tryterra.co/vantage-api-reference/core-resources/orders.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
