If you haven’t already, review best practices for sending a file to your connection. This article contains instructions for how to send a file with the Redox Data Model API specifically. You can either:
- embed a file directly in the Notes, Results, or Media data models; or
- (recommended) upload a file to a Redox blob endpoint, then include the URL reference in the Notes, Results, or Media data models.
You can embed a file within the Notes or Results data model, so long as the file fits within the size limit for the type of traffic. Check limits by traffic type.
The data model you use depends on the context of the file.
- The Notes data model can send a provider’s clinical notes or a general file related to the patient (e.g., a signed consent form or a patient-related JPG file).What to send with a Notes file
- The Results data model can send a file with a patient’s test results or lab-related data.
Another possible alternative
Each data model has their own supported fields and requirements. In this how-to, we only highlight the required fields for each, but check out our data model reference docs for full specs.
- Encode the file as a base64 encoded string.
- Populate the required document fields to include the encoded file in your request:
- In the Note.ContentType field, enter Base64 Encoded (as one of the supported values from the value set).Encoded files
- In the Note.FileContents field, insert the base64 encoded string for the file.Referencing an uploaded file
- In the Note.FileName field, enter the name of the file.
- In the Note.DocumentType field, enter the type of document that should be associated with the file (e.g., consent form, treatment plan).
- In the Note.DocumentID field, enter the unique identifier for this document.
- In the Note.Provider.ID field, enter the ID of the provider responsible for the document.
- Populate any of the other fields of the Notes request with relevant data. Refer to the Notes schema for all the available fields.Example: Embed a file in the Notes data modeljson
- Encode the file as a base64 encoded string.
- Populate the required document fields to include the encoded file in your request:
- In the Orders[].Results[].Value field, insert the base64 encoded string for the file.Referencing an uploaded file
- In the Orders[].Results[].ValueType field, enter Encapsulated Data (as one of the supported values from the value set).
- In the Orders[].Results[].FileType field, enter a valid file type.
- Populate any of the other fields of the Results request with relevant data. Refer to the Results schema for all the available fields.Example: Embed a file in the Results data modeljson
- Encode the file as a base64 encoded string.
- Populate the required document fields to include the encoded file in your request:
- In the Media.FileType field, enter a valid file type.
- In the Media.FileName field, enter the name of the file.
- In the Media.FileContents field, insert the base64 encoded string for the file.Referencing an uploaded file
- In the Media.DocumentType field, enter the type of document that should be associated with the file (e.g., consent form, treatment plan).
- In the Media.DocumentID field, enter the unique identifier for this document.
- In the Media.Provider.ID field, enter the ID of the provider responsible for the document.
- In the Media.Availability field, enter the value that describes the file's availability: Available, Unavailable, Obsolete, Deleted, Cancelled.
- Populate any of the other fields of the request with relevant data. Refer to the Media schema for all the available fields.Example: Embed a file in the Media data modeljson
Our recommended method is to upload a file to the Redox blob. Then, include a reference to the file in your request.
- Locate the file you want to upload.
- Send an HTTP request with your file to the Redox upload endpoint. The file should be uploaded with the file key, using the multipart/form-data content type. Learn more about multipart form submission. You must authenticate the API key like you would for a typical Data Model API request. Learn how to authenticate and initiate a request.Development not available for free accountsMultiple sources and OAuth API keysExample: Upload a file to Redox with the Data Model APIbashExample: Upload a file with the Redox Data Model API (Node.js)javascript
- If successful, you receive a 201 Created status with the URI reference to your file in the body of the response.
- Send the uploaded file following the same instructions for embedding a file in the relevant data model. But in place of the base64 encoded string, include the URI from the previous step.
- To check if the file uploaded successfully, log in to the Redox dashboard and check the log for the request. The uploaded file displays under the Process tab of the log.