openapi: 3.0.0
info:
  title: JustWatch Search API
  description: |
    Search JustWatch for movies and TV shows and see where each one can be watched in a country.

    Each title carries its JustWatch id and, when available, its IMDb and TMDB ids, ratings, genres, poster and JustWatch page link. Offers cover subscriptions, free streaming, ad-supported streaming, rentals, purchases, free ad-supported TV channels (FAST) and cinema in that country. Offers include the provider, quality, price, currency and a link to the title on the provider's site. `gl` picks the country's catalog and `hl` the language of the text.

    Some titles JustWatch lists have no JustWatch page, so they come without a `link`.

    **Cross-linking**: pass the `provider_short_name` of an offer as `providers` to return only titles that provider offers in the same country.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: JustWatch Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `justwatch_search`'
          schema:
            type: string
            enum: ["justwatch_search"]
        - name: q
          in: query
          required: true
          description: The title or keywords to search for.
          schema:
            type: string
            maxLength: 512
        - name: gl
          in: query
          required: false
          description: Country whose catalog, providers, offers and prices are returned (ISO 3166-1 alpha-2).
          schema:
            type: string
            enum: ["ad", "ae", "ag", "al", "ao", "ar", "at", "au", "az", "ba", "bb", "be", "bf", "bg", "bh", "bm", "bo", "br", "bs", "by", "bz", "ca", "cd", "ch", "ci", "cl", "cm", "co", "cr", "cu", "cv", "cy", "cz", "de", "dk", "do", "dz", "ec", "ee", "eg", "es", "fi", "fj", "fr", "gb", "gf", "gg", "gh", "gi", "gq", "gr", "gt", "gy", "hk", "hn", "hr", "hu", "id", "ie", "il", "in", "iq", "is", "it", "jm", "jo", "jp", "ke", "kr", "kw", "lb", "lc", "li", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me", "mg", "mk", "ml", "mt", "mu", "mw", "mx", "my", "mz", "ne", "ng", "ni", "nl", "no", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "ps", "pt", "py", "qa", "ro", "rs", "ru", "sa", "sc", "se", "sg", "si", "sk", "sm", "sn", "sv", "tc", "td", "th", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "va", "ve", "xk", "ye", "za", "zm", "zw"]
            default: "us"
        - name: hl
          in: query
          required: false
          description: Language of titles, descriptions, genres and prices (ISO 639-1). Defaults to the main language of the `gl` country.
          schema:
            type: string
            enum: ["ar", "az", "be", "bg", "bs", "ca", "cs", "de", "el", "en", "es", "et", "fi", "fr", "he", "hr", "hu", "is", "it", "ja", "ko", "lt", "lv", "mk", "mt", "pl", "pt", "ro", "ru", "sk", "sl", "sq", "sr", "sv", "sw", "tr", "uk", "ur", "zh"]
        - name: title_type
          in: query
          required: false
          description: Kind of title to return.
          schema:
            type: string
            enum: ["movie", "tv"]
        - name: providers
          in: query
          required: false
          description: Comma-separated provider codes, at most 10, to return only titles one of these providers offers. Each country has its own codes, the ones its offers carry in `provider_short_name`.
          schema:
            type: string
        - name: monetization_types
          in: query
          required: false
          description: 'Comma-separated ways of watching to return only titles offered one of these ways: `flatrate` (subscription), `free`, `ads`, `rent`, `buy`, `fast` (free ad-supported TV channels) and `cinema`.'
          schema:
            type: string
        - name: release_year_min
          in: query
          required: false
          description: Earliest release year of the titles returned.
          schema:
            type: integer
            minimum: 1000
            maximum: 9999
        - name: release_year_max
          in: query
          required: false
          description: Latest release year of the titles returned, not lower than `release_year_min`.
          schema:
            type: integer
            minimum: 1000
            maximum: 9999
        - name: page
          in: query
          required: false
          description: >-
            Page of results. The requested `page` times `num` can be at most 10,000, including searches with
            only `title_type` set. With `providers`, `monetization_types`, `release_year_min` or `release_year_max`,
            the limit is 1,999. With `num` 20, the last pages are 500 and 99, respectively.
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: num
          in: query
          required: false
          description: Number of titles per page. A page filtered by `providers` or `monetization_types` can hold fewer, so follow `pagination.next`.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: zero_retention
          in: query
          required: false
          description: Set to true to keep request parameters, HTML, and JSON responses out of storage and logs. 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 unavailable 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. Could not retrieve usable results for this search.
            The search credit is refunded.
          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'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        organic_results:
          type: array
          description: Titles JustWatch lists for the search, in JustWatch's order.
          items:
            $ref: '#/components/schemas/OrganicResult'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Why this query or page 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: "JustWatch search page for the query in this country"
        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 title or keywords searched for
        gl:
          type: string
          description: Country whose catalog was searched
        hl:
          type: string
          description: Language of the text returned
        title_type:
          type: string
          description: Kind of title returned
        providers:
          type: string
          description: Provider codes the titles were limited to
        monetization_types:
          type: string
          description: Ways of watching the titles were limited to
        release_year_min:
          type: integer
          description: Earliest release year of the titles returned
        release_year_max:
          type: integer
          description: Latest release year of the titles returned
        page:
          type: integer
          description: Page of results
        num:
          type: integer
          description: Number of titles per page
        zero_retention:
          type: boolean
          description: Whether zero data retention was requested.
    SearchInformation:
      type: object
      required: [total_results]
      properties:
        total_results:
          type: integer
          minimum: 1
          description: Approximate number of titles JustWatch has for the search.
    OrganicResult:
      type: object
      required: [position, justwatch_id, type]
      properties:
        position:
          type: integer
          description: Position of the title in JustWatch's results, counting from the first page.
        justwatch_id:
          type: string
          description: JustWatch id of the title, the same in every country.
        type:
          type: string
          enum: ["movie", "tv"]
          description: Kind of title.
        title:
          type: string
          description: Title in the language asked for.
        original_title:
          type: string
          description: Title in its original language.
        year:
          type: integer
          description: Year the title was first released.
        release_date:
          type: string
          format: date
          description: Date the title was first released.
        runtime_minutes:
          type: integer
          description: Length of the movie, or of a typical episode, in minutes.
        content_rating:
          type: string
          description: Age rating of the title in the country.
        genres:
          type: array
          description: Genres of the title in the language asked for.
          items:
            type: string
        description:
          type: string
          description: Short synopsis of the title.
        imdb_id:
          type: string
          description: IMDb id of the title.
        tmdb_id:
          type: string
          description: TMDB id of the title.
        imdb_rating:
          type: number
          description: IMDb rating of the title, out of 10.
        imdb_votes:
          type: integer
          description: Number of IMDb ratings of the title.
        tmdb_rating:
          type: number
          description: TMDB rating of the title, out of 10.
        rotten_tomatoes_score:
          type: integer
          description: Rotten Tomatoes Tomatometer score of the title, out of 100.
        is_certified_fresh:
          type: boolean
          description: Whether Rotten Tomatoes rates the title Certified Fresh.
        justwatch_rating:
          type: number
          description: JustWatch's own rating of the title, from 0 to 1.
        total_seasons:
          type: integer
          minimum: 1
          description: Number of seasons of the show.
        link:
          type: string
          description: Link to the title's page on JustWatch.
        thumbnail:
          type: string
          description: Link to the title's poster.
        offers:
          type: array
          description: Viewing offers JustWatch lists for the title in the selected country, including any repeated offers.
          items:
            $ref: '#/components/schemas/Offer'
    Offer:
      type: object
      required: [provider, provider_id, provider_short_name, monetization_type, presentation_type, currency]
      properties:
        provider:
          type: string
          description: Name of the provider.
        provider_id:
          type: integer
          description: JustWatch id of the provider.
        provider_short_name:
          type: string
          description: JustWatch code of the provider, as the `providers` parameter takes it.
        provider_icon:
          type: string
          description: Link to the provider's icon.
        monetization_type:
          type: string
          description: How the provider offers the title, such as `flatrate` (subscription), `free`, `ads`, `rent`, `buy`, `fast` or `cinema`.
        presentation_type:
          type: string
          description: Quality of the offer, such as `sd`, `hd`, `4k`, `dvd`, `bluray`, `bluray_4k` or `canvas`.
        price:
          type: string
          description: Price as JustWatch shows it in the language asked for.
        extracted_price:
          type: number
          description: Numeric price supplied by JustWatch, which can differ slightly from the localized `price` text.
        extracted_previous_price:
          type: number
          description: Price before the provider last changed it, as a number.
        currency:
          type: string
          description: ISO 4217 code of the currency of the offer.
        seasons_count:
          type: integer
          description: Number of seasons the offer covers.
        available_until:
          type: string
          format: date
          description: Date the offer leaves the provider.
        audio_languages:
          type: array
          description: Audio languages of the offer, as language codes such as `en`, `pt-BR` or `es-419`.
          items:
            type: string
        subtitle_languages:
          type: array
          description: Subtitle languages of the offer, as language codes such as `en`, `pt-BR` or `es-419`.
          items:
            type: string
        link:
          type: string
          description: Link to the title on the provider's site.
    Pagination:
      type: object
      required: [current]
      properties:
        current:
          type: integer
          description: Current page number.
        next:
          type: integer
          description: Number of the next page.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
