StabisoDocs

API reference

Capacity

Capacity: products sold by the time slot (a room by the night, a meeting room or a person's day by the day, people's time by the hour) with the units of each slot, what is free on each day, and bookings that never take more than is free. Nothing here posts.

Operation Summary Scope Idempotency-Key
GET /v1/capacity-bookings List bookings read
POST /v1/capacity-bookings Book capacity draft required
GET /v1/capacity-bookings/{booking_id} Get a booking read
POST /v1/capacity-bookings/{booking_id}/cancel Cancel a booking draft
GET /v1/capacity-items List capacity items read
POST /v1/capacity-items Sell a product by the time slot draft required
GET /v1/capacity-items/{product_id} Get a capacity item read
PATCH /v1/capacity-items/{product_id} Change a capacity item's units draft
GET /v1/capacity-items/{product_id}/availability What is free on each day read

GET /v1/capacity-bookings

List bookings

The bookings, by first day and number, with their item, customer, days and units.

Required scope read (admin implies every scope)
Operation id list_capacity_bookings_v1_capacity_bookings_get

Parameters

In Name Type Required Description
query entity string or null Only this entity's (code or id).
query item string or null Only this item's (product code, with entity, or id).
query status "booked" | "cancelled" or null Only booked or cancelled.
query first_day string (date) or null Only those that cover a day on or after this one.
query last_day string (date) or null Only those that cover a day on or before this one.
query limit integer How many, by first day and number. (min 1; max 5000; default 500)

Example request

curl "$ERP_URL/v1/capacity-bookings" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK array of BookingOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entity": "string",
    "number": "string",
    "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "item": "string",
    "item_name": "string",
    "slot": "day",
    "customer": "string",
    "customer_name": "string",
    "first_day": "2026-09-21",
    "last_day": "2026-09-21",
    "slots": 1,
    "quantity": "string",
    "reference": "string",
    "note": "string",
    "status": "booked",
    "held_by": "string",
    "created_by": {},
    "created_at": "2026-09-21T09:30:00Z",
    "cancelled_by": {},
    "cancelled_at": "2026-09-21T09:30:00Z"
  }
]

POST /v1/capacity-bookings

Book capacity

Book units of an item in every slot from the first to the last day (both included), for a customer or none named. 409 (capacity_full, with the first day short) when a day has fewer units free than asked for. Nothing is posted. Needs an Idempotency-Key.

Required scope draft (admin implies every scope)
Idempotency-Key required
Operation id create_capacity_booking_v1_capacity_bookings_post

Request body

application/json (required): BookingInput

Field Type Required Description
entity string yes Code (or id) of the entity that sells the item.
item string yes Product code (or id) of the capacity item.
customer string or null Code (or id) of the customer it is for; omitted: none named.
first_day string (date) yes The first day (or night) booked.
last_day string (date) yes The last day (or night) booked, included: a stay that leaves on the 5th books the nights up to the 4th. At most a year after the first.
quantity decimal string yes Units booked in each slot: rooms, seats or people, or hours a day. (greater than 0)
reference string or null The customer's reference or a guest's name. (max length 100)
note string or null A note. (max length 1000)

Example request

curl -X POST "$ERP_URL/v1/capacity-bookings" \
  -H "Authorization: Bearer $ERP_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "customer": "C-CH",
  "entity": "CH01",
  "first_day": "2026-11-03",
  "item": "ROOM-DBL",
  "last_day": "2026-11-04",
  "quantity": "2",
  "reference": "Offsite Zürich Kunde AG"
}'

Responses

Status Meaning Body
201 Created BookingOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
409 The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "number": "string",
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "item": "string",
  "item_name": "string",
  "slot": "day",
  "customer": "string",
  "customer_name": "string",
  "first_day": "2026-09-21",
  "last_day": "2026-09-21",
  "slots": 1,
  "quantity": "string",
  "reference": "string",
  "note": "string",
  "status": "booked",
  "held_by": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z",
  "cancelled_by": {},
  "cancelled_at": "2026-09-21T09:30:00Z"
}

GET /v1/capacity-bookings/{booking_id}

Get a booking

The booking with its item, customer, days and units.

Required scope read (admin implies every scope)
Operation id get_capacity_booking_v1_capacity_bookings__booking_id__get

Parameters

In Name Type Required Description
path booking_id string (uuid) yes Id of the booking.

Example request

curl "$ERP_URL/v1/capacity-bookings/{booking_id}" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK BookingOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
404 The resource does not exist, or belongs to another organization (not_found). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "number": "string",
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "item": "string",
  "item_name": "string",
  "slot": "day",
  "customer": "string",
  "customer_name": "string",
  "first_day": "2026-09-21",
  "last_day": "2026-09-21",
  "slots": 1,
  "quantity": "string",
  "reference": "string",
  "note": "string",
  "status": "booked",
  "held_by": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z",
  "cancelled_by": {},
  "cancelled_at": "2026-09-21T09:30:00Z"
}

POST /v1/capacity-bookings/{booking_id}/cancel

Cancel a booking

Free its units. 409 (booking_cancelled) when it is cancelled already, and (booking_held) when a module keeps it (a hotel stay's rooms are cancelled with the stay).

Required scope draft (admin implies every scope)
Idempotency-Key not used
Operation id cancel_capacity_booking_v1_capacity_bookings__booking_id__cancel_post

Parameters

In Name Type Required Description
path booking_id string (uuid) yes Id of the booking.

Example request

curl -X POST "$ERP_URL/v1/capacity-bookings/{booking_id}/cancel" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK BookingOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
404 The resource does not exist, or belongs to another organization (not_found). ErrorEnvelope
409 The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "number": "string",
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "item": "string",
  "item_name": "string",
  "slot": "day",
  "customer": "string",
  "customer_name": "string",
  "first_day": "2026-09-21",
  "last_day": "2026-09-21",
  "slots": 1,
  "quantity": "string",
  "reference": "string",
  "note": "string",
  "status": "booked",
  "held_by": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z",
  "cancelled_by": {},
  "cancelled_at": "2026-09-21T09:30:00Z"
}

GET /v1/capacity-items

List capacity items

The products sold by the time slot, by entity and code: the slot, the units in each slot and what is booked and free today.

Required scope read (admin implies every scope)
Operation id list_capacity_items_v1_capacity_items_get

Parameters

In Name Type Required Description
query entity string or null Only this entity's (code or id).

Example request

curl "$ERP_URL/v1/capacity-items" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK array of CapacityItemOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

[
  {
    "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entity": "string",
    "code": "string",
    "name": "string",
    "unit": "string",
    "active": true,
    "slot": "day",
    "units": "string",
    "booked_today": "string",
    "free_today": "string",
    "created_by": {},
    "created_at": "2026-09-21T09:30:00Z"
  }
]

POST /v1/capacity-items

Sell a product by the time slot

Make a product sold per unit that is not goods (a room, a seat, people's time) bookable: its slot (night, day or hour, never changed) and how many units it has in each. 409 when it is already. Nothing is posted. Needs an Idempotency-Key.

Required scope draft (admin implies every scope)
Idempotency-Key required
Operation id create_capacity_item_v1_capacity_items_post

Request body

application/json (required): CapacityItemInput

Field Type Required Description
product string yes Code (or id) of the product sold by the slot: sold per unit, not goods.
entity string or null Code (or id) of the product's entity; needed with a code.
slot "day" | "hour" | "night" yes What one booking slot is: night (a hotel room), day (a meeting room, a person's day) or hour (people's time, booked in hours a day). Never changed.
units decimal string yes How many there are in each slot: rooms a night, seats or people a day, hours a day. (greater than 0)

Example request

curl -X POST "$ERP_URL/v1/capacity-items" \
  -H "Authorization: Bearer $ERP_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "entity": "CH01",
  "product": "ROOM-DBL",
  "slot": "night",
  "units": "12"
}'

Responses

Status Meaning Body
201 Created CapacityItemOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
409 The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "code": "string",
  "name": "string",
  "unit": "string",
  "active": true,
  "slot": "day",
  "units": "string",
  "booked_today": "string",
  "free_today": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z"
}

GET /v1/capacity-items/{product_id}

Get a capacity item

The item with its slot, units and what is booked and free today.

Required scope read (admin implies every scope)
Operation id get_capacity_item_v1_capacity_items__product_id__get

Parameters

In Name Type Required Description
path product_id string (uuid) yes Id of the capacity item's product (GET /v1/capacity-items).

Example request

curl "$ERP_URL/v1/capacity-items/{product_id}" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK CapacityItemOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
404 The resource does not exist, or belongs to another organization (not_found). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "code": "string",
  "name": "string",
  "unit": "string",
  "active": true,
  "slot": "day",
  "units": "string",
  "booked_today": "string",
  "free_today": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z"
}

PATCH /v1/capacity-items/{product_id}

Change a capacity item's units

Set how many units it has in each slot. 409 (capacity_booked) when fewer than are booked on a day from today on. Audited with the previous units.

Required scope draft (admin implies every scope)
Idempotency-Key not used
Operation id update_capacity_item_v1_capacity_items__product_id__patch

Parameters

In Name Type Required Description
path product_id string (uuid) yes Id of the capacity item's product (GET /v1/capacity-items).

Request body

application/json (required): CapacityItemUpdate

Field Type Required Description
units decimal string yes How many there are in each slot: rooms a night, seats or people a day, hours a day. Refused below what is booked on a day from today on. (greater than 0)

Example request

curl -X PATCH "$ERP_URL/v1/capacity-items/{product_id}" \
  -H "Authorization: Bearer $ERP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "units": "14"
}'

Responses

Status Meaning Body
200 OK CapacityItemOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
404 The resource does not exist, or belongs to another organization (not_found). ErrorEnvelope
409 The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entity": "string",
  "code": "string",
  "name": "string",
  "unit": "string",
  "active": true,
  "slot": "day",
  "units": "string",
  "booked_today": "string",
  "free_today": "string",
  "created_by": {},
  "created_at": "2026-09-21T09:30:00Z"
}

GET /v1/capacity-items/{product_id}/availability

What is free on each day

The units, the units booked and the units free on each day (for a night: the night that starts that day), at most a year at a time.

Required scope read (admin implies every scope)
Operation id capacity_availability_v1_capacity_items__product_id__availability_get

Parameters

In Name Type Required Description
path product_id string (uuid) yes Id of the capacity item's product (GET /v1/capacity-items).
query first_day string (date) or null From this day; default today.
query last_day string (date) or null To this day, included; default 13 days after the first.

Example request

curl "$ERP_URL/v1/capacity-items/{product_id}/availability" \
  -H "Authorization: Bearer $ERP_KEY"

Responses

Status Meaning Body
200 OK AvailabilityOut
401 Missing or invalid API key (unauthorized). ErrorEnvelope
403 The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). ErrorEnvelope
404 The resource does not exist, or belongs to another organization (not_found). ErrorEnvelope
422 Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. HTTPValidationError

Example response (shape)

{
  "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "code": "string",
  "slot": "day",
  "days": [
    {
      "day": "2026-09-21",
      "units": "string",
      "booked": "string",
      "free": "string"
    }
  ]
}

Schemas

AvailabilityDay

Field Type Required Description
day string (date) yes The day (for a night: the night that starts that day).
units string yes Units the item has in the slot.
booked string yes Units booked.
free string yes Units still free (never below zero).

AvailabilityOut

Field Type Required Description
product_id string (uuid) yes Id of the capacity item's product.
code string yes Product code.
slot "day" | "hour" | "night" yes What one slot is.
days array of AvailabilityDay yes Each day asked for, in order.

BookingInput

Field Type Required Description
entity string yes Code (or id) of the entity that sells the item.
item string yes Product code (or id) of the capacity item.
customer string or null Code (or id) of the customer it is for; omitted: none named.
first_day string (date) yes The first day (or night) booked.
last_day string (date) yes The last day (or night) booked, included: a stay that leaves on the 5th books the nights up to the 4th. At most a year after the first.
quantity decimal string yes Units booked in each slot: rooms, seats or people, or hours a day. (greater than 0)
reference string or null The customer's reference or a guest's name. (max length 100)
note string or null A note. (max length 1000)

BookingOut

Field Type Required Description
id string (uuid) yes Booking id.
entity string yes Entity code.
number string yes Booking number, gap-free per entity and year (BK-...).
product_id string (uuid) yes Id of the capacity item's product.
item string yes Product code of the item.
item_name string yes Product name of the item.
slot "day" | "hour" | "night" yes What one slot is.
customer string or null yes Customer code; null when none is named.
customer_name string or null yes Customer name.
first_day string (date) yes First day (or night) booked.
last_day string (date) yes Last day (or night) booked, included.
slots integer yes How many slots (days or nights) it covers.
quantity string yes Units booked in each slot.
reference string or null yes Reference.
note string or null yes Note.
status "booked" | "cancelled" yes booked or cancelled.
held_by string or null yes The module that keeps the booking (hospitality: a hotel stay's rooms), which alone cancels it; null when it was booked here.
created_by object yes Who booked it.
created_at string (date-time) yes When (UTC).
cancelled_by object or null yes Who cancelled it.
cancelled_at string (date-time) or null yes When (UTC).

CapacityItemInput

Field Type Required Description
product string yes Code (or id) of the product sold by the slot: sold per unit, not goods.
entity string or null Code (or id) of the product's entity; needed with a code.
slot "day" | "hour" | "night" yes What one booking slot is: night (a hotel room), day (a meeting room, a person's day) or hour (people's time, booked in hours a day). Never changed.
units decimal string yes How many there are in each slot: rooms a night, seats or people a day, hours a day. (greater than 0)

CapacityItemOut

Field Type Required Description
product_id string (uuid) yes Id of the product (and of the capacity item).
entity string yes Entity code.
code string yes Product code.
name string yes Product name.
unit string yes The product's unit (night, day, hour, ...).
active boolean yes Whether the product is still sold.
slot "day" | "hour" | "night" yes What one slot is: night, day or hour.
units string yes How many there are in each slot: rooms a night, seats or people a day, hours a day.
booked_today string yes Units booked for today's slot.
free_today string yes Units still free for today's slot.
created_by object yes Who started selling it by the slot.
created_at string (date-time) yes When (UTC).

CapacityItemUpdate

Field Type Required Description
units decimal string yes How many there are in each slot: rooms a night, seats or people a day, hours a day. Refused below what is booked on a day from today on. (greater than 0)
Stabiso, the Enterprise System of Record · generated from the code and its guides · release 20b7dd5b0c4d