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

# Retorna duplicatas

> Retorna duplicatas em um intervalo de datas, por identificador ou agrupadas por cliente



## OpenAPI

````yaml /api-cobmais/openapi.yaml get /duplicatas
openapi: 3.1.0
info:
  title: Agulhão API - Cobmais
  description: API do sistema Agulhão para integração com Cobmais.
  version: 1.0.1
  contact:
    email: contato@softros.com.br
    url: https://agulhao.com.br
servers:
  - url: https://api-integracoes.agulhao.com.br
    description: Produção
security: []
tags:
  - name: duplicatas-cb
externalDocs:
  description: Mais sobre a API
  url: https://docs.agulhao.com.br/api
paths:
  /duplicatas:
    get:
      tags:
        - duplicatas-cb
      summary: Retorna duplicatas
      description: >-
        Retorna duplicatas em um intervalo de datas, por identificador ou
        agrupadas por cliente
      operationId: getDuplicatas
      parameters:
        - name: dataInicial
          in: query
          required: true
          description: Data inicial para filtro (yyyy-MM-dd)
          schema:
            type: string
            format: date
        - name: dataFinal
          in: query
          required: true
          description: Data final para filtro (yyyy-MM-dd)
          schema:
            type: string
            format: date
        - name: agrupadoPorCliente
          in: query
          description: Indica se as duplicatas devem ser agrupadas por cliente
          schema:
            type: boolean
        - name: duplicatas
          in: query
          description: Lista de IDs de duplicatas separados por vírgula
          schema:
            type: string
            example: 1,2,3
        - name: tipo
          in: query
          required: true
          description: Tipo do retorno das duplicatas
          schema:
            type: string
            enum:
              - aberto
              - vencido
              - comPagamento
              - liquidado
      responses:
        '200':
          description: Retorno das duplicatas conforme tipo solicitado
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Duplicata'
                  - $ref: '#/components/schemas/DuplicataComPagamentos'
                  - $ref: '#/components/schemas/DuplicataAgrupadaPorCliente'
        '400':
          description: Parâmetros inválidos
        '401':
          description: Chave de API inválida ou ausente
      security:
        - chaveApi: []
components:
  schemas:
    Duplicata:
      type: array
      items:
        $ref: '#/components/schemas/DuplicataItem'
    DuplicataComPagamentos:
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/DuplicataItem'
          - type: object
            properties:
              pagamentos:
                type: array
                items:
                  $ref: '#/components/schemas/Pagamento'
    DuplicataAgrupadaPorCliente:
      type: array
      items:
        type: object
        properties:
          id:
            type: integer
            format: int64
          cpfCnpj:
            type: string
          nome:
            type: string
          telefone:
            type: string
          celular:
            type: string
          email:
            type: string
          logradouro:
            type: string
          numero:
            type: string
          bairro:
            type: string
          cep:
            type: string
          cidadeId:
            type: integer
            format: int64
          cidadeNome:
            type: string
          uf:
            type: string
          ieRg:
            type: string
          dataAniversario:
            type: string
            format: date
          duplicatas:
            type: array
            items:
              $ref: '#/components/schemas/DuplicataItem'
    DuplicataItem:
      type: object
      properties:
        id:
          type: integer
          format: int64
        clienteId:
          type: integer
          format: int64
        clienteCpfCnpj:
          type: string
        filialId:
          type: integer
          format: int64
        filialNome:
          type: string
        pedidoId:
          type: integer
          format: int64
        parcelas:
          type: string
        dataEmissao:
          type: string
          format: date-time
        vencimento:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - A
            - I
        tipo:
          type: string
        tipoDescricao:
          type: string
        valor:
          type: number
          format: float
        saldo:
          type: number
          format: float
        numero:
          type: string
    Pagamento:
      type: object
      properties:
        valor:
          type: number
          format: float
        dataHora:
          type: string
          format: date-time
        descricao:
          type: string
  securitySchemes:
    chaveApi:
      type: apiKey
      in: header
      name: x-api-key
      description: Chave da API gerada no Agulhão

````