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

# GET /v1/scheduling/resources/:id/occupancy

> Night-by-night occupancy of a night resource: how much is used, how much is left and whether the night is blocked.

Returns one entry per night of the range for a `night` resource. Use it to paint a calendar where the customer picks check-in and check-out, disabling the nights with no room.

A night counts every stay that sleeps there and every older resource appointment of that day. A night inside a block the business set on the resource (maintenance, a private event) comes back `blocked`, with nothing left.

## Endpoint

```
GET https://api.keebai.com/v1/scheduling/resources/:id/occupancy
```

## Required scope

`scheduling:availability:read`

## Path params

* `id`: resource id. It must be a night resource.

## Query params

```json theme={"system"}
{
  "from": "2026-12-01",
  "to": "2026-12-08"
}
```

* `from`: first night, `YYYY-MM-DD`. Required.
* `to`: the day after the last night (excluded), `YYYY-MM-DD`. Required. At most 92 nights after `from`.

## Example request

```bash curl theme={"system"}
curl -G https://api.keebai.com/v1/scheduling/resources/665f00000000000000000a01/occupancy \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  --data-urlencode "from=2026-12-01" \
  --data-urlencode "to=2026-12-07"
```

## Response

### 200 OK

```json theme={"system"}
[
  { "date": "2026-12-01", "used": 6, "remaining": 4, "blocked": false },
  { "date": "2026-12-02", "used": 7, "remaining": 3, "blocked": false },
  { "date": "2026-12-03", "used": 7, "remaining": 3, "blocked": false },
  { "date": "2026-12-04", "used": 6, "remaining": 4, "blocked": false },
  { "date": "2026-12-05", "used": 2, "remaining": 8, "blocked": false },
  { "date": "2026-12-06", "used": 0, "remaining": 0, "blocked": true }
]
```

* `used`: guests that night in a `shared` resource (the sum of the party sizes), or `1` when an `exclusive` resource is taken.
* `remaining`: what is left: capacity minus `used` in a `shared` resource, `1` or `0` in an `exclusive` one.
* `blocked`: the business blocked the resource that night. `remaining` is `0` whatever `used` says.

### 400 Bad Request

```json theme={"system"}
{
  "error": {
    "code": "RESOURCE_BOOKING_UNIT_MISMATCH",
    "message": "Este recurso se reserva por bloque, no por noche"
  }
}
```

Also `STAY_INVALID_RANGE` when `to` is not after `from` or the range is longer than 92 nights.

### 404 Not Found

`RESOURCE_NOT_FOUND`: the resource does not exist or belongs to another company.

### 401 Unauthorized · 403 Forbidden

Same semantics as the rest of the public API.


## OpenAPI

````yaml GET /v1/scheduling/resources/{id}/occupancy
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/scheduling/resources/{id}/occupancy:
    get:
      tags:
        - scheduling-resources
      summary: Night-by-night occupancy of a night resource
      operationId: PublicResourcesController_occupancy
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: First night.
          schema:
            example: '2026-12-01'
            type: string
        - name: to
          required: true
          in: query
          description: Excluded. At most 92 nights after from.
          schema:
            example: '2026-12-08'
            type: string
      responses:
        '200':
          description: ''
      security:
        - PAT: []
components:
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.