Skip to main content
POST
/
documents
Upload Document
curl --request POST \
  --url https://api.usecobalt.com/v1/documents \
  --header 'Content-Type: multipart/form-data' \
  --header 'access_token: <api-key>' \
  --header 'client_id: <api-key>' \
  --header 'client_secret: <api-key>' \
  --form 'folder_name=<string>' \
  --form 'patient_mrn=<string>' \
  --form document='@example-file' \
  --form 'emr_assigned_to_id=<string>' \
  --form is_reviewed=true \
  --form 'notes=<string>' \
  --form is_high_priority=true
{
  "success": true,
  "message": "<string>",
  "document_id": "<string>"
}
Documents are processed asynchronously. You’ll receive a webhook notification when the upload is complete or if there was an error.

Example Request

curl -X POST https://api.usecobalt.com/v1/documents \
-H 'Content-Type: multipart/form-data' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-F 'folder_name=MedicalRecords' \
-F 'patient_mrn=123456' \
-F 'document=@/path/to/document.pdf'

Example Response

{
    "success": true,
    "message": "Document uploaded successfully. It will be processed soon.",
    "document_id": "9988776655443322"
}

Example Success Webhook

{
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "object": "event",
    "created": "2023-10-01T12:34:56Z",
    "type": "document.uploaded",
    "data": {
        "document_id": "9988776655443322",
        "patient_mrn": "123456",
        "folder_name": "MedicalRecords"
    }
}

Example Failure Webhook

{
    "id": "123e4567-e89b-12d3-a456-426614174001",
    "object": "event",
    "created": "2023-10-01T12:34:56Z",
    "type": "document.upload_failed",
    "data": {
        "document_id": "9988776655443322",
        "patient_mrn": "123456",
        "folder_name": "MedicalRecords",
        "failure_reason": "Patient not found. Please check the patient MRN and try again."
    }
}

Authorizations

client_id
string
header
required
client_secret
string
header
required
access_token
string
header
required

Body

multipart/form-data
folder_name
string
required

The name of the folder where the document will be stored. Supports nested folders using forward slashes (e.g., 'MedicalRecords/LabResults').

patient_mrn
string
required

The medical record number of the patient.

document
file
required

The document file to be uploaded. Only PDF, JPEG, and PNG files are allowed. Maximum file size is 5MB.

emr_assigned_to_id
string

The EMR staff ID to assign the document to. Must match a staff member in your organization's staff list.

is_reviewed
boolean

Mark the document as reviewed. Defaults to false.

notes
string

Description or notes for the document. Maximum 1000 characters.

is_high_priority
boolean

Mark the document as high priority. Defaults to false.

Response

200 - application/json

Successful response

success
boolean
message
string
document_id
string