> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpersona.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server.

# Search Cases

POST https://api.withpersona.com/api/v1/cases/search
Content-Type: application/json

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.


Reference: https://docs.withpersona.com/api-reference/cases/search-cases

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: '2025-12-08'
  version: 1.0.0
paths:
  /cases/search:
    post:
      operationId: search-cases
      summary: Search Cases
      description: >
        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.
      tags:
        - subpackage_cases
      parameters:
        - name: fields
          in: query
          description: >-
            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.
          required: false
          schema:
            type: object
            additionalProperties:
              type: string
        - name: page
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/CasesSearchPostParametersPage'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
        - name: Key-Inflection
          in: header
          description: Determines casing for the API response.
          required: false
          schema:
            $ref: '#/components/schemas/CasesSearchPostParametersKeyInflection'
        - name: Idempotency-Key
          in: header
          description: Ensures the request is idempotent.
          required: false
          schema:
            type: string
        - name: Persona-Version
          in: header
          required: false
          schema:
            $ref: '#/components/schemas/api-version'
      responses:
        '200':
          description: >-
            This endpoint returns a collection of Case objects matching the
            search criteria.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cases_search-cases_Response_200'
        '400':
          description: The request was unacceptable, often due to invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestBadRequestError'
        '401':
          description: An invalid API key was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestUnauthorizedError'
        '403':
          description: >-
            The given API key doesn’t have permissions to perform the request or
            a quota has been exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestForbiddenError'
        '404':
          description: The requested resource doesn’t exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestNotFoundError'
        '409':
          description: >-
            The request conflicts with another request, often due to attempting
            to create a duplicate resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestConflictError'
        '422':
          description: >-
            The request modifies the resource in an unacceptable way, often due
            to an invalid action or parameter.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Search-casesRequestUnprocessableEntityError
        '429':
          description: >-
            Your organization’s rate limit has been exceeded. We recommend an
            exponential backoff on requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search-casesRequestTooManyRequestsError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Cases_search-cases_Request'
servers:
  - url: https://api.withpersona.com/api/v1
    description: https://api.withpersona.com/api/v1
components:
  schemas:
    CasesSearchPostParametersPage:
      type: object
      properties:
        after:
          type: string
          description: >-
            Cursor for forward pagination. Use the value from `links.next` in
            the previous response.
        before:
          type: string
          description: >-
            Cursor for backward pagination. Use the value from `links.prev` in
            the previous response.
        size:
          type: integer
          default: 10
          description: Number of results to return per page.
      title: CasesSearchPostParametersPage
    CasesSearchPostParametersKeyInflection:
      type: string
      enum:
        - camel
        - kebab
        - snake
      title: CasesSearchPostParametersKeyInflection
    api-version:
      type: string
      enum:
        - '2025-12-08'
        - '2025-10-27'
        - '2023-01-05'
        - '2022-09-01'
        - '2021-08-18'
        - '2021-07-05'
        - '2021-02-21'
        - '2020-05-18'
      description: >-
        Server API version. More info on versioning can be found
        [here](https://docs.withpersona.com/versioning).
      title: api-version
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery0:
      type: object
      properties:
        and:
          type: array
          items:
            type: object
            additionalProperties:
              description: Any type
      required:
        - and
      description: >
        Boolean AND clause - combines multiple conditions where ALL must be
        true.


        This clause is recursive: each item in the `and` array can be another
        AND, OR, NOT clause, or a leaf predicate, enabling complex nested
        queries.


        Maximum nesting depth: 2 levels, Maximum clauses per AND: 20
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery0
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery1:
      type: object
      properties:
        or:
          type: array
          items:
            type: object
            additionalProperties:
              description: Any type
      required:
        - or
      description: >
        Boolean OR clause - combines multiple conditions where AT LEAST ONE must
        be true.


        This clause is recursive: each item in the `or` array can be another
        AND, OR, NOT clause, or a leaf predicate, enabling complex nested
        queries.


        Maximum nesting depth: 2 levels, Maximum clauses per OR: 20
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery1
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery2:
      type: object
      properties:
        not:
          type: object
          additionalProperties:
            description: Any type
      required:
        - not
      description: >
        Boolean NOT clause - negates a single condition.


        This clause is recursive: the `not` value can be another AND, OR, NOT
        clause, or a leaf predicate, enabling complex nested queries.


        Maximum nesting depth: 2 levels
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery2
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQueryOneOf3Value:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: boolean
      description: Value to compare against
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQueryOneOf3Value
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery3:
      type: object
      properties:
        attribute:
          type: string
          description: >-
            The attribute name to filter on (e.g., 'created_at', 'template',
            'status', 'fields.priority')
        operator:
          type: string
          description: >-
            Comparison operator. Possible values: eq (equal), gt (greater than),
            gte (greater than or equal), lt (less than), lte (less than or
            equal).
        value:
          $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQueryOneOf3Value
          description: Value to compare against
      required:
        - attribute
        - operator
        - value
      description: Attribute predicate
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery3
    CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery:
      oneOf:
        - $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery0
        - $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery1
        - $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery2
        - $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery3
      description: >
        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).
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery
    CasesSearchPostRequestBodyContentApplicationJsonSchemaSort:
      type: object
      properties:
        attribute:
          type: string
          description: The attribute name to sort by
        direction:
          type: string
          default: desc
          description: 'Sort direction. Possible values: asc (ascending), desc (descending).'
      required:
        - attribute
        - direction
      description: Sort configuration for results
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaSort
    CasesSearchPostRequestBodyContentApplicationJsonSchemaPage:
      type: object
      properties:
        after:
          type: string
          description: Cursor for forward pagination
        before:
          type: string
          description: Cursor for backward pagination
        size:
          type: integer
          default: 10
          description: Number of results to return per page
      description: Pagination parameters
      title: CasesSearchPostRequestBodyContentApplicationJsonSchemaPage
    Cases_search-cases_Request:
      type: object
      properties:
        query:
          $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaQuery
          description: >
            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).
        sort:
          $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaSort
          description: Sort configuration for results
        page:
          $ref: >-
            #/components/schemas/CasesSearchPostRequestBodyContentApplicationJsonSchemaPage
          description: Pagination parameters
      title: Cases_search-cases_Request
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributesAttachmentsItems:
      type: object
      properties:
        filename:
          type: string
        url:
          type: string
        byte-size:
          type: integer
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributesAttachmentsItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributes:
      type: object
      properties:
        status:
          type: string
        name:
          type: string
        resolution:
          type:
            - string
            - 'null'
        created-at:
          type: string
        updated-at:
          type:
            - string
            - 'null'
        assigned-at:
          type:
            - string
            - 'null'
        resolved-at:
          type:
            - string
            - 'null'
        redacted-at:
          type:
            - string
            - 'null'
        sla-expires-at:
          type:
            - string
            - 'null'
        creator-id:
          type:
            - string
            - 'null'
        creator-type:
          type:
            - string
            - 'null'
          description: >-
            Possible values:

            - user

            - workflow-run


            Do not assume this is a static enumeration; Persona may add new
            values

            in the future without a versioned update.
        assignee-id:
          type:
            - string
            - 'null'
        assigner-id:
          type:
            - string
            - 'null'
        assigner-type:
          type:
            - string
            - 'null'
          description: >-
            Possible values:

            - case-assignment-policy

            - user

            - workflow-run


            Do not assume this is a static enumeration; Persona may add new
            values

            in the future without a versioned update.
        resolver-id:
          type:
            - string
            - 'null'
        resolver-type:
          type:
            - string
            - 'null'
          description: >-
            Possible values:

            - user

            - workflow-run


            Do not assume this is a static enumeration; Persona may add new
            values

            in the future without a versioned update.
        updater-id:
          type:
            - string
            - 'null'
        updater-type:
          type:
            - string
            - 'null'
          description: >-
            Possible values:

            - case-assignment-policy

            - user

            - workflow-run


            Do not assume this is a static enumeration; Persona may add new
            values

            in the future without a versioned update.
        tags:
          type: array
          items:
            type: string
        fields:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            JSON key-value pairs of field name to field value. Exact schema
            depends on the configuration of the Case template for this Case.
            Keys in `fields` are **not** key inflected.
        attachments:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributesAttachmentsItems
      title: ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributes
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccountsDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - account
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccountsDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccounts:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccountsDataItems
      title: ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccounts
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseCommentsDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - case-comment
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseCommentsDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseComments:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseCommentsDataItems
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseComments
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplateData:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - case-template
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplateData
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplate:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplateData
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplate
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueueData:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - case-queue
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueueData
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueue:
      type: object
      properties:
        data:
          oneOf:
            - $ref: >-
                #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueueData
            - type: 'null'
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueue
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiriesDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - inquiry
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiriesDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiries:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiriesDataItems
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiries
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReportsDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReportsDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReports:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReportsDataItems
      title: ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReports
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerificationsDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerificationsDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerifications:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerificationsDataItems
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerifications
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxnsDataItems:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - transaction
      title: >-
        ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxnsDataItems
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxns:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxnsDataItems
      title: ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxns
    ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationships:
      type: object
      properties:
        accounts:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsAccounts
        case-comments:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseComments
        case-template:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseTemplate
        case-queue:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsCaseQueue
        inquiries:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsInquiries
        reports:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsReports
        verifications:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsVerifications
        txns:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationshipsTxns
      title: ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationships
    case:
      type: object
      properties:
        id:
          type: string
        attributes:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseAttributes
        relationships:
          $ref: >-
            #/components/schemas/ReportsIncludedObjectsItemsDiscriminatorMappingCaseRelationships
      description: A Case object
      title: case
    CasesSearchPostResponsesContentApplicationJsonSchemaLinks:
      type: object
      properties:
        prev:
          type:
            - string
            - 'null'
          description: >-
            URL pointing to the previous page of data, or null if on the first
            page. Must be used with POST request and original request body.
        next:
          type:
            - string
            - 'null'
          description: >-
            URL pointing to the next page of data, or null if on the last page.
            Must be used with POST request and original request body.
      required:
        - prev
        - next
      title: CasesSearchPostResponsesContentApplicationJsonSchemaLinks
    Cases_search-cases_Response_200:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/case'
          description: An array of Cases matching the search criteria
        links:
          $ref: >-
            #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaLinks
      required:
        - data
        - links
      title: Cases_search-cases_Response_200
    CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems:
      type: object
      properties:
        title:
          type: string
        details:
          type: string
      title: CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
    Search-casesRequestBadRequestError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestBadRequestError
    Search-casesRequestUnauthorizedError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestUnauthorizedError
    Search-casesRequestForbiddenError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestForbiddenError
    Search-casesRequestNotFoundError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestNotFoundError
    Search-casesRequestConflictError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestConflictError
    Search-casesRequestUnprocessableEntityError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestUnprocessableEntityError
    Search-casesRequestTooManyRequestsError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/CasesSearchPostResponsesContentApplicationJsonSchemaErrorsItems
      title: Search-casesRequestTooManyRequestsError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples

### Success



**Request**

```json
undefined
```

**Response**

```json
{
  "data": [
    {
      "id": "case_ABC123",
      "attributes": {
        "status": "open",
        "name": "KCAS-1",
        "created-at": "2025-01-15T10:30:00.000Z",
        "updated-at": "2025-01-15T14:22:00.000Z",
        "assigned-at": "2025-01-15T10:35:00.000Z",
        "sla-expires-at": "2025-01-20T10:30:00.000Z",
        "creator-id": "case_creator@withpersona.com",
        "creator-type": "user",
        "assignee-id": "case_assignee@withpersona.com",
        "assigner-id": "manager@withpersona.com",
        "assigner-type": "user",
        "updater-id": "case_updater@withpersona.com",
        "updater-type": "user",
        "tags": [
          "urgent",
          "review-needed"
        ],
        "fields": {
          "priority": {
            "type": "string",
            "value": "high"
          },
          "amount": {
            "type": "number",
            "value": 1000
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {
          "data": {
            "id": "cqueue_XYZ789",
            "type": "case-queue"
          }
        },
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    },
    {
      "id": "case_DEF456",
      "attributes": {
        "status": "pending",
        "name": "KCAS-2",
        "created-at": "2025-01-14T15:20:00.000Z",
        "updated-at": "2025-01-14T16:10:00.000Z",
        "creator-id": "api_key_123",
        "creator-type": "api-key",
        "updater-id": "api_key_123",
        "updater-type": "api-key",
        "tags": [],
        "fields": {
          "priority": {
            "type": "string",
            "value": "medium"
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {},
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    }
  ],
  "links": {
    "prev": "/api/v1/cases/search?page%5Bbefore%5D=case_ABC123&page%5Bsize%5D=10",
    "next": "/api/v1/cases/search?page%5Bafter%5D=case_DEF456&page%5Bsize%5D=10"
  }
}
```

**SDK Code**

```python Success
import requests

url = "https://api.withpersona.com/api/v1/cases/search"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Success
const url = 'https://api.withpersona.com/api/v1/cases/search';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Success
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withpersona.com/api/v1/cases/search"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Success
require 'uri'
require 'net/http'

url = URI("https://api.withpersona.com/api/v1/cases/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Success
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.withpersona.com/api/v1/cases/search")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Success
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withpersona.com/api/v1/cases/search', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Success
using RestSharp;

var client = new RestClient("https://api.withpersona.com/api/v1/cases/search");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Success
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/cases/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Simple query



**Request**

```json
{
  "query": {
    "not": {
      "attribute": "status",
      "operator": "eq",
      "value": "resolved"
    }
  },
  "sort": {
    "attribute": "created_at",
    "direction": "asc"
  },
  "page": {
    "size": 15
  }
}
```

**Response**

```json
{
  "data": [
    {
      "id": "case_ABC123",
      "attributes": {
        "status": "open",
        "name": "KCAS-1",
        "created-at": "2025-01-15T10:30:00.000Z",
        "updated-at": "2025-01-15T14:22:00.000Z",
        "assigned-at": "2025-01-15T10:35:00.000Z",
        "sla-expires-at": "2025-01-20T10:30:00.000Z",
        "creator-id": "case_creator@withpersona.com",
        "creator-type": "user",
        "assignee-id": "case_assignee@withpersona.com",
        "assigner-id": "manager@withpersona.com",
        "assigner-type": "user",
        "updater-id": "case_updater@withpersona.com",
        "updater-type": "user",
        "tags": [
          "urgent",
          "review-needed"
        ],
        "fields": {
          "priority": {
            "type": "string",
            "value": "high"
          },
          "amount": {
            "type": "number",
            "value": 1000
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {
          "data": {
            "id": "cqueue_XYZ789",
            "type": "case-queue"
          }
        },
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    },
    {
      "id": "case_DEF456",
      "attributes": {
        "status": "pending",
        "name": "KCAS-2",
        "created-at": "2025-01-14T15:20:00.000Z",
        "updated-at": "2025-01-14T16:10:00.000Z",
        "creator-id": "api_key_123",
        "creator-type": "api-key",
        "updater-id": "api_key_123",
        "updater-type": "api-key",
        "tags": [],
        "fields": {
          "priority": {
            "type": "string",
            "value": "medium"
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {},
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    }
  ],
  "links": {
    "prev": "/api/v1/cases/search?page%5Bbefore%5D=case_ABC123&page%5Bsize%5D=10",
    "next": "/api/v1/cases/search?page%5Bafter%5D=case_DEF456&page%5Bsize%5D=10"
  }
}
```

**SDK Code**

```python Simple query
import requests

url = "https://api.withpersona.com/api/v1/cases/search"

payload = {
    "query": { "not": {
            "attribute": "status",
            "operator": "eq",
            "value": "resolved"
        } },
    "sort": {
        "attribute": "created_at",
        "direction": "asc"
    },
    "page": { "size": 15 }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Simple query
const url = 'https://api.withpersona.com/api/v1/cases/search';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"query":{"not":{"attribute":"status","operator":"eq","value":"resolved"}},"sort":{"attribute":"created_at","direction":"asc"},"page":{"size":15}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Simple query
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withpersona.com/api/v1/cases/search"

	payload := strings.NewReader("{\n  \"query\": {\n    \"not\": {\n      \"attribute\": \"status\",\n      \"operator\": \"eq\",\n      \"value\": \"resolved\"\n    }\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"asc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Simple query
require 'uri'
require 'net/http'

url = URI("https://api.withpersona.com/api/v1/cases/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": {\n    \"not\": {\n      \"attribute\": \"status\",\n      \"operator\": \"eq\",\n      \"value\": \"resolved\"\n    }\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"asc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Simple query
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.withpersona.com/api/v1/cases/search")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": {\n    \"not\": {\n      \"attribute\": \"status\",\n      \"operator\": \"eq\",\n      \"value\": \"resolved\"\n    }\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"asc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}")
  .asString();
```

```php Simple query
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withpersona.com/api/v1/cases/search', [
  'body' => '{
  "query": {
    "not": {
      "attribute": "status",
      "operator": "eq",
      "value": "resolved"
    }
  },
  "sort": {
    "attribute": "created_at",
    "direction": "asc"
  },
  "page": {
    "size": 15
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Simple query
using RestSharp;

var client = new RestClient("https://api.withpersona.com/api/v1/cases/search");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": {\n    \"not\": {\n      \"attribute\": \"status\",\n      \"operator\": \"eq\",\n      \"value\": \"resolved\"\n    }\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"asc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Simple query
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "query": ["not": [
      "attribute": "status",
      "operator": "eq",
      "value": "resolved"
    ]],
  "sort": [
    "attribute": "created_at",
    "direction": "asc"
  ],
  "page": ["size": 15]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/cases/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Complex boolean query



**Request**

```json
{
  "query": {
    "and": [
      {
        "attribute": "template",
        "operator": "eq",
        "value": "ctmpl_ABC123"
      },
      {
        "or": [
          {
            "attribute": "status",
            "operator": "eq",
            "value": "open"
          },
          {
            "attribute": "status",
            "operator": "eq",
            "value": "pending"
          }
        ]
      }
    ]
  },
  "sort": {
    "attribute": "created_at",
    "direction": "desc"
  },
  "page": {
    "size": 15
  }
}
```

**Response**

```json
{
  "data": [
    {
      "id": "case_ABC123",
      "attributes": {
        "status": "open",
        "name": "KCAS-1",
        "created-at": "2025-01-15T10:30:00.000Z",
        "updated-at": "2025-01-15T14:22:00.000Z",
        "assigned-at": "2025-01-15T10:35:00.000Z",
        "sla-expires-at": "2025-01-20T10:30:00.000Z",
        "creator-id": "case_creator@withpersona.com",
        "creator-type": "user",
        "assignee-id": "case_assignee@withpersona.com",
        "assigner-id": "manager@withpersona.com",
        "assigner-type": "user",
        "updater-id": "case_updater@withpersona.com",
        "updater-type": "user",
        "tags": [
          "urgent",
          "review-needed"
        ],
        "fields": {
          "priority": {
            "type": "string",
            "value": "high"
          },
          "amount": {
            "type": "number",
            "value": 1000
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {
          "data": {
            "id": "cqueue_XYZ789",
            "type": "case-queue"
          }
        },
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    },
    {
      "id": "case_DEF456",
      "attributes": {
        "status": "pending",
        "name": "KCAS-2",
        "created-at": "2025-01-14T15:20:00.000Z",
        "updated-at": "2025-01-14T16:10:00.000Z",
        "creator-id": "api_key_123",
        "creator-type": "api-key",
        "updater-id": "api_key_123",
        "updater-type": "api-key",
        "tags": [],
        "fields": {
          "priority": {
            "type": "string",
            "value": "medium"
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {},
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    }
  ],
  "links": {
    "prev": "/api/v1/cases/search?page%5Bbefore%5D=case_ABC123&page%5Bsize%5D=10",
    "next": "/api/v1/cases/search?page%5Bafter%5D=case_DEF456&page%5Bsize%5D=10"
  }
}
```

**SDK Code**

```python Complex boolean query
import requests

url = "https://api.withpersona.com/api/v1/cases/search"

payload = {
    "query": { "and": [{
                "attribute": "template",
                "operator": "eq",
                "value": "ctmpl_ABC123"
            }, { "or": [
                    {
                        "attribute": "status",
                        "operator": "eq",
                        "value": "open"
                    },
                    {
                        "attribute": "status",
                        "operator": "eq",
                        "value": "pending"
                    }
                ] }] },
    "sort": {
        "attribute": "created_at",
        "direction": "desc"
    },
    "page": { "size": 15 }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Complex boolean query
const url = 'https://api.withpersona.com/api/v1/cases/search';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"query":{"and":[{"attribute":"template","operator":"eq","value":"ctmpl_ABC123"},{"or":[{"attribute":"status","operator":"eq","value":"open"},{"attribute":"status","operator":"eq","value":"pending"}]}]},"sort":{"attribute":"created_at","direction":"desc"},"page":{"size":15}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Complex boolean query
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withpersona.com/api/v1/cases/search"

	payload := strings.NewReader("{\n  \"query\": {\n    \"and\": [\n      {\n        \"attribute\": \"template\",\n        \"operator\": \"eq\",\n        \"value\": \"ctmpl_ABC123\"\n      },\n      {\n        \"or\": [\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"open\"\n          },\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"pending\"\n          }\n        ]\n      }\n    ]\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"desc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Complex boolean query
require 'uri'
require 'net/http'

url = URI("https://api.withpersona.com/api/v1/cases/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": {\n    \"and\": [\n      {\n        \"attribute\": \"template\",\n        \"operator\": \"eq\",\n        \"value\": \"ctmpl_ABC123\"\n      },\n      {\n        \"or\": [\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"open\"\n          },\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"pending\"\n          }\n        ]\n      }\n    ]\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"desc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Complex boolean query
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.withpersona.com/api/v1/cases/search")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": {\n    \"and\": [\n      {\n        \"attribute\": \"template\",\n        \"operator\": \"eq\",\n        \"value\": \"ctmpl_ABC123\"\n      },\n      {\n        \"or\": [\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"open\"\n          },\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"pending\"\n          }\n        ]\n      }\n    ]\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"desc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}")
  .asString();
```

```php Complex boolean query
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withpersona.com/api/v1/cases/search', [
  'body' => '{
  "query": {
    "and": [
      {
        "attribute": "template",
        "operator": "eq",
        "value": "ctmpl_ABC123"
      },
      {
        "or": [
          {
            "attribute": "status",
            "operator": "eq",
            "value": "open"
          },
          {
            "attribute": "status",
            "operator": "eq",
            "value": "pending"
          }
        ]
      }
    ]
  },
  "sort": {
    "attribute": "created_at",
    "direction": "desc"
  },
  "page": {
    "size": 15
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Complex boolean query
using RestSharp;

var client = new RestClient("https://api.withpersona.com/api/v1/cases/search");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": {\n    \"and\": [\n      {\n        \"attribute\": \"template\",\n        \"operator\": \"eq\",\n        \"value\": \"ctmpl_ABC123\"\n      },\n      {\n        \"or\": [\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"open\"\n          },\n          {\n            \"attribute\": \"status\",\n            \"operator\": \"eq\",\n            \"value\": \"pending\"\n          }\n        ]\n      }\n    ]\n  },\n  \"sort\": {\n    \"attribute\": \"created_at\",\n    \"direction\": \"desc\"\n  },\n  \"page\": {\n    \"size\": 15\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Complex boolean query
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "query": ["and": [[
        "attribute": "template",
        "operator": "eq",
        "value": "ctmpl_ABC123"
      ], ["or": [
          [
            "attribute": "status",
            "operator": "eq",
            "value": "open"
          ],
          [
            "attribute": "status",
            "operator": "eq",
            "value": "pending"
          ]
        ]]]],
  "sort": [
    "attribute": "created_at",
    "direction": "desc"
  ],
  "page": ["size": 15]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/cases/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Empty query (all cases)



**Request**

```json
{
  "page": {
    "size": 15
  }
}
```

**Response**

```json
{
  "data": [
    {
      "id": "case_ABC123",
      "attributes": {
        "status": "open",
        "name": "KCAS-1",
        "created-at": "2025-01-15T10:30:00.000Z",
        "updated-at": "2025-01-15T14:22:00.000Z",
        "assigned-at": "2025-01-15T10:35:00.000Z",
        "sla-expires-at": "2025-01-20T10:30:00.000Z",
        "creator-id": "case_creator@withpersona.com",
        "creator-type": "user",
        "assignee-id": "case_assignee@withpersona.com",
        "assigner-id": "manager@withpersona.com",
        "assigner-type": "user",
        "updater-id": "case_updater@withpersona.com",
        "updater-type": "user",
        "tags": [
          "urgent",
          "review-needed"
        ],
        "fields": {
          "priority": {
            "type": "string",
            "value": "high"
          },
          "amount": {
            "type": "number",
            "value": 1000
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {
          "data": {
            "id": "cqueue_XYZ789",
            "type": "case-queue"
          }
        },
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    },
    {
      "id": "case_DEF456",
      "attributes": {
        "status": "pending",
        "name": "KCAS-2",
        "created-at": "2025-01-14T15:20:00.000Z",
        "updated-at": "2025-01-14T16:10:00.000Z",
        "creator-id": "api_key_123",
        "creator-type": "api-key",
        "updater-id": "api_key_123",
        "updater-type": "api-key",
        "tags": [],
        "fields": {
          "priority": {
            "type": "string",
            "value": "medium"
          }
        },
        "attachments": []
      },
      "relationships": {
        "accounts": {
          "data": []
        },
        "case-comments": {
          "data": []
        },
        "case-template": {
          "data": {
            "id": "ctmpl_ABC123",
            "type": "case-template"
          }
        },
        "case-queue": {},
        "inquiries": {
          "data": []
        },
        "reports": {
          "data": []
        },
        "verifications": {
          "data": []
        },
        "txns": {
          "data": []
        }
      },
      "type": "case"
    }
  ],
  "links": {
    "prev": "/api/v1/cases/search?page%5Bbefore%5D=case_ABC123&page%5Bsize%5D=10",
    "next": "/api/v1/cases/search?page%5Bafter%5D=case_DEF456&page%5Bsize%5D=10"
  }
}
```

**SDK Code**

```python Empty query (all cases)
import requests

url = "https://api.withpersona.com/api/v1/cases/search"

payload = { "page": { "size": 15 } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Empty query (all cases)
const url = 'https://api.withpersona.com/api/v1/cases/search';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"page":{"size":15}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Empty query (all cases)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withpersona.com/api/v1/cases/search"

	payload := strings.NewReader("{\n  \"page\": {\n    \"size\": 15\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Empty query (all cases)
require 'uri'
require 'net/http'

url = URI("https://api.withpersona.com/api/v1/cases/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"page\": {\n    \"size\": 15\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Empty query (all cases)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.withpersona.com/api/v1/cases/search")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"page\": {\n    \"size\": 15\n  }\n}")
  .asString();
```

```php Empty query (all cases)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withpersona.com/api/v1/cases/search', [
  'body' => '{
  "page": {
    "size": 15
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Empty query (all cases)
using RestSharp;

var client = new RestClient("https://api.withpersona.com/api/v1/cases/search");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"page\": {\n    \"size\": 15\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Empty query (all cases)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["page": ["size": 15]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/cases/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```