openapi: 3.0.0
info:
  title: IMDb Search API
  description: |
    Search IMDb titles by name: films, series, episodes, video games, podcasts and music videos.

    Each result carries its IMDb title id and link, with the type, release year, rating, vote count, runtime, certificate, genres, poster and plot that IMDb has for it. `gl` picks the regional title and certificate, and `hl` the language of the plot.

    Pages hold up to 300 titles. Pass `pagination.next_page_token` back as `next_page_token` for the next page.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: IMDb Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `imdb_search`'
          schema:
            type: string
            enum: ["imdb_search"]
        - name: q
          in: query
          required: false
          description: The title to search for, up to 512 bytes. Required unless `next_page_token` is set.
          schema:
            type: string
        - name: title_type
          in: query
          required: false
          description: 'Kinds of title to return, comma-separated for several (e.g. `movie,tv`). `tv` covers TV titles such as series, mini-series and TV movies. Leave it out for no filter.'
          schema:
            type: string
            pattern: '^ *(movie|tv|tv_episode|podcast_series|podcast_episode|video_game|music_video) *(, *(movie|tv|tv_episode|podcast_series|podcast_episode|video_game|music_video) *)*$'
        - name: is_exact_match
          in: query
          required: false
          description: Set to `true` to match `q` as whole words instead of word beginnings.
          schema:
            type: string
            enum: ["true", "false"]
            default: "false"
        - name: gl
          in: query
          required: false
          description: Country (ISO 3166-1 alpha-2, lowercase) that picks the regional title and certificate IMDb returns.
          schema:
            type: string
            enum: ["af", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "il", "it", "jm", "jp", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "sh", "kn", "lc", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sk", "si", "sb", "so", "za", "gs", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw", "gg", "je", "im", "me"]
            default: "us"
        - name: hl
          in: query
          required: false
          description: Language of the plot. `es` is Spanish as used in Mexico, `es-es` Spanish as used in Spain.
          schema:
            type: string
            enum: ["en", "de", "es", "es-es", "fr", "fr-ca", "hi", "it", "pt"]
            default: "en"
        - name: num
          in: query
          required: false
          description: Number of titles per page.
          schema:
            type: integer
            minimum: 1
            maximum: 300
            default: 25
        - name: next_page_token
          in: query
          required: false
          description: The `pagination.next_page_token` of a previous response. It carries the search's `q`, `title_type` and `is_exact_match`, so send it alone or with the same values. Send `gl` and `hl` again with it to keep the same market. A later page can repeat a title from an earlier one.
          schema:
            type: string
            maxLength: 2048
        - 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: Timeout. We could not retrieve results in 90 seconds.
          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'
        organic_results:
          type: array
          description: Titles IMDb lists for the search, in IMDb's order.
          items:
            $ref: '#/components/schemas/OrganicResult'
        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: "IMDb find page for this search"
        html_url:
          type: string
          description: "URL to view the raw 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 title searched for
        title_type:
          type: string
          description: Kinds of title asked for
        is_exact_match:
          type: boolean
          description: Whether only exact title matches were asked for
        gl:
          type: string
          description: Country whose regional titles were asked for
        hl:
          type: string
          description: Language asked for the plot
        num:
          type: integer
          description: Number of titles per page
        next_page_token:
          type: string
          description: Token of the page asked for
        zero_retention:
          type: boolean
          description: Whether zero data retention was requested
    OrganicResult:
      type: object
      required: [position, title_id, title, type, link]
      properties:
        position:
          type: integer
          description: Position of the title on this page, counting from 1.
        title_id:
          type: string
          description: IMDb title id, such as `tt1375666`.
        title:
          type: string
          description: Title as IMDb shows it for the chosen country and language.
        original_title:
          type: string
          description: Title in its original release.
        type:
          type: string
          description: IMDb title type, such as `movie`, `tvSeries`, `tvMiniSeries`, `tvEpisode`, `short`, `video`, `videoGame`, `podcastEpisode` or `musicVideo`.
        year:
          type: integer
          description: Year of release, or the first year of a series.
        end_year:
          type: integer
          description: Last year of a series that has ended.
        link:
          type: string
          description: Link to the title's page on IMDb.
        thumbnail:
          type: string
          description: Link to the title's poster image.
        rating:
          type: number
          description: IMDb user rating from 1 to 10.
        votes:
          type: integer
          description: Number of IMDb user ratings.
        runtime_seconds:
          type: integer
          description: Running time in seconds.
        content_rating:
          type: string
          description: Age certificate in the country set by `gl`, such as `PG-13`.
        genres:
          type: array
          description: Genres IMDb lists for the title.
          items:
            type: string
        description:
          type: string
          description: Short plot summary in the language set by `hl`.
    Pagination:
      type: object
      required: [next_page_token]
      properties:
        next_page_token:
          type: string
          description: Value to pass as `next_page_token` for the next page.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
