Skip to content

Client Onboarding API

All endpoints require authentication and clients tool permissions. Routes are mounted under /api/clients.

GET /api/clients/:companyId/onboarding

Returns the client’s assigned onboarding template with all stages, milestones, and completion progress.

Permission: clients:view

Path parameters:

ParamTypeDescription
companyIdstringCompany ID

Response: { template, stages, current_stage_type, total_milestones, completed_milestones, completion_percentage }

Each stage includes a nested milestones array with:

FieldTypeDescription
completedbooleanWhether the milestone is complete
completed_atstring|nullCompletion timestamp
completed_bystring|nullUser ID who completed it
completed_by_namestring|nullUser name who completed it
sourcestring|nullCompletion source (manual or auto)
notesstring|nullCompletion notes

Each stage also includes completed_count and total_count summary fields.

Returns { template: null, stages: [], current_stage_type: null } if no template is assigned.


POST /api/clients/:companyId/onboarding/assign

Assigns an onboarding template to a client. Creates progress rows for all milestones and auto-completes milestones whose conditions are already met (e.g. deal already won, project already created, invoice already exists).

Permission: clients:update

Path parameters:

ParamTypeDescription
companyIdstringCompany ID

Body:

FieldTypeRequiredDescription
template_idstringYesOnboarding template ID
forcebooleanNoForce re-assignment if a different template is already assigned

Response: { ok: true }

Error responses:

  • 400template_id missing
  • 404 — Template not found/inactive or client profile not found
  • 409 — Different template already assigned (use force: true to override). Returns { requires_confirmation: true }

PATCH /api/clients/:companyId/onboarding/milestones/:milestoneId

Marks a milestone as completed or uncompleted. Recomputes the client’s current_stage_type after toggling.

Permission: clients:update

Path parameters:

ParamTypeDescription
companyIdstringCompany ID
milestoneIdstringMilestone ID

Body:

FieldTypeRequiredDescription
completedbooleanYesWhether the milestone is complete
notesstringNoOptional notes

Response: { ok: true }

Error responses:

  • 400 — No onboarding template assigned
  • 404 — Milestone not found in the assigned template

GET /api/clients/onboarding/stuck

Dashboard widget endpoint. Returns up to 5 clients whose onboarding has stalled (no milestone activity in 14+ days, onboarding not yet completed).

Permission: clients:view

Response: { clients }

Each client includes:

FieldTypeDescription
idstringCompany ID
namestringCompany name
logo_urlstring|nullCompany logo
current_stage_typestring|nullCurrent onboarding stage type
completed_countnumberMilestones completed
total_countnumberTotal milestones
last_activitystring|nullLast milestone completion date
days_since_activitynumber|nullDays since last activity