> ## 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.

# Decodificar un payload EMV de Pix

> Analiza un payload EMV de Pix y devuelve los datos estructurados del pago. Se aceptan payloads de terceros, por lo que la decodificación es más permisiva que la creación de códigos BR: un payload sin método de iniciación se decodifica como `STATIC`. `keyType` se infiere a partir del valor de la clave y se omite cuando ningún tipo de clave definido por el BCB coincide con el valor y supera la validación. El esquema de respuesta detalla las reglas aplicables a cada campo.



## OpenAPI

````yaml es/openapi/v3-current/pix-lerian-cob.yaml POST /brcodes/decode
openapi: 3.1.0
info:
  contact:
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    API pública para códigos BR Pix y cobros inmediatos y con fecha de
    vencimiento.
  license:
    name: Elastic License 2.0
    url: https://www.elastic.co/licensing/elastic-license
  title: Pix Lerian — Cobros
  version: release-candidate
servers:
  - url: https://api.example.com/cob-hub/v1
    description: >-
      El host de ejemplo debe reemplazarse por la URL proporcionada durante el
      onboarding del entorno.
security:
  - BearerAuth: []
tags:
  - description: >-
      Creación, consulta, listado y decodificación de códigos BR estáticos de
      Pix.
    name: BR Codes
  - description: Creación, consulta, listado y cancelación de cobros Pix inmediatos.
    name: Immediate Collections
  - description: Creación, consulta, listado y cancelación de cobros Pix con vencimiento.
    name: Due-Date Collections
paths:
  /brcodes/decode:
    post:
      tags:
        - BR Codes
      summary: Decodificar un payload EMV de Pix
      description: >-
        Analiza un payload EMV de Pix y devuelve los datos estructurados del
        pago. Se aceptan payloads de terceros, por lo que la decodificación es
        más permisiva que la creación de códigos BR: un payload sin método de
        iniciación se decodifica como `STATIC`. `keyType` se infiere a partir
        del valor de la clave y se omite cuando ningún tipo de clave definido
        por el BCB coincide con el valor y supera la validación. El esquema de
        respuesta detalla las reglas aplicables a cada campo.
      operationId: decodeQRCode
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecodeQRCodeBody'
            examples:
              ejemploFicticio:
                summary: Ejemplo ficticio
                value:
                  emvPayload: >-
                    00020101021126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266554400005204000053039865802BR5913Fulano
                    de Tal6008BRASILIA62070503***630448CD
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecodeQRCodeOutput'
              examples:
                ejemploFicticio:
                  summary: Ejemplo ficticio
                  value:
                    amount: '100.50'
                    currency: BRL
                    description: Pagamento do pedido 12345
                    expiresAt: '2026-05-06T11:30:00Z'
                    isReusable: true
                    keyType: EVP
                    keyValue: 123e4567-e12b-12d1-a456-426655440000
                    merchantCity: Goiania
                    merchantName: Loja Teste
                    txId: TX12345
                    type: STATIC
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      x-codeSamples:
        - lang: bash
          label: cURL con datos ficticios
          source: |-
            curl --request POST \
              --url https://api.example.com/cob-hub/v1/brcodes/decode \
              --header 'Authorization: Bearer demo-access-token' \
              --header 'Content-Type: application/json' \
              --data '{
              "emvPayload": "00020101021126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266554400005204000053039865802BR5913Fulano de Tal6008BRASILIA62070503***630448CD"
            }'
components:
  schemas:
    DecodeQRCodeBody:
      additionalProperties: false
      properties:
        emvPayload:
          description: EMV BR Code payload to decode
          examples:
            - >-
              00020101021126580014br.gov.bcb.pix0136123e4567-e12b-12d1-a456-4266554400005204000053039865802BR5913Fulano
              de Tal6008BRASILIA62070503***630448CD
          type: string
      required:
        - emvPayload
      type: object
    DecodeQRCodeOutput:
      additionalProperties: false
      properties:
        amount:
          examples:
            - '100.50'
          type: string
        currency:
          enum:
            - BRL
          examples:
            - BRL
          type: string
        description:
          examples:
            - Pagamento do pedido 12345
          type: string
        expiresAt:
          examples:
            - '2026-05-06T11:30:00Z'
          format: date-time
          type: string
        isReusable:
          description: >-
            Whether the BR Code may be paid more than once. True for every
            STATIC payload, including one whose Point of Initiation method is
            absent.
          examples:
            - true
          type: boolean
        keyType:
          description: >-
            Pix key type inferred from keyValue, ABSENT when no type both
            matches and validates. A CPF/CNPJ must satisfy its Modulo 11 check
            digits — a document that does not is unregistrable at DICT, so no
            type is reported. A masked document ("529.982.247-25") IS
            recognised. A phone is any E.164 number, not only "+55".
          enum:
            - CPF
            - CNPJ
            - PHONE
            - EMAIL
            - EVP
          examples:
            - EVP
          type: string
        keyValue:
          description: >-
            Pix key exactly as the payload carries it, punctuation included. It
            is never normalized: this endpoint reports what was scanned.
          examples:
            - 123e4567-e12b-12d1-a456-426655440000
          type: string
        merchantCity:
          examples:
            - Goiania
          type: string
        merchantName:
          examples:
            - Loja Teste
          type: string
        txId:
          examples:
            - TX12345
          type: string
        type:
          description: >-
            Type embedded in the payload. A payload that names NO Point of
            Initiation method (EMV tag 01 absent) is reported as STATIC: EMVCo
            makes the element optional and defines its absence as static, and
            BCB's own composed QR Code examples omit it. Such a payload was
            previously rejected as malformed.
          enum:
            - STATIC
            - DYNAMIC_IMMEDIATE
            - DYNAMIC_DUEDATE
          examples:
            - STATIC
          type: string
      required:
        - type
        - merchantName
        - merchantCity
        - isReusable
      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
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      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
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````