Upload File¶
Upload a file to cloud storage and receive a URL. Use this as the first step before saving a document record — pass the returned file_url and bucket_name to that endpoint.
Endpoint¶
Content-Type: multipart/form-data
Form Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | The file to upload |
bucket_name |
string | Yes | Storage bucket name (e.g., us-phy-uploads) |
file_path |
string | Yes | Folder path within the bucket (e.g., patients/1172416/documents) |
file_name |
string | Yes | File name to store in the bucket (e.g., insurance-card.pdf) |
Request¶
curl --location '{base_url}/apis/v1/file/upload/unsigned' \
--header 'Authorization: Bearer JWT_TOKEN' \
--form 'file=@"/path/to/insurance-card.pdf"' \
--form 'bucket_name="us-phy-uploads"' \
--form 'file_path="patients/1172416/documents"' \
--form 'file_name="insurance-card.pdf"'
Response¶
Success Response¶
Code: 200 OK
{
"code": 2000,
"data": {
"file_url": "https://storage.googleapis.com/us-phy-uploads/patients/1172416/documents/insurance-card.pdf",
"bucket_name": "us-phy-uploads",
"file_name": "insurance-card.pdf",
"size_bytes": 204800
},
"message": "Success"
}
Response Fields¶
| Field | Type | Description |
|---|---|---|
file_url |
string | Publicly accessible URL of the uploaded file; pass this as document_url when saving the document record |
bucket_name |
string | Bucket where the file was stored; pass this as bucket_name when saving the document record |
file_name |
string | Stored file name |
size_bytes |
integer | File size in bytes |
Error Response¶
Code: 400 Bad Request
Notes¶
- After uploading, call Save Document with the returned
file_urlandbucket_nameto create the document record linked to a patient. - The
file_pathshould be organized by patient:patients/{patient_id}/documentsis a common convention.