Use this guide when you want to display Bible text on the web without a YouVersion React component. The recommended JavaScript API returns everything the page needs together:
- transformed, sanitized Bible HTML
- current Bible version attribution
- the Bible CSS and font stylesheet URLs
- the attributes that scope YouVersion styles to your container
If you use React and want a ready-made component, use BibleTextView instead.
Recommended: use the JavaScript SDK
Install the framework-independent core package:
Code
Create a client and request a display-ready passage. A passage ID uses USFM format, such as JHN.3.16 for John 3:16.
Code
getPassageDisplay always returns transformed HTML. It also fetches the Bible version metadata on every call so its required attribution is current. If the version has no usable attribution, the call fails instead of returning an incomplete display model.
The result is declarative: the SDK returns data but does not modify the DOM, inject resources, or cache attribution.
Render in a browser
Start with an empty container:
Code
Then install the returned stylesheets and content:
Code
The SDK sanitizes and transforms display.html, so it is intended for the browser's HTML rendering API. Keep attribution as text, as shown above.
For a client-side framework other than React, apply the returned container attributes to the component that owns the Bible HTML, add each stylesheet to the document head, and use the framework's raw-HTML escape hatch only for display.html. Render display.attribution.text normally.
Render on a server
Server-side transformation uses jsdom, an optional peer dependency:
Code
Call getPassageDisplay on the server exactly as in the recommended example. Add the returned resources to the document head and emit the Bible HTML inside the scoped container:
Code
display.html is the only value intentionally emitted without escaping. Continue to escape attributes and attribution, or let your template engine escape them.
Without npm: use the REST API
If you cannot install the JavaScript SDK, fetch the passage and Bible version directly. The API's Bible HTML is safe to render, but it is not transformed like SDK HTML. Bible CSS still provides a readable basic presentation; verse-level targeting, normalized tables, and extracted footnote data require the SDK transformation.
Add the two required stylesheets to the page:
Code
Then fetch both resources and display them:
Code
See the Bibles API and Fonts API for endpoint details.
Font delivery
Untitled Serif is the intended Bible typeface, and font ID 1 is its permanent Platform identifier. Load it through the Fonts API stylesheet returned by getPassageDisplay, or through the URL shown above. Do not download or self-host its font files. The Bible CSS includes a fallback font if Untitled Serif cannot load.
If an app key contains reserved URL characters, URL-encode it before placing it in the manual font stylesheet URL. The SDK does this automatically.
Customize the reader
Set the supported reader tokens on the scoped container:
Code
For dark tokens, add data-yv-theme="dark" to the container or an ancestor that also has data-yv-sdk.
Transformed HTML makes verse-level styling predictable. For example:
Code
Prefer the reader tokens for typography and layout. Treat other Bible CSS classes and generated markup as content structure rather than a general theming API.
Content security policy
For a strict Content Security Policy, allow:
https://cdn.youversion.cominstyle-srcandfont-srchttps://api.youversion.cominstyle-src