Overview
Fetch a document from a provided URL (e.g., a signed PDF from an external intake provider) and save it to the client’s profile.
This endpoint downloads the file from the source URL and uploads it to the internal storage provider (e.g., Azure Blob Storage), linking it to the specified patient.
This endpoint uses Machine-to-Machine (M2M) authentication.
Standard Bearer token (e.g., Bearer <your_access_token>).
See the M2M Authentication guide for details.
Must be set to application/json.
Optional. Accept header to specify response media type (e.g., application/json).
Path Parameters
The unique UUID of the client (patient) to attach the document to.
Category of the document.
Examples: intake-forms, lab-results, id-card.
Body Parameters
The public or accessible URL of the file to fetch.
The name to assign to the saved file (e.g., “intake_form_2025.pdf”).
Response Parameters
Success message indicating the upload status.
The unique UUID assigned to the newly created document.
The internal URL (often a SAS URL) where the uploaded file can be accessed.
The full document object containing metadata and storage details.
The unique UUID of the document record.
UUID of the user associated with the document.
UUID of the client (patient) associated with the document.
userDocument.storageProvider
The storage provider used (e.g., azure-blob).
Internal path to the blob in storage.
MIME type of the file (e.g., application/pdf).
Size of the file in bytes.
The category of the document (matches the documentType path parameter).
ISO 8601 timestamp of creation.
Status Codes
| Status | Description |
|---|
200 | Success. Document fetched and uploaded successfully. |
400 | Bad Request. Invalid file URL or file type mismatch. |
401 | Unauthorized. Do not have access to upload documents for this client. |
curl -X 'POST' \
'http://localhost:5001/clients-documents/a8912dbe-137c-4d9e-8785-84bd1ef298f3/upload-url/intake-forms' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your_access_token>' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf",
"fileName": "intake_form_2025.pdf"
}'
{
"message": "Document uploaded successfully",
"documentId": "c1814499-8db8-a017-9b58-952679d6d3bd",
"fileUrl": "http://127.0.0.1:10000/devstoreaccount1/profile-images/ec09ad81-8c51-4132-a78d-3bb173413ccb/documents/c18144998db8a0179b58952679d6d3bd/a75c4a3b-7afb-4eae-8826-6e78c42585d7pdf?sv=2025-11-05&st=2025-12-05T10%3A36%3A19Z&se=2025-12-05T11%3A36%3A19Z&sr=b&sp=r&sig=wzEgEzEEgGSy%2Ber88L0Pjz2E4BMhkgNmumNZ30nw%2BWU%3D",
"userDocument": {
"id": "c1814499-8db8-a017-9b58-952679d6d3bd",
"user_id": "a8912dbe-137c-4d9e-8785-84bd1ef298f3",
"clinicId": null,
"clientId": "a8912dbe-137c-4d9e-8785-84bd1ef298f3",
"storageProvider": "azure-blob",
"container": "documents",
"blobPath": "ec09ad81-8c51-4132-a78d-3bb173413ccb/documents/c18144998db8a0179b58952679d6d3bd/a75c4a3b-7afb-4eae-8826-6e78c42585d7pdf",
"fileUrl": "http://127.0.0.1:10000/devstoreaccount1/profile-images/ec09ad81-8c51-4132-a78d-3bb173413ccb/documents/c18144998db8a0179b58952679d6d3bd/a75c4a3b-7afb-4eae-8826-6e78c42585d7pdf?sv=2025-11-05&st=2025-12-05T10%3A36%3A19Z&se=2025-12-05T11%3A36%3A19Z&sr=b&sp=r&sig=wzEgEzEEgGSy%2Ber88L0Pjz2E4BMhkgNmumNZ30nw%2BWU%3D",
"contentType": "application/pdf",
"sizeBytes": 88226,
"checksum": "",
"docType": "intake-forms",
"metadata": {
"uploadedById": "34b2cdf8-5599-49c5-9438-eec551d4d196",
"originalFilename": "intake_form_2025.pdf"
},
"fileName": "intake_form_2025.pdf",
"createdAt": "2025-12-05T10:36:19.507Z",
"updatedAt": "2025-12-05T10:36:19.507Z"
}
}