For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help CenterOpenAPI SpecStatus
OverviewInquiriesTransactionsRelaysAPI ReferenceChangelog
OverviewInquiriesTransactionsRelaysAPI ReferenceChangelog
  • Getting Started
    • Introduction
    • Quickstart Tutorial
  • API Overview
    • API Keys
    • Authentication
    • Protocol
    • Response Body
    • Idempotence
    • Pagination
    • Rate Limiting
    • Downloading Files
    • API Logs
    • Request IDs
  • Versioning
    • API Changelog
    • Versioning
  • Troubleshooting
    • Error Handling
  • API Reference
    • OpenAPI Specification
    • Cases
      • GETList all Cases
      • POSTCreate a Case
      • GETRetrieve a Case
      • DELRedact a Case
      • PATCHUpdate a Case
      • POSTAdd Persona objects to a Case
      • POSTAssign a Case
      • POSTSet status on a Case
      • POSTAdd tag to a Case
      • POSTRemove tag from a Case
      • POSTSet tags on a Case
      • POSTSearch Cases
    • Connect
    • Documents
    • Inquiries
    • List Items
    • Lists
    • OAuth
    • Reports
    • Transactions
    • Verifications
    • Workflows
  • Webhooks
LogoLogo
Help CenterOpenAPI SpecStatus
API ReferenceCases

Search Cases

POST
https://api.withpersona.com/api/v1/cases/search
POST
/api/v1/cases/search
$curl -X POST https://api.withpersona.com/api/v1/cases/search \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "query": {
> "not": {
> "attribute": "status",
> "operator": "eq",
> "value": "resolved"
> }
> },
> "sort": {
> "attribute": "created_at",
> "direction": "asc"
> },
> "page": {
> "size": 15
> }
>}'
1{
2 "data": [
3 {
4 "id": "case_ABC123",
5 "attributes": {
6 "status": "open",
7 "name": "KCAS-1",
8 "created-at": "2025-01-15T10:30:00.000Z",
9 "updated-at": "2025-01-15T14:22:00.000Z",
10 "assigned-at": "2025-01-15T10:35:00.000Z",
11 "sla-expires-at": "2025-01-20T10:30:00.000Z",
12 "creator-id": "case_creator@withpersona.com",
13 "creator-type": "user",
14 "assignee-id": "case_assignee@withpersona.com",
15 "assigner-id": "manager@withpersona.com",
16 "assigner-type": "user",
17 "updater-id": "case_updater@withpersona.com",
18 "updater-type": "user",
19 "tags": [
20 "urgent",
21 "review-needed"
22 ],
23 "fields": {
24 "priority": {
25 "type": "string",
26 "value": "high"
27 },
28 "amount": {
29 "type": "number",
30 "value": 1000
31 }
32 },
33 "attachments": []
34 },
35 "relationships": {
36 "accounts": {
37 "data": []
38 },
39 "case-comments": {
40 "data": []
41 },
42 "case-template": {
43 "data": {
44 "id": "ctmpl_ABC123",
45 "type": "case-template"
46 }
47 },
48 "case-queue": {
49 "data": {
50 "id": "cqueue_XYZ789",
51 "type": "case-queue"
52 }
53 },
54 "inquiries": {
55 "data": []
56 },
57 "reports": {
58 "data": []
59 },
60 "verifications": {
61 "data": []
62 },
63 "txns": {
64 "data": []
65 }
66 },
67 "type": "case"
68 },
69 {
70 "id": "case_DEF456",
71 "attributes": {
72 "status": "pending",
73 "name": "KCAS-2",
74 "created-at": "2025-01-14T15:20:00.000Z",
75 "updated-at": "2025-01-14T16:10:00.000Z",
76 "creator-id": "api_key_123",
77 "creator-type": "api-key",
78 "updater-id": "api_key_123",
79 "updater-type": "api-key",
80 "tags": [],
81 "fields": {
82 "priority": {
83 "type": "string",
84 "value": "medium"
85 }
86 },
87 "attachments": []
88 },
89 "relationships": {
90 "accounts": {
91 "data": []
92 },
93 "case-comments": {
94 "data": []
95 },
96 "case-template": {
97 "data": {
98 "id": "ctmpl_ABC123",
99 "type": "case-template"
100 }
101 },
102 "case-queue": {},
103 "inquiries": {
104 "data": []
105 },
106 "reports": {
107 "data": []
108 },
109 "verifications": {
110 "data": []
111 },
112 "txns": {
113 "data": []
114 }
115 },
116 "type": "case"
117 }
118 ],
119 "links": {
120 "prev": "/api/v1/cases/search?page%5Bbefore%5D=case_ABC123&page%5Bsize%5D=10",
121 "next": "/api/v1/cases/search?page%5Bafter%5D=case_DEF456&page%5Bsize%5D=10"
122 }
123}
Search for cases using a flexible query language. ## Search vs. List Endpoints The Search and List endpoints serve different purposes and have distinct performance characteristics. Use the **Search** endpoint (`POST /cases/search`) when you need to perform complex queries with boolean logic (AND/OR/NOT), filter by custom fields, assignee, case queue, or SLA expiration, or apply multiple conditions simultaneously. Search is optimized for flexible querying and is faster than paginating through all resources when looking for specific records. Use the **List** endpoint (`GET /cases`) for simple listing with basic filters like status, case template, account, inquiry, or report. ## Data Freshness Do not use search for read-after-write flows because the data will not be immediately available to search. Under normal operating conditions, data is searchable within approximately 1 minute of creation or modification. Propagation of new or updated data could be delayed during an outage. For workflows that require immediate data availability after creating or updating a case, use the List Cases endpoint instead. ### Searchable Attributes The following attributes can be used in query predicates: | Attribute | Description | |-----------|-------------| | `template` | Case template (e.g., `ctmpl_ABC123`) | | `status` | Case status (e.g., `open`, `pending`, `resolved`) | | `state` | Case state | | `created_at` | Case creation timestamp | | `updated_at` | Case last updated timestamp | | `resolved_at` | Case resolution timestamp | | `sla_expires_at` | SLA expiration timestamp | | `assignee` | Assigned user (e.g., `user_ABC123`) | | `case_queue` | Case queue (e.g., `cqueue_ABC123`) | | `resolver` | Resolver user | | `fields.*` | Custom case field (e.g., `fields.priority`) | **Note:** Custom fields (`fields.*`) must be configured as searchable on the Case Template to be queryable.
Was this page helpful?
Previous

Retrieve a Case Template

Next
Built with

Search for cases using a flexible query language.

Search vs. List Endpoints

The Search and List endpoints serve different purposes and have distinct performance characteristics.

Use the Search endpoint (POST /cases/search) when you need to perform complex queries with boolean logic (AND/OR/NOT), filter by custom fields, assignee, case queue, or SLA expiration, or apply multiple conditions simultaneously. Search is optimized for flexible querying and is faster than paginating through all resources when looking for specific records.

Use the List endpoint (GET /cases) for simple listing with basic filters like status, case template, account, inquiry, or report.

Data Freshness

Do not use search for read-after-write flows because the data will not be immediately available to search. Under normal operating conditions, data is searchable within approximately 1 minute of creation or modification. Propagation of new or updated data could be delayed during an outage. For workflows that require immediate data availability after creating or updating a case, use the List Cases endpoint instead.

Searchable Attributes

The following attributes can be used in query predicates:

AttributeDescription
templateCase template (e.g., ctmpl_ABC123)
statusCase status (e.g., open, pending, resolved)
stateCase state
created_atCase creation timestamp
updated_atCase last updated timestamp
resolved_atCase resolution timestamp
sla_expires_atSLA expiration timestamp
assigneeAssigned user (e.g., user_ABC123)
case_queueCase queue (e.g., cqueue_ABC123)
resolverResolver user
fields.*Custom case field (e.g., fields.priority)

Note: Custom fields (fields.*) must be configured as searchable on the Case Template to be queryable.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

Key-InflectionenumOptional
Determines casing for the API response.
Allowed values:
Idempotency-KeystringOptional
Ensures the request is idempotent.
Persona-VersionenumOptional
Server API version. More info on versioning can be found [here](https://docs.withpersona.com/versioning).

Query parameters

fieldsmap from strings to stringsOptional
Comma-separated list(s) of attributes to include in the response. This can be used to customize which attributes will be serialized in the response. See [Serialization](https://docs.withpersona.com/serialization#sparse-fieldsets) for more details.
pageobjectOptional

Request

This endpoint expects an object.
queryobjectOptional

Search query using boolean logic (AND/OR/NOT) and comparison operators. Supports predicates with operators: eq (equal), gt (greater than), gte (greater than or equal), lt (less than), lte (less than or equal).

sortobjectOptional
Sort configuration for results
pageobjectOptional
Pagination parameters

Response

This endpoint returns a collection of Case objects matching the search criteria.
datalist of objects
An array of Cases matching the search criteria
linksobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
429
Too Many Requests Error

Server API version. More info on versioning can be found here.

Comma-separated list(s) of attributes to include in the response. This can be used to customize which attributes will be serialized in the response. See Serialization for more details.