Create document record
curl --request POST \
--url https://enterprise.tavrn.ai/v2/cases/{case_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upload_id": "11111111-1111-4111-8111-111111111111",
"path": "Example_General_Hospital"
}
'import requests
url = "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents"
payload = {
"upload_id": "11111111-1111-4111-8111-111111111111",
"path": "Example_General_Hospital"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upload_id: '11111111-1111-4111-8111-111111111111',
path: 'Example_General_Hospital'
})
};
fetch('https://enterprise.tavrn.ai/v2/cases/{case_id}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'upload_id' => '11111111-1111-4111-8111-111111111111',
'path' => 'Example_General_Hospital'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents"
payload := strings.NewReader("{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://enterprise.tavrn.ai/v2/cases/{case_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/cases/{case_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}"
response = http.request(request)
puts response.read_body{
"id": "doc_abc123",
"case_id": "case_xyz",
"file_name": "medical_record.pdf",
"file_size": 1234567,
"file_type": "application/pdf",
"archived": false,
"created_at": "2025-02-01T12:34:56Z",
"updated_at": "2025-02-01T12:34:56Z",
"path": "Example_General_Hospital"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}Case Documents
Create document record
Create a document record after uploading the file via the presigned URL
POST
/
v2
/
cases
/
{case_id}
/
documents
Create document record
curl --request POST \
--url https://enterprise.tavrn.ai/v2/cases/{case_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upload_id": "11111111-1111-4111-8111-111111111111",
"path": "Example_General_Hospital"
}
'import requests
url = "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents"
payload = {
"upload_id": "11111111-1111-4111-8111-111111111111",
"path": "Example_General_Hospital"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upload_id: '11111111-1111-4111-8111-111111111111',
path: 'Example_General_Hospital'
})
};
fetch('https://enterprise.tavrn.ai/v2/cases/{case_id}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'upload_id' => '11111111-1111-4111-8111-111111111111',
'path' => 'Example_General_Hospital'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://enterprise.tavrn.ai/v2/cases/{case_id}/documents"
payload := strings.NewReader("{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://enterprise.tavrn.ai/v2/cases/{case_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/cases/{case_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"path\": \"Example_General_Hospital\"\n}"
response = http.request(request)
puts response.read_body{
"id": "doc_abc123",
"case_id": "case_xyz",
"file_name": "medical_record.pdf",
"file_size": 1234567,
"file_type": "application/pdf",
"archived": false,
"created_at": "2025-02-01T12:34:56Z",
"updated_at": "2025-02-01T12:34:56Z",
"path": "Example_General_Hospital"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required"
}
}Authorizations
API key authentication. Use format: Authorization: Bearer tavrn_sk_live_...
Path Parameters
Case ID
Body
application/json
Response
Document created successfully
Unique document identifier
Example:
"doc_abc123"
Associated case ID
Example:
"case_xyz"
File name
Example:
"medical_record.pdf"
File size in bytes
Example:
1234567
MIME type
Example:
"application/pdf"
Whether document is archived
Example:
false
Creation timestamp (ISO 8601)
Example:
"2025-02-01T12:34:56Z"
Last update timestamp (ISO 8601)
Example:
"2025-02-01T12:34:56Z"
Virtual path for UI grouping
Example:
"Example_General_Hospital"