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

# Crear cobranza recurrente (txid generado por el PSP)

> Crea una cobranza recurrente (CobR) con un txid generado por el servidor. API Pix POST /cobr.



## OpenAPI

````yaml es/openapi/v3-current/spi-brcode.yaml post /api/v1/brcode/cobr
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Servicio de BR Code para la generación y decodificación de códigos QR (EMV
    QRCPS-MPM).
  license:
    name: Lerian Studio General License
  title: Lerian SPI — BR Code API
  version: 1.0.0
servers:
  - url: https://spi.sandbox.lerian.net
security: []
tags:
  - description: >-
      Generación, decodificación, validación, información y consulta de payloads
      de BR Code EMV.
    name: BRCode
  - description: >-
      Cobranzas Pix (Cob/CobV/LoteCobV): crear, consultar por TxID, listar,
      cancelar, conciliar y resolver payloads públicos.
    name: Charges
  - description: >-
      Flujo (orden obligatorio): crear cob/cobv → generar QR/payload. Un payload
      dinámico de BR Code hace referencia a una cobranza, por lo que la cobranza
      cob/cobv DEBE crearse primero; el payload se vincula a ella mediante
      txid/locator.
    name: charge
paths:
  /api/v1/brcode/cobr:
    post:
      tags:
        - CobR
      summary: Crear cobranza recurrente (txid generado por el PSP)
      description: >-
        Crea una cobranza recurrente (CobR) con un txid generado por el
        servidor. API Pix POST /cobr.
      operationId: postCobR
      parameters:
        - description: Idempotency key, max 255 characters.
          in: header
          name: Idempotency-Key
          schema:
            description: Idempotency key, max 255 characters.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CobRSolicitada'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CobRGerada'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    CobRSolicitada:
      additionalProperties: false
      properties:
        ajusteDiaUtil:
          description: >-
            Ajusta a liquidação para o próximo dia útil quando o vencimento cai
            em dia não-útil.
          type: boolean
        calendario:
          $ref: '#/components/schemas/CobRCalendarioCreate'
          description: Controle de tempo da cobrança.
        devedor:
          $ref: '#/components/schemas/CobRDevedorDTO'
          description: Contato do devedor (sem identidade; a identidade está na Rec).
        idRec:
          description: Recorrência a que a cobrança pertence.
          examples:
            - RR1234567820240115abcdefghijk
          pattern: ^[a-zA-Z0-9]{29}$
          type: string
        infoAdicional:
          description: Informação adicional (campo único, não array).
          maxLength: 140
          type: string
        recebedor:
          $ref: '#/components/schemas/CobRRecebedorBancarioDTO'
          description: Conta bancária do recebedor.
        valor:
          $ref: '#/components/schemas/CobRValorCreate'
          description: Valor da cobrança.
      required:
        - idRec
        - calendario
        - valor
        - ajusteDiaUtil
        - recebedor
      type: object
    CobRGerada:
      additionalProperties: false
      properties:
        ajusteDiaUtil:
          type: boolean
        atualizacao:
          items:
            $ref: '#/components/schemas/CobRAtualizacaoDTO'
          type:
            - array
            - 'null'
        calendario:
          $ref: '#/components/schemas/CobRCalendarioDTO'
        devedor:
          $ref: '#/components/schemas/CobRDevedorDTO'
        encerramento:
          $ref: '#/components/schemas/CobREncerramentoDTO'
        idRec:
          pattern: ^[a-zA-Z0-9]{29}$
          type: string
        infoAdicional:
          maxLength: 140
          type: string
        recebedor:
          $ref: '#/components/schemas/CobRRecebedorDTO'
        revisao:
          format: int64
          type: integer
        status:
          enum:
            - CRIADA
            - ATIVA
            - CONCLUIDA
            - EXPIRADA
            - REJEITADA
            - CANCELADA
          type: string
        txid:
          pattern: ^[a-zA-Z0-9]{26,35}$
          type: string
        valor:
          $ref: '#/components/schemas/CobRValorDTO'
      required:
        - idRec
        - txid
        - calendario
        - ajusteDiaUtil
        - valor
        - recebedor
        - status
        - revisao
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    CobRCalendarioCreate:
      additionalProperties: false
      properties:
        dataDeVencimento:
          description: Data de vencimento da cobrança (YYYY-MM-DD).
          examples:
            - '2025-08-15'
          type: string
      required:
        - dataDeVencimento
      type: object
    CobRDevedorDTO:
      additionalProperties: false
      properties:
        cep:
          description: CEP do devedor.
          maxLength: 8
          type: string
        cidade:
          description: Cidade do devedor.
          maxLength: 200
          type: string
        email:
          description: Email do devedor.
          type: string
        logradouro:
          description: Logradouro do devedor.
          maxLength: 200
          type: string
        uf:
          description: UF do devedor.
          maxLength: 2
          type: string
      type: object
    CobRRecebedorBancarioDTO:
      additionalProperties: false
      properties:
        agencia:
          description: Agência do recebedor.
          examples:
            - '0001'
          maxLength: 4
          type: string
        conta:
          description: Conta do recebedor.
          examples:
            - '1234567890'
          maxLength: 20
          type: string
        tipoConta:
          description: Tipo de conta do recebedor.
          enum:
            - CORRENTE
            - POUPANCA
            - PAGAMENTO
          examples:
            - CORRENTE
          type: string
      required:
        - conta
        - tipoConta
      type: object
    CobRValorCreate:
      additionalProperties: false
      properties:
        original:
          description: Valor original da cobrança recorrente (único campo monetário).
          examples:
            - '100.00'
          pattern: ^\d{1,10}\.\d{2}$
          type: string
      required:
        - original
      type: object
    CobRAtualizacaoDTO:
      additionalProperties: false
      properties:
        data:
          description: Instante da atualização (RFC 3339).
          type: string
        status:
          enum:
            - CRIADA
            - ATIVA
            - CONCLUIDA
            - EXPIRADA
            - REJEITADA
            - CANCELADA
          type: string
      required:
        - status
        - data
      type: object
    CobRCalendarioDTO:
      additionalProperties: false
      properties:
        criacao:
          description: Data de criação da cobrança (YYYY-MM-DD).
          type: string
        dataDeVencimento:
          description: Data de vencimento (YYYY-MM-DD).
          type: string
      required:
        - dataDeVencimento
      type: object
    CobREncerramentoDTO:
      additionalProperties: false
      properties:
        cancelamento:
          $ref: '#/components/schemas/CobRCancelamentoDTO'
        rejeicao:
          $ref: '#/components/schemas/CobRRejeicaoDTO'
      type: object
    CobRRecebedorDTO:
      additionalProperties: false
      properties:
        agencia:
          description: Agência do recebedor.
          maxLength: 4
          type: string
        conta:
          description: Conta do recebedor.
          maxLength: 20
          type: string
        tipoConta:
          enum:
            - CORRENTE
            - POUPANCA
            - PAGAMENTO
          type: string
      required:
        - conta
        - tipoConta
      type: object
    CobRValorDTO:
      additionalProperties: false
      properties:
        original:
          description: Valor original da cobrança recorrente.
          pattern: ^\d{1,10}\.\d{2}$
          type: string
      required:
        - original
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    CobRCancelamentoDTO:
      additionalProperties: false
      properties:
        codigo:
          type: string
        descricao:
          type: string
        solicitante:
          type: string
      required:
        - solicitante
        - codigo
        - descricao
      type: object
    CobRRejeicaoDTO:
      additionalProperties: false
      properties:
        codigo:
          type: string
        descricao:
          type: string
      required:
        - codigo
        - descricao
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````