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
Source
- Resources controller:
backend-nestjs/src/resources/resources.controller.ts - Resource types controller:
backend-nestjs/src/resource-types/resource-types.controller.ts - DTOs:
backend-nestjs/src/dto/resource.dto.ts,backend-nestjs/src/dto/resource-type.dto.ts,backend-nestjs/src/resources/dto/resource.query.dto.ts
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, minimum0customerInfoFields: optional string arraywaitlistEnabled: optional booleanrecurringEnabled: optional booleancolor: optional stringicon: optional stringpricingEnabled: 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 intisActive: 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",
"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.
- 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.
Best Practices
- Create the resource type before creating resources that depend on it.
- 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.