This API provides access to Gemara Tzuras Hadaf PDF files. Request a specific masechta (tractate) and daf (page) to receive the corresponding PDF.
These PDF files are sourced from HebrewBooks.org, where they are made available for free, non-commercial redistribution with attribution under the terms of the HebrewBooks.org Limited License.
If you redistribute these files, you must do so free of charge, retain all original attribution notices (including credit to HebrewBooks.org and Moznaim / הוצאת ח. וגשל), retain our attribution (Shas.org), and include the full text of the HebrewBooks.org Paragraph 1 License Terms.
Attribution Example:
Scanned Shas provided courtesy of shas.org (http://shas.org/dafviewer), hebrewbooks.org (https://www.hebrewbooks.org/shas) and Moznaim (הוצאת ח. וגשל);
Redistributed free for non-commercial, educational use under the HebrewBooks License (https://web.archive.org/web/20101028043253/http://hebrewbooks.org/media/terms.html).
https://www.shas.org/daf-pdf/api/
Retrieve a specific daf from a masechta as a PDF file.
| Parameter | Type | Required | Description |
|---|---|---|---|
masechta |
string | Required | Name of the masechta (see list below) |
daf |
integer | Required | Daf number (starts from 2) |
amud |
string | Optional | Side of the daf: a (default), b, aleph, bet,
1, or 2
|
format |
string | Optional | Set to json to get metadata instead of the PDF file |
Use these exact masechta names in your API requests (case-insensitive):
Note: Some masechtot end on amud 'a' rather than 'b'. Attempting to access a non-existent amud 'b' will return an error.
meilah, kinim, tamid, or
middos as aliases to access:GET /?masechta=berachos&daf=2
Response: application/pdf
Returns the PDF file for Berachos daf 2, amud aleph.
GET /?masechta=shabbos&daf=5&amud=b
Response: application/pdf
Returns the PDF file for Shabbos daf 5, amud bet.
GET /?masechta=bava-metzia&daf=10&amud=a&format=json
Response: application/json
{
"success": true,
"masechta": "Bava Metzia",
"daf": 10,
"amud": "a",
"page_number": 3043,
"pdf_url": "3043.pdf",
"file_size": 1234567
}
Status Code: 400 Bad Request
{
"error": "Missing masechta parameter",
"message": "Please provide a masechta name (e.g., ?masechta=berachos&daf=2)"
}
Status Code: 404 Not Found
{
"error": "Invalid masechta",
"message": "Masechta 'invalid' not found",
"available_masechtot": ["berachos", "shabbos", ...]
}
Status Code: 400 Bad Request
{
"error": "Daf out of range",
"message": "Masechta Berachos only has 64 dapim",
"max_daf": 64
}
Status Code: 400 Bad Request
{
"error": "Amud does not exist",
"message": "Masechta Berachos ends at daf 64a (amud aleph only)",
"last_daf": 64,
"last_amud": "a"
}
Status Code: 404 Not Found
{
"error": "PDF not found",
"message": "PDF file for page 1234 does not exist",
"requested": {
"masechta": "Berachos",
"daf": 10,
"amud": "a",
"page_number": 1234
}
}
bava-kamma, rosh-hashanah)
a, aleph, or 1 for
amud aleph; b, bet, or 2 for amud betkinim, tamid, or middos to
access specific sections within the Meilah volume (see masechta list above for daf ranges)&format=json to get file information without
downloading the PDF// Fetch and display a PDF
function loadDaf(masechta, daf, amud = 'a') {
const url = `https://www.shas.org/daf-pdf/api/?masechta=${masechta}&daf=${daf}&amud=${amud}`;
// Display PDF in iframe
document.getElementById('pdf-viewer').src = url;
// Or get metadata
fetch(`${url}&format=json`)
.then(response => response.json())
.then(data => {
console.log('Loaded:', data.masechta, data.daf, data.amud);
});
}
// Example usage
loadDaf('berachos', 2, 'a');