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

# Grouped historical query

> Returns the total number of lawsuits related to a party, aggregated by lawsuit header attributes (classification, subject, area, tribunal, and more).



## OpenAPI

````yaml openapi/lawsuits.json POST /lawsuits/synthetic
openapi: 3.0.0
info:
  title: JUDIT - Lawsuits API
  version: v1.28.8
servers:
  - url: https://lawsuits.production.judit.io
    description: Production server
security: []
paths:
  /lawsuits/synthetic:
    post:
      tags:
        - Processos
      summary: Agregações sintéticas de processos
      description: >-
        Retorna processos agregados por: (classificações, assuntos, tribunais,
        etc.) para os filtros informados.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LawsuitsSynthetic.Body.Post'
            example:
              search:
                search_type: cpf
                search_key: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LawsuitsSynthetic.Response.Post'
        '401':
          description: Unauthorized - Missing or invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpUnauthorizedError'
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpForbiddenError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpInternalServerError'
      security:
        - jwtAuth: []
        - apiKeyAuth: []
components:
  schemas:
    LawsuitsSynthetic.Body.Post:
      type: object
      properties:
        search:
          type: object
          properties:
            search_type:
              type: string
              enum:
                - cpf
                - cnpj
                - oab
                - name
                - rji
                - lawsuit_cnj
                - lawsuit_attachment
                - execution_attachment
                - custom
            search_key:
              type: string
            search_name:
              type: string
            response_type:
              default: lawsuits
              anyOf:
                - type: string
                  enum:
                    - application_error
                    - application_warning
                    - application_info
                - type: string
                  enum:
                    - lawsuits
                - type: string
                  enum:
                    - lawsuit
                - type: string
                  enum:
                    - warrant
                    - execution
                - type: string
                  enum:
                    - entity
                - type: string
                  enum:
                    - summary
                - type: string
                  enum:
                    - sanction
                - type: string
                  enum:
                    - synthetic_lawsuits
                - type: string
                  enum:
                    - communication
            search_params:
              type: object
              properties:
                with_inferred_parties:
                  type: boolean
                with_unique_name_search:
                  type: boolean
                lawsuit_instance:
                  type: number
                filter:
                  type: object
                  properties:
                    side:
                      type: string
                      enum:
                        - Passive
                        - Active
                        - Interested
                        - Unknown
                    party_names:
                      type: array
                      items:
                        type: string
                    party_documents:
                      type: array
                      items:
                        type: string
                    distribution_date_gte:
                      type: string
                      format: date-time
                    distribution_date_lte:
                      type: string
                      format: date-time
                    last_step_date_gte:
                      type: string
                      format: date-time
                    last_step_date_lte:
                      type: string
                      format: date-time
                    tribunals:
                      type: object
                      properties:
                        keys:
                          type: array
                          items:
                            type: string
                        not_equal:
                          type: boolean
                      required:
                        - keys
                        - not_equal
                    classification_codes:
                      type: object
                      properties:
                        keys:
                          type: array
                          items:
                            type: string
                        not_equal:
                          type: boolean
                      required:
                        - keys
                        - not_equal
                    classification_names:
                      type: object
                      properties:
                        keys:
                          type: array
                          items:
                            type: string
                        not_equal:
                          type: boolean
                      required:
                        - keys
                        - not_equal
                    subject_codes:
                      type: object
                      properties:
                        contains:
                          type: array
                          items:
                            type: string
                        not_contains:
                          type: array
                          items:
                            type: string
                      required:
                        - contains
                        - not_contains
                    subject_names:
                      type: object
                      properties:
                        contains:
                          type: array
                          items:
                            type: string
                        not_contains:
                          type: array
                          items:
                            type: string
                      required:
                        - contains
                        - not_contains
                    amount_lte:
                      type: number
                    amount_gte:
                      type: number
            lawsuit_list:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  instance:
                    type: number
                required:
                  - code
                  - instance
          required:
            - search_type
            - search_key
      required:
        - search
    LawsuitsSynthetic.Response.Post:
      type: object
      properties:
        classifications:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        subjects:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        areas:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        tribunals:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        justices:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        phases:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        states:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        instances:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        sides:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        person_types:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        names:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        other_parties:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              count:
                type: number
            required:
              - value
              - count
        lawsuits_count:
          type: number
        secrecy_lawsuits_count:
          type: number
        request_id:
          type: string
      required:
        - classifications
        - subjects
        - areas
        - tribunals
        - justices
        - phases
        - states
        - instances
        - sides
        - person_types
        - names
        - other_parties
        - lawsuits_count
        - secrecy_lawsuits_count
        - request_id
    HttpUnauthorizedError:
      type: object
      properties:
        error:
          type: object
          properties:
            name:
              type: string
              example: HttpUnauthorizedError
            message:
              type: string
              example: UNAUTHORIZED
            stack:
              type: string
            data:
              type: string
              example: User must be authenticated
    HttpForbiddenError:
      type: object
      properties:
        error:
          type: object
          properties:
            name:
              type: string
              example: HttpForbiddenError
            message:
              type: string
              example: FORBIDDEN
            stack:
              type: string
            data:
              type: string
              example: Authenticated user is not authorized
    HttpInternalServerError:
      type: object
      properties:
        error:
          type: object
          properties:
            name:
              type: string
              example: HttpInternalServerError
            message:
              type: string
              example: INTERNAL_SERVER_ERROR
            stack:
              type: string
            data:
              type: object
              example:
                message: Database connection failed
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token for authentication
    apiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: API key for authentication

````