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
organisationIdfor resource-type or resource creation. - Resource and resource-type reads are always filtered to the active organisation.
Endpoint Reference
Resource Types
| Method | Path | Purpose | Request or query | Auth | Source |
|---|---|---|---|---|---|
POST | /api/resource-types | Create a resource type in the active organisation. | Body: type fields | JWT or user API key | resource-types/resource-types.controller.ts |
GET | /api/resource-types | List resource types in the active organisation. | None | JWT or user API key | resource-types/resource-types.controller.ts |
GET | /api/resource-types/:id | Get one resource type. | Path: id | JWT or user API key | resource-types/resource-types.controller.ts |
PATCH | /api/resource-types/:id | Update a resource type. | Path: id, body: partial type fields | JWT or user API key | resource-types/resource-types.controller.ts |
DELETE | /api/resource-types/:id | Delete a resource type. | Path: id | JWT or user API key | resource-types/resource-types.controller.ts |
PATCH | /api/resource-types/:id/color | Update only the resource-type color. | Path: id, body: color | JWT or user API key | resource-types/resource-types.controller.ts |
Resources
| Method | Path | Purpose | Request or query | Auth | Source |
|---|---|---|---|---|---|
POST | /api/resources | Create a resource. | Body: name,description,capacity,resourceTypeId,managedById | JWT or user API key | resources/resources.controller.ts |
GET | /api/resources | List resources. | Query: resourceTypeId? | JWT or user API key | resources/resources.controller.ts |
GET | /api/resources/:id | Get one resource. | Path: id | JWT or user API key | resources/resources.controller.ts |
PATCH | /api/resources/:id | Update a resource. | Path: id, body: partial resource fields | JWT or user API key | resources/resources.controller.ts |
DELETE | /api/resources/:id | Delete a resource. | Path: id | JWT or user API key | resources/resources.controller.ts |
GET | /api/resources/:id/public-token | Read the public booking token for a resource. | Path: id | JWT or user API key | resources/resources.controller.ts |
POST | /api/resources/:id/regenerate-token | Regenerate the public booking token for a resource. | Path: id | JWT or user API key | resources/resources.controller.ts |
Request Shapes
Resource types
CreateResourceTypeDto and UpdateResourceTypeDto
name: required on createdescription: optional stringminBookingDuration: optional int, minimum1bufferTime: optional int, minimum0availabilityMode: optional enumcontinuous|shiftscustomerInfoFields: optional string arraywaitlistEnabled: optional booleanrecurringEnabled: optional booleanbookingMode: optional enumSINGLE_RESOURCE|POOL|BOTHcolor: optional stringicon: optional stringschedulePolicy: optional schedule-override objectoperatingHours: optional weekly array of{ dayOfWeek, openTime, closeTime, isActive }shiftSchedule: optional weekly array of{ dayOfWeek, slots[] }
pricingEnabled: optional booleanpaymentRequired: optional booleanpriceAmount: optional integer in minor unitspriceCurrency: optional Stripe-supported three-letter currency codeisActive: update-only optional booleanorganisationId: not accepted from the client; the server derives it from the active organisation
Resources
CreateResourceDto and UpdateResourceDto
name: required on createdescription: optional stringcapacity: optional int, minimum1resourceTypeId: required on createmanagedById: optional intoperatingHoursOverrides: compatibility bridge for resource-level opening hoursschedulePolicy: optional resource-level schedule override objectavailabilityMode: optionalcontinuous|shiftsoperatingHours: optional weekly array of{ dayOfWeek, openTime, closeTime, isActive }shiftSchedule: optional weekly array of{ dayOfWeek, slots[] }
parentResourceId: optional positive int used for seeded capacity child resourcesisCapacityChild: optional boolean, system-managed for seeded capacity lanescapacityLaneIndex: optional positive int lane number for capacity child resourcesisActive: 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.
bookingModedetermines 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=continuouskeeps the resource type'sminBookingDurationandbufferTimelogic, constrained by the resolved opening hours.availabilityMode=shiftsswitches availability generation to exact slot matching fromschedulePolicy.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/:idflow 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
bookingModeon 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.