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

# Editar paciente

> Muda só os campos enviados. Campo ausente fica como está; `null` limpa.

**Escopo do app:** `patients:write`. Pelo OAuth, vale o perfil da pessoa.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/patients/{id}
openapi: 3.1.0
info:
  title: API da Westhetics
  version: 1.0.0
  description: >-
    A API pública da Westhetics: pacientes, anamneses, contratos e assinaturas
    da clínica, com eventos por webhook. Autentique com a chave do app
    (`Authorization: Bearer wx_…`), criada pela gestora em Integrações, ou com o
    token OAuth da pessoa. Respostas em JSON, mensagens em pt-BR. Guias em
    https://docs.westhetics.io.
  contact:
    name: Westhetics
    url: https://docs.westhetics.io
    email: suporte@westhetics.com.br
servers:
  - url: https://api.westhetics.io
    description: Produção
security:
  - apiKey: []
  - oauth2: []
tags:
  - name: Conta
    description: Quem chama e a clínica.
  - name: Pacientes
    description: O cadastro da paciente.
  - name: Anamneses
    description: Enviar, acompanhar e ler a anamnese.
  - name: Catálogo
    description: Procedimentos, prestadores e modelos.
  - name: Contratos e assinaturas
    description: Gerar o contrato e os termos e enviar para assinatura.
  - name: Eventos
    description: O que aconteceu na clínica, por consulta ou por webhook.
  - name: Webhooks
    description: Os endereços que recebem os eventos do app.
paths:
  /v1/patients/{id}:
    patch:
      tags:
        - Pacientes
      summary: Editar paciente
      description: >-
        Muda só os campos enviados. Campo ausente fica como está; `null` limpa.


        **Escopo do app:** `patients:write`. Pelo OAuth, vale o perfil da
        pessoa.
      operationId: updatePatient
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                whatsapp:
                  type: string
                  minLength: 1
                dialCode:
                  type: string
                  pattern: ^\+[0-9]{1,3}$
                audience:
                  anyOf:
                    - type: string
                      enum:
                        - patient
                        - student
                        - employee
                        - third_party
                    - type: 'null'
                email:
                  type: string
                  minLength: 1
                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'
                docNumber:
                  anyOf:
                    - type: string
                    - type: 'null'
                docType:
                  anyOf:
                    - type: string
                      enum:
                        - cnpj
                        - cpf
                    - type: 'null'
                foreignDocument:
                  anyOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - passport
                            - rne
                            - crnm
                            - other
                        number:
                          type: string
                          minLength: 1
                          pattern: ^[A-Z0-9]{4,20}$
                        country:
                          type: string
                          pattern: ^[A-Z]{2}$
                      required:
                        - type
                        - number
                        - country
                    - type: 'null'
                rg:
                  anyOf:
                    - type: string
                    - type: 'null'
                gender:
                  anyOf:
                    - type: string
                      enum:
                        - female
                        - male
                        - other
                        - not_provided
                    - type: 'null'
                maritalStatus:
                  anyOf:
                    - type: string
                      enum:
                        - single
                        - married
                        - domestic_partnership
                        - separated
                        - divorced
                        - widowed
                    - type: 'null'
                occupation:
                  anyOf:
                    - type: string
                    - type: 'null'
                address:
                  anyOf:
                    - type: object
                      properties:
                        postalCode:
                          type: string
                        street:
                          type: string
                          minLength: 2
                          maxLength: 120
                        number:
                          type: string
                          minLength: 1
                          maxLength: 10
                        complement:
                          anyOf:
                            - type: string
                            - type: 'null'
                        district:
                          type: string
                          minLength: 2
                          maxLength: 80
                        city:
                          type: string
                          minLength: 2
                          maxLength: 80
                        state:
                          type: string
                        country:
                          default: BR
                          type: string
                          pattern: ^[A-Z]{2}$
                      required:
                        - postalCode
                        - street
                        - number
                        - district
                        - city
                        - state
                    - type: 'null'
                guardian:
                  anyOf:
                    - type: object
                      properties:
                        name:
                          type: string
                          minLength: 2
                          maxLength: 120
                        docType:
                          anyOf:
                            - type: string
                              const: cpf
                            - type: 'null'
                        docNumber:
                          type: string
                        whatsapp:
                          type: string
                      required:
                        - name
                        - docNumber
                        - whatsapp
                    - type: 'null'
                imageConsent:
                  anyOf:
                    - type: string
                      enum:
                        - 'yes'
                        - 'no'
                        - not_provided
                    - type: 'null'
                instagram:
                  anyOf:
                    - type: string
                      pattern: ^[A-Za-z0-9._]{1,30}$
                    - type: 'null'
                notes:
                  anyOf:
                    - type: string
                    - type: 'null'
                referralSource:
                  anyOf:
                    - type: object
                      properties:
                        channel:
                          type: string
                          enum:
                            - referral
                            - social_media
                            - instagram
                            - google
                            - ad
                            - website
                            - storefront
                            - event
                            - other
                        detail:
                          anyOf:
                            - type: string
                            - type: 'null'
                      required:
                        - channel
                    - type: 'null'
            example:
              email: amanda.costa@email.com
              occupation: Arquiteta
      responses:
        '200':
          description: Sucesso.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Patient'
                required:
                  - data
              example:
                data:
                  id: f47ac10b-58cc-4372-a567-0e02b2c3d479
                  audience: patient
                  status: active
                  name: Amanda Ribeiro Costa
                  birthDate: '1992-04-18'
                  isMinor: false
                  docType: cpf
                  docNumber: '44595830890'
                  foreignDocument: null
                  rg: null
                  gender: female
                  maritalStatus: married
                  occupation: Arquiteta
                  email: amanda@email.com
                  whatsapp: '+5511987654321'
                  address:
                    postalCode: '01310100'
                    street: Avenida Paulista
                    number: '1000'
                    complement: apto 52
                    district: Bela Vista
                    city: São Paulo
                    state: SP
                    country: BR
                  guardian: null
                  imageConsent: 'yes'
                  instagram: amanda.ribeiro
                  referralSource:
                    channel: instagram
                    detail: null
                  notes: null
                  patientSince: '2026-10-15'
                  selfRegisteredAt: null
                  mergedIntoId: null
                  createdAt: '2026-10-15T14:30:00Z'
                  updatedAt: '2026-10-15T14:30:00Z'
                  archivedAt: null
        '400':
          description: O corpo não é JSON, ou falta o que a rota precisa.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Sem chave, chave que não confere, revogada ou token vencido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: O app não tem o escopo, ou a pessoa não pode pelo perfil.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Não existe nesta clínica.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            Conflito com o estado atual (já existe, já enviado, outra alteração
            chegou antes, ou a mesma Idempotency-Key ainda em andamento).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Dado que não passa na regra; `fields` traz a mensagem de cada campo.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Passou de 100 chamadas por minuto; veja `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Patient:
      type: object
      properties:
        id:
          type: string
        audience:
          type: string
          enum:
            - patient
            - student
            - employee
            - third_party
          description: O público da pessoa (RN-PAC-36).
        status:
          type: string
          enum:
            - active
            - archived
            - merged
        name:
          type: string
        birthDate:
          anyOf:
            - type: string
              description: Data no formato aaaa-mm-dd.
            - type: 'null'
        isMinor:
          type: boolean
          description: Menos de 18 anos no fuso da clínica.
        docType:
          anyOf:
            - type: string
              enum:
                - cpf
                - cnpj
            - type: 'null'
        docNumber:
          anyOf:
            - type: string
            - type: 'null'
          description: Só dígitos.
        foreignDocument:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                number:
                  type: string
                country:
                  type: string
              required:
                - type
                - number
                - country
              additionalProperties: false
            - type: 'null'
        rg:
          anyOf:
            - type: string
            - type: 'null'
        gender:
          type: string
        maritalStatus:
          anyOf:
            - type: string
            - type: 'null'
        occupation:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
            - type: 'null'
        whatsapp:
          anyOf:
            - type: string
            - type: 'null'
          description: E.164, como +5511987654321.
        address:
          anyOf:
            - type: object
              properties:
                postalCode:
                  anyOf:
                    - type: string
                    - type: 'null'
                street:
                  anyOf:
                    - type: string
                    - type: 'null'
                number:
                  anyOf:
                    - type: string
                    - type: 'null'
                complement:
                  anyOf:
                    - type: string
                    - type: 'null'
                district:
                  anyOf:
                    - type: string
                    - type: 'null'
                city:
                  anyOf:
                    - type: string
                    - type: 'null'
                state:
                  anyOf:
                    - type: string
                    - type: 'null'
                country:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - postalCode
                - street
                - number
                - complement
                - district
                - city
                - state
                - country
              additionalProperties: false
            - type: 'null'
        guardian:
          anyOf:
            - type: object
              properties:
                name:
                  type: string
                docType:
                  anyOf:
                    - type: string
                      enum:
                        - cpf
                        - cnpj
                    - type: 'null'
                docNumber:
                  anyOf:
                    - type: string
                    - type: 'null'
                whatsapp:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - name
                - docType
                - docNumber
                - whatsapp
              additionalProperties: false
            - type: 'null'
        imageConsent:
          type: string
          enum:
            - 'yes'
            - 'no'
            - not_provided
          description: O uso de imagem autorizado a esta clínica; vale só para ela.
        instagram:
          anyOf:
            - type: string
            - type: 'null'
        referralSource:
          anyOf:
            - type: object
              properties:
                channel:
                  type: string
                detail:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - channel
                - detail
              additionalProperties: false
            - type: 'null'
        notes:
          anyOf:
            - type: string
            - type: 'null'
        patientSince:
          type: string
          description: Data no formato aaaa-mm-dd.
        selfRegisteredAt:
          anyOf:
            - type: string
              description: Data e hora ISO 8601, em UTC.
            - type: 'null'
        mergedIntoId:
          anyOf:
            - type: string
            - type: 'null'
        createdAt:
          type: string
          description: Data e hora ISO 8601, em UTC.
        updatedAt:
          type: string
          description: Data e hora ISO 8601, em UTC.
        archivedAt:
          anyOf:
            - type: string
              description: Data e hora ISO 8601, em UTC.
            - type: 'null'
      required:
        - id
        - audience
        - status
        - name
        - birthDate
        - isMinor
        - docType
        - docNumber
        - foreignDocument
        - rg
        - gender
        - maritalStatus
        - occupation
        - email
        - whatsapp
        - address
        - guardian
        - imageConsent
        - instagram
        - referralSource
        - notes
        - patientSince
        - selfRegisteredAt
        - mergedIntoId
        - createdAt
        - updatedAt
        - archivedAt
      additionalProperties: false
      description: O cadastro da paciente na clínica.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unauthenticated
                - forbidden
                - not_found
                - conflict
                - validation_failed
                - rate_limited
                - unavailable
                - internal_error
            message:
              type: string
              description: A causa e o caminho, em pt-BR.
            fields:
              description: 'No 422: a mensagem de cada campo.'
              type: object
              propertyNames:
                type: string
              additionalProperties:
                type: string
            requestId:
              type: string
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
      description: O envelope de erro.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: wx_<64 hex>
      description: >-
        A chave do app de integração, criada em Integrações. Escopos:
        `patients:read` (Listar, buscar e ler pacientes; os eventos patient.*.);
        `patients:write` (Criar e editar pacientes. Inclui ler.);
        `anamneses:read` (Listar e ler anamneses, sem as respostas; os eventos
        anamnesis.*.); `anamneses:write` (Enviar, reenviar e cancelar anamnese.
        Inclui ler.); `anamneses:answers` (Ler as respostas da anamnese
        preenchida. É dado de saúde.); `documents:read` (Atendimentos,
        documentos, status da assinatura e o PDF; os eventos appointment.* e
        signature_request.*.); `documents:write` (Gerar contrato e termos e
        enviar para assinatura, reenviar e cancelar. Inclui ler.);
        `catalog:read` (Procedimentos, prestadores e modelos de documento da
        clínica.); `webhooks:write` (Criar, alterar e remover os webhooks do
        próprio app pela API.)
    oauth2:
      type: oauth2
      description: >-
        Token OAuth 2.1 da pessoa (código com PKCE), emitido a um aplicativo
        conectado. Vale o perfil da pessoa na clínica da conexão, por 12 horas.
      flows:
        authorizationCode:
          authorizationUrl: https://zosqwpksgewzphikvgfz.supabase.co/auth/v1/oauth/authorize
          tokenUrl: https://zosqwpksgewzphikvgfz.supabase.co/auth/v1/oauth/token
          refreshUrl: https://zosqwpksgewzphikvgfz.supabase.co/auth/v1/oauth/token
          scopes:
            openid: Identidade.
            email: O e-mail.
            profile: O nome.

````

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