curl "https://rhizomeai.com/api/v3/documents/WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d?page_from=1&page_to=2" \
-H "x-api-key: YOUR_API_KEY"
import requests
document_id = "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d"
response = requests.get(
f"https://rhizomeai.com/api/v3/documents/{document_id}",
headers={"x-api-key": "YOUR_API_KEY"},
params={"page_from": 1, "page_to": 2},
)
response.raise_for_status()
data = response.json()
print(f"{data['title']}: {data['total_pages']} pages")
const documentId =
"WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d";
const response = await fetch(
`https://rhizomeai.com/api/v3/documents/${documentId}?page_from=1&page_to=2`,
{ headers: { "x-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();
console.log(`${data.title}: ${data.total_pages} pages`);
{
"document_id": "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d",
"dataset": "fda_483",
"title": "Example Pharma Inc.",
"url": "https://www.fda.gov/media/000000/download",
"total_pages": 14,
"pages": [
{
"page_num": 1,
"text": "DEPARTMENT OF HEALTH AND HUMAN SERVICES FOOD AND DRUG ADMINISTRATION..."
},
{
"page_num": 2,
"text": "OBSERVATION 1. There is a failure to thoroughly review the failure of a batch to meet its specifications. Sterility test..."
}
],
"next_page_from": 3
}
API v3
Read a document
A document’s full text, one page range at a time
GET
/
api
/
v3
/
documents
/
{document_id}
curl "https://rhizomeai.com/api/v3/documents/WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d?page_from=1&page_to=2" \
-H "x-api-key: YOUR_API_KEY"
import requests
document_id = "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d"
response = requests.get(
f"https://rhizomeai.com/api/v3/documents/{document_id}",
headers={"x-api-key": "YOUR_API_KEY"},
params={"page_from": 1, "page_to": 2},
)
response.raise_for_status()
data = response.json()
print(f"{data['title']}: {data['total_pages']} pages")
const documentId =
"WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d";
const response = await fetch(
`https://rhizomeai.com/api/v3/documents/${documentId}?page_from=1&page_to=2`,
{ headers: { "x-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();
console.log(`${data.title}: ${data.total_pages} pages`);
{
"document_id": "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d",
"dataset": "fda_483",
"title": "Example Pharma Inc.",
"url": "https://www.fda.gov/media/000000/download",
"total_pages": 14,
"pages": [
{
"page_num": 1,
"text": "DEPARTMENT OF HEALTH AND HUMAN SERVICES FOOD AND DRUG ADMINISTRATION..."
},
{
"page_num": 2,
"text": "OBSERVATION 1. There is a failure to thoroughly review the failure of a batch to meet its specifications. Sterility test..."
}
],
"next_page_from": 3
}
Returns the text of one document, by the
document_id a search result carries. Pages are numbered from 1. A response holds up to 100 pages or 2 MB of text, whichever comes first. next_page_from says where to continue.
Path parameters
string
required
The
document_id of a search result. It is opaque: take it from a search,
don’t build it.Query parameters
integer
default:1
First page to return. The first page is 1.
integer
Last page to return, inclusive. Omit to read to the end of the document, up to
the 100-page or 2 MB cap.
Response
string
The document id.
string
The dataset id.
string
The document’s title.
string
Link to the source document.
integer
Pages in the document, so also the last page’s
page_num.array
integer | null
The page after the ones returned: send it as
page_from to continue. null
when the document ends there.Reading a whole document
Python
import requests
document_id = "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d"
pages, page_from = [], 1
while page_from is not None:
response = requests.get(
f"https://rhizomeai.com/api/v3/documents/{document_id}",
headers={"x-api-key": "YOUR_API_KEY"},
params={"page_from": page_from},
)
response.raise_for_status()
data = response.json()
pages.extend(data["pages"])
page_from = data["next_page_from"]
print(f"{data['title']}: {len(pages)} of {data['total_pages']} pages")
Errors
Errors return{"error": {"code", "message", "field", "request_id"}}; field names the value at fault when there is one. See Errors.
| Status | Code | Description |
|---|---|---|
| 400 | invalid_request | page_from or page_to isn’t a positive integer (0 included: pages start at 1), or page_to is before page_from |
| 401 | missing_api_key, invalid_api_key | Missing or invalid API key |
| 403 | forbidden | The document’s dataset needs an enterprise plan |
| 404 | not_found | No document has this id |
| 429 | rate_limited | Rate limit exceeded (50 requests/minute) |
| 504 | timeout | Reading the document timed out |
curl "https://rhizomeai.com/api/v3/documents/WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d?page_from=1&page_to=2" \
-H "x-api-key: YOUR_API_KEY"
import requests
document_id = "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d"
response = requests.get(
f"https://rhizomeai.com/api/v3/documents/{document_id}",
headers={"x-api-key": "YOUR_API_KEY"},
params={"page_from": 1, "page_to": 2},
)
response.raise_for_status()
data = response.json()
print(f"{data['title']}: {data['total_pages']} pages")
const documentId =
"WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d";
const response = await fetch(
`https://rhizomeai.com/api/v3/documents/${documentId}?page_from=1&page_to=2`,
{ headers: { "x-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();
console.log(`${data.title}: ${data.total_pages} pages`);
{
"document_id": "WyJmZGFfNDgzIixbImh0dHBzOi8vd3d3LmZkYS5nb3YvbWVkaWEvMDAwMDAwL2Rvd25sb2FkIl1d",
"dataset": "fda_483",
"title": "Example Pharma Inc.",
"url": "https://www.fda.gov/media/000000/download",
"total_pages": 14,
"pages": [
{
"page_num": 1,
"text": "DEPARTMENT OF HEALTH AND HUMAN SERVICES FOOD AND DRUG ADMINISTRATION..."
},
{
"page_num": 2,
"text": "OBSERVATION 1. There is a failure to thoroughly review the failure of a batch to meet its specifications. Sterility test..."
}
],
"next_page_from": 3
}