API.Bible Logo

Documentation Navigation

Books

Overview

A Book object represents a single book (Matthew, Mark, etc.) of a single Bible. Each Book is accessible via a Book ID, a 3-digit code representing the book's name. A few examples are:

Book NameBook ID
GenesisGEN
MarkMRK
1 John1JN

These Book IDs are used to identify subsequent chapters and verses and will remain consistent across most Bible versions. Some Bible versions, however, may not contain every book or may contain altered book IDs. If you experience issues fetching a chapter or verse, this endpoint can be a helpful tool to identify which books/chapters are available for this Bible version.


Book Data Structure

Below is the data structure for the Book object, which is returned by all /books API endpoints

{
"id": "string",
"bibleId": "string",
"abbreviation": "string",
"name": "string",
"nameLong": "string",
"chapters": [
{
"id": "string",
"bibleId": "string",
"number": "string",
"bookId": "string",
"reference": "string"
}
]
}

Fetching a List of Books for a Bible

GET https://rest.api.bible/v1/bibles/{bibleId}/books

To fetch a list of books for a Bible, you must send a GET request to the above API endpoint. This will return a list of every book available in this Bible. Using the include-chapters parameter will allow you to fetch every book and chapter for this Bible in a single request.

Parameters

You can use the following query parameters to alter the results of your request:

NameFormatDefaultDescription
include-chaptersBooleanfalseReturns available chapter information for each book
include-chapters-and-sectionsBooleanfalseReturns available chapter and section information for each book

Response

Below is the expected output structure from a successful API request:

{
"data": [
{
"id": "string",
"bibleId": "string",
"abbreviation": "string",
"name": "string",
"nameLong": "string",
"chapters": [
{
"id": "string",
"bibleId": "string",
"number": "string",
"bookId": "string",
"reference": "string"
}
]
}
]
}

Code Samples

To make a simple curl request, copy the following snippet and insert your API key and a bible ID:

curl --request GET \
--url https://rest.api.bible/v1/bibles/{bibleId}/books \
--header 'api-key: YOUR_API_KEY'

For a JavaScript application, copy the following function and insert your API key and a bible ID:

const fetchBookList = async (bibleId) => {
const url = `https://rest.api.bible/v1/bibles/${bibleId}/books`;
try {
const response = await fetch(url, {
headers: {
"api-key": "YOUR_API_KEY",
},
});
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
const result = await response.json();
console.log(result);
return result;
} catch (error) {
console.error(error.message);
}
};

Note: To protect your API key, it is not recommended to use your API key in a client-side JS application (i.e. React)


Fetching a Single Book

GET https://rest.api.bible/v1/bibles/{bibleId}/books/{bookId}

To fetch a single book for a Bible, you must send a GET request to the above API endpoint using the appropriate Bible ID and Book ID you would like to fetch. If you are having trouble finding a specific Book ID, try fetching a list of books first.

Parameters

You can use the following query parameters to alter the results of your request:

NameFormatDefaultDescription
include-chaptersBooleanfalseReturns available chapter information for each book

Response

Below is the expected output structure from a successful API request:

{
"data": {
"id": "string",
"bibleId": "string",
"abbreviation": "string",
"name": "string",
"nameLong": "string",
"chapters": [
{
"id": "string",
"bibleId": "string",
"number": "string",
"bookId": "string",
"reference": "string"
}
]
}
}

Code Samples

To make a simple curl request, copy the following snippet and insert your API key, Bible ID, and Book ID::

curl --request GET \
--url https://rest.api.bible/v1/bibles/{bibleId}/books/{bookId} \
--header 'api-key: YOUR_API_KEY'

For a JavaScript application, copy the following function and insert your API key, Bible ID, and Book ID:

const fetchBook = async (bibleId, bookId) => {
const url = `https://rest.api.bible/v1/bibles/${bibleId}/books/${bookId}`;
try {
const response = await fetch(url, {
headers: {
"api-key": "YOUR_API_KEY",
},
});
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
const result = await response.json();
console.log(result);
return result;
} catch (error) {
console.error(error.message);
}
};

Note: To protect your API key, it is not recommended to use your API key in a client-side JS application (i.e. React)