Skip to main content
Data hooks provide a consistent interface for fetching and managing data from the YouVersion Platform API. All hooks follow the useApiData pattern and return { data, loading, error, refetch }.

Bible Content Hooks

useVersion

Fetches metadata for a specific Bible version.
versionId
number
required
The Bible version ID (e.g., 1 for KJV, 3034 for BSB)
options
UseApiDataOptions
Optional configuration object with enabled boolean
version
BibleVersion | null
Bible version metadata including title, abbreviation, language, and more
loading
boolean
True while data is being fetched
error
Error | null
Error object if the request failed
refetch
() => void
Function to manually refetch the data

Usage

import { useVersion } from '@youversion/platform-react-hooks';

function VersionInfo({ versionId }) {
  const { version, loading, error } = useVersion(versionId);
  
  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  
  return (
    <div>
      <h2>{version?.title}</h2>
      <p>{version?.abbreviation} - {version?.language.name}</p>
    </div>
  );
}

useVersions

Fetches a list of Bible versions, optionally filtered by language and license.
languageRanges
string | string[]
default:"en"
Language code(s) to filter by (e.g., ‘en’, [‘en’, ‘es’])
licenseId
string | number
Optional license ID to filter versions
options
UseVersionsOptions
Configuration object for pagination, field selection, and fetching behavior

Options

options.page_size
number | '*'
Maximum results per page, or '' for all (requires 1-3 fields when using '')
options.page_token
string
Token for pagination
options.fields
(keyof BibleVersion)[]
Specific fields to return (required when page_size is ’*’)
options.all_available
boolean
Include all available versions regardless of license
options.enabled
boolean
Enable/disable automatic fetching

Returns

versions
Collection<BibleVersion> | null
Collection of Bible versions with pagination metadata
loading
boolean
Loading state
error
Error | null
Error if request failed
refetch
() => void
Refetch function

Usage

import { useVersions } from '@youversion/platform-react-hooks';

function VersionList() {
  const { versions, loading } = useVersions('en');
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <ul>
      {versions?.data.map(v => (
        <li key={v.id}>{v.title}</li>
      ))}
    </ul>
  );
}

useBook

Fetches metadata for a specific book within a Bible version.
versionId
number
required
Bible version ID
book
string
required
USFM book abbreviation (e.g., ‘GEN’, ‘JHN’, ‘PSA’)
options
UseApiDataOptions
Optional configuration

Returns

book
BibleBook | null
Book metadata including chapters, human reference, and intro
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useBook } from '@youversion/platform-react-hooks';

function BookInfo({ versionId, bookId }) {
  const { book, loading } = useBook(versionId, bookId);
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <div>
      <h2>{book?.human_reference}</h2>
      <p>{book?.chapters?.length} chapters</p>
    </div>
  );
}

useBooks

Fetches all books for a specific Bible version.
versionId
number
required
Bible version ID
options
UseApiDataOptions
Optional configuration

Returns

books
Collection<BibleBook> | null
Collection of all books in the version
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useBooks } from '@youversion/platform-react-hooks';

function TableOfContents({ versionId }) {
  const { books, loading } = useBooks(versionId);
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <nav>
      {books?.data.map(book => (
        <a key={book.id} href={`/bible/${book.id}`}>
          {book.human_reference}
        </a>
      ))}
    </nav>
  );
}

useChapter

Fetches a specific chapter’s content.
versionId
number
required
Bible version ID
book
string
required
USFM book abbreviation
chapter
number
required
Chapter number
options
UseApiDataOptions
Optional configuration

Returns

chapter
BibleChapter | null
Chapter content and metadata
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useChapter } from '@youversion/platform-react-hooks';

function ChapterView() {
  const { chapter, loading, error } = useChapter(1, 'JHN', 3);
  
  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  
  return <div dangerouslySetInnerHTML={{ __html: chapter?.content }} />;
}

useVerse

Fetches a specific verse.
versionId
number
required
Bible version ID
book
string
required
USFM book abbreviation
chapter
number
required
Chapter number
verse
number
required
Verse number
options
UseApiDataOptions
Optional configuration

Returns

verse
BibleVerse | null
Verse content and metadata
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useVerse } from '@youversion/platform-react-hooks';

function SingleVerse() {
  const { verse, loading } = useVerse(1, 'JHN', 3, 16);
  
  if (loading) return <div>Loading...</div>;
  
  return <p>{verse?.text}</p>;
}

usePassage

Fetches a passage using USFM notation (supports ranges like “JHN.3.16-18”).
versionId
number
required
Bible version ID
usfm
string
required
USFM passage identifier (e.g., ‘JHN.3.16’, ‘JHN.3.16-18’)
format
'html' | 'text'
default:"html"
Content format
include_headings
boolean
default:false
Include section headings
include_notes
boolean
default:false
Include footnotes
options
UseApiDataOptions
Optional configuration

Returns

passage
BiblePassage | null
Passage content and metadata
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { usePassage } from '@youversion/platform-react-hooks';

function PassageView() {
  const { passage, loading } = usePassage({
    versionId: 1,
    usfm: 'JHN.3.16',
  });
  
  if (loading) return <div>Loading...</div>;
  
  return <div dangerouslySetInnerHTML={{ __html: passage?.content }} />;
}

useVOTD

Fetches the Verse of the Day for a specific day of the year.
day
number
required
Day of year (1-366). Use the getDayOfYear utility to calculate from a Date.
options
UseApiDataOptions
Optional configuration

Returns

data
VOTD | null
Verse of the Day including verse content, reference, and image
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useVOTD, getDayOfYear } from '@youversion/platform-react-hooks';

function DailyVerse() {
  const today = getDayOfYear(new Date());
  const { data: votd, loading, refetch } = useVOTD(today);
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <div>
      <p>{votd?.verse.text}</p>
      <small>{votd?.verse.reference}</small>
      <button onClick={refetch}>Refresh</button>
    </div>
  );
}

Language Hooks

useLanguages

Fetches available languages with optional filtering and pagination.
options
GetLanguagesOptions
Query options for filtering and pagination
apiOptions
UseApiDataOptions
Hook configuration (enable/disable fetching)

Options

options.fields
(keyof Language)[]
Specific fields to return
options.country
string
Filter by country code
options.page_size
number
Results per page
options.page_token
string
Pagination token

Returns

languages
Collection<Language> | null
Collection of languages with pagination metadata
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function

Usage

import { useLanguages } from '@youversion/platform-react-hooks';

function LanguageSelector() {
  const { languages, loading } = useLanguages();
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <select>
      {languages?.data.map(lang => (
        <option key={lang.id} value={lang.id}>
          {lang.name}
        </option>
      ))}
    </select>
  );
}

Highlight Hooks

useHighlights

Fetches, creates, and deletes user highlights (requires authentication).
options
GetHighlightsOptions
Query options for filtering highlights
apiOptions
UseApiDataOptions
Hook configuration

Options

options.version_id
number
Filter by version ID
options.passage_id
string
Filter by passage ID

Returns

highlights
Collection<Highlight> | null
User’s highlights
loading
boolean
Loading state
error
Error | null
Error state
refetch
() => void
Refetch function
createHighlight
(data: CreateHighlight) => Promise<Highlight>
Create a new highlight
deleteHighlight
(passageId: string, options?: DeleteHighlightOptions) => Promise<void>
Delete a highlight

Usage

import { useHighlights } from '@youversion/platform-react-hooks';

function HighlightManager({ versionId }) {
  const { 
    highlights, 
    loading, 
    createHighlight, 
    deleteHighlight 
  } = useHighlights({ version_id: versionId });
  
  const handleCreate = async () => {
    await createHighlight({
      passage_id: 'JHN.3.16',
      version_id: versionId,
      color: 'yellow',
    });
  };
  
  const handleDelete = async (passageId: string) => {
    await deleteHighlight(passageId);
  };
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <div>
      <button onClick={handleCreate}>Highlight Verse</button>
      <ul>
        {highlights?.data.map(h => (
          <li key={h.passage_id}>
            {h.passage_id}
            <button onClick={() => handleDelete(h.passage_id)}>Delete</button>
          </li>
        ))}
      </ul>
    </div>
  );
}

Client Hooks

useBibleClient

Returns a configured BibleClient instance. Used internally by data hooks.

Returns

bibleClient
BibleClient
Configured Bible API client

Usage

import { useBibleClient } from '@youversion/platform-react-hooks';

function CustomDataFetcher() {
  const client = useBibleClient();
  
  // Use client for custom API calls
  const fetchCustomData = async () => {
    const version = await client.getVersion(1);
    // ...
  };
  
  // ...
}

Best Practices

// ✅ Good - only fetches when IDs are valid
const { chapter } = useChapter(versionId, book, chapterNum, {
  enabled: Boolean(versionId && book && chapterNum),
});

// ❌ Bad - fetches even with invalid params
const { chapter } = useChapter(0, '', 0);
const { version, loading, error } = useVersion(versionId);

if (loading) return <Spinner />;
if (error) return <ErrorMessage error={error} />;
if (!version) return <NotFound />;

return <VersionDisplay version={version} />;
const { data: votd, loading, refetch } = useVOTD(dayOfYear);

return (
  <div>
    <Verse verse={votd?.verse} />
    <button onClick={refetch} disabled={loading}>
      {loading ? 'Refreshing...' : 'Refresh'}
    </button>
  </div>
);

Build docs developers (and LLMs) love