Work Request Settings API
Request types and the work-request pipelines and stages they run on. Reads need work_requests.view (the request form and board use them); writes are @AdminOnly() (admins, or roles with admin.edit / settings.edit). Pipelines here always have scope = 'work_requests' and stages module = 'work_requests'; IDs of sales pipelines or stages return 404. See Work Requests Module.
Request Types
| Method | Endpoint | Permission | Description |
|---|---|---|---|
| GET | /work-request-settings/types?includeInactive=true | view | List types (active only unless includeInactive=true), with openCount |
| GET | /work-request-settings/types/:id | view | Get a type |
| POST | /work-request-settings/types | admin | Create a type |
| PUT | /work-request-settings/types/:id | admin | Update a type (partial) |
| DELETE | /work-request-settings/types/:id | admin | Soft delete; 409 while the type has open requests |
Type body
{
"name": "Technical Demo",
"slug": "technical_demo",
"description": "Book a product demo with presales",
"icon": null,
"color": "#7C3AED",
"ownerTeamId": "uuid",
"ownerDepartmentId": null,
"defaultPipelineId": "uuid",
"assignmentMode": "manual",
"allowedEntities": ["leads", "opportunities"],
"requestFields": [
{ "label": "Products to demo", "type": "multiselect", "required": true,
"options": [{ "label": "Analytics", "value": "Analytics" }] },
{ "label": "Preferred demo date", "type": "date", "required": true, "helpText": "Customer's preference" }
],
"defaultDueDays": 5,
"defaultBillable": false,
"defaultHourlyRate": null,
"currency": null,
"isActive": true,
"sortOrder": 3
}
| Field | Validation |
|---|---|
name | Required |
slug | Optional; generated from the name ([a-z0-9_]); 409 if taken |
assignmentMode | queue (default) · auto · manual |
allowedEntities | Non-empty; any of leads, opportunities, accounts, contacts, projects, tasks. Default ["leads","opportunities"] |
requestFields[] | label required; key generated from it if omitted, unique; type one of text, textarea, number, date, select, multiselect, checkbox, url (else text); select / multiselect need options |
defaultPipelineId | Must be a work-request pipeline |
ownerTeamId, ownerDepartmentId | Must exist |
defaultDueDays, sortOrder | Non-negative integers |
defaultHourlyRate | Non-negative number |
Response object adds ownerTeamName, ownerDepartmentName, defaultPipelineName, openCount, createdAt, updatedAt.
Pipelines
| Method | Endpoint | Permission | Description |
|---|---|---|---|
| GET | /work-request-settings/pipelines?includeInactive=true | view | List work-request pipelines with stageCount and requestCount |
| GET | /work-request-settings/pipelines/:id | view | Pipeline with its active stages[] |
| POST | /work-request-settings/pipelines | admin | Create (body { name, description?, isActive?, stageMovement?, withDefaultStages? }) |
| PUT | /work-request-settings/pipelines/:id | admin | Update name, description, isActive, stageMovement, sortOrder |
| DELETE | /work-request-settings/pipelines/:id | admin | Hard delete; 409 while any request uses it or any type defaults to it |
stageMovement is free (default) or sequential. Unless withDefaultStages: false, a new pipeline is seeded with New, In Progress, Review, Completed (isWon) and Cancelled (isLost).
Stages
| Method | Endpoint | Permission | Description |
|---|---|---|---|
| GET | /work-request-settings/pipelines/:id/stages?includeInactive=true | view | List stages with requestCount |
| POST | /work-request-settings/pipelines/:id/stages | admin | Add a stage ({ name, color?, description?, isWon?, isLost?, sortOrder? }) |
| PUT | /work-request-settings/pipelines/:id/stages/reorder | admin | Body { orderedIds: string[] } — stage ids of this pipeline in the new order |
| PUT | /work-request-settings/stages/:stageId | admin | Update name, color, description, isWon, isLost, isActive, sortOrder |
| DELETE | /work-request-settings/stages/:stageId | admin | Hard delete; 409 while requests are in the stage |
isWon means entering the stage completes the request, isLost that it cancels it; setting both returns 400. Without sortOrder, a new stage is placed after the last open stage (before the closing ones).
Stage object
{
"id": "uuid",
"pipelineId": "uuid",
"name": "Solution Design",
"slug": "solution_design",
"color": "#3B82F6",
"description": null,
"sortOrder": 3,
"isActive": true,
"isWon": false,
"isLost": false,
"stageOwnerType": "role",
"requestCount": 4
}
Stage Owner Rules
Owner rules for work-request stages use the shared stage-ownership endpoints, which work by stage id:
| Method | Endpoint | Description |
|---|---|---|
| GET | /lead-settings/stage-ownership/:stageId | Current rule (stageOwnerType, stageOwnerUser, stageOwnerTeam, stageOwnerRole) |
| PUT | /lead-settings/stage-ownership/:stageId | Body { stageOwnerType, stageOwnerUserId, stageOwnerTeamId, stageOwnerRoleId } |
See Stage Ownership.