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

# Get lawsuits by exact party document filter



## OpenAPI

````yaml /api-reference/openapi.json get /v2/lawsuits
openapi: 3.1.0
info:
  title: Base39 API
  description: Base39 API
  version: 1.0.0
  contact:
    name: Base39 Team
    url: https://base39.com.br
    email: suporte@base39.com.br
  termsOfService: https://base39.com.br/termos
  license:
    name: Proprietary
    url: https://base39.com.br/termos
servers:
  - url: http://localhost:3000
    description: Local
  - url: https://api.dev.base39.cloud
    description: Development
  - url: https://api.base39.com.br
    description: Production
security:
  - OAuth2: []
tags:
  - name: pages
    description: Profiles and reports pages
  - name: pipelines
    description: Pipeline boards (kanban) of pages
  - name: blocks
    description: Blocks operations
  - name: search
    description: Search across content
  - name: targets
    description: Lookup targets via datasets
  - name: CognitoTriggers
    description: Cognito triggers
paths:
  /v2/lawsuits:
    get:
      tags:
        - lawsuits
      summary: Get lawsuits by exact party document filter
      operationId: lawsuits_list
      parameters:
        - name: expand
          required: false
          in: query
          description: >-
            Comma-separated fields to expand. Supports selection with brackets
            (e.g., "createdBy,updatedBy" or "targets.company[icon,tradeName]").
          schema:
            example: createdBy
            type: string
        - name: page_size
          required: false
          in: query
          description: Items per page (default 20, max 100)
          schema:
            minimum: 1
            maximum: 100
            default: 20
            example: 100
            type: number
        - name: start_cursor
          required: false
          in: query
          description: Cursor for next page
          schema:
            example: >-
              eyJjcmVhdGVkX3RpbWUiOiIyMDI0LTExLTE1VDEwOjAwOjAwLjAwMFoiLCJpZCI6InBhZ2VfYWJjMTIzIn0=
            type: string
        - name: filter
          required: true
          in: query
          description: 'Required exact filter. Supported field: `parties.document`.'
          schema:
            example: parties.document:"61969404000182"
            type: string
        - name: legal_name
          required: false
          in: query
          description: Company legal name for party-name matching
          schema:
            type: string
      responses:
        '200':
          description: Stable lawsuits payload
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/LawsuitsByDocumentOutput'
        '400':
          description: Invalid filter, document or cursor
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '401':
          description: Unauthorized
        '404':
          description: Lawsuits not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '412':
          description: Concurrency conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
components:
  schemas:
    LawsuitsByDocumentOutput:
      type: object
      properties:
        object:
          type: string
          description: Object type identifier
          default: list
        results:
          description: Array of results for current page
          type: array
          items:
            $ref: '#/components/schemas/LawsuitListItemOutput'
        next_cursor:
          type: string
          description: Opaque cursor for next page. null if no more results.
          nullable: true
        has_more:
          type: boolean
          description: Whether more results exist beyond this page
        type:
          type: string
          description: Type of results (Notion-compatible)
        entityType:
          type: string
          enum:
            - company
            - person
        document:
          type: string
        asOf:
          type: string
          nullable: true
        sources:
          type: array
          items:
            $ref: '#/components/schemas/SourceReferenceOutput'
        metadata:
          $ref: '#/components/schemas/EntityDomainMetadataOutput'
      required:
        - object
        - results
        - has_more
        - entityType
        - document
        - sources
        - metadata
    ProblemDetailsDto:
      type: object
      properties:
        type:
          type: string
          example: about:blank
        title:
          type: string
          example: Not Found
        status:
          type: number
          example: 404
        detail:
          type: string
          example: Protests not found for document
        instance:
          type: string
          example: /v2/entities/61969404000182/protests
        request_id:
          type: string
          example: req_123
      required:
        - type
        - title
        - status
        - detail
        - instance
        - request_id
    LawsuitListItemOutput:
      type: object
      properties:
        cnjNumber:
          type: string
        type:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        value:
          type: number
          nullable: true
        courtName:
          type: string
          nullable: true
        courtType:
          type: string
          nullable: true
        courtLevel:
          type: string
          nullable: true
        courtDistrict:
          type: string
          nullable: true
        judgingBody:
          type: string
          nullable: true
        state:
          type: string
          nullable: true
        mainSubject:
          type: string
          nullable: true
        distributionDate:
          type: string
          nullable: true
        noticeDate:
          type: string
          nullable: true
        closeDate:
          type: string
          nullable: true
        partyPolarity:
          type: string
          nullable: true
        lastMovementDate:
          type: string
          nullable: true
        lastActivityAt:
          type: string
          nullable: true
        roles:
          type: array
          items:
            type: string
        polarities:
          type: array
          items:
            type: string
        matchType:
          type: string
          enum:
            - document
            - name
          nullable: true
          description: How the searched entity matched this lawsuit.
        parties:
          type: array
          items:
            $ref: '#/components/schemas/LawsuitPartyItemOutput'
      required:
        - cnjNumber
        - roles
        - polarities
        - parties
    SourceReferenceOutput:
      type: object
      properties:
        queryId:
          type: string
        datasetSlug:
          type: string
        sourcePriority:
          type: number
        observedAt:
          type: string
        recordedAt:
          type: string
      required:
        - queryId
        - datasetSlug
        - sourcePriority
        - observedAt
        - recordedAt
    EntityDomainMetadataOutput:
      type: object
      properties:
        status:
          type: string
          enum:
            - NOT_QUERIED
            - QUERY_SUCCEEDED
            - QUERY_OUTDATED
            - QUERY_FAILED
            - QUERY_PARTIALLY_SUCCEEDED
        summary:
          description: >-
            Rendered domain summary markdown or MDX when requested via
            ?fields=summary.short, summary.long, and/or summary.mdx. Single
            format → string. Multiple formats → object { short, long, mdx }.
          oneOf:
            - type: string
            - type: object
              properties:
                short:
                  type: string
                long:
                  type: string
                mdx:
                  type: string
        provenance:
          $ref: '#/components/schemas/EntityDomainProvenanceOutput'
      required:
        - status
        - provenance
    LawsuitPartyItemOutput:
      type: object
      properties:
        cnjNumber:
          type: string
        name:
          type: string
          nullable: true
        document:
          type: string
          nullable: true
        role:
          type: string
          nullable: true
        polarity:
          type: string
          nullable: true
        matched:
          type: boolean
          description: True when this party is the searched entity.
        matchType:
          type: string
          enum:
            - document
            - name
          nullable: true
          description: How this party matched the searched entity.
        isActive:
          type: boolean
          nullable: true
        isInference:
          type: boolean
          nullable: true
        oab:
          type: string
          nullable: true
        oabState:
          type: string
          nullable: true
        specificType:
          type: string
          nullable: true
        aliases:
          nullable: true
          type: array
          items:
            type: string
        sourceProvider:
          type: string
          nullable: true
        sourceDataset:
          type: string
          nullable: true
        sourceCollection:
          type: string
          nullable: true
      required:
        - cnjNumber
    EntityDomainProvenanceOutput:
      type: object
      properties:
        datasets:
          type: array
          items:
            $ref: '#/components/schemas/EntityDatasetProvenanceOutput'
      required:
        - datasets
    EntityDatasetProvenanceOutput:
      type: object
      properties:
        queryId:
          type: string
          nullable: true
        datasetSlug:
          type: string
        requirement:
          type: string
          enum:
            - required
            - optional
        visible:
          type: boolean
        onRefresh:
          type: boolean
        sourcePriority:
          type: number
        observedAt:
          type: string
          nullable: true
        recordedAt:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - NOT_QUERIED
            - QUERY_SUCCEEDED
            - QUERY_OUTDATED
            - QUERY_FAILED
            - QUERY_PARTIALLY_SUCCEEDED
        errorCode:
          type: string
          enum:
            - upstream_error
            - upstream_unauthorized
            - upstream_not_found
            - upstream_rate_limit
            - upstream_invalid_request
            - upstream_unavailable
            - upstream_timeout
            - upstream_invalid_response
            - mock_response_missing
            - provider_execution_failed
            - query_persistence_failed
            - workflow_failed
          nullable: true
      required:
        - datasetSlug
        - requirement
        - visible
        - onRefresh
        - sourcePriority
        - status
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://id.local.base39.cloud/oauth2/authorize
          tokenUrl: https://id.local.base39.cloud/oauth2/token
          scopes:
            profile: Read user profile
            email: Read user email
            openid: OpenID authentication
      description: OAuth2 Authorization Code flow

````