Documentation / Recursos Avançados
Recursos Avançados

How to Update or Cancel an Appointment Via API

Update or Cancel an Appointment

Overview

The eAgenda platform API allows you to update or cancel an appointment programmatically, adjusting the status or removing existing appointments. This practical guide explains how to send HTTP PATCH requests to update (/api/v3/appointments/{appointment_key}/) and DELETE requests to cancel (/api/v3/appointments/{appointment_key}/) an appointment, as well as process the responses. For more details, see the official eAgenda API documentation.

Environment Setup

Before you begin, you will need:

  • API Key: Access the eAgenda dashboard to obtain your Bearer token.
  • HTTP request tool: Use cURL, Postman, or libraries such as requests (Python) or axios (JavaScript).
  • Header configuration: Authentication is done via Bearer Token. Set the header Authorization: Bearer and, for updates, define Content-Type: application/json.
  • Appointment key (appointment_key): Obtain the UUID of the appointment to be updated or cancelled, usually returned when creating or listing appointments.

Tip: Refer to the authentication section in the API documentation to configure the token correctly.

Update an Appointment

To update an appointment, send an HTTP PATCH request to the endpoint /api/v3/appointments/{appointment_key}/, modifying the status or other parameters.

Data Definition for Update

Send a JSON object in the request body with the following fields:

{
  "status": "string",
  "send_email": boolean,
  "account_slug": "string"
}

status (optional)

  • Description: New appointment status.
  • Possible values: ATTENDED, CANCELED, CANCELED_CLIENT, CANCELED_GOOGLE, CONFIRMED, IN_PROGRESS, NO_SHOW, PENDING, PENDING_COMPANIONS, PENDING_FORM, PENDING_PAYMENT.
  • Impact: Changes the appointment state.
  • Example: “CONFIRMED”

send_email (optional)

  • Description: Sends update confirmation email.
  • Impact: Notifies attendees if set to true.
  • Example: true

account_slug (optional)

  • Description: Account or sub-account slug.
  • Restrictions: Minimum of 1 character, pattern ^[-a-zA-Z0-9_]+$.
  • How to obtain: Use the account listing endpoint.
  • Impact: Links the update to a specific account.
  • Example: “my-account”

Note: At least one field must be sent to update the appointment.

Sending the Update Request

To update an appointment, send an HTTP PATCH request to the endpoint:

https://eagenda.com.br/api/v3/appointments/{appointment_key}/

Request Configuration

  • Method: PATCH
  • Headers:
    • accept: application/json
    • Authorization: Bearer
    • Content-Type: application/json
  • Request body: JSON with the data to be updated.

cURL Request Example

curl -X PATCH https://eagenda.com.br/api/v3/appointments/19730681-29a0-4000-8ddf-025c8f2d1401/ \
-H "accept: application/json" \
-H "Authorization: Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999" \
-H "Content-Type: application/json" \
-d '{
  "status": "CONFIRMED",
  "send_email": true,
  "account_slug": "minha-conta"
}'

Python Example (using requests)

import requests

url = "https://eagenda.com.br/api/v3/appointments/19730681-29a0-4000-8ddf-025c8f2d1401/"
headers = {
    "accept": "application/json",
    "Authorization": "Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999",
    "Content-Type": "application/json"
}
data = {
    "status": "CONFIRMED",
    "send_email": True,
    "account_slug": "minha-conta"
}

response = requests.patch(url, json=data, headers=headers)
print(response.status_code)
print(response.json())

Response Verification

The API will return a response with the update status. Check the following points:

  • HTTP status code:
    • 200 OK: Appointment successfully updated.
    • 400 Bad Request: Error in the submitted data (check the JSON).
    • 401 Unauthorized: Invalid or missing token.
    • 404 Not Found: Invalid appointment_key.
  • Response body: Contains the updated appointment details, such as:
{
  "appointment_key": "19730681-29a0-4000-8ddf-025c8f2d1401",
  "search_code": "A001",
  "status": "CONFIRMED",
  "calendar": {
    "calendar_key": "1973125a-ab10-4000-8674-eef17b31e080",
    "calendar_name": "Agenda Principal"
  },
  "service_list": [],
  "tag_list": [],
  "attendees": [
    {
      "person_key": "19730681-29a0-4000-8584-d036c75a2f80",
      "name": "João Silva",
      "email": "joao.silva@example.com",
      "phone": null,
      "identification_code": null,
      "identification_type": null
    }
  ],
  "owner_user": null,
  "start": {
    "dateTime": "2025-06-01T10:00:00Z",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2025-06-01T10:30:00Z",
    "timeZone": "UTC"
  },
  "description": null,
  "questionnaires": [],
  "created_at": {
    "dateTime": "2025-06-01T09:58:00Z",
    "timeZone": "UTC"
  },
  "location": null,
  "conference_data": null,
  "account_slug": "minha-conta"
}

The appointment will be updated in the system, reflecting the submitted changes.

Cancel an Appointment

To cancel an appointment, send an HTTP DELETE request to the endpoint /api/v3/appointments/{appointment_key}/.

Cancellation Parameter Definition

appointment_key (required)

  • Description: UUID key of the appointment.
  • Impact: Identifies the appointment to be cancelled.
  • How to obtain: Obtained when creating or listing appointments.
  • Example: 19730681-29a0-4000-8ddf-025c8f2d1401

send_email (optional)

  • Description: Sends cancellation notification email.
  • Impact: Notifies attendees if set to true.
  • Example: true

Sending the Cancellation Request

To cancel an appointment, send an HTTP DELETE request to the endpoint:

https://eagenda.com.br/api/v3/appointments/{appointment_key}/

Request Configuration

  • Method: DELETE
  • Headers:
    • accept: application/json
    • Authorization: Bearer
  • Query string: send_email parameter (e.g., ?send_email=true).

cURL Request Example

curl -X DELETE "https://eagenda.com.br/api/v3/appointments/19730681-29a0-4000-8ddf-025c8f2d1401/?send_email=true" \
-H "accept: application/json" \
-H "Authorization: Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999"

Python Example (using requests)

import requests

url = "https://eagenda.com.br/api/v3/appointments/19730681-29a0-4000-8ddf-025c8f2d1401/"
headers = {
    "accept": "application/json",
    "Authorization": "Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999"
}
params = {
    "send_email": True
}

response = requests.delete(url, headers=headers, params=params)
print(response.status_code)
print(response.json())

Response Verification

The API will return a response with the cancellation status. Check the following points:

  • HTTP status code:
    • 200 OK: Appointment successfully cancelled.
    • 401 Unauthorized: Invalid or missing token.
    • 404 Not Found: Invalid appointment_key.
  • Response body: Contains the cancelled appointment details, with the status updated to CANCELED, such as:
{
  "appointment_key": "19730681-29a0-4000-8ddf-025c8f2d1401",
  "search_code": "A001",
  "status": "CANCELED",
  "calendar": {
    "calendar_key": "1973125a-ab10-4000-8674-eef17b31e080",
    "calendar_name": "Agenda Principal"
  },
  "service_list": [],
  "tag_list": [],
  "attendees": [
    {
      "person_key": "19730681-29a0-4000-8584-d036c75a2f80",
      "name": "João Silva",
      "email": "joao.silva@example.com",
      "phone": null,
      "identification_code": null,
      "identification_type": null
    }
  ],
  "owner_user": null,
  "start": {
    "dateTime": "2025-06-01T10:00:00Z",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2025-06-01T10:30:00Z",
    "timeZone": "UTC"
  },
  "description": null,
  "questionnaires": [],
  "created_at": {
    "dateTime": "2025-06-01T09:58:00Z",
    "timeZone": "UTC"
  },
  "location": null,
  "conference_data": null,
  "account_slug": null
}

The appointment will be marked as cancelled in the system, and attendees will be notified if send_email is set to true.

Conclusion

With this tutorial, you learned how to update or cancel an appointment via the eAgenda API, using the PATCH and DELETE endpoints to manage appointments efficiently. These integrations are ideal for automating appointment administration, adjusting statuses, or removing appointments as needed. For additional features such as creating or listing appointments, see the complete eAgenda API documentation.

Contact Us or Learn More

We are here to help! Access our official channels:

📞 WhatsApp : Click here to send us a message 🌐 eAgenda Platform : Discover eAgenda 🏢 Our Company : Mupi Systems – Innovative Solutions 📧 Email : contato@mupisystems.com.br 📚 Tutorials and Documentation : Access our guides and tutorials