The Admin Bible Sync endpoints allow the Florilegio Django admin panel to incrementally import full Bible translations from the API.Bible service into the localDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alfonsoolavarria/florilegio/llms.txt
Use this file to discover all available pages before exploring further.
VersiculoBiblia database table. All four endpoints are protected by the @staff_member_required decorator and will redirect unauthenticated or non-staff users to the admin login page. The BIBLE_API_KEY environment variable must be set to a valid API.Bible API key before any sync operation can succeed.
Supported Versions
| Version Key | Bible ID | Name |
|---|---|---|
nbla | ce11b813f9a27e20-01 | Nueva Biblia de las Américas |
ntv | 826f63861180e056-01 | Nueva Traducción Viviente |
rvr09 | 592420522e16049f-01 | Reina Valera 1909 |
GET /api/admin/bible-status/
Returns the current synchronization status for all three supported Bible versions. The admin panel calls this endpoint first to determine which versions need to be re-synced. Auth: Staff required (@staff_member_required)
A version is considered to need syncing (needs_sync: true) when either 30 or more days have elapsed since the last successful sync, or when no VersiculoBiblia records exist in the database for that version.
Response
| Field | Type | Description |
|---|---|---|
key | string | Internal version key (nbla, ntv, or rvr09) |
name | string | Human-readable name of the Bible translation |
days_passed | integer | Days elapsed since last_synced_at. Defaults to 30 when no prior sync exists |
needs_sync | boolean | true when days_passed >= 30 or no verses exist for this version |
sync_date | string | Formatted timestamp (YYYY-MM-DD HH:MM) of the last sync, or "Nunca" if never synced |
GET /api/admin/bible-sync/<version_key>/setup/
Returns the ordered list of book numbers that must be iterated to perform a full Bible sync. The list always contains integers 1 through 66, corresponding to Genesis through Revelation. Auth: Staff requiredThe Bible version to sync. Must be one of:
nbla, ntv, rvr09.GET /api/admin/bible-sync/<version_key>/sync/<libro_num>/<capitulo_num>/
Fetches a single chapter from the API.Bible REST API, parses the HTML/USFM-based response using BeautifulSoup, extracts individual verse text, and saves or updates the correspondingVersiculoBiblia records in the database. Existing records for the given version, book, and chapter are deleted before the new batch is inserted via bulk_create.
Auth: Staff required
Bible version key. Must be one of:
nbla, ntv, rvr09. Returns HTTP 400 with {"error": "Versión no válida"} if the key is unrecognized.Book number in the range 1–66. Internally mapped to its USFM code (e.g.,
1 → GEN, 40 → MAT, 66 → REV) before constructing the API.Bible request URL.Chapter number within the book. Combined with the USFM book code to form the passage ID (e.g.,
GEN.1 for Genesis chapter 1).| Status | Body | Cause |
|---|---|---|
400 | {"error": "Versión no válida"} | version_key is not one of the three supported values |
400 | {"error": "Libro no válido"} | libro_num is not in the USFM mapping (outside 1–66) |
200 | {"error": "Not found", "end_of_book": true} | API.Bible returned 404 — chapter does not exist in this translation (signals end of book to the caller) |
400 | {"error": "Error de la API: <code>"} | Any other non-200 response from API.Bible is propagated |
The sync endpoint constructs USFM passage IDs of the form
BOOK.chapter (e.g., GEN.1 for Genesis chapter 1, MAT.5 for Matthew chapter 5) and requests HTML-formatted content from the API.Bible /chapters/{id} endpoint. Verse numbers are parsed from <span class="v"> elements in the returned HTML.| # | Code | Book | # | Code | Book |
|---|---|---|---|---|---|
| 1 | GEN | Genesis | 34 | NAM | Nahum |
| 2 | EXO | Exodus | 35 | HAB | Habakkuk |
| 3 | LEV | Leviticus | 36 | ZEP | Zephaniah |
| 4 | NUM | Numbers | 37 | HAG | Haggai |
| 5 | DEU | Deuteronomy | 38 | ZEC | Zechariah |
| 6 | JOS | Joshua | 39 | MAL | Malachi |
| 7 | JDG | Judges | 40 | MAT | Matthew |
| 8 | RUT | Ruth | 41 | MRK | Mark |
| 9 | 1SA | 1 Samuel | 42 | LUK | Luke |
| 10 | 2SA | 2 Samuel | 43 | JHN | John |
| 11 | 1KI | 1 Kings | 44 | ACT | Acts |
| 12 | 2KI | 2 Kings | 45 | ROM | Romans |
| 13 | 1CH | 1 Chronicles | 46 | 1CO | 1 Corinthians |
| 14 | 2CH | 2 Chronicles | 47 | 2CO | 2 Corinthians |
| 15 | EZR | Ezra | 48 | GAL | Galatians |
| 16 | NEH | Nehemiah | 49 | EPH | Ephesians |
| 17 | EST | Esther | 50 | PHP | Philippians |
| 18 | JOB | Job | 51 | COL | Colossians |
| 19 | PSA | Psalms | 52 | 1TH | 1 Thessalonians |
| 20 | PRO | Proverbs | 53 | 2TH | 2 Thessalonians |
| 21 | ECC | Ecclesiastes | 54 | 1TI | 1 Timothy |
| 22 | SNG | Song of Solomon | 55 | 2TI | 2 Timothy |
| 23 | ISA | Isaiah | 56 | TIT | Titus |
| 24 | JER | Jeremiah | 57 | PHM | Philemon |
| 25 | LAM | Lamentations | 58 | HEB | Hebrews |
| 26 | EZK | Ezekiel | 59 | JAS | James |
| 27 | DAN | Daniel | 60 | 1PE | 1 Peter |
| 28 | HOS | Hosea | 61 | 2PE | 2 Peter |
| 29 | JOL | Joel | 62 | 1JN | 1 John |
| 30 | AMO | Amos | 63 | 2JN | 2 John |
| 31 | OBA | Obadiah | 64 | 3JN | 3 John |
| 32 | JON | Jonah | 65 | JUD | Jude |
| 33 | MIC | Micah | 66 | REV | Revelation |
GET /api/admin/bible-sync/<version_key>/finish/
Marks a version sync as complete by updating theApiBibleSyncStatus.last_synced_at timestamp to the current time. This resets the days_passed counter and clears the needs_sync flag for the version.
Auth: Staff required
Bible version key for which to record the completion timestamp. Must be one of:
nbla, ntv, rvr09.Sync Workflow
Check sync status
Call
GET /api/admin/bible-status/ to retrieve the current sync state for all three versions. Inspect needs_sync for each entry to decide which versions to process.Get the list of books
For each version that needs syncing, call
GET /api/admin/bible-sync/<version_key>/setup/ to retrieve the ordered list of book numbers (1–66) to iterate over.Sync each chapter
For every book number returned by setup, iterate through chapter numbers starting at 1 and call
GET /api/admin/bible-sync/<version_key>/sync/<libro>/<cap>/ for each. Continue incrementing the chapter number until the response contains "end_of_book": true (HTTP 200 with a 404 from API.Bible), which signals the book has no more chapters.The
BIBLE_API_KEY environment variable must be set to a valid API.Bible key. Requests are sent to https://rest.api.bible/v1/bibles/{bible_id}/chapters/{USFM_passage_id} with the key passed in the api-key request header. The passage ID format is BOOK.chapter (e.g., GEN.1 for Genesis chapter 1, REV.22 for Revelation chapter 22).