> ## 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 query execution details



## OpenAPI

````yaml /api-reference/openapi.json get /v2/queries/{id}
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/queries/{id}:
    get:
      tags:
        - queries
      summary: Get query execution details
      operationId: query_find_one
      parameters:
        - name: id
          required: true
          in: path
          description: Query execution ID
          schema:
            type: string
        - name: field
          required: false
          in: query
          description: Optional field to include in the response.
          schema:
            enum:
              - raw_response_provider
            type: string
        - name: fields
          required: false
          in: query
          description: >-
            Comma-separated optional response fields. Supports "summary.short",
            "summary.long", and "summary.mdx".
          schema:
            example: summary
            type: string
      responses:
        '200':
          description: Query execution details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
components:
  schemas:
    Query:
      type: object
      properties:
        object:
          type: string
          description: Object type identifier
          example: query
          enum:
            - query
        id:
          type: string
          description: Query execution ID
          example: qry_abc123
        status:
          type: string
          description: Query execution status
          enum:
            - success
            - partial_success
            - error
            - pending
        dataset:
          description: Dataset being queried (minimal reference)
          allOf:
            - $ref: '#/components/schemas/DatasetRef'
        provider:
          description: Provider used for the query
          allOf:
            - $ref: '#/components/schemas/ProviderRef'
        asOfDate:
          type: string
          description: Date for which data is queried
          example: '2025-11-21'
        createdAt:
          type: string
          description: Query creation timestamp
          example: '2025-11-21T19:00:00.000Z'
          format: date-time
        createdBy:
          type: object
          description: Principal who created this query
          properties:
            object:
              type: string
              enum:
                - user
                - service_account
              example: user
            id:
              type: string
              example: usr_abc123
            apiKeyId:
              type: string
              example: bsk_abc123
        isMock:
          type: boolean
          description: Whether this is a mock query (testing mode)
          example: false
        cacheStatus:
          type: string
          enum:
            - hit
            - miss
        results:
          type: array
          items:
            type: object
            additionalProperties: true
          description: >-
            Query results. Each item follows the schema defined by the dataset
            being queried.
        requestId:
          type: string
        summary:
          description: >-
            Rendered query summary markdown or MDX when requested via
            ?fields=summary.short, summary.long, summary.mdx, and/or
            summary.mdx-list. Single format → string. Multiple formats → object
            { short, long, mdx, "mdx-list" }.
          oneOf:
            - type: string
            - type: object
              properties:
                short:
                  type: string
                long:
                  type: string
                mdx:
                  type: string
                mdx-list:
                  type: string
        attempts:
          type: number
        duration:
          type: number
          description: Query duration in milliseconds
        errorMessage:
          type: string
        rawParams:
          type: object
          description: Raw query parameters used for this query
          additionalProperties: true
        cost:
          type: number
          description: Query cost in cents (0 for cached queries)
        affectedCanonicalTargets:
          description: Canonical entity query targets impacted by this dataset execution.
          type: array
          items:
            $ref: '#/components/schemas/QueryCanonicalInvalidationTargetOutput'
        rawResponseProvider:
          type: array
          description: Raw provider response captured during query execution.
          items:
            type: object
            additionalProperties: true
          nullable: true
        parent:
          description: Parent dataset query reference
          allOf:
            - $ref: '#/components/schemas/QueryParentOutput'
        export:
          description: PDF export generated for this query
          allOf:
            - $ref: '#/components/schemas/QueryExportOutput'
      required:
        - object
        - status
        - dataset
        - asOfDate
        - createdAt
        - isMock
        - cacheStatus
        - results
        - rawParams
    DatasetRef:
      type: object
      properties:
        object:
          type: string
          description: Object type identifier
          example: dataset
          enum:
            - dataset
        id:
          type: string
          description: Dataset ID
        slug:
          type: string
          description: Dataset slug
        name:
          type: string
          description: Dataset name
        description:
          type: string
          description: Dataset description
          nullable: true
        cost:
          type: number
          description: Query cost in cents
        upstreams:
          type: array
          items:
            $ref: '#/components/schemas/UpstreamOutput'
      required:
        - object
        - id
    ProviderRef:
      type: object
      properties:
        object:
          type: string
          description: Object type identifier
          example: provider
          enum:
            - provider
        id:
          type: string
          description: Provider ID
        slug:
          type: string
          description: Provider slug
        name:
          type: string
          description: Provider name
      required:
        - object
        - id
    QueryCanonicalInvalidationTargetOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - domain
            - certificate
            - sanction
            - endpoint
        domain:
          type: string
          description: Entity domain when type is domain
          example: serasa
        certificate:
          type: string
          description: Certificate key when type is certificate
          example: fgts
        sanction:
          type: string
          description: Sanction source key when type is sanction
          example: ceis
        endpoint:
          type: string
          description: Canonical entity endpoint key when type is endpoint
          example: entitiesGetScr
      required:
        - type
    QueryParentOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - dataset_query_id
            - company_id
            - person_id
        dataset_query_id:
          type: string
          description: Parent dataset query ID
          example: qry_parent123
        company_id:
          type: string
          description: Parent company ID
          example: cmp_123
        person_id:
          type: string
          description: Parent person ID
          example: '12345678909'
      required:
        - type
    QueryExportOutput:
      type: object
      properties:
        type:
          type: string
          description: Export reference type
          enum:
            - file_upload_id
          example: file_upload_id
        file_upload_id:
          type: string
          description: File upload ID for the generated PDF
          example: fl_abc123
        downloadUrl:
          type: string
          description: Authenticated PDF download URL
          example: https://files.base39.cloud/uploads/org/fl/report.pdf
      required:
        - type
        - file_upload_id
        - downloadUrl
    UpstreamOutput:
      type: object
      properties:
        object:
          type: string
          example: page
          description: Object type
          title: Object
          x-locale-pt-br-title: Objeto
        id:
          type: string
          example: p_abc123
          description: Unique identifier
          title: ID
          x-locale-pt-br-title: ID
        createdAt:
          format: date-time
          type: string
          example: '2024-01-15T10:30:00.000Z'
          description: Creation timestamp
          title: Created at
          x-locale-pt-br-title: Criado em
        updatedAt:
          format: date-time
          type: string
          example: '2024-01-15T14:45:00.000Z'
          description: Last update timestamp
          title: Updated at
          x-locale-pt-br-title: Atualizado em
        createdBy:
          type: object
          example:
            object: user
            id: u_abc123
            apiKeyId: bsk_abc123
          description: Principal who created this object
          properties:
            object:
              type: string
              enum:
                - user
                - service_account
              example: user
            id:
              type: string
              example: u_abc123
            apiKeyId:
              type: string
              example: bsk_abc123
          title: Created by
          x-locale-pt-br-title: Criado por
        updatedBy:
          type: object
          example:
            object: user
            id: u_abc123
            apiKeyId: bsk_abc123
          description: Principal who last updated this object
          properties:
            object:
              type: string
              enum:
                - user
                - service_account
                - webhook
                - stream
              example: user
            id:
              type: string
              example: u_abc123
            apiKeyId:
              type: string
              example: bsk_abc123
          title: Updated by
          x-locale-pt-br-title: Atualizado por
        name:
          type: string
          description: Upstream name
          example: Federal Revenue
        description:
          type: string
          description: Upstream description
          nullable: true
        logo:
          type: string
          description: Upstream logo URL
          nullable: true
        slug:
          type: string
          description: URL-friendly slug
          example: federal-revenue
        country:
          type: string
          description: Country code
          example: BR
        type:
          type: string
          description: Upstream type
          nullable: true
        url:
          type: string
          description: Upstream URL
          nullable: true
        featured:
          type: boolean
          description: Whether this is the featured upstream
          example: true
      required:
        - object
        - id
        - createdAt
        - updatedAt
        - name
        - description
        - logo
        - slug
        - country
        - type
        - url
  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

````