> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voyantcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Price Departure

> Calculate departure pricing, including rules, rooms, addons, and tax breakdown.

## Endpoints

| Method | Path                                                            | Description                                          |
| ------ | --------------------------------------------------------------- | ---------------------------------------------------- |
| POST   | `/v1/departures/:id/price`                                      | Calculate pricing for a departure (top-level).       |
| GET    | `/v1/departures/:id/price`                                      | Querystring-friendly pricing (requires `productId`). |
| POST   | `/v1/products/{productIdOrSlug}/departures/{departureId}/price` | Calculate pricing scoped to a product (ID or slug).  |
| GET    | `/v1/products/{productIdOrSlug}/departures/{departureId}/price` | Querystring-friendly pricing scoped to a product.    |

For nested routes, `productId` is inferred from the path (or slug). Use the nested form when you prefer slug addressing.

## Path Parameters

<ParamField path="id" type="uuid" required>Departure ID.</ParamField>

## Body Parameters

<ParamField name="productId" type="uuid" required>Associated product ID (inferred for nested routes).</ParamField>
<ParamField name="ratePlanId" type="uuid">Specific rate plan to evaluate.</ParamField>
<ParamField name="currency" type="string">Override currency (ISO 4217). Defaults to product currency.</ParamField>
<ParamField name="applyRules" type="boolean">Set to <code>false</code> to skip pricing rules (defaults to <code>true</code>).</ParamField>
<ParamField name="buyerType" type="string">`B2C` (default) or `B2B` for tax resolution.</ParamField>
<ParamField name="buyerVatId" type="string">Buyer VAT identifier (used for B2B reverse-charge logic).</ParamField>
<ParamField name="pax" type="object" required>Passenger counts.</ParamField>

<Expandable title="`pax` object">
  <ParamField name="pax.adults" type="integer" required>Number of adults (min 1).</ParamField>
  <ParamField name="pax.children" type="integer">Number of children (defaults to 0).</ParamField>
  <ParamField name="pax.infants" type="integer">Number of infants (defaults to 0).</ParamField>
</Expandable>

<ParamField name="optionKey" type="string">Pricing option key for per-option products.</ParamField>
<ParamField name="rooms" type="array">Room selections for per-room pricing.</ParamField>

<Expandable title="Room object">
  <ParamField name="rooms[].categoryKey" type="string" required>Room category identifier.</ParamField>
  <ParamField name="rooms[].typeId" type="uuid">Specific room type ID.</ParamField>
  <ParamField name="rooms[].occupancy" type="integer" required>Occupancy for the room.</ParamField>
  <ParamField name="rooms[].quantity" type="integer" required>Number of rooms in this category.</ParamField>
</Expandable>

<ParamField name="addons" type="array">Selected addons/extensions.</ParamField>

<Expandable title="Addon object">
  <ParamField name="addons[].id" type="uuid" required>Addon (extension) ID.</ParamField>
  <ParamField name="addons[].quantity" type="integer" required>Quantity for the addon.</ParamField>
</Expandable>

## Headers

<ParamField header="Authorization" type="string">Bearer token (workspace API key).</ParamField>
<ParamField header="content-type" type="string">`application/json`</ParamField>

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.voyantcloud.com/v1/departures/dep_456/price" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "productId": "prod_123",
      "buyerType": "B2B",
      "buyerVatId": "RO12345678",
      "pax": { "adults": 2, "children": 0, "infants": 0 },
      "rooms": [
        { "categoryKey": "double", "occupancy": 2, "quantity": 1 }
      ],
      "addons": [
        { "id": "ext_001", "quantity": 1 }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://api.voyantcloud.com/v1/departures/dep_456/price", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({
      productId: "prod_123",
      currency: "EUR",
      pax: { adults: 2, children: 1, infants: 0 },
      applyRules: true,
    }),
  })
  const quote = await res.json()
  ```

  ```python Python theme={null}
  import os, requests

  payload = {
    "productId": "prod_123",
    "pax": {"adults": 2, "children": 1, "infants": 0},
    "addons": [{"id": "ext_001", "quantity": 2}],
  }

  resp = requests.post(
    "https://api.voyantcloud.com/v1/departures/dep_456/price",
    headers={
      "Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}",
      "content-type": "application/json",
    },
    json=payload,
  )
  price = resp.json()

  curl -X POST "https://api.voyantcloud.com/v1/products/paris-city-break/departures/dep_456/price" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{ "pax": { "adults": 2 } }'
  ```
</RequestExample>

## Response Fields

<ResponseField name="total" type="number" required>Total amount (gross).</ResponseField>
<ResponseField name="net" type="number" required>Subtotal before tax.</ResponseField>
<ResponseField name="tax" type="number" required>Total tax amount.</ResponseField>
<ResponseField name="gross" type="number" required>Alias for `total`.</ResponseField>
<ResponseField name="taxesIncluded" type="boolean" required>Whether taxes are included in pricing.</ResponseField>
<ResponseField name="breakdown" type="object" required>Detailed line items and taxes.</ResponseField>

<Expandable title="`breakdown` object">
  <ResponseField name="base" type="object">Base price summary.</ResponseField>
  <ResponseField name="lines" type="array">Itemized pricing lines (rules, addons, rooms).</ResponseField>
  <ResponseField name="taxes" type="array">Applied taxes with rate and amount.</ResponseField>
</Expandable>

## Response Example

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "breakdown": {
      "base": { "label": "Base", "amount": 1450 },
      "lines": [
        { "label": "Base fare", "amount": 1200 },
        { "label": "Extension: Traditional taverna", "qty": 1, "unitAmount": 150, "amount": 150 }
      ],
      "addons": [],
      "taxes": [
        { "rate": 9, "amount": 130.5, "jurisdiction": null }
      ]
    },
    "total": 1580.5,
    "net": 1450,
    "tax": 130.5,
    "gross": 1580.5,
    "taxesIncluded": false
  }
  ```
</ResponseExample>

<Tip>Pricing honors workspace tax settings, market rules, and rate plan tax codes. Set <code>applyRules</code> to <code>false</code> to retrieve raw base prices without adjustments.</Tip>
