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

# Create Note

> Creates a note for a given appointment.

<Note>
  **Use the Cobalt `appointment_id`.** The `appointment_id` parameter should be the Cobalt appointment ID returned from API responses or GET endpoints, not the EHR appointment ID.
</Note>

### Formatting Note Content

When providing the `note` content, it's important to use `\n` for line breaks if you want those line breaks to be reflected in the EMR. For example, if you want the note to appear in the EMR as:

```
SUBJECTIVE:
this is the subjective section

OBJECTIVE:
this is the objective section

ASSESSMENT:
this is the assessment section

PLAN:
this is the plan section
```

You should send the following in the `note` field:

```
"SUBJECTIVE:\nthis is the subjective section\n\nOBJECTIVE:\nthis is the objective section\n\nASSESSMENT\nthis is the assessment section\n\nPLAN: this is the plan section"
```

### Note Content Formats

The `note` parameter accepts two different formats depending on your EMR integration:

1. **String format** (default): A single text string with `\n` line breaks
2. **Structured object format** (eClinicalWorks): An object with separate fields for clinical documentation, along with optional ICD-10 and CPT codes

### Example Request (String Format)

```bash theme={null}
curl -X POST https://api.usecobalt.com/v1/notes \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "appointment_id": "728948",
    "note": "SUBJECTIVE:\nthis is the subjective section\n\nOBJECTIVE:\nthis is the objective section\n\nASSESSMENT\nthis is the assessment section\n\nPLAN: this is the plan section"
}'
```

### Example Request (Structured Format for eClinicalWorks)

```bash theme={null}
curl -X POST https://api.usecobalt.com/v1/notes \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "appointment_id": "728948",
    "note": {
        "hpi": "Patient presents with persistent lower back pain for 2 weeks. Pain is described as dull and achy, rated 6/10. Worse with prolonged sitting and bending forward. Denies radiation to legs, numbness, or tingling. No bowel or bladder changes. Patient tried over-the-counter ibuprofen with minimal relief.",
        "exam": "Vital signs: BP 128/82, HR 74, Temp 98.6°F. General: Alert and oriented x3, in no acute distress. MSK: Limited range of motion in lumbar spine with forward flexion. Tenderness to palpation over L4-L5 region. Negative straight leg raise bilaterally. Motor strength 5/5 in bilateral lower extremities. Sensation intact.",
        "assessment": "Acute mechanical low back pain, likely lumbar strain. No red flags for serious pathology.",
        "treatment": "Prescribed naproxen 500mg BID for 10 days. Recommended ice/heat therapy alternating every 20 minutes. Physical therapy referral placed for core strengthening and flexibility exercises. Patient educated on proper lifting mechanics and posture. Return precautions discussed including progressive neurological symptoms."
    },
    "icd_10_codes": ["M54.5", "M54.50"],
    "cpt_codes": ["99213", "97110"]
}'
```

### Example Response

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

### Webhook Notifications

When the note processing is complete, we will send a webhook to your registered endpoint. Here are examples of what those webhook payloads will look like:

See the [Webhook Events reference](/docs/webhooks/operation-events) for the full field breakdown and error codes.

#### Success

```json theme={null}
{
    "id": "evt_1J9X2q2eZvKYlo2CluR9g9gV",
    "access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
    "object": "event",
    "created": "2023-10-27T10:30:00Z",
    "type": "note.uploaded",
    "job_id": 12345,
    "data": {
        "appointment_id": "728948",
        "mrn": "12345",
        "timezone": "America/New_York",
        "status": "partial_success",
        "icd_codes": {
            "matched": [
                { "code": "E11.9", "name": "Type 2 diabetes mellitus without complications" }
            ],
            "unmatched": [
                { "code": "Z00.00", "reason": "Code not found in EHR system" }
            ]
        },
        "cpt_codes": {
            "matched": [
                { "code": "99213", "name": "Office/outpatient visit, established patient" }
            ],
            "unmatched": []
        }
    }
}
```

#### Failure

```json theme={null}
{
    "id": "evt_1J9X2q2eZvKYlo2CluR9g9gW",
    "access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
    "object": "event",
    "created": "2023-10-27T10:35:00Z",
    "type": "note.failed",
    "job_id": 12345,
    "data": {
        "appointment_id": "728948",
        "mrn": "12345",
        "status": "failed",
        "failure_reason": "Text contains \"]]>\" which cannot be used in CDATA blocks. Please remove this sequence from the note text.",
        "reasons": [
            {
                "code": "UNSUPPORTED_CHARACTERS",
                "description": "Text contains \"]]>\" which cannot be used in CDATA blocks. Please remove this sequence from the note text."
            }
        ]
    }
}
```


## OpenAPI

````yaml POST /notes
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:
  /notes:
    post:
      summary: Create Note
      description: >-
        Creates a note for a given appointment. Notes are created in the
        provider's EMR using RPA via a headless browser. Instead of waiting for
        completion, we immediately return a success response and notify you via
        webhook when processing is complete.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                appointment_id:
                  type: string
                  description: >-
                    The id of the appointment. This is the id included in the
                    response to GET /appointments.
                note:
                  oneOf:
                    - type: string
                      description: A single text string with line breaks
                    - type: object
                      description: Structured note content (for eClinicalWorks)
                      properties:
                        HPI:
                          type: string
                          description: History of Present Illness
                        Exam:
                          type: string
                          description: Physical examination findings
                        Assessment:
                          type: string
                          description: Clinical assessment
                        Treatment:
                          type: string
                          description: Treatment plan
                  description: >-
                    The data for the note. Can be either a string or structured
                    object depending on EMR integration.
                icd_10_codes:
                  type: array
                  items:
                    type: string
                  description: >-
                    Optional ICD-10 diagnosis codes (only used with structured
                    note format)
                cpt_codes:
                  type: array
                  items:
                    type: string
                  description: >-
                    Optional CPT procedure codes (only used with structured note
                    format)
              required:
                - appointment_id
                - note
      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

````