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

# Factura

> Devuelve una factura con sus líneas: concepto, cantidad, precio, descuento, IVA y el cargo que documenta cada una.

**Cuándo usarla:** Cuando tienes el id de una factura y necesitas sus líneas o totales. Los importes van en céntimos.


## OpenAPI

````yaml /api-reference/openapi.es.json get /invoices/{id}
openapi: 3.1.0
info:
  title: API de Brelio
  version: '1'
  description: >-
    Todo lo que una persona hace en Brelio lo puede hacer un programa, con los
    mismos permisos, auditoría y límites. Cada endpoint se deriva del catálogo
    de operaciones.
servers:
  - url: https://api.brelio.app/v1
security: []
tags:
  - name: Agenda
  - name: Huecos libres
  - name: Citas
  - name: Pacientes
  - name: Profesionales
  - name: Servicios
  - name: Webhooks
  - name: Centros y accesos
  - name: Datos para integraciones
  - name: Facturación
paths:
  /invoices/{id}:
    get:
      tags:
        - Facturación
      summary: Factura
      description: >-
        Devuelve una factura con sus líneas: concepto, cantidad, precio,
        descuento, IVA y el cargo que documenta cada una.


        **Cuándo usarla:** Cuando tienes el id de una factura y necesitas sus
        líneas o totales. Los importes van en céntimos.
      operationId: invoices.get
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            description: El id de la factura.
      responses:
        '200':
          description: Correcto
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  number:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      Número fiscal asignado al emitir, como 2026-0042; null
                      mientras la factura es un borrador.
                  series:
                    type: string
                    description: >-
                      Serie de numeración: INV para facturas ordinarias, R para
                      rectificativas, S para simplificadas.
                  documentType:
                    type: string
                    enum:
                      - ordinary
                      - simplified
                    description: Factura ordinaria o factura simplificada.
                  status:
                    type: string
                    enum:
                      - draft
                      - issued
                      - paid
                      - partial
                      - void
                      - overdue
                      - credit_note_issued
                      - refunded
                    description: >-
                      draft (borrador), issued (emitida), partial (cobrada en
                      parte), paid (cobrada), void (anulada) o un estado
                      heredado de devolución.
                  patientId:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                    description: El paciente al que corresponde la factura.
                  billToId:
                    anyOf:
                      - type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      - type: 'null'
                    description: >-
                      El tercero pagador al que va dirigida la factura; null si
                      va dirigida al paciente.
                  subtotal:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: Base imponible tras descuentos, en céntimos.
                  tax:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: IVA y otros impuestos, en céntimos.
                  total:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: Total, en céntimos.
                  currency:
                    type: string
                    description: Código ISO 4217, como EUR.
                  correctsInvoiceId:
                    anyOf:
                      - type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      - type: 'null'
                    description: >-
                      En una rectificativa, la factura que corrige; null en las
                      demás.
                  replacesInvoiceId:
                    anyOf:
                      - type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      - type: 'null'
                    description: La factura a la que sustituyó, si la hay.
                  invoiceDate:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601, en UTC.
                      - type: 'null'
                    description: >-
                      Fecha de expedición; null mientras la factura es un
                      borrador.
                  issuedAt:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601, en UTC.
                      - type: 'null'
                  dueAt:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601, en UTC.
                      - type: 'null'
                  paidAt:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601, en UTC.
                      - type: 'null'
                  voidedAt:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        description: ISO 8601, en UTC.
                      - type: 'null'
                  createdAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: ISO 8601, en UTC.
                  updatedAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: ISO 8601, en UTC.
                  lines:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        concept:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: Lo que cobra la línea, tal como se imprime.
                        description:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: Detalle adicional impreso bajo el concepto.
                        quantity:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        unitPrice:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: Precio unitario antes de impuestos, en céntimos.
                        discount:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: >-
                            Descuento sobre cantidad × precio unitario, antes de
                            impuestos, en céntimos.
                        taxRate:
                          type: number
                          description: Tipo de IVA, en porcentaje.
                        tax:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: Impuestos de la línea, en céntimos.
                        total:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          description: Total de la línea con impuestos, en céntimos.
                        chargeId:
                          anyOf:
                            - type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            - type: 'null'
                          description: >-
                            El cargo (charges.list) que documenta esta línea, si
                            lo hay.
                        correctsLineId:
                          anyOf:
                            - type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            - type: 'null'
                          description: >-
                            En una línea de una rectificativa, la línea que
                            corrige.
                      required:
                        - id
                        - concept
                        - description
                        - quantity
                        - unitPrice
                        - discount
                        - taxRate
                        - tax
                        - total
                        - chargeId
                        - correctsLineId
                      additionalProperties: false
                required:
                  - id
                  - number
                  - series
                  - documentType
                  - status
                  - patientId
                  - billToId
                  - subtotal
                  - tax
                  - total
                  - currency
                  - correctsInvoiceId
                  - replacesInvoiceId
                  - invoiceDate
                  - issuedAt
                  - dueAt
                  - paidAt
                  - voidedAt
                  - createdAt
                  - updatedAt
                  - lines
                additionalProperties: false
        '401':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '402':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '503':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearer: []
components:
  schemas:
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - code
        - detail
        - request_id
        - params
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        code:
          type: string
        detail:
          type: string
        request_id:
          type: string
        hint:
          type: string
        retryAfterSeconds:
          type: integer
        params:
          type: object
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Clave de API de Brelio (de organización o personal) o un token de acceso
        de WorkOS.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.