# Resources

To use this capability, add `octo/resources` to your `Octo-Capabilities` header.

Resources are allocated to each booking and determine availability for resource-based products (for example vehicles, rooms, or seat maps).

{% hint style="info" %}
Even for products that rely on resources, this capability is optional. If you do not provide resource selections, allocations are assigned automatically.
{% endhint %}

{% hint style="info" %}
Operations below use the `/octo` prefix.
{% endhint %}

{% openapi src="/files/9aBZzqykFPaTU7bfbNrr" path="/availability/resources" method="get" %}
[openapi.yaml](https://221588849-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7bgGIyO7QYNOfUMfxh%2Fuploads%2Fgit-blob-fa2d8cb1d7297d352c2639e6c4c6a990f2add6d7%2Fopenapi.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/9aBZzqykFPaTU7bfbNrr" path="/availability/resources" method="post" %}
[openapi.yaml](https://221588849-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7bgGIyO7QYNOfUMfxh%2Fuploads%2Fgit-blob-fa2d8cb1d7297d352c2639e6c4c6a990f2add6d7%2Fopenapi.yaml?alt=media)
{% endopenapi %}

Returns resources grouped by `resourceGroupId` for a single `availabilityId`.

### Request Fields

For `GET`, send these as query parameters. For `POST`, send them in the JSON body.

### Response Fields

Response is an array of resource-group objects.

#### Seat Object

Used in `resource.seats[]`, `availableSeats[]`, `selectedSeats[]`, and booking allocation `seats[]`.

#### Seller Object (driver/guide)

See the resource operations above for response payload examples.

{% hint style="info" %}
Each booking must allocate enough resources from every required resource group. When `resourceGroup.split` is `false`, one resource in that group must cover the full requested size.
{% endhint %}

## Booking Reservation / Update

Resource allocations are accepted on all booking write routes that call booking create/update logic:

* `POST /bookings`
* `PATCH /bookings/{uuid}`
* `POST /bookings/{uuid}/confirm`

{% hint style="info" %}
Request `resourceAllocations[].paxCount` and `resourceAllocations[].seatIds` are ignored by current booking write parsing. Pax and seat assignment are computed server-side from allocation/unit data.
{% endhint %}

{% hint style="info" %}
When `resourceAllocations` is present and non-empty, allocations not included in the submitted list are removed from the booking. Sending `resourceAllocations: []` is currently a no-op (existing allocations remain unchanged).
{% endhint %}

`resourceAllocations` is appended to serialized booking objects on:

* `POST /bookings`
* `PATCH /bookings/{uuid}`
* `POST /bookings/{uuid}/confirm`
* `GET /bookings/{uuid}`
* `GET /bookings`
* `POST /bookings/{uuid}/cancel`
* `POST /bookings/{uuid}/extend`

The same booking-response additions are also present in any other response that serializes a booking object.

Base booking schema: [Bookings](/octo-core/bookings.md#endpoints).

## Added Availability Field

This capability also adds `hasResources` to serialized availability objects returned by:

* `POST /availability`
* `POST /availability/batch`
* `booking.availability` inside serialized booking responses

Base availability schema: [Availability](/octo-core/availability.md).

{% hint style="info" %}
`hasResources` is added to `/availability` responses, not `/availability/calendar` responses.
{% endhint %}

## Schema Additions (JSON)

These are additive fragments showing only fields introduced by this capability.

### `Availability`

```json
{
  "// ...rest of availability object": "...",
  "hasResources": true
}
```

### `AvailabilityBatchRow`

```json
{
  "// ...rest of availability batch row object": "...",
  "hasResources": true
}
```

### `AvailabilityResourcesRequest`

```json
{
  "// ...rest of availability resources request object": "...",
  "resourceAllocations": [
    {
      "resourceId": "resource_coach_12"
    }
  ]
}
```

### `Booking`

```json
{
  "// ...rest of booking object": "...",
  "resourceAllocations": [
    {
      "resourceGroupId": "resource_group_front_row",
      "resourceGroup": {
        "title": "Front Row"
      },
      "resourceId": "resource_coach_12",
      "resource": {
        "title": "Coach 12"
      },
      "seatIds": [
        "seat_one",
        "seat_two"
      ],
      "seats": [
        {
          "row": "A",
          "column": "4"
        }
      ],
      "paxCount": 2
    }
  ]
}
```

### `BookingWriteRequest`

```json
{
  "// ...rest of booking write request object": "...",
  "resourceAllocations": [
    {
      "resourceId": "resource_coach_12"
    }
  ]
}
```

### `PackageAvailability`

```json
{
  "// ...rest of package availability object": "...",
  "hasResources": true
}
```


---

# Agent Instructions: 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:

```
GET https://docs.ventrata.com/capabilities/resources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
