curl --request POST \
--url https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patient": {
"name": "Jane Doe",
"date_of_birth": "1989-04-12",
"address": "123 Main St, Austin, TX 78701",
"phone": "+1-512-555-0101",
"email": "jane@example.com",
"gender": "F",
"ssn": "<string>"
},
"facility": {
"name": "Example General Hospital",
"address_line1": "100 Example Ave",
"city": "Springfield",
"state": "PA",
"zip_code": "00000",
"address_line2": null,
"phone": "+1-555-010-2000",
"fax": "+1-555-010-1111"
},
"auth_form": {
"upload_id": "11111111-1111-4111-8111-111111111111",
"file_name": "jane_doe_hipaa.pdf",
"signer_name": "Mary Doe",
"signer_relationship": "Mother"
},
"requested_records": [
{
"type": "medical_records",
"custom_label": null,
"deliverable_format": null,
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"requirements": []
}
],
"facility_id": "facility_example",
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"notes": "Please include any radiology read reports",
"submitter_email": "jane.smith@example.com",
"attachments": [],
"requestor_id": "111111111111111111111111",
"allow_duplicate": true,
"metadata": {
"external_id": "request-123"
}
}
'import requests
url = "https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests"
payload = {
"patient": {
"name": "Jane Doe",
"date_of_birth": "1989-04-12",
"address": "123 Main St, Austin, TX 78701",
"phone": "+1-512-555-0101",
"email": "jane@example.com",
"gender": "F",
"ssn": "<string>"
},
"facility": {
"name": "Example General Hospital",
"address_line1": "100 Example Ave",
"city": "Springfield",
"state": "PA",
"zip_code": "00000",
"address_line2": None,
"phone": "+1-555-010-2000",
"fax": "+1-555-010-1111"
},
"auth_form": {
"upload_id": "11111111-1111-4111-8111-111111111111",
"file_name": "jane_doe_hipaa.pdf",
"signer_name": "Mary Doe",
"signer_relationship": "Mother"
},
"requested_records": [
{
"type": "medical_records",
"custom_label": None,
"deliverable_format": None,
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"requirements": []
}
],
"facility_id": "facility_example",
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"notes": "Please include any radiology read reports",
"submitter_email": "jane.smith@example.com",
"attachments": [],
"requestor_id": "111111111111111111111111",
"allow_duplicate": True,
"metadata": { "external_id": "request-123" }
}
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({
patient: {
name: 'Jane Doe',
date_of_birth: '1989-04-12',
address: '123 Main St, Austin, TX 78701',
phone: '+1-512-555-0101',
email: 'jane@example.com',
gender: 'F',
ssn: '<string>'
},
facility: {
name: 'Example General Hospital',
address_line1: '100 Example Ave',
city: 'Springfield',
state: 'PA',
zip_code: '00000',
address_line2: null,
phone: '+1-555-010-2000',
fax: '+1-555-010-1111'
},
auth_form: {
upload_id: '11111111-1111-4111-8111-111111111111',
file_name: 'jane_doe_hipaa.pdf',
signer_name: 'Mary Doe',
signer_relationship: 'Mother'
},
requested_records: [
{
type: 'medical_records',
custom_label: null,
deliverable_format: null,
service_start_date: '2024-03-15',
service_end_date: '2024-09-30',
requirements: []
}
],
facility_id: 'facility_example',
service_start_date: '2024-03-15',
service_end_date: '2024-09-30',
notes: 'Please include any radiology read reports',
submitter_email: 'jane.smith@example.com',
attachments: [],
requestor_id: '111111111111111111111111',
allow_duplicate: true,
metadata: {external_id: 'request-123'}
})
};
fetch('https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests', 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}/retrieval-requests",
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([
'patient' => [
'name' => 'Jane Doe',
'date_of_birth' => '1989-04-12',
'address' => '123 Main St, Austin, TX 78701',
'phone' => '+1-512-555-0101',
'email' => 'jane@example.com',
'gender' => 'F',
'ssn' => '<string>'
],
'facility' => [
'name' => 'Example General Hospital',
'address_line1' => '100 Example Ave',
'city' => 'Springfield',
'state' => 'PA',
'zip_code' => '00000',
'address_line2' => null,
'phone' => '+1-555-010-2000',
'fax' => '+1-555-010-1111'
],
'auth_form' => [
'upload_id' => '11111111-1111-4111-8111-111111111111',
'file_name' => 'jane_doe_hipaa.pdf',
'signer_name' => 'Mary Doe',
'signer_relationship' => 'Mother'
],
'requested_records' => [
[
'type' => 'medical_records',
'custom_label' => null,
'deliverable_format' => null,
'service_start_date' => '2024-03-15',
'service_end_date' => '2024-09-30',
'requirements' => [
]
]
],
'facility_id' => 'facility_example',
'service_start_date' => '2024-03-15',
'service_end_date' => '2024-09-30',
'notes' => 'Please include any radiology read reports',
'submitter_email' => 'jane.smith@example.com',
'attachments' => [
],
'requestor_id' => '111111111111111111111111',
'allow_duplicate' => true,
'metadata' => [
'external_id' => 'request-123'
]
]),
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}/retrieval-requests"
payload := strings.NewReader("{\n \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\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}/retrieval-requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests")
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 \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "rr_abc123",
"order_number": "T-ABC-12345",
"case_id": "case_abc123",
"status": "received",
"created_at": "2025-02-01T12:50:00Z",
"updated_at": "2025-02-01T12:50:00Z",
"requestor_id": "111111111111111111111111",
"metadata": {
"external_id": "request-123"
}
}{
"object": "retrieval_request_draft",
"id": "222222222222222222222222",
"case_id": "case_abc123",
"status": "draft",
"validation_errors": [
{
"code": "auth_form_missing",
"param": "auth_form",
"message": "A HIPAA authorization form (auth_form) is required"
}
],
"created_at": "2025-02-01T12:50:00Z",
"metadata": {
"external_id": "request-123"
},
"updated_at": "2025-02-01T12:55:00Z"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "duplicate_request_detected",
"message": "<string>"
},
"duplicates": [
{
"id": "<string>",
"order_number": "<string>",
"classification": "EXACT",
"overlapping_record_types": [
"<string>"
],
"cross_case": true
}
]
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#internal_error"
}
}{
"error": {
"code": "internal_error",
"message": "Unable to verify the request submitter at this time — please retry",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#internal_error"
}
}Create retrieval request
Create a retrieval under the case in the URL using patient and requested_records, plus exactly one of facility_id from GET /v2/facilities or a manual facility object. An inline case is not accepted. Optionally select requestor_id or create an inline requestor; omitting both uses the default profile. Use an API key with retrievals:write for creation, plus requestors:write for an inline Requestor. Upload the authorization with POST /v2/retrieval-requests/sign-upload or the case sign-upload endpoint. Use POST /v2/retrieval-requests to create an inline case. Each successful POST with an inline Requestor creates a new profile; retain its ID for reuse.
curl --request POST \
--url https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patient": {
"name": "Jane Doe",
"date_of_birth": "1989-04-12",
"address": "123 Main St, Austin, TX 78701",
"phone": "+1-512-555-0101",
"email": "jane@example.com",
"gender": "F",
"ssn": "<string>"
},
"facility": {
"name": "Example General Hospital",
"address_line1": "100 Example Ave",
"city": "Springfield",
"state": "PA",
"zip_code": "00000",
"address_line2": null,
"phone": "+1-555-010-2000",
"fax": "+1-555-010-1111"
},
"auth_form": {
"upload_id": "11111111-1111-4111-8111-111111111111",
"file_name": "jane_doe_hipaa.pdf",
"signer_name": "Mary Doe",
"signer_relationship": "Mother"
},
"requested_records": [
{
"type": "medical_records",
"custom_label": null,
"deliverable_format": null,
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"requirements": []
}
],
"facility_id": "facility_example",
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"notes": "Please include any radiology read reports",
"submitter_email": "jane.smith@example.com",
"attachments": [],
"requestor_id": "111111111111111111111111",
"allow_duplicate": true,
"metadata": {
"external_id": "request-123"
}
}
'import requests
url = "https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests"
payload = {
"patient": {
"name": "Jane Doe",
"date_of_birth": "1989-04-12",
"address": "123 Main St, Austin, TX 78701",
"phone": "+1-512-555-0101",
"email": "jane@example.com",
"gender": "F",
"ssn": "<string>"
},
"facility": {
"name": "Example General Hospital",
"address_line1": "100 Example Ave",
"city": "Springfield",
"state": "PA",
"zip_code": "00000",
"address_line2": None,
"phone": "+1-555-010-2000",
"fax": "+1-555-010-1111"
},
"auth_form": {
"upload_id": "11111111-1111-4111-8111-111111111111",
"file_name": "jane_doe_hipaa.pdf",
"signer_name": "Mary Doe",
"signer_relationship": "Mother"
},
"requested_records": [
{
"type": "medical_records",
"custom_label": None,
"deliverable_format": None,
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"requirements": []
}
],
"facility_id": "facility_example",
"service_start_date": "2024-03-15",
"service_end_date": "2024-09-30",
"notes": "Please include any radiology read reports",
"submitter_email": "jane.smith@example.com",
"attachments": [],
"requestor_id": "111111111111111111111111",
"allow_duplicate": True,
"metadata": { "external_id": "request-123" }
}
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({
patient: {
name: 'Jane Doe',
date_of_birth: '1989-04-12',
address: '123 Main St, Austin, TX 78701',
phone: '+1-512-555-0101',
email: 'jane@example.com',
gender: 'F',
ssn: '<string>'
},
facility: {
name: 'Example General Hospital',
address_line1: '100 Example Ave',
city: 'Springfield',
state: 'PA',
zip_code: '00000',
address_line2: null,
phone: '+1-555-010-2000',
fax: '+1-555-010-1111'
},
auth_form: {
upload_id: '11111111-1111-4111-8111-111111111111',
file_name: 'jane_doe_hipaa.pdf',
signer_name: 'Mary Doe',
signer_relationship: 'Mother'
},
requested_records: [
{
type: 'medical_records',
custom_label: null,
deliverable_format: null,
service_start_date: '2024-03-15',
service_end_date: '2024-09-30',
requirements: []
}
],
facility_id: 'facility_example',
service_start_date: '2024-03-15',
service_end_date: '2024-09-30',
notes: 'Please include any radiology read reports',
submitter_email: 'jane.smith@example.com',
attachments: [],
requestor_id: '111111111111111111111111',
allow_duplicate: true,
metadata: {external_id: 'request-123'}
})
};
fetch('https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests', 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}/retrieval-requests",
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([
'patient' => [
'name' => 'Jane Doe',
'date_of_birth' => '1989-04-12',
'address' => '123 Main St, Austin, TX 78701',
'phone' => '+1-512-555-0101',
'email' => 'jane@example.com',
'gender' => 'F',
'ssn' => '<string>'
],
'facility' => [
'name' => 'Example General Hospital',
'address_line1' => '100 Example Ave',
'city' => 'Springfield',
'state' => 'PA',
'zip_code' => '00000',
'address_line2' => null,
'phone' => '+1-555-010-2000',
'fax' => '+1-555-010-1111'
],
'auth_form' => [
'upload_id' => '11111111-1111-4111-8111-111111111111',
'file_name' => 'jane_doe_hipaa.pdf',
'signer_name' => 'Mary Doe',
'signer_relationship' => 'Mother'
],
'requested_records' => [
[
'type' => 'medical_records',
'custom_label' => null,
'deliverable_format' => null,
'service_start_date' => '2024-03-15',
'service_end_date' => '2024-09-30',
'requirements' => [
]
]
],
'facility_id' => 'facility_example',
'service_start_date' => '2024-03-15',
'service_end_date' => '2024-09-30',
'notes' => 'Please include any radiology read reports',
'submitter_email' => 'jane.smith@example.com',
'attachments' => [
],
'requestor_id' => '111111111111111111111111',
'allow_duplicate' => true,
'metadata' => [
'external_id' => 'request-123'
]
]),
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}/retrieval-requests"
payload := strings.NewReader("{\n \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\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}/retrieval-requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://enterprise.tavrn.ai/v2/cases/{case_id}/retrieval-requests")
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 \"patient\": {\n \"name\": \"Jane Doe\",\n \"date_of_birth\": \"1989-04-12\",\n \"address\": \"123 Main St, Austin, TX 78701\",\n \"phone\": \"+1-512-555-0101\",\n \"email\": \"jane@example.com\",\n \"gender\": \"F\",\n \"ssn\": \"<string>\"\n },\n \"facility\": {\n \"name\": \"Example General Hospital\",\n \"address_line1\": \"100 Example Ave\",\n \"city\": \"Springfield\",\n \"state\": \"PA\",\n \"zip_code\": \"00000\",\n \"address_line2\": null,\n \"phone\": \"+1-555-010-2000\",\n \"fax\": \"+1-555-010-1111\"\n },\n \"auth_form\": {\n \"upload_id\": \"11111111-1111-4111-8111-111111111111\",\n \"file_name\": \"jane_doe_hipaa.pdf\",\n \"signer_name\": \"Mary Doe\",\n \"signer_relationship\": \"Mother\"\n },\n \"requested_records\": [\n {\n \"type\": \"medical_records\",\n \"custom_label\": null,\n \"deliverable_format\": null,\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"requirements\": []\n }\n ],\n \"facility_id\": \"facility_example\",\n \"service_start_date\": \"2024-03-15\",\n \"service_end_date\": \"2024-09-30\",\n \"notes\": \"Please include any radiology read reports\",\n \"submitter_email\": \"jane.smith@example.com\",\n \"attachments\": [],\n \"requestor_id\": \"111111111111111111111111\",\n \"allow_duplicate\": true,\n \"metadata\": {\n \"external_id\": \"request-123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "rr_abc123",
"order_number": "T-ABC-12345",
"case_id": "case_abc123",
"status": "received",
"created_at": "2025-02-01T12:50:00Z",
"updated_at": "2025-02-01T12:50:00Z",
"requestor_id": "111111111111111111111111",
"metadata": {
"external_id": "request-123"
}
}{
"object": "retrieval_request_draft",
"id": "222222222222222222222222",
"case_id": "case_abc123",
"status": "draft",
"validation_errors": [
{
"code": "auth_form_missing",
"param": "auth_form",
"message": "A HIPAA authorization form (auth_form) is required"
}
],
"created_at": "2025-02-01T12:50:00Z",
"metadata": {
"external_id": "request-123"
},
"updated_at": "2025-02-01T12:55:00Z"
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "duplicate_request_detected",
"message": "<string>"
},
"duplicates": [
{
"id": "<string>",
"order_number": "<string>",
"classification": "EXACT",
"overlapping_record_types": [
"<string>"
],
"cross_case": true
}
]
}{
"error": {
"code": "validation_error",
"message": "The patient.date_of_birth field is required",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"param": "patient.date_of_birth",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#validation_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#internal_error"
}
}{
"error": {
"code": "internal_error",
"message": "Unable to verify the request submitter at this time — please retry",
"request_id": "req_0c1f1f1cd1c84e2f8d4b6a2e9f3b7a11",
"doc_url": "https://docs.tavrn.ai/guides/v2/errors#internal_error"
}
}Authorizations
API key authentication. Use format: Authorization: Bearer tavrn_sk_live_... Live keys (tavrn_sk_live_...) work only against https://enterprise.tavrn.ai; sandbox test keys (tavrn_sk_test_..., from https://sandbox.tavrn.ai) work only against https://sandbox.tavrn.ai.
Headers
Optional opaque key (1-255 characters, a UUID v4 is recommended) that makes a POST safe to retry. Scoped to your organization and kept for 24 hours. A retry with the same key and the same body replays the original status and body with Idempotent-Replayed: true; the same key with a different body returns 422 idempotency_key_reused_with_different_payload; a retry while the first attempt is still running returns 409 idempotency_key_in_use. Only 2xx and 4xx outcomes are stored - a 5xx releases the key so the retry executes again. See the Idempotent requests guide.
1 - 255Body
- Standard
- Standard
- Draft on validation failure
Email of a user in your organization to attribute the request to. That user receives retrieval notifications for the request. Must match an existing user in your organization or the request is rejected with a 400 validation_error. If omitted, the request is attributed to the creator of the API key.
"jane.smith@example.com"
Response
Retrieval request created