curl -X POST https://api.rhizomeai.com/api/contents \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}'
import requests
response = requests.post(
"https://api.rhizomeai.com/api/contents",
headers={
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
},
json={
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}
)
data = response.json()
print(f"Document: {data['name']}")
print(f"Total pages: {data['total_pages']}")
for page in data["pages"]:
print(f"Page {page['page_num']}: {page['text'][:100]}...")
const response = await fetch("https://api.rhizomeai.com/api/contents", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
doc_id: "nda/2017/208264Orig1s000ChemR.pdf",
top_k: 10,
offset: 0,
}),
});
const data = await response.json();
console.log(`Document: ${data.name}`);
console.log(`Total pages: ${data.total_pages}`);
{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"dataset": "fda_drug",
"name": "TEPADINA THIOTEPA",
"url": "https://www.accessdata.fda.gov/drugsatfda_docs/nda/2017/208264Orig1s000ChemR.pdf",
"company": "ADIENNE SA",
"year_decision": 2017,
"pages": [
{
"page_num": 1,
"text": "CENTER FOR DRUG EVALUATION AND RESEARCH..."
},
{
"page_num": 2,
"text": "TABLE OF CONTENTS..."
},
{
"page_num": 3,
"text": "EXECUTIVE SUMMARY..."
}
],
"total_pages": 97
}
Get Document Contents
Retrieve all pages of a document by document ID
POST
/
api
/
contents
curl -X POST https://api.rhizomeai.com/api/contents \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}'
import requests
response = requests.post(
"https://api.rhizomeai.com/api/contents",
headers={
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
},
json={
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}
)
data = response.json()
print(f"Document: {data['name']}")
print(f"Total pages: {data['total_pages']}")
for page in data["pages"]:
print(f"Page {page['page_num']}: {page['text'][:100]}...")
const response = await fetch("https://api.rhizomeai.com/api/contents", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
doc_id: "nda/2017/208264Orig1s000ChemR.pdf",
top_k: 10,
offset: 0,
}),
});
const data = await response.json();
console.log(`Document: ${data.name}`);
console.log(`Total pages: ${data.total_pages}`);
{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"dataset": "fda_drug",
"name": "TEPADINA THIOTEPA",
"url": "https://www.accessdata.fda.gov/drugsatfda_docs/nda/2017/208264Orig1s000ChemR.pdf",
"company": "ADIENNE SA",
"year_decision": 2017,
"pages": [
{
"page_num": 1,
"text": "CENTER FOR DRUG EVALUATION AND RESEARCH..."
},
{
"page_num": 2,
"text": "TABLE OF CONTENTS..."
},
{
"page_num": 3,
"text": "EXECUTIVE SUMMARY..."
}
],
"total_pages": 97
}
Request Body
string
required
The document identifier. Get this from the
doc_id field in search results.
Examples: nda/2017/208264Orig1s000ChemR.pdf or
https://www.fda.gov/media/71756/downloadinteger
default:10
Maximum number of pages to return. Min: 1, Max: 100.
integer
default:0
Number of pages to skip for pagination. Min: 0.
Response
string
The document identifier.
string
The dataset this document belongs to.
string
Document name/title.
string
Original FDA URL for the document.
string
Company name (if applicable).
integer
Year of the decision/publication.
array
integer
Total number of pages in the document (for pagination).
curl -X POST https://api.rhizomeai.com/api/contents \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}'
import requests
response = requests.post(
"https://api.rhizomeai.com/api/contents",
headers={
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
},
json={
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"top_k": 10,
"offset": 0
}
)
data = response.json()
print(f"Document: {data['name']}")
print(f"Total pages: {data['total_pages']}")
for page in data["pages"]:
print(f"Page {page['page_num']}: {page['text'][:100]}...")
const response = await fetch("https://api.rhizomeai.com/api/contents", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
doc_id: "nda/2017/208264Orig1s000ChemR.pdf",
top_k: 10,
offset: 0,
}),
});
const data = await response.json();
console.log(`Document: ${data.name}`);
console.log(`Total pages: ${data.total_pages}`);
{
"doc_id": "nda/2017/208264Orig1s000ChemR.pdf",
"dataset": "fda_drug",
"name": "TEPADINA THIOTEPA",
"url": "https://www.accessdata.fda.gov/drugsatfda_docs/nda/2017/208264Orig1s000ChemR.pdf",
"company": "ADIENNE SA",
"year_decision": 2017,
"pages": [
{
"page_num": 1,
"text": "CENTER FOR DRUG EVALUATION AND RESEARCH..."
},
{
"page_num": 2,
"text": "TABLE OF CONTENTS..."
},
{
"page_num": 3,
"text": "EXECUTIVE SUMMARY..."
}
],
"total_pages": 97
}
Pagination Example
To fetch all pages of a large document:Python
import requests
doc_id = "nda/2017/208264Orig1s000ChemR.pdf"
all_pages = []
offset = 0
page_size = 20
while True:
response = requests.post(
"https://api.rhizomeai.com/api/contents",
headers={
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
},
json={
"doc_id": doc_id,
"top_k": page_size,
"offset": offset
}
)
data = response.json()
all_pages.extend(data["pages"])
if len(all_pages) >= data["total_pages"]:
break
offset += page_size
print(f"Retrieved {len(all_pages)} pages")
Error Codes
| Status | Description |
|---|---|
| 400 | Invalid request body |
| 401 | Missing or invalid API key |
| 404 | Document not found |
| 429 | Rate limit exceeded (50 requests/minute) |
| 500 | Internal server error |