Get started with Tavrn’s Demand Letter API
Tavrn’s Demand Letter API provides a simple way for developers to automate the creation of personalized demand letters using Tavrn’s advanced AI capabilities.Step 1: Create an API key
To get started, you will need to create an API key in your organization’s Tavrn dashboard. API keys are used to authenticate requests to the API. All requests to the API must include your API key in anAuthorization HTTP header as follows:
Step 2: Creating a job
To create a demand letter job, you need to send a POST request to the/v1/jobs endpoint with the patient’s name, injury date, and any additional information. If no additional information is provided, pass an empty string.
packageId which will be used in subsequent steps.
Step 3: Uploading files
To upload files for the job, send a POST request to the/v1/jobs/:packageId/upload endpoint with the file and specify its type. Replace :packageId with the actual packageId received from the previous step.
Each file must be uploaded individually with its associated type field, which can be medical-record, case-info, or sample-demand.
<type> with one of the allowed types: medical-record, case-info, or sample-demand.
You can upload multiple files by making separate POST requests for each file.
Step 4: Completing the job
To process the uploaded files and complete the job, send a POST request to the/v1/jobs/:packageId/complete endpoint to confirm that all files have been uploaded.
Step 5: Fetching the job status
To fetch the status of the job, you can use thestatus endpoint with the packageId.
created, processing, done, or failed. If the status is processing, you need to keep polling the status endpoint until the status changes to done or failed. Keep in mind that the processing time can vary depending on the number of files and their size.
Step 6: Downloading the demand letter
Once the job is done and has a status ofdone, you can download the demand letter in PDF using the download endpoint.
downloadDocx endpoint.
Step 7: Adding New Files and Rerunning the Job
Even after a job has been completed and has a status ofdone, you can still add new files to the existing package and rerun the job to include all files—both existing and new—in the demand letter.
Uploading Additional Files
To add new files to a completed job, use the same upload endpoint as before:<type> with one of the allowed types: medical-record, case-info, or sample-demand.