> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drain.lat/llms.txt
> Use this file to discover all available pages before exploring further.

# Genius

> Search for songs and fetch lyrics from Genius.

# Genius

**Base URL:** `https://drain.lat/api/v1/genius`

<AccordionGroup>
  <Accordion title="GET /search" icon="magnifying-glass">
    Search for songs on Genius by title or artist.

    ```
    GET /api/v1/genius/search
    ```

    <ParamField query="q" type="string" required>
      Song name or artist name to search for. Can also use `query` parameter.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/genius/search?q=bohemian+rhapsody" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/genius/search?q=bohemian+rhapsody", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/genius/search",
          params={"q": "bohemian rhapsody"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="results" type="array">
      <Expandable title="result object">
        <ResponseField name="id" type="number">Song ID.</ResponseField>
        <ResponseField name="title" type="string">Song title.</ResponseField>
        <ResponseField name="artist" type="string">Artist name.</ResponseField>
        <ResponseField name="artistId" type="number">Artist ID.</ResponseField>
        <ResponseField name="artistImage" type="string">Artist image URL.</ResponseField>
        <ResponseField name="albumArt" type="string">Album art URL.</ResponseField>
        <ResponseField name="url" type="string">Link to the song on Genius.</ResponseField>
        <ResponseField name="releaseDate" type="string">Release date.</ResponseField>
        <ResponseField name="pageviews" type="number">Total page views.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Number of results returned.</ResponseField>

    ```json Response theme={null}
    {
      "results": [
        {
          "id": 12345,
          "title": "Bohemian Rhapsody",
          "artist": "Queen",
          "artistId": 123,
          "artistImage": "https://images.genius.com/...",
          "albumArt": "https://images.genius.com/...",
          "url": "https://genius.com/Queen-bohemian-rhapsody-lyrics",
          "releaseDate": "October 31, 1975",
          "pageviews": 5000000
        }
      ],
      "total": 1
    }
    ```
  </Accordion>

  <Accordion title="GET /song" icon="file-lines">
    Get complete song data including full lyrics text.

    ```
    GET /api/v1/genius/song
    ```

    <ParamField query="q" type="string" required>
      Song name or artist name to search for. Can also use `query` parameter.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/genius/song?q=never+gonna+give+you+up" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/genius/song?q=never+gonna+give+you+up", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/genius/song",
          params={"q": "never gonna give you up"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="id" type="number">Song ID.</ResponseField>
    <ResponseField name="title" type="string">Song title.</ResponseField>
    <ResponseField name="artist" type="string">Artist name.</ResponseField>
    <ResponseField name="artistId" type="number">Artist ID.</ResponseField>
    <ResponseField name="artistImage" type="string">Artist image URL.</ResponseField>
    <ResponseField name="albumArt" type="string">Album art URL.</ResponseField>
    <ResponseField name="lyrics" type="string">Full lyrics text.</ResponseField>
    <ResponseField name="url" type="string">Link to the song on Genius.</ResponseField>
    <ResponseField name="releaseDate" type="string">Release date.</ResponseField>
    <ResponseField name="pageviews" type="number">Total page views.</ResponseField>

    ```json Response theme={null}
    {
      "id": 67890,
      "title": "Never Gonna Give You Up",
      "artist": "Rick Astley",
      "artistId": 456,
      "artistImage": "https://images.genius.com/...",
      "albumArt": "https://images.genius.com/...",
      "lyrics": "We're no strangers to love\nYou know the rules and so do I...",
      "url": "https://genius.com/Rick-astley-never-gonna-give-you-up-lyrics",
      "releaseDate": "July 27, 1987",
      "pageviews": 10000000,
      "scrapedAt": "2026-05-31T00:00:00Z"
    }
    ```

    <Note>This endpoint scrapes lyrics from Genius pages and may take 5-10 seconds to respond.</Note>
  </Accordion>
</AccordionGroup>
