Sefaria icon

Sefaria

Interact with Sefaria API

Actions5

Overview

This node interacts with the Sefaria Text API to retrieve Jewish textual sources by their reference identifiers. Specifically, the "Get Texts By Ref" operation fetches the text corresponding to a given reference string (e.g., "Shabbat.1a"). It is useful for scenarios where you want to programmatically access classical Jewish texts, such as Torah portions, Talmudic pages, or commentaries, and integrate them into workflows for study, analysis, or display.

Practical examples include:

  • Automatically fetching the text of a weekly Torah portion for a newsletter.
  • Retrieving Talmudic passages referenced in a study app.
  • Including related commentaries or cross-references alongside the main text for enhanced learning tools.

Properties

Name Meaning
Ref A valid textual reference string identifying the desired text segment (e.g., "Shabbat.1a").
Commentary Option to include known connections to other texts along with the requested text. Values: 0 (no), 1 (yes).
Context Controls whether surrounding texts are included when only a single segment is requested. Values: 0 (no), 1 (yes).
Pad Determines if the reference should be padded down to section level or return the entire book. Values: 0 (no), 1 (yes).

Output

The node outputs JSON data representing the requested text from the Sefaria API. This includes the main text content identified by the reference, and optionally:

  • A list of commentaries or connected texts if the "Commentary" property is enabled.
  • Surrounding context segments if the "Context" property is enabled.

The output structure typically contains fields such as the text itself, its reference, and metadata about the text. The node does not output binary data.

Dependencies

  • Requires access to the Sefaria API endpoint (default base URL: https://www.sefaria.org).
  • Optionally requires an API key credential if configured in n8n (not mandatory based on provided code).
  • No additional external dependencies beyond standard HTTP requests.

Troubleshooting

  • Invalid Reference Error: If the "Ref" property is malformed or does not correspond to a valid text segment, the API may return an error or empty result. Verify the reference format (e.g., "BookName.chapter.verse" or "Tractate.page").
  • Network Issues: Failure to connect to the Sefaria API could be due to network problems or incorrect base URL configuration.
  • Unexpected Empty Results: If "Pad" or "Context" options are set incorrectly, the returned text might be incomplete or missing expected surrounding segments.
  • API Rate Limits: Excessive requests might trigger rate limiting; consider adding delays or caching results.

Links and References

Discussion