Skip to main content
POST
/
clients-documents
/
{id}
/
upload-url
/
{documentType}
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"
  }
}

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.

Headers

This endpoint uses Machine-to-Machine (M2M) authentication.
Authorization
string
required
Standard Bearer token (e.g., Bearer <your_access_token>). See the M2M Authentication guide for details.
Content-Type
string
required
Must be set to application/json.
Accept
string
Optional. Accept header to specify response media type (e.g., application/json).

Path Parameters

id
string
required
The unique UUID of the client (patient) to attach the document to.
documentType
string
required
Category of the document. Examples: intake-forms, lab-results, id-card.

Body Parameters

url
string
required
The public or accessible URL of the file to fetch.
fileName
string
The name to assign to the saved file (e.g., “intake_form_2025.pdf”).

Response Parameters

message
string
Success message indicating the upload status.
documentId
string
The unique UUID assigned to the newly created document.
fileUrl
string
The internal URL (often a SAS URL) where the uploaded file can be accessed.
userDocument
object
The full document object containing metadata and storage details.
userDocument.id
string
The unique UUID of the document record.
userDocument.user_id
string
UUID of the user associated with the document.
userDocument.clientId
string
UUID of the client (patient) associated with the document.
userDocument.storageProvider
string
The storage provider used (e.g., azure-blob).
userDocument.blobPath
string
Internal path to the blob in storage.
userDocument.contentType
string
MIME type of the file (e.g., application/pdf).
userDocument.sizeBytes
integer
Size of the file in bytes.
userDocument.docType
string
The category of the document (matches the documentType path parameter).
userDocument.fileName
string
The name of the file.
userDocument.createdAt
string
ISO 8601 timestamp of creation.

Status Codes

StatusDescription
200Success. Document fetched and uploaded successfully.
400Bad Request. Invalid file URL or file type mismatch.
401Unauthorized. 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"
  }
}