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

# Remove Diagnosis Codes

> Removes ICD-10 diagnosis codes from an existing appointment's encounter.

<Info>
  This is an asynchronous operation. The request returns a `job_id` immediately, and a webhook is sent when the operation completes. Codes that are not on the encounter are ignored. Currently available on eClinicalWorks.
</Info>

The body is the same shape as [Add Diagnosis Codes](/api-reference/codes/add): each code is `{ "type": "icd10", "code": "..." }`, and you can remove one or many in a single request.

### Example Request

```bash theme={null}
curl -X DELETE https://api.usecobalt.com/v1/appointments/APPT-12345/codes \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "codes": [
        { "type": "icd10", "code": "I10" }
    ]
}'
```

### Example Response

```json theme={null}
{
    "success": true,
    "message": "Codes operation in progress. A webhook event will be sent upon completion.",
    "job_id": "12346"
}
```

### Webhook

On completion we send a `codes.removed` event (or `codes.failed` on error). `notFound` lists codes that were not on the encounter.

```json theme={null}
{
    "id": "evt_1J9X2q2eZvKYlo2CluR9g9gW",
    "access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
    "object": "event",
    "created": "2025-10-09T10:35:00Z",
    "type": "codes.removed",
    "job_id": "12346",
    "data": {
        "appointment_id": "APPT-12345",
        "operation": "remove",
        "icd": {
            "removed": ["I10"],
            "notFound": []
        }
    }
}
```

See [Operation Events](/docs/webhooks/operation-events) for the failure payload and error codes.


## OpenAPI

````yaml DELETE /appointments/{appointment_id}/codes
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/{appointment_id}/codes:
    delete:
      summary: Remove Diagnosis Codes
      description: >-
        Removes one or more ICD-10 diagnosis codes from an existing
        appointment's encounter. Asynchronous: returns a job_id immediately and
        sends a webhook on completion. Codes not present on the encounter are
        ignored. Currently supported on eClinicalWorks.
      parameters:
        - in: path
          name: appointment_id
          required: true
          schema:
            type: string
          description: The Cobalt appointment ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - codes
              properties:
                codes:
                  type: array
                  description: Codes to remove. Accepts one or many.
                  items:
                    type: object
                    required:
                      - type
                      - code
                    properties:
                      type:
                        type: string
                        enum:
                          - icd10
                        description: Code type. Only icd10 is currently supported.
                      code:
                        type: string
                        description: ICD-10 code, e.g. E11.9. The dot is optional.
                callback_urls:
                  type: array
                  items:
                    type: string
                  description: Optional per-request webhook URLs to notify on completion.
      responses:
        '200':
          description: Operation queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  job_id:
                    type: string
                    description: Job execution identifier for tracking the async operation.
        '400':
          description: Validation error, e.g. missing codes or an unsupported code type.
        '404':
          description: Appointment not found for this connection.
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

````