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

> Approves an existing encounter in the provider's EMR system.

Some EMR configurations approve an encounter automatically when it is signed; others leave it unapproved. The [`encounter.created`](/api-reference/encounters/create#success) webhook tells you which: when `approved` is `false`, call this endpoint to approve the encounter.

Updates are processed asynchronously. We return a success response as soon as the request is accepted, then send a webhook when the update has been applied in the EMR.

### Path Parameters

* **id** (string, required): The Cobalt `encounter_id` returned when the encounter was created.

### Request Parameters

#### Required Fields

* **approved** (boolean, required): Must be `true`. Approves the encounter. Unapproving is not supported. If the encounter was already approved in the EMR before your request (for example, approved by a user in the EMR), nothing is changed and the `encounter.updated` webhook has `already_approved: true`.

#### Optional Fields

* **callback\_urls** (array of strings, optional): URLs to receive the completion webhook for this update, in addition to your account webhook.

### Example Request

```bash theme={null}
curl -X PATCH https://api.usecobalt.com/v1/encounters/123e4567e89b12d3a456426614174000 \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "approved": true
}'
```

### Example Response

```json theme={null}
{
    "success": true,
    "message": "Encounter update processing. A webhook event will be sent upon completion.",
    "encounter_id": "123e4567e89b12d3a456426614174000",
    "job_id": 12346
}
```

### Error Responses

#### Missing Approved

```json theme={null}
{
    "success": false,
    "message": "Missing required field: approved (must be true)."
}
```

#### Encounter Not Found

```json theme={null}
{
    "success": false,
    "message": "Encounter with id '123e4567e89b12d3a456426614174000' not found."
}
```

#### Encounter Not Created Yet

```json theme={null}
{
    "success": false,
    "message": "Encounter has not been created in the EMR yet. Wait for the encounter.created webhook before updating it."
}
```

#### Update Already In Progress

```json theme={null}
{
    "success": false,
    "message": "An update is already in progress for this encounter. Please wait for it to complete before submitting another update."
}
```

#### Unsupported EMR

```json theme={null}
{
    "success": false,
    "message": "Updating encounters is not supported for [EMR Name]."
}
```

### Webhook Notifications

#### Success

```json theme={null}
{
    "id": "<id-of-webhook-response>",
    "access_token_reference_id": "<access-token-reference-id>",
    "object": "event",
    "created": "2026-10-06T10:30:00.000Z",
    "type": "encounter.updated",
    "job_id": "12346",
    "data": {
        "encounter_id": "123e4567e89b12d3a456426614174000",
        "emr_encounter_id": "927341",
        "emr_status": "COMPLETED",
        "approved": true,
        "already_approved": false,
        "patient_mrn": "1234567"
    }
}
```

The webhook data includes:

* **encounter\_id**: The Cobalt encounter ID.
* **emr\_encounter\_id**: The encounter id in the EMR.
* **emr\_status**: The encounter status in the EMR.
* **approved**: `true` once the encounter is approved.
* **already\_approved**: `true` if the encounter was already approved in the EMR before your request, so nothing was changed. `false` if this request approved it.
* **patient\_mrn**: The patient's medical record number.

#### Failure

```json theme={null}
{
    "id": "<id-of-webhook-response>",
    "access_token_reference_id": "<access-token-reference-id>",
    "object": "event",
    "created": "2026-10-06T10:35:00.000Z",
    "type": "encounter.update_failed",
    "job_id": "12346",
    "data": {
        "encounter_id": "123e4567e89b12d3a456426614174000",
        "emr_encounter_id": "927341",
        "patient_mrn": "1234567",
        "failure_reason": "Service 927341 cannot be approved by this account (no Approve button on the visit view)."
    }
}
```

A failed update is not retried automatically; send the request again once the cause is fixed. Common `failure_reason` values:

* `Service <id> cannot be approved by this account (no Approve button on the visit view).` — the connected EMR user does not have rights to approve this encounter.
* `Approve did not persist for service <id> ...` — the EMR did not record the approval. Retry the request.


## OpenAPI

````yaml PATCH /encounters/{id}
openapi: 3.1.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
    description: Production
security:
  - ClientCredentials: []
    ClientSecret: []
    AccessToken: []
paths:
  /encounters/{id}:
    patch:
      tags:
        - Encounters
      summary: Update an encounter
      description: >-
        Queues an update (approval) of an existing encounter in the connected
        EMR.
      operationId: updateEncounter
      parameters:
        - name: id
          in: path
          description: Cobalt encounter ID (UUID, with or without dashes).
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - approved
              properties:
                approved:
                  type: boolean
                  enum:
                    - true
                  x-supported-emrs:
                    - Credible
                  description: >-
                    Set to true to approve the encounter in the EMR. An
                    encounter that is already approved is left as is.
                  example: true
                  x-required-for-emrs:
                    - Credible
                callback_urls:
                  type: array
                  items:
                    type: string
                  x-supported-emrs:
                    - Credible
                  description: >-
                    URLs to receive the completion webhook for this update, in
                    addition to the account webhook.
      responses:
        '200':
          description: Encounter update queued for processing
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  encounter_id:
                    type: string
                  job_id:
                    type: integer
                required:
                  - success
                  - message
                  - encounter_id
                  - job_id
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    BadRequest:
      description: Bad request — missing or invalid parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
    Unauthorized:
      description: Unauthorized — missing or invalid credentials
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
  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

````

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