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

# Criar cobrança via boleto

> Gera um boleto bancário. A cobrança nasce com `status` `pending`; a compensação leva de 1 a 3 dias úteis e é confirmada por webhook.

Gera um boleto bancário. A resposta traz a linha digitável (`digitableLine`), o código de barras (`barcode`) e uma `url` para visualização e impressão. A cobrança nasce com `status: "pending"`.

<Note>
  A compensação de boleto leva de 1 a 3 dias úteis. Aguarde o webhook `transaction_paid` antes de liberar o pedido.
</Note>

<Info>
  Visão conceitual e prazos em [Guias › Boleto](/guias/boleto).
</Info>


## OpenAPI

````yaml POST /v1/boleto
openapi: 3.0.3
info:
  title: API Ephra
  description: >-
    API REST para gerar cobranças (PIX, cartão e boleto), consultar transações e
    gerenciar webhooks.
  version: 1.0.0
servers:
  - url: https://api.ephra.io
    description: Servidor de produção
security:
  - bearerAuth: []
tags:
  - name: Autenticação
    description: Login e obtenção do token de acesso
  - name: Pagamentos
    description: Criação de cobranças PIX, cartão e boleto
  - name: Assinaturas
    description: Cobrança recorrente — iniciar, listar, consultar e cancelar assinaturas
  - name: Transações
    description: Consulta de transações
  - name: Webhooks
    description: Cadastro e gerenciamento de webhooks
paths:
  /v1/boleto:
    post:
      tags:
        - Pagamentos
      summary: Criar cobrança via boleto
      description: >-
        Gera um boleto bancário. A cobrança nasce com `status` `pending`; a
        compensação leva de 1 a 3 dias úteis e é confirmada por webhook.
      operationId: createBoleto
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PixQrCodeRequest'
      responses:
        '200':
          description: Boleto criado
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Transação criada com sucesso
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        example: clxabc123def456
                      boleto:
                        type: object
                        properties:
                          url:
                            type: string
                            example: https://.../boleto/clxabc123def456
                          barcode:
                            type: string
                            example: '23793381286000782726337000963779410010000025000'
                          digitableLine:
                            type: string
                            example: >-
                              23793.38128 60007.827263 37000.963779 4
                              10010000025000
                          dueAt:
                            type: string
                            example: '2026-06-10T03:00:00.000Z'
                      status:
                        type: string
                        example: pending
                      fees:
                        type: integer
                        example: 200
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    PixQrCodeRequest:
      type: object
      required:
        - amountInCents
        - customer
      properties:
        amountInCents:
          type: integer
          description: Valor em centavos (> 0)
          example: 10000
        description:
          type: string
          example: 'Pedido #1234'
        postbackUrl:
          type: string
          format: uri
          description: Recebe webhooks só desta transação
        customer:
          $ref: '#/components/schemas/Customer'
        seller:
          $ref: '#/components/schemas/Seller'
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
    Customer:
      type: object
      required:
        - documentType
        - document
      properties:
        documentType:
          type: string
          enum:
            - cpf
            - cnpj
          example: cpf
        document:
          type: string
          description: CPF/CNPJ do pagador (validado)
          example: '12345678909'
        name:
          type: string
          example: Maria Silva
        email:
          type: string
          format: email
          example: maria@email.com
        phone:
          type: string
          example: '+5511999998888'
        billingAddress:
          $ref: '#/components/schemas/Address'
    Seller:
      type: object
      required:
        - name
        - documentType
        - document
      properties:
        name:
          type: string
        documentType:
          type: string
          enum:
            - cpf
            - cnpj
        document:
          type: string
        phone:
          type: string
        averageTicket:
          type: number
        address:
          $ref: '#/components/schemas/Address'
    Item:
      type: object
      required:
        - title
        - tangible
        - quantity
        - amountInCents
      properties:
        title:
          type: string
          example: Produto A
        tangible:
          type: boolean
          example: false
        quantity:
          type: integer
          minimum: 1
          example: 1
        amountInCents:
          type: integer
          example: 10000
        shippingAddress:
          $ref: '#/components/schemas/Address'
    Error:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        error:
          type: string
          example: Bad Request
        message:
          type: string
          example: Mensagem descritiva do erro
    Address:
      type: object
      properties:
        street:
          type: string
        number:
          type: string
        neighborhood:
          type: string
        city:
          type: string
        state:
          type: string
        zipCode:
          type: string
  responses:
    BadRequest:
      description: Requisição inválida
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            error: Bad Request
            message: Documento inválido para o tipo selecionado
    Unauthorized:
      description: Token ausente, inválido ou expirado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            error: Unauthorized
            message: Token inválido ou expirado
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````