Table of Contents
Overview
A search will attempt to match all verses with the list of keywords provided in the query string. The order of the keywords does not matter, however all listed keywords must be present in a verse for it to be considered a match.
Wildcard searches are supported, and can be used to match partial results:
| Wildcard | Description | Example |
|---|---|---|
* | Matches any character sequence | "wo*d" finds text such as "word", "world", and "worshipped" |
? | Matches any single character | "l?ve" finds text such as "live" and "love" |
Search a Bible
GET https://rest.api.bible/v1/bibles/{bibleId}/search
To search within a Bible, you must send a GET request to the above API endpoint using the appropriate Bible ID you are looking to search.
The text property of each search result contains only the verse text, it does not
contain footnote references or additional formatting. However, more information on a verse can be queried directly by
fetching a single verse.
Parameters
You can use the following query parameters to alter the results of your request:
| Name | Format | Default | Description |
|---|---|---|---|
query | String | Search keywords or passage reference | |
limit | Number | 10 | Limits the number of results returned |
offset | Number | 0 | Offsets search results, used with limit for pagination |
sort | relevance | canonical | reverse-canonical | relevance | Sort order for search results |
range | Comma-separated Passage IDs | Limits search to given range | |
fuzziness | 0 | 1 | 2 | AUTO | AUTO | Sets the fuzziness of a search to account for misspellings |
Response
Below is the expected output structure from a successful API request:
{"query": "string","data": {"query": "string","limit": 0,"offset": 0,"total": 0,"verseCount": 0,"verses": [{"id": "string","orgId": "string","bibleId": "string","bookId": "string","chapterId": "string","text": "string","reference": "string"}],"passages": [{"id": "string","bibleId": "string","orgId": "string","content": "string","reference": "string","verseCount": 0,"copyright": "string"}]}}
Code Samples
To make a simple curl request, copy the following snippet and insert your API key and search query:
curl --request GET \--url https://rest.api.bible/v1/bibles/{bibleId}/search?query={searchQuery} \--header 'api-key: YOUR_API_KEY'
For a JavaScript application, copy the following function and insert your API key and search query:
const search = async (bibleId, query) => {const url ="https://rest.api.bible/v1/bibles/${bibleId}/search?query={query}";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)