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

# Update Appointment

> Updates an existing appointment. The update process differs based on the current status of the appointment.

<Note>
  **Use the Cobalt `id` in the URL path.** The `{id}` parameter should be the Cobalt appointment ID returned from API responses or GET endpoints, not the EHR ID.
</Note>

The update process differs based on the current status of the appointment:

### 1. Updating Pending or Failed Appointments

For appointments with a status of 'pending' or 'failed', you can update any attribute of the appointment.

| Parameter                 | Type   | Required | Description                                                               |
| ------------------------- | ------ | -------- | ------------------------------------------------------------------------- |
| Any appointment attribute | varies | No       | Any attribute of the appointment can be updated. All fields are optional. |

### 2. Updating Scheduled Appointments

For appointments with a status of 'scheduled', you can only update the status or note property.

| Parameter | Type   | Required | Description                                                                                                                                                                     |
| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status    | string | No       | Must be one of the available statuses associated with the linked account. You can find the available statuses by using our GET /visit-statuses endpoint                         |
| note      | string | No       | A note associated with the appointment. This is not a progress note or addition to the patient chart. This is primarily used for admin (eg. "patient might be 5 minutes late"). |

### Example Request for Updating a Pending/Failed Appointment

```bash theme={null}
curl -X PATCH https://api.usecobalt.com/v1/appointments/23456789 \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "appointment_datetime": "2024-01-15T14:00:00-07:00",
    "location": "New Clinic",
    "type": "f/u"
}'
```

### Example Response

```json theme={null}
{
    "success": true,
    "message": "Appointment updated successfully"
}
```


## OpenAPI

````yaml PATCH /appointments/{id}
openapi: 3.0.0
info:
  title: Cobalt API
  version: 1.0.1
  description: API for interacting with Cobalt's EHR integration services
servers:
  - url: https://api.usecobalt.com/v1
security:
  - ClientCredentials: []
    ClientSecret: []
    AccessToken: []
paths:
  /appointments/{id}:
    patch:
      summary: Update Appointment
      description: >-
        Updates an existing appointment. The update process differs based on the
        current status of the appointment.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: The appointment ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  description: Updates for pending/failed appointments
                  properties:
                    mrn:
                      type: string
                    location:
                      type: string
                    datetime:
                      type: string
                    provider:
                      type: string
                    type:
                      type: string
                    note:
                      type: string
                    reason:
                      type: string
                - type: object
                  description: Updates for scheduled appointments
                  properties:
                    status:
                      type: string
                    note:
                      type: string
                      description: >-
                        A note associated with the appointment. This is not a
                        progress note or addition to the patient chart.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
components:
  securitySchemes:
    ClientCredentials:
      type: apiKey
      in: header
      name: client_id
    ClientSecret:
      type: apiKey
      in: header
      name: client_secret
    AccessToken:
      type: apiKey
      in: header
      name: access_token

````