The JavaScript SDK (@youversion/platform-core) provides typed API clients for fetching Bible data in any JavaScript environment.
See the source on GitHub.
Installation
Install the package with your preferred package manager:
Configuration
Create an API client with your App Key:
Code
Types
BibleClient API
The BibleClient provides methods for fetching Bible versions, books, chapters, verses, and passages.
Version Methods
getVersions(language_ranges, license_id?)
Fetch available Bible versions filtered by language.
Code
Parameters:
language_ranges(string): Comma-separated language codes or ranges (e.g.,"en*","es-ES")license_id(string | number, optional): License ID to filter versions
Response:
Code
getVersion(id)
Fetch a specific Bible version by ID.
Code
Parameters:
id(number): Bible version ID
Troubleshooting: If you get a "Version not found" error (404), verify the version ID exists:
Code
Book Methods
getBooks(versionId)
Fetch all books for a specific Bible version.
Code
Parameters:
versionId(number): Bible version ID
Response:
Code
getBook(versionId, book)
Fetch a specific book by its USFM identifier.
Code
Parameters:
versionId(number): Bible version IDbook(string): 3-character USFM book code (e.g.,"GEN","MAT","JHN")
Chapter Methods
getChapters(versionId, book)
Fetch all chapters for a specific book.
Code
Parameters:
versionId(number): Bible version IDbook(string): 3-character USFM book code
getChapter(versionId, book, chapter)
Fetch a specific chapter.
Code
Parameters:
versionId(number): Bible version IDbook(string): 3-character USFM book codechapter(number): Chapter number
Verse Methods
getVerses(versionId, book, chapter)
Fetch all verses for a specific chapter.
Code
Parameters:
versionId(number): Bible version IDbook(string): 3-character USFM book codechapter(number): Chapter number
Response:
Code
getVerse(versionId, book, chapter, verse)
Fetch a specific verse.
Code
Parameters:
versionId(number): Bible version IDbook(string): 3-character USFM book codechapter(number): Chapter numberverse(number): Verse number
Passage Methods
getPassage(versionId, usfm, format?, include_headings?, include_notes?)
Fetch a passage with formatted content. This is the recommended method for retrieving verse text to preserve proper formatting of paragraphs and tables.
Code
Parameters:
versionId(number): Bible version IDusfm(string): USFM reference format (e.g.,"JHN.3.16","GEN.1.1-5","MAT.1")format(string, optional):"html"or"text"(default:"text")include_headings(boolean, optional): Include section headings in outputinclude_notes(boolean, optional): Include footnotes/endnotes in output
USFM format: References follow the pattern BOOK.CHAPTER.VERSE where BOOK is a 3-character code (e.g., GEN, JHN, PSA). You can specify:
- A single verse:
JHN.3.16 - A verse range:
GEN.1.1-5 - An entire chapter:
GEN.1
Use getBooks() to discover valid book codes for a version, or see the USFM Reference for all standard book identifiers.
Choosing a Format
"text"(default) — Plain text with no markup. Easy to display in any framework or environment. Recommended for most non-React apps that don't need formatted output."html"— Returns HTML with YouVersion-specific CSS classes for verse numbers, paragraphs, headings, poetry, tables, and more. If you're using React, use theBibleTextVieworBibleReadercomponents which handle styling and footnotes automatically.
Response:
format: text
format: html
When displaying Bible text, always display a Bible Version's copyright attribution in accordance with the license agreement
Index & VOTD Methods
getIndex(versionId)
Fetch the complete indexing structure for a Bible version.
Code
Parameters:
versionId(number): Bible version ID
Response:
Code
getAllVOTDs()
Fetch the Verse of the Day for the entire year.
Code
getVOTD(day)
Fetch the Verse of the Day for a specific day of the year.
Code
Parameters:
day(number): Day of the year (1-366)
LanguagesClient API
The LanguagesClient provides methods for accessing language information.
Code
Language Methods
getLanguages(options)
Fetch available languages supported in the platform.
Code
Parameters:
options(object):country(string, required): ISO 3166-1 alpha-2 country code (e.g.,"US","BR","MX")page_size(number, optional): Results per pagepage_token(string, optional): Pagination token from previous response
Response:
Code
getLanguage(languageId)
Fetch details about a specific language.
Code
Parameters:
languageId(string): BCP 47 language code (e.g.,"en","es","sr-Cyrl")
Troubleshooting: If you get "Language ID must match BCP 47 format" error, use proper language codes:
Code