Docs
Make your first Mantrilo API request
One REST API for mantras, sacred audio, scripture books and astrology. Start from a guide for what you’re building, or look up any endpoint. Examples show the response format. Some use excerpts or placeholders.
Quickstart
- Get a key. Every account starts with a sandbox key. Open the sandbox quickstart
- Keep it on your server. Set
MANTRILO_API_KEYandMANTRILO_API_URLin your backend’s environment. - Make a request. List one mantra, then follow the endpoint reference or a guide for your goal.
curl "https://api.mantrilo.com/v1/mantras?limit=1" \
-H "Authorization: Bearer $MANTRILO_API_KEY"Start from your goal
Each guide starts with a request you can run, then shows the server code, pagination and quota.
Load the Upanishads
Call one collection directly, page through it, then open a book, chapter or verse.
Open guideBuild a searchable shloka library
List mantras and shlokas, filter by deity, and search the titles you have loaded.
Open guidePlay sacred audio
Request a temporary playback URL for an entry with a recording.
Open guideBuild a book reader
Read Sanskrit verses or English retellings of the Ramayana and Mahabharata.
Open guideAdd birth charts
Build a Lahiri birth chart with optional Dasha periods.
Open guideAdd a daily Panchang
Build a local daily Panchang calendar.
Open guideFeature a daily mantra
Fetch a selected mantra and present its original Sanskrit and transliteration.
Open guideAstrology has a guide for every capability. Browse astrology capabilities
Authentication
Send your key on every request as Authorization: Bearer YOUR_KEY. The API blocks browser cross-origin calls, so call it from your server and pass only the content to your app. Never put a key in a web bundle, mobile app or repository. If a key leaks, regenerate it in the console; the old key stops working within a minute.
Sandbox and live
| Environment | Key prefix | What it reads |
|---|---|---|
| Sandbox | mtr_sbx_ | Sample mantras, the sample books’ opening verses, and available astrology operations. Every account has one. |
| Live | mtr_live_ | The full available catalog. Issued with a paid plan. |
Sandbox and live keep separate usage totals. A sandbox request for an item outside the sample returns 403 sandbox_sample_only.
Pagination
List endpoints return nextCursor. Pass it back as cursor to read the next page. It is null on the last page. Set the page size with limit (1–100).
Chapter pages return nextOffset. Pass it back as offset to read more verses of the same chapter.
curl "$MANTRILO_API_URL/v1/books?collection=upanishads&limit=3&cursor={nextCursor}" \
-H "Authorization: Bearer $MANTRILO_API_KEY"Errors
Every error has the same shape. The code is stable; the message explains what to fix. Only successful responses count toward your plan.
{
"error": {
"code": "invalid_api_key",
"message": "Send a valid API key."
},
"requestId": "request-id"
}| Status | Code | What to do |
|---|---|---|
400 | invalid_limit, invalid_cursor, invalid_deity, invalid_collection, invalid_offset | Fix the query parameter named in the message. |
400 | invalid_operation, invalid_input, invalid_datetime, invalid_timezone, … | Fix the astrology input named in the message. |
401 | invalid_api_key, revoked_api_key | The key is missing, wrong, or revoked. |
403 | plan_inactive | Live keys need an active paid plan. |
403 | sandbox_sample_only | That item is outside the sandbox sample. Use your live key. |
404 | not_found, audio_unavailable | No such item, or it has no recording. |
405 | method_not_allowed | Use the method listed for the endpoint. |
429 | rate_limited | Wait for the Retry-After header, then retry. |
429 | quota_exceeded, audio_quota_exceeded | The monthly allowance has run out. |
429 | too_many_failed_attempts | Too many bad keys from one address. Retry later. |
500 | internal_error | Retry, and quote the requestId if it continues. |
503 | books_unavailable, astrology_unavailable, astrology_operation_unavailable | The service or operation is temporarily unavailable. Retry later. |
504 | astrology_timeout | The calculation took too long. Retry. Nothing is charged. |
Usage limits
Allowances apply to your whole workspace, not to each key, and reset monthly in UTC. Each successful content response or astrology calculation is one request. Each audio link also counts the file’s size.
| Plan | Requests a month | Audio | Rate | Burst |
|---|---|---|---|---|
| Free | 500 | Sample audio only | 2 per second | 10 |
| Starter | 50,000 | 10 GB | 10 per second | 20 |
| Growth | 250,000 | 50 GB | 25 per second | 50 |
| Business | 1,000,000 | 200 GB | 50 per second | 100 |
Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-Quota-Requests-Remaining and X-Request-Id. A rate_limited response adds Retry-After. Sandbox keys always use the Free rate. If your workspace has no monthly request cap, X-Quota-Requests-Remaining is unlimited. Compare plans
Ramayana and Mahabharata
Use a live key to read these English prose retellings. Open a book for its chapter index, then use a chapter number to load the full chapter in one request.
Ramayana
22 chapters
curl "$MANTRILO_API_URL/v1/books/ramayana" \
-H "Authorization: Bearer $MANTRILO_API_KEY"
curl "$MANTRILO_API_URL/v1/books/ramayana/chapters/1" \
-H "Authorization: Bearer $MANTRILO_API_KEY"Mahabharata
62 chapters
curl "$MANTRILO_API_URL/v1/books/mahabharata" \
-H "Authorization: Bearer $MANTRILO_API_KEY"
curl "$MANTRILO_API_URL/v1/books/mahabharata/chapters/1" \
-H "Authorization: Bearer $MANTRILO_API_KEY"Books return format: "prose" and language: "en". For a chapter, display data.source and iterate over data.sections. Render each section’s title and paragraphs in order. Prose chapters return an empty verses array and nextOffset: null.
Endpoint reference
GET /v1
The API name, version and resource list. Useful as a health check.
No key neededNo parameters.
curl "$MANTRILO_API_URL/v1"{
"name": "Mantrilo API",
"version": "1",
"authentication": "Authorization: Bearer <your Mantrilo API key>",
"resources": [
"/v1/mantras",
"/v1/books?collection={collection}",
"…"
]
}GET /v1/mantras
Mantras and shlokas, in a stable order. Each item is a summary without verses.
limitquery- Integer, 1–100. Default 20.
cursorquery- The nextCursor from the previous page.
deityquery- A deity id, such as shiva or annapurna. Exact match.
curl "$MANTRILO_API_URL/v1/mantras?limit=1" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": [
{
"id": "annapurna-aham-vaishvanaro-bhuthva",
"title": "Aham Vaishvanaro Bhuthva",
"deity": {
"id": "annapurna",
"name": "Lord Annapurna"
},
"category": "Annapurna Stotras",
"source": "Sanatana Shastras",
"description": "Aham Vaishvanaro Bhutva means \"I, having become the universal fire,\" and in Bhagavad Gita 15.14 Krishna says he lives in every body and digests its food. United with the prana and apana breaths, this inner fire cooks the four kinds of food: chewed, swallowed, licked and sucked. Families often say it before a meal to treat eating as an offering.",
"verseCount": 1,
"audio": {
"href": "/v1/mantras/annapurna-aham-vaishvanaro-bhuthva/audio"
}
}
],
"nextCursor": "YW5uYXB1cm5hLWFoYW0tdmFpc2h2YW5hcm8tYmh1dGh2YQ",
"requestId": "request-id"
}GET /v1/mantras/{id}
One mantra with its verses. Any text field can be null, so render only what is present.
idpath- The mantra id from a list response.
description is the mantra’s short public summary. It is null when a record has none.
curl "$MANTRILO_API_URL/v1/mantras/annapurna-aham-vaishvanaro-bhuthva" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": {
"id": "annapurna-aham-vaishvanaro-bhuthva",
"title": "Aham Vaishvanaro Bhuthva",
"deity": {
"id": "annapurna",
"name": "Lord Annapurna"
},
"category": "Annapurna Stotras",
"source": "Sanatana Shastras",
"description": "Aham Vaishvanaro Bhutva means \"I, having become the universal fire,\" and in Bhagavad Gita 15.14 Krishna says he lives in every body and digests its food. United with the prana and apana breaths, this inner fire cooks the four kinds of food: chewed, swallowed, licked and sucked. Families often say it before a meal to treat eating as an offering.",
"verseCount": 1,
"audio": {
"href": "/v1/mantras/annapurna-aham-vaishvanaro-bhuthva/audio"
},
"verses": [
{
"number": 1,
"title": "Aham Vaishvanaro Bhuthva – Verse 1",
"sanskrit": "अहं वैश्वानरो भूत्वा प्राणिनां देहमाश्रितः\nप्राणापान समायुक्तः पचाम्यन्नं चतुर्विधम्",
"transliteration": "ahaṃ vaiśvānaro bhūtvā prāṇināṃ dehamāśritaḥ\nprāṇāpāna samāyuktaḥ pacāmyannaṃ caturvidham",
"translation": null,
"wordMeanings": []
}
]
},
"requestId": "request-id"
}GET /v1/mantras/{id}/audio
The recording for a mantra whose audio field is not null. Without format=json the response is a 302 redirect to the file.
idpath- The mantra id.
formatquery- json returns the signed link as JSON instead of redirecting.
Links last 15 minutes. Each link counts its file size toward your audio allowance.
curl "$MANTRILO_API_URL/v1/mantras/annapurna-aham-vaishvanaro-bhuthva/audio?format=json" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": {
"url": "https://storage.googleapis.com/mantrilo-media/…?X-Goog-Signature=…",
"expiresAt": "2026-11-10T06:45:00.000Z",
"bytes": 123077,
"contentType": "audio/x-m4a"
},
"requestId": "request-id"
}GET /v1/books
Live books in catalog order. Filter by collection to call a set such as the Upanishads directly.
collectionquery- A collection id: upanishads, bhagavad-gita, advaita-vedanta-prakarana-granthas, vedanta, yoga.
limitquery- Integer, 1–100. Default 24.
cursorquery- The nextCursor from the previous page.
Sandbox keys list Isha Upanishad and the Bhagavad Gita. Other collections may return no sandbox titles.
curl "$MANTRILO_API_URL/v1/books?collection=upanishads&limit=3" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": [
{
"id": "ishaUpanishad",
"title": "Īśāvāsya Upaniṣad",
"author": "Vedic Rishis",
"category": null,
"subcategory": null,
"collection": {
"id": "upanishads",
"name": "Upanishads"
},
"description": "One of the shortest and most profound Upanishads, revealing the nature of the Supreme Lord who pervades all.",
"verseCount": 18
}
],
"nextCursor": null,
"sandbox": true,
"requestId": "request-id"
}GET /v1/books/{id}
A book summary with its chapter index. Use the chapter numbers to request text.
idpath- The book id from a list response.
preview is true for sandbox keys, which see the opening chapter only.
curl "$MANTRILO_API_URL/v1/books/ishaUpanishad" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": {
"id": "ishaUpanishad",
"title": "…",
"collection": {
"id": "upanishads",
"name": "Upanishads"
},
"description": "…",
"chapters": [
{
"number": 1,
"title": "…",
"description": null,
"verseCount": 18
}
],
"preview": false
},
"requestId": "request-id"
}GET /v1/books/{id}/chapters/{chapter}
A page of up to 30 verses or a complete chapter of a prose retelling.
idpath- The book id.
chapterpath- A chapter number from the book’s chapter index.
offsetquery- For verses, pass nextOffset from the previous page. Omit for prose.
Sandbox keys read the first three verses of the opening chapter of sample books. Ramayana and Mahabharata require a live key.
curl "$MANTRILO_API_URL/v1/books/ishaUpanishad/chapters/1" \
-H "Authorization: Bearer $MANTRILO_API_KEY"{
"data": {
"number": 1,
"title": "…",
"verseCount": 18,
"verses": [
{
"number": 1,
"sanskrit": "…",
"transliteration": "…",
"translation": null,
"translator": "…",
"wordMeaning": null,
"commentary": null
}
],
"nextOffset": null
},
"requestId": "request-id"
}GET /v1/astrology
The current operation catalog, with IDs, categories, and sample inputs where available.
No key neededNo parameters.
curl "$MANTRILO_API_URL/v1/astrology"{
"data": [
{
"id": "positions",
"name": "Planetary positions",
"description": "…"
},
{
"id": "vedic-panchang",
"name": "Panchang",
"category": "Vedic",
"availability": "available",
"example": {
"…": "…"
}
}
]
}POST /v1/astrology/calculate
Run one operation. Send operation and that operation’s inputs as JSON. Each operation’s inputs are on the Astrology page.
operationbody- An operation id from GET /v1/astrology.
datetimebody- For positions and panchang: ISO 8601 with seconds and a UTC offset.
…body- Other inputs depend on the operation.
Failed calculations are not charged.
Hindi responses: five operations answer in Hindi when you add "lang": "hi" or "language": "hi" under parameters. These are Daily Rashifal, Daily Rashifal for all signs, the Western daily sign horoscope, Daily Muhurat lookup and Moon sign compatibility. Codes and scores stay the same in both languages. Every other operation answers in English. The list is on the Astrology page.
curl -X POST "$MANTRILO_API_URL/v1/astrology/calculate" \
-H "Authorization: Bearer $MANTRILO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operation":"positions","datetime":"2026-11-10T12:00:00+05:30"}'{
"data": {
"engineVersion": "mantrilo-astro-1",
"datetimeUtc": "2026-11-10T06:30:00.000Z",
"referenceFrame": "geocentric_true_ecliptic_of_date",
"ayanamsa": {
"model": "lahiri_linear_approximation",
"degrees": 24.232277,
"approximate": true
},
"operation": "positions",
"planets": [
{
"body": "Moon",
"tropicalLongitudeDegrees": 238.933105,
"siderealLongitudeDegrees": 214.700828,
"latitudeDegrees": -4.987681,
"distanceAU": 0.00267702,
"motion": {
"degreesPerDay": 12.232549,
"retrograde": false
},
"rashi": {
"number": 8,
"name": "Vrishchika",
"degreesWithin": 4.700828
},
"nakshatra": {
"number": 17,
"name": "Anuradha",
"pada": 1
}
}
]
},
"calculated": true,
"requestId": "request-id"
}