> ## Documentation Index
> Fetch the complete documentation index at: https://prismeai-docs-next.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Post v2workspaces search

> Generic search API to query or aggregate events & DSUL objects



## OpenAPI

````yaml /api-reference/swagger.yml post /v2/workspaces/{workspaceId}/search
openapi: 3.0.0
info:
  version: 1.0.0
  title: Prisme.ai APIs
  description: Prisme.ai APIs specifications
  termsOfService: https://www.prisme.ai/mentions-legales
  contact:
    name: Prisme.ai Support Team
    email: support@prisme.ai
    url: https://www.prisme.ai
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.eda.prisme.ai
  - url: http://localhost:3001
security:
  - BearerAuth: []
  - WorkspaceApiKeyAuth: []
  - BearerAuth: []
    WorkspaceApiKeyAuth: []
paths:
  /v2/workspaces/{workspaceId}/search:
    post:
      tags:
        - Prisme.ai Events
      description: Generic search API to query or aggregate events & DSUL objects
      operationId: search
      parameters:
        - name: workspaceId
          in: path
          description: ID of workspace to search in
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - query
              properties:
                scope:
                  type: string
                  enum:
                    - events
                limit:
                  type: number
                  description: >-
                    Page size. Limit response documents, but aggregations still
                    execute on all documents matching the given query
                page:
                  type: number
                  description: Page number returned by response's documents field
                query:
                  type: object
                  additionalProperties: true
                  description: Elasticsearch DSL query to filter response documents
                aggs:
                  type: object
                  additionalProperties: true
                  description: Elasticsearch aggregations executed on response documents
                runtime_mappings:
                  type: object
                  additionalProperties: true
                  description: Elasticsearch runtime_mappings executed on runtime
                source:
                  type: array
                  items:
                    type: string
                  description: Elasticsearch _source
                sort:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                    description: Elasticsearch sort
                track_total_hits:
                  type: boolean
                  description: Get real total instead of 10000
      responses:
        '200':
          description: Success Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  size:
                    type: number
                  documents:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  aggs:
                    type: object
                    additionalProperties: true
        '400':
          description: Bad parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadParametersError'
        '401':
          description: AuthenticationError
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '403':
          description: Bad permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Object not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectNotFoundError'
components:
  schemas:
    BadParametersError:
      type: object
      properties:
        error:
          type: string
          example: BadParameters
        message:
          type: string
        details: {}
    AuthenticationError:
      type: object
      properties:
        error:
          type: string
          example: AuthenticationError
        message:
          type: string
          example: Unauthenticated
    ForbiddenError:
      type: object
      properties:
        error:
          type: string
          example: ForbiddenError
        message:
          type: string
          example: Forbidden
    ObjectNotFoundError:
      type: object
      properties:
        error:
          type: string
          example: ObjectNotFound
        message:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key

````