@sefaria/api-client
v0.1.0-alpha.0
Published
Source-backed Sefaria API client with generated contracts, validators, and bounded caching.
Keywords
Readme
Created/edited by GitHub Copilot; pending human review.
@sefaria/api-client
Fetches Sefaria API responses and checks them against a corrected API description before your code uses them. It has 60 generated functions grouped by Sefaria's API sections and a bounded per-client response cache.
A community-driven project with Sefaria backing and support. The toolkit is experimental; names and APIs may change.
Install
Public npm release 0.1.0-alpha.0 is prepared but remains pending hosted qualification. After release, installation is anonymous and needs no GitHub token. Types are included; no @types package is needed. Install and status › Packages owns current availability and exact-version installation guidance.
First success
import { createSefariaClient, text } from "@sefaria/api-client";
const client = createSefariaClient();
// Fetch one passage. The client checks the response before you see it.
const { data, error, response } = await text.getV3Texts({
client,
path: { tref: "Micah 6:8" },
});
if (data === undefined) {
console.log(`Sefaria answered HTTP ${response.status}:`, error);
} else {
for (const version of data.versions) {
console.log(`${data.ref} · ${version.language} · ${version.versionTitle}`);
}
}Next steps
For maintainers: IMPLEMENTATION.md.
