openapi: 3.0.0
info:
  title: Genius Search API
  description: |
    Search Genius for songs, lyrics, artists, albums, videos, articles or users.

    Each result carries its Genius id and link. Songs carry their primary and featured artists with ids, release date, page views and annotation counts. A lyrics search returns the songs whose lyrics match, with the matching lines.

    Genius returns at most 1,000 results per search and type, up to 20 per page.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Genius Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `genius_search`'
          schema:
            type: string
            enum: ["genius_search"]
        - name: q
          in: query
          required: true
          description: The terms to search for, such as a song title, an artist name or a line of lyrics.
          schema:
            type: string
            maxLength: 500
        - name: type
          in: query
          required: false
          description: 'The kind of result to return. `lyrics` returns songs whose lyrics match, under `lyric_matches`. `all` returns the top results and up to 5 results of each kind.'
          schema:
            type: string
            enum: ["songs", "lyrics", "artists", "albums", "videos", "articles", "users", "all"]
            default: "songs"
        - name: page
          in: query
          required: false
          description: Page of results, up to 20 per page. With `type` `all` only page 1 exists.
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 1
        - name: zero_retention
          in: query
          required: false
          description: Set to true to disable logging and persistent storage for this request. Enterprise plans only.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Validation Error. There is an issue with query parameters, such as missing required parameters or invalid values.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication Error. The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden. Zero data retention is not available to the account, or the account requires `zero_retention=true`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate Limit Exceeded. The number of allowed requests has been exceeded. Consider upgrading your plan or waiting for the limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server Error. Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service Unavailable. Results could not be retrieved for this search. Please try again later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use Bearer authentication. Format: "Bearer YOUR_API_KEY"'
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Pass API key as query parameter
  schemas:
    SearchResponse:
      type: object
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        top_results:
          type: array
          description: Top matches across all sections. Returned with `type` `all`.
          items:
            $ref: '#/components/schemas/TopResult'
        songs:
          type: array
          description: Songs whose title or artist matches the search, in Genius's order.
          items:
            $ref: '#/components/schemas/Song'
        lyric_matches:
          type: array
          description: Songs whose lyrics match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/LyricMatch'
        artists:
          type: array
          description: Artists that match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/Artist'
        albums:
          type: array
          description: Albums that match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/Album'
        videos:
          type: array
          description: Genius videos that match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/Video'
        articles:
          type: array
          description: Genius articles that match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/Article'
        users:
          type: array
          description: Genius users that match the search, in Genius's order.
          items:
            $ref: '#/components/schemas/User'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Why the search returned no results.
    SearchMetadata:
      type: object
      required: [status, created_at]
      properties:
        id:
          type: string
          description: "Unique identifier for the search request"
        status:
          type: string
          description: "Status of the search request"
        created_at:
          type: string
          format: date-time
          description: "Timestamp when the search was created"
        request_time_taken:
          type: number
          description: "Time taken to make the request in seconds"
        parsing_time_taken:
          type: number
          description: "Time taken to parse the results in seconds"
        total_time_taken:
          type: number
          description: "Total time taken for the search in seconds"
        request_url:
          type: string
          description: "Genius search page for this search"
        html_url:
          type: string
          description: "URL to view HTML results"
        json_url:
          type: string
          description: "URL to view JSON results"
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
          description: Search engine used
        q:
          type: string
          description: The terms searched for
        type:
          type: string
          description: The kind of result returned
        page:
          type: integer
          description: Page of results
        zero_retention:
          type: boolean
          description: Whether zero data retention was requested.
    TopResult:
      type: object
      required: [type, position, id, link]
      properties:
        type:
          type: string
          description: Section the result comes from.
          enum: ["song", "lyric", "artist", "album", "video", "article", "user"]
        position:
          type: integer
          description: Position among the top results.
        id:
          type: integer
          description: Genius id of the song, artist, album, video, article or user.
        link:
          type: string
          description: Link to the result's page on Genius.
        thumbnail:
          type: string
          description: Picture of the result.
        title:
          type: string
          description: Title of the result.
        title_with_featured:
          type: string
          description: Title of the result followed by its featured artists.
        full_title:
          type: string
          description: Title of the result followed by all of its artists.
        artist_names:
          type: string
          description: Names of the result's primary and featured artists, as Genius displays them.
        primary_artist_names:
          type: string
          description: Names of the result's primary artists, as Genius credits them on the result.
        primary_artists:
          type: array
          description: Primary artists of the result.
          items:
            $ref: '#/components/schemas/ArtistReference'
        featured_artists:
          type: array
          description: Featured artists of the result.
          items:
            $ref: '#/components/schemas/ArtistReference'
        release_date:
          type: string
          description: Release date as Genius displays it.
        iso_release_date:
          type: string
          description: Release date as `YYYY-MM-DD`, `YYYY-MM` or `YYYY`, as precise as Genius has it.
          pattern: '^\d{4}(-\d{2}(-\d{2})?)?$'
        pageviews:
          type: integer
          description: Number of views of the result's page on Genius.
        annotations:
          type: integer
          description: Number of annotations on the result.
        unreviewed_annotations:
          type: integer
          description: Number of annotations on the result that Genius editors have not reviewed.
        pyongs:
          type: integer
          description: Number of pyongs, Genius's share reaction, the result has.
        is_instrumental:
          type: boolean
          description: Whether Genius marks the result as an instrumental.
        image:
          type: string
          description: Cover art in full size.
        snippet:
          type: string
          description: Lines of the lyrics that match the search, one line per row.
        snippet_highlighted_words:
          type: array
          description: Words of the snippet that Genius highlights as matching the search.
          items:
            type: string
        name:
          type: string
          description: Name of the result.
        iq:
          type: integer
          description: Genius IQ points of the result's account.
        is_verified:
          type: boolean
          description: Whether Genius has verified the result.
        is_meme_verified:
          type: boolean
          description: Whether the result carries Genius's meme-verified badge.
        username:
          type: string
          description: Login name of the result.
        bio:
          type: string
          description: Summary of the result's profile text.
        role:
          type: string
          description: Role of the result on Genius, such as `contributor`, `editor` or `verified_artist`.
        description:
          type: string
          description: Description of the result.
        article_link:
          type: string
          description: Link to the Genius article published with the result.
        author:
          type: string
          description: Names of the result's authors, as Genius displays them.
        length_seconds:
          type: integer
          description: Length of the result in seconds.
        views:
          type: integer
          description: Number of views of the result on Genius.
        iso_date:
          type: string
          format: date-time
          description: When the result was published, in UTC.
        article_type:
          type: string
          description: Kind of article, such as `news`, `feature` or `video`.
        votes:
          type: integer
          description: Number of votes the result has.
        is_sponsored:
          type: boolean
          description: Whether the result is sponsored.
    Song:
      type: object
      required: [position, id, title, title_with_featured, full_title, link, artist_names, primary_artist_names, primary_artists, annotations, unreviewed_annotations]
      properties:
        position:
          type: integer
          description: Position of the song in the results, counted across pages.
        id:
          type: integer
          description: Genius song id.
        title:
          type: string
          description: Title of the song.
        title_with_featured:
          type: string
          description: Title of the song followed by its featured artists.
        full_title:
          type: string
          description: Title of the song followed by all of its artists.
        link:
          type: string
          description: Link to the song's lyrics page on Genius.
        artist_names:
          type: string
          description: Names of the song's primary and featured artists, as Genius displays them.
        primary_artist_names:
          type: string
          description: Names of the song's primary artists, as Genius credits them on the song.
        primary_artists:
          type: array
          description: Primary artists of the song.
          items:
            $ref: '#/components/schemas/ArtistReference'
        featured_artists:
          type: array
          description: Featured artists of the song.
          items:
            $ref: '#/components/schemas/ArtistReference'
        release_date:
          type: string
          description: Release date as Genius displays it.
        iso_release_date:
          type: string
          description: Release date as `YYYY-MM-DD`, `YYYY-MM` or `YYYY`, as precise as Genius has it.
          pattern: '^\d{4}(-\d{2}(-\d{2})?)?$'
        pageviews:
          type: integer
          description: Number of views of the song's page on Genius.
        annotations:
          type: integer
          description: Number of annotations on the song.
        unreviewed_annotations:
          type: integer
          description: Number of annotations on the song that Genius editors have not reviewed.
        pyongs:
          type: integer
          description: Number of pyongs, Genius's share reaction, the song has.
        is_instrumental:
          type: boolean
          description: Whether Genius marks the song as an instrumental.
        thumbnail:
          type: string
          description: Song cover art, 300 pixels wide.
        image:
          type: string
          description: Song cover art in full size.
    LyricMatch:
      type: object
      required: [position, id, title, title_with_featured, full_title, link, artist_names, primary_artist_names, primary_artists, annotations, unreviewed_annotations, snippet]
      properties:
        position:
          type: integer
          description: Position of the song in the results, counted across pages.
        id:
          type: integer
          description: Genius song id.
        title:
          type: string
          description: Title of the song.
        title_with_featured:
          type: string
          description: Title of the song followed by its featured artists.
        full_title:
          type: string
          description: Title of the song followed by all of its artists.
        link:
          type: string
          description: Link to the song's lyrics page on Genius.
        artist_names:
          type: string
          description: Names of the song's primary and featured artists, as Genius displays them.
        primary_artist_names:
          type: string
          description: Names of the song's primary artists, as Genius credits them on the song.
        primary_artists:
          type: array
          description: Primary artists of the song.
          items:
            $ref: '#/components/schemas/ArtistReference'
        featured_artists:
          type: array
          description: Featured artists of the song.
          items:
            $ref: '#/components/schemas/ArtistReference'
        release_date:
          type: string
          description: Release date as Genius displays it.
        iso_release_date:
          type: string
          description: Release date as `YYYY-MM-DD`, `YYYY-MM` or `YYYY`, as precise as Genius has it.
          pattern: '^\d{4}(-\d{2}(-\d{2})?)?$'
        pageviews:
          type: integer
          description: Number of views of the song's page on Genius.
        annotations:
          type: integer
          description: Number of annotations on the song.
        unreviewed_annotations:
          type: integer
          description: Number of annotations on the song that Genius editors have not reviewed.
        pyongs:
          type: integer
          description: Number of pyongs, Genius's share reaction, the song has.
        thumbnail:
          type: string
          description: Song cover art, 300 pixels wide.
        image:
          type: string
          description: Song cover art in full size.
        snippet:
          type: string
          description: Lines of the lyrics that match the search, one line per row.
        snippet_highlighted_words:
          type: array
          description: Words of the snippet that Genius highlights as matching the search.
          items:
            type: string
    Artist:
      type: object
      required: [position, id, name, link]
      properties:
        position:
          type: integer
          description: Position of the artist in the results, counted across pages.
        id:
          type: integer
          description: Genius artist id.
        name:
          type: string
          description: Name of the artist.
        link:
          type: string
          description: Link to the artist's page on Genius.
        thumbnail:
          type: string
          description: Picture of the artist.
        iq:
          type: integer
          description: Genius IQ points of the artist's account.
        is_verified:
          type: boolean
          description: Whether Genius has verified the artist.
        is_meme_verified:
          type: boolean
          description: Whether the artist carries Genius's meme-verified badge.
    Album:
      type: object
      required: [position, id, title, full_title, link, artist_names, primary_artists]
      properties:
        position:
          type: integer
          description: Position of the album in the results, counted across pages.
        id:
          type: integer
          description: Genius album id.
        title:
          type: string
          description: Title of the album.
        full_title:
          type: string
          description: Title of the album followed by its artists.
        link:
          type: string
          description: Link to the album's page on Genius.
        artist_names:
          type: string
          description: Names of the album's primary artists, as Genius displays them.
        primary_artists:
          type: array
          description: Primary artists of the album.
          items:
            $ref: '#/components/schemas/ArtistReference'
        release_date:
          type: string
          description: Release date as Genius displays it.
        iso_release_date:
          type: string
          description: Release date as `YYYY-MM-DD`, `YYYY-MM` or `YYYY`, as precise as Genius has it.
          pattern: '^\d{4}(-\d{2}(-\d{2})?)?$'
        thumbnail:
          type: string
          description: Album cover art, 300 pixels wide.
        image:
          type: string
          description: Album cover art in full size.
    Video:
      type: object
      required: [position, id, title, link, iso_date]
      properties:
        position:
          type: integer
          description: Position of the video in the results, counted across pages.
        id:
          type: integer
          description: Genius video id.
        title:
          type: string
          description: Title of the video.
        description:
          type: string
          description: Description of the video.
        link:
          type: string
          description: Link to the video's page on Genius.
        article_link:
          type: string
          description: Link to the Genius article published with the video.
        author:
          type: string
          description: Names of the video's authors, as Genius displays them.
        length_seconds:
          type: integer
          description: Length of the video in seconds.
        views:
          type: integer
          description: Number of views of the video on Genius.
        iso_date:
          type: string
          format: date-time
          description: When the video was published, in UTC.
        is_sponsored:
          type: boolean
          description: Whether the video is sponsored.
        thumbnail:
          type: string
          description: Poster image of the video.
    Article:
      type: object
      required: [position, id, title, link, article_type, iso_date]
      properties:
        position:
          type: integer
          description: Position of the article in the results, counted across pages.
        id:
          type: integer
          description: Genius article id.
        title:
          type: string
          description: Title of the article.
        description:
          type: string
          description: Summary line of the article.
        link:
          type: string
          description: Link to the article on Genius.
        article_type:
          type: string
          description: Kind of article, such as `news`, `feature` or `video`.
        author:
          type: string
          description: Names of the article's authors, as Genius displays them.
        votes:
          type: integer
          description: Number of votes the article has.
        iso_date:
          type: string
          format: date-time
          description: When the article was published, in UTC.
        is_sponsored:
          type: boolean
          description: Whether the article is sponsored.
        thumbnail:
          type: string
          description: Preview image of the article.
    User:
      type: object
      required: [position, id, username, link]
      properties:
        position:
          type: integer
          description: Position of the user in the results, counted across pages.
        id:
          type: integer
          description: Genius user id.
        username:
          type: string
          description: Login name of the user.
        name:
          type: string
          description: Display name of the user.
        link:
          type: string
          description: Link to the user's profile on Genius.
        bio:
          type: string
          description: Summary of the user's profile text.
        role:
          type: string
          description: Role of the user on Genius, such as `contributor`, `editor` or `verified_artist`.
        iq:
          type: integer
          description: Genius IQ points of the user.
        is_verified:
          type: boolean
          description: Whether Genius has verified the user.
        is_meme_verified:
          type: boolean
          description: Whether the user carries Genius's meme-verified badge.
        thumbnail:
          type: string
          description: Avatar of the user.
    ArtistReference:
      type: object
      required: [id, name, link]
      properties:
        id:
          type: integer
          description: Genius artist id.
        name:
          type: string
          description: Name of the artist.
        link:
          type: string
          description: Link to the artist's page on Genius.
        thumbnail:
          type: string
          description: Picture of the artist.
        iq:
          type: integer
          description: Genius IQ points of the artist's account.
        is_verified:
          type: boolean
          description: Whether Genius has verified the artist.
        is_meme_verified:
          type: boolean
          description: Whether the artist carries Genius's meme-verified badge.
    Pagination:
      type: object
      required: [current]
      properties:
        current:
          type: integer
          description: The current page.
        next_page:
          type: integer
          description: Value to pass as `page` for the next page. That page can come back without results when the current page was the last one.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
