Skip to content
Get API key

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

  1. Get a key. Every account starts with a sandbox key. Open the sandbox quickstart
  2. Keep it on your server. Set MANTRILO_API_KEY and MANTRILO_API_URL in your backend’s environment.
  3. Make a request. List one mantra, then follow the endpoint reference or a guide for your goal.
GET Your first request
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.

Astrology 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

EnvironmentKey prefixWhat it reads
Sandboxmtr_sbx_Sample mantras, the sample books’ opening verses, and available astrology operations. Every account has one.
Livemtr_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.

GET Continue when nextCursor is present
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.

Error401
{
  "error": {
    "code": "invalid_api_key",
    "message": "Send a valid API key."
  },
  "requestId": "request-id"
}
StatusCodeWhat to do
400invalid_limit, invalid_cursor, invalid_deity, invalid_collection, invalid_offsetFix the query parameter named in the message.
400invalid_operation, invalid_input, invalid_datetime, invalid_timezone, …Fix the astrology input named in the message.
401invalid_api_key, revoked_api_keyThe key is missing, wrong, or revoked.
403plan_inactiveLive keys need an active paid plan.
403sandbox_sample_onlyThat item is outside the sandbox sample. Use your live key.
404not_found, audio_unavailableNo such item, or it has no recording.
405method_not_allowedUse the method listed for the endpoint.
429rate_limitedWait for the Retry-After header, then retry.
429quota_exceeded, audio_quota_exceededThe monthly allowance has run out.
429too_many_failed_attemptsToo many bad keys from one address. Retry later.
500internal_errorRetry, and quote the requestId if it continues.
503books_unavailable, astrology_unavailable, astrology_operation_unavailableThe service or operation is temporarily unavailable. Retry later.
504astrology_timeoutThe 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.

PlanRequests a monthAudioRateBurst
Free500Sample audio only2 per second10
Starter50,00010 GB10 per second20
Growth250,00050 GB25 per second50
Business1,000,000200 GB50 per second100

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

Ramayana book and first chapter
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

Mahabharata book and first chapter
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.

Book reader integration guide

Endpoint reference

GET /v1

The API name, version and resource list. Useful as a health check.

No key needed

No parameters.

GET Request
curl "$MANTRILO_API_URL/v1"
Open the sandbox request tester
Response200 OK
{
  "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.

limit query
Integer, 1–100. Default 20.
cursor query
The nextCursor from the previous page.
deity query
A deity id, such as shiva or annapurna. Exact match.
GET Request
curl "$MANTRILO_API_URL/v1/mantras?limit=1" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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.

id path
The mantra id from a list response.

description is the mantra’s short public summary. It is null when a record has none.

GET Request
curl "$MANTRILO_API_URL/v1/mantras/annapurna-aham-vaishvanaro-bhuthva" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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.

id path
The mantra id.
format query
json returns the signed link as JSON instead of redirecting.

Links last 15 minutes. Each link counts its file size toward your audio allowance.

GET Request
curl "$MANTRILO_API_URL/v1/mantras/annapurna-aham-vaishvanaro-bhuthva/audio?format=json" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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.

collection query
A collection id: upanishads, bhagavad-gita, advaita-vedanta-prakarana-granthas, vedanta, yoga.
limit query
Integer, 1–100. Default 24.
cursor query
The nextCursor from the previous page.

Sandbox keys list Isha Upanishad and the Bhagavad Gita. Other collections may return no sandbox titles.

GET Request
curl "$MANTRILO_API_URL/v1/books?collection=upanishads&limit=3" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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.

id path
The book id from a list response.

preview is true for sandbox keys, which see the opening chapter only.

GET Request
curl "$MANTRILO_API_URL/v1/books/ishaUpanishad" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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.

id path
The book id.
chapter path
A chapter number from the book’s chapter index.
offset query
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.

GET Request
curl "$MANTRILO_API_URL/v1/books/ishaUpanishad/chapters/1" \
  -H "Authorization: Bearer $MANTRILO_API_KEY"
Open the sandbox request tester
Response200 OK
{
  "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 needed

No parameters.

GET Request
curl "$MANTRILO_API_URL/v1/astrology"
Open the sandbox request tester
Response200 OK
{
  "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.

operation body
An operation id from GET /v1/astrology.
datetime body
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.

POST Request
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"}'
Try planetary positions in the sandbox
Response200 OK
{
  "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"
}
Want to see what each content type returns first? Browse the Library.