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

# Update patient

> Changes a patient's administrative details (name, contact, birth date). Only the fields sent change; null clears a field.

**When to use it:** When a patient's details must be corrected or completed. Read the patient with patients.get first and send its version as expectedVersion; if it changed meanwhile the answer is 409 and you must read it again.



## OpenAPI

````yaml /api-reference/openapi.en.json patch /patients/{id}
openapi: 3.1.0
info:
  title: Brelio API
  version: '1'
  description: >-
    Everything a person can do in Brelio, a program can do, with the same
    permissions, audit and limits. Every endpoint is derived from the operation
    catalogue.
servers:
  - url: https://api.brelio.app/v1
security: []
paths:
  /patients/{id}:
    patch:
      tags:
        - patients
      summary: Update patient
      description: >-
        Changes a patient's administrative details (name, contact, birth date).
        Only the fields sent change; null clears a field.


        **When to use it:** When a patient's details must be corrected or
        completed. Read the patient with patients.get first and send its version
        as expectedVersion; if it changed meanwhile the answer is 409 and you
        must read it again.
      operationId: patients.update
      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: The patient id.
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 255
          description: Unique per command; reuse it only to retry the same call.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                expectedVersion:
                  type: string
                  pattern: >-
                    ^\d{4}-\d{2}-\d{2}[
                    T]\d{2}:\d{2}:\d{2}(\.\d{1,6})?([+-]\d{2}(:?\d{2})?|Z)$
                  description: >-
                    The `version` of the patient as you read it. Do not build it
                    yourself.
                firstName:
                  type: string
                  minLength: 1
                  maxLength: 100
                lastName:
                  description: Cannot be cleared, as on the web.
                  type: string
                  minLength: 1
                  maxLength: 100
                birthDate:
                  description: Send null to clear it.
                  anyOf:
                    - type: string
                      format: date
                      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])))$
                    - type: 'null'
                sex:
                  description: Send null to clear it.
                  anyOf:
                    - type: string
                      enum:
                        - male
                        - female
                        - other
                    - type: 'null'
                email:
                  description: Send null to clear it.
                  anyOf:
                    - type: string
                      maxLength: 254
                      format: email
                      pattern: >-
                        ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                    - type: 'null'
                phone:
                  description: Send null to clear it.
                  anyOf:
                    - type: string
                      minLength: 3
                      maxLength: 30
                    - type: 'null'
              required:
                - expectedVersion
            examples:
              example1:
                summary: Correct the phone number
                value:
                  id: 0f6c2a8e-4b1d-4c3a-9e57-2d8b1f0a6c41
                  expectedVersion: '2026-01-15 10:00:00+00'
                  phone: +34 600 765 432
              example2:
                summary: Clear the email
                value:
                  id: 0f6c2a8e-4b1d-4c3a-9e57-2d8b1f0a6c41
                  expectedVersion: '2026-01-15 10:00:00+00'
                  email: null
      responses:
        '200':
          description: Success
          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)$
                  code:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Human code, such as PAC-0042.
                  firstName:
                    type: string
                  lastName:
                    anyOf:
                      - type: string
                      - type: 'null'
                  birthDate:
                    anyOf:
                      - type: string
                        format: date
                        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])))$
                      - type: 'null'
                  sex:
                    anyOf:
                      - type: string
                        enum:
                          - male
                          - female
                          - other
                      - type: 'null'
                  email:
                    anyOf:
                      - type: string
                      - type: 'null'
                  phone:
                    anyOf:
                      - type: string
                      - type: 'null'
                  status:
                    type: string
                    enum:
                      - active
                      - inactive
                      - discharged
                  identificationNumber:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: ID document number (DNI, NIE, passport).
                  identificationType:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Kind of ID document, such as dni.
                  internalCode:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: The clinic’s own code for the patient, if any.
                  responsibleId:
                    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: The professional responsible for the patient.
                  admittedAt:
                    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, UTC.
                      - type: 'null'
                  lastSessionAt:
                    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, UTC.
                      - type: 'null'
                  nextSessionAt:
                    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, UTC.
                      - type: 'null'
                  archivedAt:
                    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, UTC.
                      - type: 'null'
                    description: When the patient was archived; null while active.
                  version:
                    type: string
                    description: >-
                      Opaque version token. Send it back as expectedVersion to
                      change this patient; do not parse it.
                  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, 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, UTC.
                required:
                  - id
                  - code
                  - firstName
                  - lastName
                  - birthDate
                  - sex
                  - email
                  - phone
                  - status
                  - identificationNumber
                  - identificationType
                  - internalCode
                  - responsibleId
                  - admittedAt
                  - lastSessionAt
                  - nextSessionAt
                  - archivedAt
                  - version
                  - createdAt
                  - updatedAt
                additionalProperties: false
        '401':
          description: Problem Details (RFC 9457) with a stable `code`
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '402':
          description: Problem Details (RFC 9457) with a stable `code`
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: Problem Details (RFC 9457) with a stable `code`
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: Problem Details (RFC 9457) with a stable `code`
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Problem Details (RFC 9457) with a stable `code`
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '503':
          description: Problem Details (RFC 9457) with a stable `code`
          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: Brelio API key (organization or user) or a WorkOS access token.

````

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