Skip to main content

Documents API

The Documents API is used for managing files within a case.

List Documents for a Case

Retrieves a list of all documents associated with a specific case.

GET /api/cases/{caseId}/documents

Parameters

  • caseId (string, required): The ID of the case.

Response

Returns an array of DocumentRecord objects.

[
{
"id": "doc-123",
"recordType": "documentRecord",
"caseId": "case-abc",
"fileName": "Medical_Notes_Part1.pdf",
"size": 1024567,
"processStatus": "completed",
"pageCount": 52,
// ... other fields
}
]

Upload a Document

Uploading a document is a two-step process to ensure security and reliability.

Step 1: Prepare the Upload

First, you request a secure upload URL from the server.

POST /api/cases/{caseId}/upload-documents

Request Body

An array of file metadata objects.

[
{
"name": "Medical_Notes_Part2.pdf",
"type": "application/pdf",
"size": 2048999
}
]

Response

The server responds with an array of PreparedUploadInfo objects, each containing a unique documentId and a short-lived uploadUrl (a SAS URL for Azure Blob Storage).

[
{
"documentId": "doc-456",
"fileName": "Medical_Notes_Part2.pdf",
"uploadUrl": "[https://your-storage-account.blob.core.windows.net/](https://your-storage-account.blob.core.windows.net/)...",
"blobPath": "...",
"expiresOn": "..."
}
]

Step 2: Upload the File

Your application then uses the provided uploadUrl to upload the file directly to secure blob storage.

PUT {uploadUrl}

Headers:

  • x-ms-blob-type: BlockBlob
  • Content-Type: The content type of the file (e.g., application/pdf).

Body: The raw file binary.

Step 3: Finalize the Upload

After the file is successfully uploaded to blob storage, you must notify Records Rocket to create the document record in the database and begin the OCR process.

POST /api/cases/{caseId}/upload-documents/finalize

Request Body

{
"caseId": "case-abc",
"documentId": "doc-456",
"blobPath": "...",
"fileName": "Medical_Notes_Part2.pdf",
"contentType": "application/pdf",
"size": 2048999
}

Response

A confirmation that the document record has been created and processing has started.

{
"success": true,
"documentId": "doc-456",
"processingStarted": true
}