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

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 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
  • customerInfoFields: optional string array
  • waitlistEnabled: optional boolean
  • recurringEnabled: optional boolean
  • color: optional string
  • icon: optional string
  • 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
  • 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",
"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.