Skip to main content
Was this helpful?

Resource API

Resource Catalog

Manage resource types, concrete resources, pricing, and public booking entry points

This page covers the authenticated resource surface for the enterprise reservation system. Resource types define the service and pricing model. Resources are the concrete items that can be assigned to reservations.

JWT or user API keyActive organisationPricing configurationPublic booking tokens

Authentication and Permissions

  • All routes on this page require authentication.
  • The active organisation comes from the authenticated context.
  • Clients do not send organisationId for resource-type or resource creation.
  • Resource and resource-type reads are always filtered to the active organisation.

Endpoint Reference

Resource Types

MethodPathPurposeRequest or queryAuthSource
POST/api/resource-typesCreate a resource type in the active organisation.Body: type fieldsJWT or user API keyresource-types/resource-types.controller.ts
GET/api/resource-typesList resource types in the active organisation.NoneJWT or user API keyresource-types/resource-types.controller.ts
GET/api/resource-types/:idGet one resource type.Path: idJWT or user API keyresource-types/resource-types.controller.ts
PATCH/api/resource-types/:idUpdate a resource type.Path: id, body: partial type fieldsJWT or user API keyresource-types/resource-types.controller.ts
DELETE/api/resource-types/:idDelete a resource type.Path: idJWT or user API keyresource-types/resource-types.controller.ts
PATCH/api/resource-types/:id/colorUpdate only the resource-type color.Path: id, body: colorJWT or user API keyresource-types/resource-types.controller.ts

Resources

MethodPathPurposeRequest or queryAuthSource
POST/api/resourcesCreate a resource.Body: name,description,capacity,resourceTypeId,managedByIdJWT or user API keyresources/resources.controller.ts
GET/api/resourcesList resources.Query: resourceTypeId?JWT or user API keyresources/resources.controller.ts
GET/api/resources/:idGet one resource.Path: idJWT or user API keyresources/resources.controller.ts
PATCH/api/resources/:idUpdate a resource.Path: id, body: partial resource fieldsJWT or user API keyresources/resources.controller.ts
DELETE/api/resources/:idDelete a resource.Path: idJWT or user API keyresources/resources.controller.ts
GET/api/resources/:id/public-tokenRead the public booking token for a resource.Path: idJWT or user API keyresources/resources.controller.ts
POST/api/resources/:id/regenerate-tokenRegenerate the public booking token for a resource.Path: idJWT or user API keyresources/resources.controller.ts

Request Shapes

Resource types

CreateResourceTypeDto and UpdateResourceTypeDto

  • name: required on create
  • description: optional string
  • minBookingDuration: optional int, minimum 1
  • bufferTime: optional int, minimum 0
  • availabilityMode: optional enum continuous|shifts
  • customerInfoFields: optional string array
  • waitlistEnabled: optional boolean
  • recurringEnabled: optional boolean
  • bookingMode: optional enum SINGLE_RESOURCE|POOL|BOTH
  • color: optional string
  • icon: optional string
  • schedulePolicy: optional schedule-override object
    • operatingHours: optional weekly array of { dayOfWeek, openTime, closeTime, isActive }
    • shiftSchedule: optional weekly array of { dayOfWeek, slots[] }
  • pricingEnabled: optional boolean
  • paymentRequired: optional boolean
  • priceAmount: optional integer in minor units
  • priceCurrency: optional Stripe-supported three-letter currency code
  • isActive: update-only optional boolean
  • organisationId: not accepted from the client; the server derives it from the active organisation

Resources

CreateResourceDto and UpdateResourceDto

  • name: required on create
  • description: optional string
  • capacity: optional int, minimum 1
  • resourceTypeId: required on create
  • managedById: optional int
  • operatingHoursOverrides: compatibility bridge for resource-level opening hours
  • schedulePolicy: optional resource-level schedule override object
    • availabilityMode: optional continuous|shifts
    • operatingHours: optional weekly array of { dayOfWeek, openTime, closeTime, isActive }
    • shiftSchedule: optional weekly array of { dayOfWeek, slots[] }
  • parentResourceId: optional positive int used for seeded capacity child resources
  • isCapacityChild: optional boolean, system-managed for seeded capacity lanes
  • capacityLaneIndex: optional positive int lane number for capacity child resources
  • isActive: update-only optional boolean

Query

  • ResourceListQueryDto.resourceTypeId: optional int >= 1

Example Calls

Create a resource type

curl -X POST "$PRIMECAL_API/api/resource-types" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Meeting Room",
"bookingMode": "BOTH",
"minBookingDuration": 30,
"bufferTime": 15,
"pricingEnabled": true,
"paymentRequired": true,
"priceAmount": 12500,
"priceCurrency": "usd",
"color": "#0ea5e9"
}'

Create a resource

curl -X POST "$PRIMECAL_API/api/resources" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Room A",
"resourceTypeId": 3,
"capacity": 1
}'

Response and Behavior Notes

  • Resource types and resources cannot cross organisation boundaries.
  • Price and currency always come from the resource type, never from the client.
  • bookingMode determines whether the booking flow may stay on one concrete resource, allocate from a pool, or allow both styles.
  • When a parent resource is saved with capacity > 1, PrimeCalendar seeds child resources that represent the allocatable capacity lanes.
  • Once child lanes exist, booking and availability flows flatten the parent out and treat the child lanes as the real schedulable resources.
  • Resource list reads are returned in parent/lane order so editors can manage seeded child lanes cleanly.
  • availabilityMode=continuous keeps the resource type's minBookingDuration and bufferTime logic, constrained by the resolved opening hours.
  • availabilityMode=shifts switches availability generation to exact slot matching from schedulePolicy.shiftSchedule.
  • Schedule precedence resolves in this order: organisation defaults, then resource type overrides, then resource overrides. Each override replaces the whole schedule section it sets.
  • Public-token routes expose the legacy token-based booking path. For new customer-facing flows, prefer the organisation slug route documented in the Booking API.
  • The normal DELETE /api/resources/:id flow now refuses to remove a parent resource while child lanes still exist. Use the cascade deletion route only when the parent and its child lanes should be removed together.

Best Practices

  • Create the resource type before creating resources that depend on it.
  • When you need interchangeable inventory, set bookingMode on the resource type instead of duplicating endpoint logic in the client.
  • Treat token regeneration as destructive for any previously shared public links.
  • Keep resource-type configuration stable and use resource records for the frequently changing real-world inventory.
  • Put pricing and payment policy on the resource type so every reservation and public booking flow derives the same quote.