WorkDesk
Search API
The WorkDesk Search API provides a unified endpoint for global search and section-scoped search. All results are scoped to the authenticated user's visible data. The API is designed for low-latency results — typically under 100ms for most queries.
Unified Search Endpoint
GET /api/workdesk/search
Authorization: Bearer {token}
// Query parameters
?q=expense+approval // required — minimum 2 characters
§ion=tasks // optional — tasks | history | notifications | all (default: all)
&limit=5 // optional — results per section (default: 5, max: 20)
&page=1 // optional — for paginating within a section result set
// Response — global search (all sections)
{
"query": "expense approval",
"tasks": {
"items": [
{
"taskId": "3fa85f64-...",
"type": "approval",
"title": "Expense Report Approval — Q1 Marketing",
"status": "pending",
"dueAt": "2026-05-27T17:00:00Z",
"workflowName": "Expense Approval Flow",
"score": 0.95, // relevance score 0-1
"matchHighlights": {
"title": "Expense Report <mark>Approval</mark> — Q1 Marketing"
}
}
],
"totalCount": 2,
"hasMore": false
},
"history": {
"items": [
{
"executionId": "7bc12d45-...",
"workflowName": "Expense Approval Flow",
"status": "completed",
"triggeredAt": "2026-05-25T09:12:00Z",
"score": 0.87
}
],
"totalCount": 3,
"hasMore": true
},
"notifications": {
"items": [
{
"notificationId": "notif-789",
"type": "hil_task_assigned",
"title": "New Approval Task",
"body": "...",
"isRead": false,
"createdAt": "2026-05-25T10:00:00Z",
"score": 0.72
}
],
"totalCount": 1,
"hasMore": false
},
"took": 48 // query execution time in ms
}
Section-Scoped Search
// Search only in tasks
GET /api/workdesk/search?q=budget+review§ion=tasks&limit=20
// Search only in history
GET /api/workdesk/search?q=payroll§ion=history&limit=20
// Response — scoped search returns full paginated results for that section only
{
"query": "budget review",
"section": "tasks",
"items": [ { ... task objects ... } ],
"totalCount": 7,
"page": 1,
"pageSize": 20,
"took": 22
}
Relevance Scoring
Results within each section are ranked by relevance score (0-1, higher is more relevant):
| Match Type | Score Range |
|---|---|
| Exact title match | 0.9 – 1.0 |
| Partial title match (starts with) | 0.75 – 0.9 |
| Partial title match (contains) | 0.5 – 0.75 |
| Body / description match | 0.3 – 0.5 |
| Metadata match (workflow name) | 0.2 – 0.4 |
Error Responses
| HTTP Status | Error Code | Meaning |
|---|---|---|
| 400 | QUERY_TOO_SHORT | Query is less than 2 characters |
| 400 | INVALID_SECTION | Unknown section value |
| 400 | LIMIT_EXCEEDED | Limit parameter exceeds maximum of 20 |
| 401 | UNAUTHORIZED | Missing or invalid JWT |
| 429 | RATE_LIMITED | Too many search requests — rate limit: 60/minute per user |