openapi: 3.0.0
info:
  title: Yahoo Videos API
  description: >-
    Search Yahoo Videos with duration, upload time, resolution, and source site filters, SafeSearch, and 20 regional
    Yahoo markets. Each video includes its title, watch page link, source site, and thumbnail, plus its embeddable
    player link, description, length, and view count when available, with up to 60 videos per page and related
    searches. Pass a related search query back as q to follow it.
  version: 1.0.0
servers:
- url: https://www.searchapi.io/api/v1
paths:
  "/search":
    get:
      summary: Yahoo Videos Search
      security:
      - ApiKeyAuth: []
      - ApiKeyQuery: []
      parameters:
      - name: engine
        in: query
        required: true
        description: Set to yahoo_videos.
        schema:
          type: string
          enum: ["yahoo_videos"]
      - name: q
        in: query
        required: true
        description: Search terms used to find videos.
        schema:
          type: string
      - name: yahoo_domain
        in: query
        required: false
        description: Yahoo domain of the market to search. Each market has its own video results.
        schema:
          type: string
          enum: ["search.yahoo.com","espanol.search.yahoo.com","fr.search.yahoo.com","br.search.yahoo.com","ca.search.yahoo.com","de.search.yahoo.com","es.search.yahoo.com","in.search.yahoo.com","id.search.yahoo.com","it.search.yahoo.com","malaysia.search.yahoo.com","at.search.yahoo.com","ph.search.yahoo.com","qc.search.yahoo.com","ch.search.yahoo.com","sg.search.yahoo.com","uk.search.yahoo.com","vn.search.yahoo.com","hk.search.yahoo.com","tw.search.yahoo.com"]
          default: "search.yahoo.com"
      - name: safe
        in: query
        required: false
        description: SafeSearch filtering of adult content.
        schema:
          type: string
          enum: ["on","off"]
          default: "on"
      - name: duration
        in: query
        required: false
        description: Filter by video length. Short is under 5 minutes, medium is 5 to 20 minutes, and long is over 20 minutes.
        schema:
          type: string
          enum: ["short","medium","long"]
      - name: time_period
        in: query
        required: false
        description: Filter by how recently the video was published.
        schema:
          type: string
          enum: ["last_day","last_week","last_month","last_year"]
      - name: quality
        in: query
        required: false
        description: Filter by minimum video resolution.
        schema:
          type: string
          enum: ["360p_or_higher","480p_or_higher","720p_or_higher","1080p_or_higher"]
      - name: source
        in: query
        required: false
        description: Return only videos from this site.
        schema:
          type: string
          enum: ["youtube","dailymotion","vimeo","cbs","fox","cnn","msn"]
      - name: page
        in: query
        required: false
        description: Page of results to return, starting at 1. Yahoo Videos shows at most 4 pages, and a page past the last one returns an error.
        schema:
          type: integer
          minimum: 1
          maximum: 4
          default: 1
      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"
        '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"
        search_information:
          "$ref": "#/components/schemas/SearchInformation"
        videos:
          type: array
          items:
            "$ref": "#/components/schemas/Video"
        shopping_ads:
          type: array
          description: Advertised products shown alongside the videos, without repeated placements of the same product.
          items:
            "$ref": "#/components/schemas/ShoppingAd"
        related_searches:
          type: array
          items:
            "$ref": "#/components/schemas/RelatedSearch"
        pagination:
          "$ref": "#/components/schemas/Pagination"
        error:
          type: string
          description: Message describing an empty result set or a page past the last one.
    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: Yahoo Videos URL 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
          enum: ["yahoo_videos"]
          description: Set to yahoo_videos.
        q:
          type: string
          description: Search terms used to find videos.
        yahoo_domain:
          type: string
          enum: ["search.yahoo.com","espanol.search.yahoo.com","fr.search.yahoo.com","br.search.yahoo.com","ca.search.yahoo.com","de.search.yahoo.com","es.search.yahoo.com","in.search.yahoo.com","id.search.yahoo.com","it.search.yahoo.com","malaysia.search.yahoo.com","at.search.yahoo.com","ph.search.yahoo.com","qc.search.yahoo.com","ch.search.yahoo.com","sg.search.yahoo.com","uk.search.yahoo.com","vn.search.yahoo.com","hk.search.yahoo.com","tw.search.yahoo.com"]
          default: "search.yahoo.com"
          description: Yahoo domain of the market searched.
        safe:
          type: string
          enum: ["on","off"]
          default: "on"
          description: SafeSearch filtering of adult content.
        duration:
          type: string
          enum: ["short","medium","long"]
          description: Filter by video length.
        time_period:
          type: string
          enum: ["last_day","last_week","last_month","last_year"]
          description: Filter by how recently the video was published.
        quality:
          type: string
          enum: ["360p_or_higher","480p_or_higher","720p_or_higher","1080p_or_higher"]
          description: Filter by minimum video resolution.
        source:
          type: string
          enum: ["youtube","dailymotion","vimeo","cbs","fox","cnn","msn"]
          description: Site the videos come from.
        page:
          type: integer
          minimum: 1
          maximum: 4
          description: Page of results returned, starting at 1.
    SearchInformation:
      type: object
      required:
      - query_displayed
      properties:
        query_displayed:
          type: string
          description: Query displayed in the search box.
    ShoppingAd:
      type: object
      required:
      - position
      - title
      - seller
      - link
      - price
      - extracted_price
      - image
      properties:
        position:
          type: integer
          description: Position in the shopping ads list.
        title:
          type: string
          description: Product title.
        seller:
          type: string
          description: Name of the store selling the product.
        link:
          type: string
          description: Link to the product on the store's website.
        price:
          type: string
          description: Price as displayed.
        extracted_price:
          type: number
          description: Price as a number.
        image:
          type: string
          description: Product image URL.
    Video:
      type: object
      required:
      - position
      - title
      - link
      - source
      - thumbnail
      properties:
        position:
          type: integer
          description: Position of the video on the results page.
        title:
          type: string
          description: Title of the video.
        link:
          type: string
          description: URL of the page where the video plays.
        video_link:
          type: string
          description: URL of the embeddable video player.
        snippet:
          type: string
          description: Description of the video.
        source:
          type: string
          description: Name of the site that hosts the video.
        length:
          type: string
          description: Video length as Yahoo displays it in minutes and seconds, with the hours omitted.
        views:
          type: integer
          description: Number of views the video has.
        thumbnail:
          type: string
          description: Thumbnail URL for the video.
    RelatedSearch:
      type: object
      required:
      - query
      - link
      - thumbnail
      properties:
        query:
          type: string
          description: Search terms for the related search.
        link:
          type: string
          description: Yahoo Videos link for the related search.
        thumbnail:
          type: string
          description: Thumbnail URL for the related search.
    Pagination:
      type: object
      required:
      - current
      properties:
        current:
          type: integer
          description: Current page number, starting at 1.
        next:
          type: string
          description: Yahoo Videos URL for the next results page.
    ErrorResponse:
      type: object
      required:
      - error
      properties:
        error:
          type: string
          description: Error message describing what went wrong
