openapi: 3.0.0
info:
  title: Bhagavad Gita API
  version: "1.0"
  x-apisguru-categories:
    - open_data
  x-logo:
    backgroundColor: "#FFFFFF"
    url: https://bhagavadgita.io/static/images/radhakrishna.png
  x-origin:
    - format: swagger
      url: http://bhagavadgita.io/apispec_1.json
      version: "2.0"
    - format: openapi
      url: http://bhagavadgita.io/apispec_1.json
      version: "3.0"
  x-providerName: bhagavadgita.io
paths:
  /api/v1/chapters:
    get:
      description: Get a list of all the 18 Chapters of the Bhagavad Gita.<br/>
      parameters:
        - description: Your app's access token.
          in: query
          name: access_token
          required: true
          schema:
            type: string
        - description: Language to query. Leave blank for english.
          in: query
          name: language
          schema:
            enum:
              - hi
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      "chapters": [
                        {
                          "chapter_number": 1, 
                          "name": "u'अर्जुनविषादयोग'", 
                          "name_english": "u'Arjuna Dilemma'", 
                          "name_transliterated": "u'Arjun Viṣhād Yog'", 
                          "name_transliterated_simple": "u'Arjuna Visada Yoga'", 
                          "verses_count": 47
                        }, 
                        {
                          "chapter_number": 2, 
                          "name": "u'सांख्ययोग'", 
                          "name_english": "u'Transcendental Knowledge'", 
                          "name_transliterated": "u'Sānkhya Yog'", 
                          "name_transliterated_simple": "u'Sankhya Yoga'", 
                          "verses_count": 72
                        }
                      ]
                    }
              schema:
                $ref: "#/components/schemas/ChapterSchema"
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Invalid access_token used."
        "402":
          description: Request Failed.
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Get all the 18 Chapters of the Bhagavad Gita.
      tags:
        - chapter
  "/api/v1/chapters/{chapter_number}":
    get:
      description: Get information about a specific chapter from the Bhagavad Gita.<br/>
      parameters:
        - description: Your app's access token.
          in: query
          name: access_token
          required: true
          schema:
            type: string
        - description: Which Chapter Number to filter?
          in: path
          name: chapter_number
          required: true
          schema:
            default: 1
            enum:
              - 1
              - 2
              - 3
            type: integer
        - description: Language to query. Leave blank for english.
          in: query
          name: language
          schema:
            enum:
              - hi
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      "chapter_number": 1, 
                      "name": "u'अर्जुनविषादयोग'", 
                      "name_english": "u'Arjuna Dilemma'", 
                      "name_transliterated": "u'Arjun Viṣhād Yog'", 
                      "name_transliterated_simple": "u'Arjuna Visada Yoga'", 
                      "verses_count": 47
                    }
              schema:
                $ref: "#/components/schemas/ChapterSchema"
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Invalid access_token used."
        "402":
          description: Request Failed.
        "404":
          description: "Not Found: The chapter number you are looking for could not be found."
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Get a specific chapter from the Bhagavad Gita.
      tags:
        - chapter
  "/api/v1/chapters/{chapter_number}/verses":
    get:
      description: Get a list of all Verses from a particular Chapter.<br/>
      parameters:
        - description: Your app's access token.
          in: query
          name: access_token
          required: true
          schema:
            type: string
        - description: Which Chapter Number to filter?
          in: path
          name: chapter_number
          required: true
          schema:
            default: 1
            enum:
              - 1
              - 2
              - 3
            type: integer
        - description: Language to query. Leave blank for english.
          in: query
          name: language
          schema:
            enum:
              - hi
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      "verses": [
                        {
                          "chapter_number": 1,
                          "meaning": "Dhritarashtra said: O Sanjay, after gathering on the holy field of Kurukshetra, and desiring to fight, what did my sons and the sons of Pandu do?",
                          "text": "धृतराष्ट्र उवाच | धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः | मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय |||1||",
                          "transliteration": "dhṛitarāśhtra uvācha dharma-kṣhetre kuru-kṣhetre samavetā yuyutsavaḥ māmakāḥ pāṇḍavāśhchaiva kimakurvata sañjaya",
                          "verse_number": 1,
                          "word_meanings": "dhṛitarāśhtraḥ uvācha—Dhritarashtra said; dharma-kṣhetre—the land of dharma; kuru-kṣhetre—at Kurukshetra; samavetāḥ—having gathered; yuyutsavaḥ—desiring to fight; māmakāḥ—my sons; pāṇḍavāḥ—the sons of Pandu; cha—and; eva—certainly; kim—what; akurvata—did they do; sañjaya—Sanjay"
                        },
                        {
                          "chapter_number": 1,
                          "meaning": "Sanjay said: On observing the Pandava army standing in military formation, King Duryodhan approached his teacher Dronacharya, and said the following words.",
                          "text": "सञ्जय उवाच | दृष्ट्वा तु पाण्डवानीकं व्यूढं दुर्योधनस्तदा | आचार्यमुपसङ्गम्य राजा वचनमब्रवीत् | ||2||",
                          "transliteration": "sañjaya uvācha dṛiṣhṭvā tu pāṇḍavānīkaṁ vyūḍhaṁ duryodhanastadā āchāryamupasaṅgamya rājā vachanamabravīt",
                          "verse_number": 2,
                          "word_meanings": "sanjayaḥ uvācha—Sanjay said; dṛiṣhṭvā—on observing; tu—but; pāṇḍava-anīkam—the Pandava army; vyūḍham—standing in a military formation; duryodhanaḥ—King Duryodhan; tadā—then; āchāryam—teacher; upasaṅgamya—approached; rājā—the king; vachanam—words; abravīt—spoke"
                        }
                      ]
                    }
              schema:
                $ref: "#/components/schemas/VerseSchema"
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Invalid access_token used."
        "402":
          description: Request Failed.
        "404":
          description: "Not Found: The chapter number you are looking for could not be found."
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Get all the Verses from a Chapter.
      tags:
        - verse
  "/api/v1/chapters/{chapter_number}/verses/{verse_number}":
    get:
      description: Get a specific verse from a specific chapter.<br/>
      parameters:
        - description: Your app's access token.
          in: query
          name: access_token
          required: true
          schema:
            type: string
        - description: Which Chapter Number to filter?
          in: path
          name: chapter_number
          required: true
          schema:
            default: 1
            enum:
              - 1
              - 2
              - 3
            type: integer
        - description: Which Verse Number to filter?
          in: path
          name: verse_number
          required: true
          schema:
            default: 1
            enum:
              - 1
              - 2
              - 3
            type: string
        - description: Language to query. Leave blank for english.
          in: query
          name: language
          schema:
            enum:
              - hi
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      "chapter_number": 1,
                      "meaning": "Dhritarashtra said: O Sanjay, after gathering on the holy field of Kurukshetra, and desiring to fight, what did my sons and the sons of Pandu do?",
                      "text": "धृतराष्ट्र उवाच | धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः | मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय |||1||",
                      "transliteration": "dhṛitarāśhtra uvācha dharma-kṣhetre kuru-kṣhetre samavetā yuyutsavaḥ māmakāḥ pāṇḍavāśhchaiva kimakurvata sañjaya",
                      "verse_number": 1,
                      "word_meanings": "dhṛitarāśhtraḥ uvācha—Dhritarashtra said; dharma-kṣhetre—the land of dharma; kuru-kṣhetre—at Kurukshetra; samavetāḥ—having gathered; yuyutsavaḥ—desiring to fight; māmakāḥ—my sons; pāṇḍavāḥ—the sons of Pandu; cha—and; eva—certainly; kim—what; akurvata—did they do; sañjaya—Sanjay"
                    }
              schema:
                $ref: "#/components/schemas/VerseSchema"
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Invalid access_token used."
        "402":
          description: Request Failed.
        "404":
          description: "Not Found: The chapter/verse number you are looking for could not be found."
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Get a particular verse from a chapter.
      tags:
        - verse
  /api/v1/verses:
    get:
      description: Get a list of all Verses.<br/>
      parameters:
        - description: Your app's access token.
          in: query
          name: access_token
          required: true
          schema:
            type: string
        - description: Language to query. Leave blank for english.
          in: query
          name: language
          schema:
            enum:
              - hi
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      "verses": [
                        {
                          "chapter_number": 1,
                          "meaning": "Dhritarashtra said: O Sanjay, after gathering on the holy field of Kurukshetra, and desiring to fight, what did my sons and the sons of Pandu do?",
                          "text": "धृतराष्ट्र उवाच | धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः | मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय |||1||",
                          "transliteration": "dhṛitarāśhtra uvācha dharma-kṣhetre kuru-kṣhetre samavetā yuyutsavaḥ māmakāḥ pāṇḍavāśhchaiva kimakurvata sañjaya",
                          "verse_number": 1,
                          "word_meanings": "dhṛitarāśhtraḥ uvācha—Dhritarashtra said; dharma-kṣhetre—the land of dharma; kuru-kṣhetre—at Kurukshetra; samavetāḥ—having gathered; yuyutsavaḥ—desiring to fight; māmakāḥ—my sons; pāṇḍavāḥ—the sons of Pandu; cha—and; eva—certainly; kim—what; akurvata—did they do; sañjaya—Sanjay"
                        },
                        {
                          "chapter_number": 1,
                          "meaning": "Sanjay said: On observing the Pandava army standing in military formation, King Duryodhan approached his teacher Dronacharya, and said the following words.",
                          "text": "सञ्जय उवाच | दृष्ट्वा तु पाण्डवानीकं व्यूढं दुर्योधनस्तदा | आचार्यमुपसङ्गम्य राजा वचनमब्रवीत् | ||2||",
                          "transliteration": "sañjaya uvācha dṛiṣhṭvā tu pāṇḍavānīkaṁ vyūḍhaṁ duryodhanastadā āchāryamupasaṅgamya rājā vachanamabravīt",
                          "verse_number": 2,
                          "word_meanings": "sanjayaḥ uvācha—Sanjay said; dṛiṣhṭvā—on observing; tu—but; pāṇḍava-anīkam—the Pandava army; vyūḍham—standing in a military formation; duryodhanaḥ—King Duryodhan; tadā—then; āchāryam—teacher; upasaṅgamya—approached; rājā—the king; vachanam—words; abravīt—spoke"
                        }
                      ]
                    }
              schema:
                $ref: "#/components/schemas/VerseSchema"
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Inavlid access_token used."
        "402":
          description: Request Failed.
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Get all the Verses.
      tags:
        - verse
  /auth/oauth/token:
    post:
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              properties:
                client_id:
                  description: Your app's client_id. Get from API dashboard.
                  type: string
                client_secret:
                  description: Your app's client_secret. Get from API dashboard.
                  type: string
                grant_type:
                  default: client_credentials
                  description: Grant Type.
                  type: string
                scope:
                  default: verse chapter
                  description: The resources that you would like to access.
                  type: string
              required:
                - client_id
                - client_secret
                - grant_type
                - scope
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |-
                    {
                      access_token: "cN31b7gClnImuQg8OeMGsUWYGsA0we"
                      token_type: "Bearer"
                      scope: "email"
                    }
          description: "Success: Everything worked as expected."
        "400":
          description: "Bad Request: The request was unacceptable due to wrong parameter(s)."
        "401":
          description: "Unauthorized: Invalid access_token used."
        "402":
          description: Request Failed.
        "500":
          description: "Server Error: Something went wrong on our end."
      summary: Send client credentials and get an access token.
      tags:
        - auth
components:
  schemas:
    ChapterSchema:
      properties:
        chapter_number:
          format: int32
          nullable: true
          type: integer
        chapter_summary:
          nullable: true
          type: string
        name:
          nullable: true
          type: string
        name_meaning:
          nullable: true
          type: string
        name_translation:
          nullable: true
          type: string
        name_transliterated:
          nullable: true
          type: string
        verses_count:
          format: int32
          nullable: true
          type: integer
      type: object
    VerseSchema:
      properties:
        meaning:
          nullable: true
          type: string
        text:
          nullable: true
          type: string
        transliteration:
          nullable: true
          type: string
        verse_number:
          nullable: true
          type: string
        word_meanings:
          nullable: true
          type: string
      type: object
