---
title: "Searches for documents"
url: "https://developers.zinnia.com/apis/documents-0-3-0/versions/43d1ee7b-44e7-4303-b0cd-ca813c63b625/operations/searchDocuments"
---

> Full API specification: https://developers.zinnia.com/apis/documents-0-3-0/versions/43d1ee7b-44e7-4303-b0cd-ca813c63b625.md

# Searches for documents

`POST` `/document/v3/documents/search`

Operation ID: `searchDocuments`

finds documents based on filters like document classification, document type, policy number etc

## Query parameters

- `limit` (integer, int32, optional) - Number of documents to be fetched. Max=1000
- `offset` (integer, int32, optional) - Offset value for pagination

## Header parameters

- `Authorization` (string, required) - Authorization token
- `x-correlation-id` (string, optional) - Unique ID for correlating requests

## Request body (required)

Content types: `application/json`

## Responses

- `200` - documents retrieved successfully
- `400` - Bad Request
- `403` - Forbidden
- `500` - Internal Server Error

## OpenAPI definition

```yaml
openapi: 3.0.1
info:
  title: Enterprise Documents API
  version: 3.0.0
servers:
  - url: https://dev.api.zinnia.io
    description: Dev Environment
  - url: https://qa.api.zinnia.io
    description: QA Environment
  - url: https://uat.api.zinnia.io
    description: UAT Environment
  - url: https://api.zinnia.io
    description: PROD Environment
paths:
  /document/v3/documents/search:
    post:
      security:
        - Auth0: []
      tags:
        - Documents V3
      summary: Searches for documents
      description: finds documents based on filters like document classification,
        document type, policy number etc
      operationId: searchDocuments
      parameters:
        - name: Authorization
          required: true
          in: header
          example: Bearer <token>
          description: Authorization token
          schema:
            type: string
        - name: limit
          in: query
          required: false
          example: 25
          description: Number of documents to be fetched. Max=1000
          schema:
            type: integer
            format: int32
            default: 10
            maximum: 1000
        - name: offset
          in: query
          required: false
          example: 1
          description: Offset value for pagination
          schema:
            type: integer
            format: int32
            default: 0
        - name: x-correlation-id
          in: header
          required: false
          description: Unique ID for correlating requests
          example: 123e4567-e89b-12d3-a456-426614174000
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SearchRequest"
        required: true
      responses:
        "200":
          description: documents retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchDocumentResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Limit must be greater than 0.\nOffset cannot be negative.
                  statusCode:
                    type: integer
                    example: 400
                  correlationId:
                    type: string
                    example: 123e4567-e89b-12d3-a456-426614174000
                  success:
                    type: string
                    example: "false"
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Document access denied
                  statusCode:
                    type: integer
                    example: 403
                  correlationId:
                    type: string
                    example: 123e4567-e89b-12d3-a456-426614174000
                  success:
                    type: string
                    example: "false"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: documents search failed
                  statusCode:
                    type: integer
                    example: 500
                  correlationId:
                    type: string
                    example: 123e4567-e89b-12d3-a456-426614174000
                  success:
                    type: string
                    example: "false"
security:
  - Auth0: []
components:
  schemas:
    SearchRequest:
      anyOf:
        - type: object
          description: Date Range scenario - Document date range search
          properties:
            documentStartDate:
              type: string
              description: Start date of the document period for filtering results
              format: date
              example: 2024-10-01
            documentEndDate:
              type: string
              description: End date of the document period for filtering results
              format: date
              example: 2024-10-31
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - documentStartDate
            - documentEndDate
        - type: object
          description: Date Range scenario - Import date range search
          properties:
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            importStartDate:
              type: string
              description: Import Start date of the document period for filtering results (in
                UTC timezone)
              format: date-time
              example: 2024-10-01T10:20:00.000Z
            importEndDate:
              type: string
              description: Import End date of the document period for filtering results (in
                UTC timezone)
              format: date-time
              example: 2025-10-01T10:20:00.000Z
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - importStartDate
            - importEndDate
        - type: object
          description: Policy Number scenario - Search based on policy number and plan code
          properties:
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - policyNumber
        - type: object
          description: Agent Documents scenario - Search based on master agent number
          properties:
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - masterAgentNumber
        - type: object
          description: Application ID scenario - Search based on application ID
          properties:
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - appId
        - type: object
          description: Zinnia Live Case ID scenario - Search based on Zinnia Live Case ID
          properties:
            parentCarrierCode:
              type: string
              description: Client code associated with the document search
              example: EVGL
            documentClassification:
              type: string
              description: Classification of the document indicating type, e.g., outbound or
                inbound
              example: OUTBOUND
              enum:
                - OUTBOUND
                - INBOUND
            documentType:
              type: string
              description: Type of document, defining its primary purpose
              example: NB Application
            documentCategory:
              type: string
              description: Category of the document, such as New Business or Claim
              example: NEW_BUSINESS
              enum:
                - NEW_BUSINESS
                - POST_ISSUE
                - DEATH
                - CORRESPONDENCE
                - AGENT
                - SUITABILITY
            policyNumber:
              type: string
              description: Policy number associated with the document, used for identification
              example: "23109168"
            planCode:
              type: string
              description: Plan code associated with the document, used for identification
              example: plan67890f
            documentStatus:
              type: array
              description: List of statuses the document may have, supporting filtering by
                multiple statuses
              example:
                - ACTIVE
                - INACTIVE
              items:
                type: string
                description: List of statuses the document may have, supporting filtering by
                  multiple statuses
                enum:
                  - ACTIVE
                  - INACTIVE
            appId:
              type: string
              description: Application ID tied to the document for tracking and retrieval
              example: EDJ041120240000000001
            zinniaLiveCaseId:
              type: string
              description: Unique case ID in the Zinnia system associated with the document
              example: ZLC09876
            orderBy:
              type: string
              description: The field used to order search results; default is document Date
              example: documentDate
            orderByDirection:
              type: string
              description: Direction of the sort order for search results, either ascending or
                descending
              example: DESC
              enum:
                - ASC
                - DESC
            recipient:
              type: string
              description: Recipient of the document
              example: AGENT
              enum:
                - AGENT
                - CLIENT
            appVersion:
              type: integer
              description: App Version
              format: int32
              example: 1
            masterAgentNumber:
              type: string
              description: Master Agent Number
              example: MA98416687
          required:
            - zinniaLiveCaseId
    SearchDocumentResponse:
      type: object
      properties:
        count:
          type: integer
          description: Number of total documents found matching the search criteria
          format: int32
          example: 100
        documents:
          type: array
          items:
            $ref: "#/components/schemas/MetadataSearchResponse"
        correlationId:
          type: string
          description: Unique ID for correlating requests
          example: 123e4567-e89b-12d3-a456-426614174000
    MetadataSearchResponse:
      type: object
      properties:
        documentClassification:
          type: string
          description: Document classification to identify document type
          example: OUTBOUND
          enum:
            - OUTBOUND
            - INBOUND
        sourceFileName:
          type: string
          description: Actual name of the document
          example: 123456.pdf
        planCode:
          type: string
          description: Plan code associated with the document
          example: "235"
        documentStatus:
          type: integer
          description: Indicates the current status of the document. '1' for ACTIVE, '0'
            for INACTIVE.
          format: int32
          example: 1
        documentId:
          type: string
          description: Unique ID of the document
          example: 67124697f3bef2497b6accfb
        documentDate:
          type: string
          description: Date associated with the document
          format: date-time
        documentType:
          type: string
          description: Type of the document
          example: NB Application
        documentCategory:
          type: string
          description: Category of the document
          example: New Business
        documentTypeDescription:
          type: string
          description: Detailed description of the document type
          example: Deferred Annuity Application
        zinniaLiveCaseId:
          type: string
          description: Zinnia live case ID associated with the document
          example: ZLC09876
        appId:
          type: string
          description: Application ID related to the document
          example: XXXXEDJ041120240000000001
        mailTrackingNumber:
          type: string
          description: Tracking ID for the document
          example: "4453166346"
        policyNumber:
          type: string
          description: Policy number linked to the document
          example: "23576001"
        createDate:
          type: string
          description: Creation date of the document (in UTC timezone)
          format: date-time
          example: 2024-03-18T14:30:00.000Z
        correlationId:
          type: string
          description: Correlation ID for the document
          example: 12345-corr-67890
        periodYear:
          type: integer
          description: Year related to the document period
          format: int32
          example: 2024
        periodQuarter:
          type: string
          description: Quarter related to the document period
          example: Q2
        fileType:
          type: string
          description: File type of the document
          example: pdf
        displayName:
          type: string
          description: Display name for the document
          example: New Business Policy Document
        brokerMasterNumber:
          type: string
          description: Master number of the broker associated with the document
          example: BKR123456
        repMasterNumber:
          type: string
          description: Master number of the representative associated with the document
          example: REP987654
        documentNumber:
          type: string
          description: Document number associated with the document (if present) else
            document Id
          example: 670e23dfab593b4387210b81 or 20241230-M-463066
        formNumber:
          type: string
          description: formNumber
          example: "1234"
        importDate:
          type: string
          format: date-time
          description: Document creation timestamp(in UTC timezone)
          example: 2024-09-23T10:30:00.000Z
  securitySchemes:
    Auth0:
      type: openIdConnect
      openIdConnectUrl: https://login.zinnia.com/.well-known/openid-configuration
      x-kong-security-openid-connect:
        config:
          run_on_preflight: true
          scopes_claim:
            - https://api.zinnia.io/permissions
          audience_claim:
            - aud
          audience_required:
            - https://api.zinnia.io
          client_id:
            - bGOIRPRq2ZnjCujDXC7ikwR5ez7VH5GZ
          auth_methods:
            - bearer
          scopes: []
        enabled: true
        protocols:
          - grpc
          - grpcs
          - http
          - https
```
