Cancelar o envio
Cancela o envio, com o motivo; o link deixa de valer e o cancelamento vale depois da janela de 10 segundos (effectiveAt). Depois que a paciente assinou, só a gestora e a Westhetics cancelam (pelo OAuth, com o perfil delas; o app recebe 403), e a paciente recebe o aviso por e-mail.
Escopo do app: documents:write. Pelo OAuth, vale o perfil da pessoa.
curl --request POST \
--url https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "A paciente desistiu do procedimento."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'A paciente desistiu do procedimento.'})
};
fetch('https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel"
payload = { "reason": "A paciente desistiu do procedimento." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "3c9d1e2f-4a5b-4c7d-8e9f-0a1b2c3d4e5f",
"parentAppointmentId": null,
"type": "procedure",
"state": "sent",
"patientId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"anamnesisId": "5e1d2c3b-4a59-4687-b6a5-948372615049",
"practitioner": {
"id": "7c1d9e2f-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
"name": "Ana Oliveira"
},
"procedures": [
{
"id": "b8e2c4d6-1f3a-4b5c-8d7e-9f0a1b2c3d4e",
"name": "Preenchimento labial",
"type": "single",
"amountCents": 190000
}
],
"totalAmountCents": 190000,
"paymentTerms": "PIX, débito ou crédito em até 10× sem juros.",
"imageConsent": "yes",
"isModelPatient": false,
"procedureDate": "2026-10-20",
"procedureTime": "14:30",
"generation": 1,
"generatedAt": "2026-10-15T14:30:00Z",
"documents": [
{
"id": "d4e5f6a7-b8c9-4123-8ef4-567890123456",
"appointmentId": "3c9d1e2f-4a5b-4c7d-8e9f-0a1b2c3d4e5f",
"patientId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"templateId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"name": "Contrato de prestação de serviços",
"category": "service_contract",
"versionLabel": "5",
"status": "awaiting_patient",
"contentHash": "a3f9c1e7d2b84f6a9e0c1d2b3a4f5e6d7c8b9a0f1e2d3c4b5a6978877665544",
"pageCount": 4,
"hasFile": true,
"isRestricted": false,
"signedFileHash": null,
"generatedAt": "2026-10-15T14:30:00Z",
"patientSignedAt": null,
"signedAt": null,
"expiredAt": null,
"canceledAt": null,
"updatedAt": "2026-10-15T14:30:00Z"
}
],
"signature": {
"status": "awaiting_patient",
"request": {
"id": "6f7e8d9c-0b1a-4f2e-9d3c-4b5a69788796",
"protocolNumber": "WX-4472-BM",
"channels": "whatsapp",
"provider": "autentique",
"sentAt": "2026-10-15T14:30:00Z",
"linkExpiresAt": "2026-10-22T14:30:00Z",
"linkOpenedAt": null,
"resendCount": 0,
"canceledAt": null,
"cancellationReason": null
}
},
"createdAt": "2026-10-15T14:30:00Z",
"updatedAt": "2026-10-15T14:30:00Z",
"effectiveAt": "2026-10-15T14:30:10Z"
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}Autorizações
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.)
curl --request POST \
--url https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "A paciente desistiu do procedimento."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'A paciente desistiu do procedimento.'})
};
fetch('https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.westhetics.io/v1/appointments/{id}/signature-request/cancel"
payload = { "reason": "A paciente desistiu do procedimento." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "3c9d1e2f-4a5b-4c7d-8e9f-0a1b2c3d4e5f",
"parentAppointmentId": null,
"type": "procedure",
"state": "sent",
"patientId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"anamnesisId": "5e1d2c3b-4a59-4687-b6a5-948372615049",
"practitioner": {
"id": "7c1d9e2f-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
"name": "Ana Oliveira"
},
"procedures": [
{
"id": "b8e2c4d6-1f3a-4b5c-8d7e-9f0a1b2c3d4e",
"name": "Preenchimento labial",
"type": "single",
"amountCents": 190000
}
],
"totalAmountCents": 190000,
"paymentTerms": "PIX, débito ou crédito em até 10× sem juros.",
"imageConsent": "yes",
"isModelPatient": false,
"procedureDate": "2026-10-20",
"procedureTime": "14:30",
"generation": 1,
"generatedAt": "2026-10-15T14:30:00Z",
"documents": [
{
"id": "d4e5f6a7-b8c9-4123-8ef4-567890123456",
"appointmentId": "3c9d1e2f-4a5b-4c7d-8e9f-0a1b2c3d4e5f",
"patientId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"templateId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"name": "Contrato de prestação de serviços",
"category": "service_contract",
"versionLabel": "5",
"status": "awaiting_patient",
"contentHash": "a3f9c1e7d2b84f6a9e0c1d2b3a4f5e6d7c8b9a0f1e2d3c4b5a6978877665544",
"pageCount": 4,
"hasFile": true,
"isRestricted": false,
"signedFileHash": null,
"generatedAt": "2026-10-15T14:30:00Z",
"patientSignedAt": null,
"signedAt": null,
"expiredAt": null,
"canceledAt": null,
"updatedAt": "2026-10-15T14:30:00Z"
}
],
"signature": {
"status": "awaiting_patient",
"request": {
"id": "6f7e8d9c-0b1a-4f2e-9d3c-4b5a69788796",
"protocolNumber": "WX-4472-BM",
"channels": "whatsapp",
"provider": "autentique",
"sentAt": "2026-10-15T14:30:00Z",
"linkExpiresAt": "2026-10-22T14:30:00Z",
"linkOpenedAt": null,
"resendCount": 0,
"canceledAt": null,
"cancellationReason": null
}
},
"createdAt": "2026-10-15T14:30:00Z",
"updatedAt": "2026-10-15T14:30:00Z",
"effectiveAt": "2026-10-15T14:30:10Z"
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}{
"error": {
"code": "bad_request",
"message": "<string>",
"requestId": "<string>",
"fields": {}
}
}