Skip to content

API reference

Entities

CRUD for the things FlexiScheduler schedules — participants, staff, vehicles, rooms. Includes bulk operations and relationship management.

Key points

  • An entity is anything the engine schedules — people, resources, places
  • Every entity has a typed entityType from your template, plus core and custom attributes
  • Most write endpoints require x-template-id in addition to x-organization-id
  • Deletes are soft (deactivate) by default; hard deletes happen via cascade rules
  • Bulk operations process up to 100 entities per call, returning per-item status

About entities

Entities are typed records — staff, participant, vehicle, room, physician, etc. — defined by your template. Each entity has a stable id, an entityType that determines which constraints apply, and structured attributes that the engine evaluates against during scheduling.

Two attribute buckets:

  • coreAttributes — fields the template declares for this entity type (skills, certifications, mobility requirements, etc.). The engine reads these during constraint evaluation.
  • customAttributes — organization- specific fields that don’t map to template constraints. Useful for storage but not evaluated by the engine.

See Core concepts for how entities relate to events, resources, and templates.

Create entity

POST/api/v1/entities

Create a single entity. Use the bulk endpoint for batches.

Headers

  • x-organization-idUUIDrequired

    Organization the entity belongs to

  • x-template-idstringrequired

    Template ID — determines which entityTypes are valid

Request body

Required: entityType, displayName. Other fields optional but typically populated.

{
  "entityType": "staff",
  "displayName": "Jane Smith",
  "coreAttributes": {
    "skills": ["wound_care", "iv_therapy"],
    "certifications": ["RN", "CPR"],
    "languages": ["en", "es"]
  },
  "customAttributes": {
    "employeeId": "EMP-001",
    "department": "Home Care"
  },
  "email": "jane.smith@example.com",
  "phone": "+1-555-123-4567",
  "defaultAvailabilityPatternKey": "standard_weekday_9to5"
}

Responses

201Entity created. Returns full EntityResponseDto.
{
  "id": "ent_a8f4c2d1-...",
  "organizationId": "org-12345",
  "templateId": "home_care_scheduling_v1",
  "entityType": "staff",
  "displayName": "Jane Smith",
  "status": "active",
  "email": "jane.smith@example.com",
  "phone": "+1-555-123-4567",
  "coreAttributes": {
    "skills": ["wound_care", "iv_therapy"],
    "certifications": ["RN", "CPR"]
  },
  "customAttributes": {
    "employeeId": "EMP-001",
    "department": "Home Care"
  },
  "createdAt": "2026-04-26T15:30:00.000Z",
  "updatedAt": "2026-04-26T15:30:00.000Z"
}
400Validation error — missing required field, unknown entityType, malformed attributes.
409Duplicate detected — typically email or external ID collision.

List entities

GET/api/v1/entities

Paginated list of entities for the organization. Supports filtering by type, status, search, and template scope.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-template-idstringrequired

    Template ID to scope the listing

Query parameters

  • entityTypestring

    Filter to a single entity type e.g. staff

  • statusenum

    Filter by status e.g. active | inactive | pending | suspended

  • searchstring

    Free-text search across displayName, email, and core attribute string fields

  • limitinteger

    Max results (default 20, max 100)

  • offsetinteger

    Pagination offset (default 0)

  • orderBystring

    Sort field — displayName, createdAt, or updatedAt

  • orderDirectionenum

    asc or desc

Responses

200Paginated entity list
{
  "items": [
    { "id": "ent_a8f4...", "displayName": "Jane Smith", "entityType": "staff", "status": "active", ... },
    { "id": "ent_b29f...", "displayName": "Mike Reyes", "entityType": "staff", "status": "active", ... }
  ],
  "total": 47,
  "limit": 20,
  "offset": 0
}

Get entity

GET/api/v1/entities/{entityId}

Retrieve a single entity by ID.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Path parameters

  • entityIdstringrequired

    Entity ID returned from create or list

Responses

200Entity returned
{
  "id": "ent_a8f4c2d1-...",
  "organizationId": "org-12345",
  "templateId": "home_care_scheduling_v1",
  "entityType": "staff",
  "displayName": "Jane Smith",
  "status": "active",
  "email": "jane.smith@example.com",
  "phone": "+1-555-123-4567",
  "coreAttributes": {
    "skills": ["wound_care", "iv_therapy"],
    "certifications": ["RN", "CPR"]
  },
  "customAttributes": {
    "employeeId": "EMP-001",
    "department": "Home Care"
  },
  "createdAt": "2026-04-26T15:30:00.000Z",
  "updatedAt": "2026-04-26T15:30:00.000Z"
}
404Entity not found in this organization (or doesn’t exist)

Update entity

PUT/api/v1/entities/{entityId}

Update entity attributes. Only fields present in the request body are updated; omitted fields are unchanged.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-user-idstringrequired

    Acting user ID for audit attribution

Path parameters

  • entityIdstringrequired

    Entity to update

Request body

Partial update. Only displayName, coreAttributes, customAttributes, email, and phone are mutable.

{
  "displayName": "Jane Smith (Senior)",
  "coreAttributes": {
    "skills": ["wound_care", "iv_therapy", "palliative_care"],
    "certifications": ["RN", "CPR"]
  }
}

Responses

200Entity updated successfully
{
  "id": "ent_a8f4c2d1-...",
  "organizationId": "org-12345",
  "templateId": "home_care_scheduling_v1",
  "entityType": "staff",
  "displayName": "Jane Smith",
  "status": "active",
  "email": "jane.smith@example.com",
  "phone": "+1-555-123-4567",
  "coreAttributes": {
    "skills": ["wound_care", "iv_therapy"],
    "certifications": ["RN", "CPR"]
  },
  "customAttributes": {
    "employeeId": "EMP-001",
    "department": "Home Care"
  },
  "createdAt": "2026-04-26T15:30:00.000Z",
  "updatedAt": "2026-04-26T15:30:00.000Z"
}
404Entity not found

entityType is immutable

Once an entity is created with a given entityType, that type can’t be changed. If you need a different type, deactivate this entity and create a new one. This constraint exists because changing type would invalidate every constraint that runs against the entity.

Deactivate entity

DELETE/api/v1/entities/{entityId}

Soft-delete (deactivate) an entity. Status moves to inactive; existing events referencing the entity are not modified.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-user-idstringrequired

    Acting user ID for audit attribution

Path parameters

  • entityIdstringrequired

    Entity to deactivate

Query parameters

  • reasonstring

    Optional human-readable reason captured in the audit log

Responses

204Deactivated; no response body
404Entity not found

Bulk operations

Three bulk endpoints handle batches of up to 100 entities per call. Each item processes independently — partial success is normal, and the response reports per-item status.

Bulk create

POST/api/v1/entities/bulk

Create up to 100 entities in a single request. Each item processes independently.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-template-idstringrequired

    Template ID

  • x-user-idstringrequired

    Acting user ID for audit

Request body

Array of entity objects, max 100 per call.

{
  "entities": [
    {
      "entityType": "staff",
      "displayName": "Carla Mendez",
      "coreAttributes": { "skills": ["wound_care"] },
      "email": "carla.m@example.com"
    },
    {
      "entityType": "staff",
      "displayName": "Tom Kim",
      "coreAttributes": { "skills": ["physical_therapy"] },
      "email": "tom.k@example.com"
    }
  ]
}

Responses

200Bulk create completed; check per-item status
{
  "results": [
    { "index": 0, "status": "created", "entityId": "ent_a8f4..." },
    { "index": 1, "status": "failed", "error": { "code": "DUPLICATE_EMAIL", "message": "..." } }
  ],
  "summary": { "total": 2, "succeeded": 1, "failed": 1 }
}
400Request shape invalid (e.g. > 100 items, malformed envelope)

Bulk update and deactivate

PUT /api/v1/entities/bulk and DELETE /api/v1/entities/bulk follow the same shape — array of items, per-item processing, per-item status in the response. The update body matches UpdateEntityDto per item; the deactivate body needs only entity IDs.

Bulk failures don’t roll back

If 50 of 100 entities fail validation, the other 50 are still created. Always inspect the per-item results array. To get all-or-nothing behavior, either validate everything client-side first or accept partial success and reconcile.

Relationships

Entities can reference each other through typed relationships — a participant’s primary caregiver, a staff member’s supervisor, a vehicle’s assigned driver. Relationships are first-class API resources nested under the entity.

Create relationship

POST/api/v1/entities/{entityId}/relationships

Create a relationship from entityId to another entity.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-user-idstringrequired

    Acting user ID for audit

Path parameters

  • entityIdstringrequired

    Source entity (the "from" side)

Request body

Specify the target entity, the relationship type, and any optional metadata.

{
  "toEntityId": "ent_caregiver_882",
  "type": "primary_caregiver",
  "metadata": {
    "since": "2025-11-01"
  }
}

Responses

201Relationship created
400Invalid relationship type or missing toEntityId

List, get, update, delete

The other relationship endpoints follow standard CRUD conventions:

  • GET /api/v1/entities/{entityId}/relationships — list with filters type, active, plus pagination
  • GET /api/v1/entities/{entityId}/relationships/{relationshipId} — get single relationship
  • PUT /api/v1/entities/{entityId}/relationships/{relationshipId} — update metadata
  • DELETE /api/v1/entities/{entityId}/relationships/{relationshipId} — hard-delete (relationships don’t soft-delete; they go away)