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

# Baixar PDF Consolidado da Diligência

> Baixa o PDF consolidado da diligência quando o processamento estiver concluído



## OpenAPI

````yaml GET /diligences/{id}/download-pdf
openapi: 3.0.3
info:
  title: DiHub API
  description: API para acessar as funcionalidades da plataforma DiHub
  version: 1.0.0
  contact:
    name: Suporte DiHub
    email: claudiolima@dihub.com.br
servers:
  - url: https://api.dihub.com.br
    description: Produção
  - url: https://homolog.api.dihubapp.com
    description: Homologação
security: []
tags:
  - name: Créditos
    description: Gestão de saldo de créditos
  - name: Diligências
    description: Emissão de diligências e gestão de certidões
paths:
  /diligences/{id}/download-pdf:
    get:
      tags:
        - Diligências
      summary: Download diligence as PDF
      description: >-
        Downloads the diligence report as PDF. When mergeCertificates=1, merges
        all completed certificates into a single PDF. When mergeCertificates=0,
        returns the first completed certificate PDF.
      operationId: downloadDiligencePdf
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Diligence ID
        - name: mergeCertificates
          in: query
          required: false
          schema:
            type: string
            enum:
              - '0'
              - '1'
            default: '0'
          description: >-
            1 to merge all certificates into one PDF, 0 to return first
            certificate only
      responses:
        '200':
          description: PDF file
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Diligence not found or no completed certificates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - ApiKeyAuth: []
components:
  responses:
    UnauthorizedError:
      description: Credenciais de autenticação ausentes ou inválidas
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: Unauthorized
    InternalServerError:
      description: Erro interno do servidor
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: Internal Server Error
  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Mensagem de erro
          example: Validation Error
        details:
          oneOf:
            - type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                  message:
                    type: string
            - type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Token
      description: Chave de API para autenticação. Envie o token no header X-Api-Token.

````