openapi: 3.0.0
info:
  title: Steam News API
  description: |
    The Steam News API returns the news posts a Steam app's developer publishes on its store news page, such as patch notes, updates, events and announcements.

    Posts come in the order of the store news page, which starts with the most recent ones. Each has its type, publish date, language, text, votes and comment count. Some also have an edit date, a header image and a build ID.

    To get older posts, pass `pagination.next_page` as `page` with the same `num`. It is set after every full page, so when the last page is full, the next one returns an error instead of posts.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Steam News Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Engine to use for the search
          schema:
            type: string
            enum: ["steam_news"]
            default: "steam_news"
        - name: app_id
          in: query
          required: true
          description: Steam app ID from 1 to 4294967295, the number in the app's store page URL such as 570
          schema:
            type: string
            pattern: '^[1-9]\d{0,9}$'
        - name: hl
          in: query
          required: false
          description: Language of the news posts. A post with no translation in that language comes back in another one, shown by its language.
          schema:
            type: string
            enum: ["ar", "bg", "zh-cn", "zh-tw", "cs", "da", "nl", "en", "fi", "fr", "de", "el", "hu", "id", "it", "ja", "ko", "ms", "no", "pl", "pt", "pt-br", "ro", "ru", "es", "es-419", "sv", "th", "tr", "uk", "vi"]
            default: "en"
        - name: num
          in: query
          required: false
          description: Number of news posts per page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: page
          in: query
          required: false
          description: Page of news posts, in the order of the store news page, which starts with the most recent posts
          schema:
            type: integer
            minimum: 1
            maximum: 10000
            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: 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
      required: [search_metadata, search_parameters]
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        news_results:
          type: array
          description: The news posts on the current page
          items:
            $ref: '#/components/schemas/NewsResult'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Message explaining why the response has no news posts
    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: Steam news page URL of the app
        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: Engine used for the search
        app_id:
          type: string
          description: Steam app ID searched for
        hl:
          type: string
          description: Language of the news posts requested
        num:
          type: integer
          description: Number of news posts per page requested
        page:
          type: integer
          description: Page of news posts requested
    NewsResult:
      type: object
      required: [position, news_id, type, link]
      properties:
        position:
          type: integer
          description: Position of the post across all pages
        news_id:
          type: string
          description: Steam's ID of the announcement
        event_id:
          type: string
          description: Steam's ID of the event the announcement belongs to
        title:
          type: string
          description: Title of the post
        subtitle:
          type: string
          description: Subtitle Steam shows under the title of the post
        summary:
          type: string
          description: Short summary Steam shows on the card of the post
        type:
          type: string
          description: Type of the post, such as small_update for patch notes, major_update or news
          enum: ["other", "game_event", "party", "meeting", "special_cause", "music_and_arts", "sports", "trip", "chat", "game_release", "broadcast", "small_update", "regular_update", "major_update", "dlc_release", "future_release", "esport_tournament_stream", "dev_stream", "famous_stream", "game_sale", "game_item_sale", "in_game_bonus_xp", "in_game_loot", "in_game_perks", "in_game_challenge", "in_game_contest", "irl_event", "news", "beta_release", "in_game_content_release", "free_trial", "season_release", "season_update", "crosspost", "in_game_event", "creator_home"]
        link:
          type: string
          description: Link to the post on Steam
        iso_date:
          type: string
          format: date-time
          description: Time the post was published, in UTC
        iso_last_updated:
          type: string
          format: date-time
          description: Time the post was last edited, in UTC
        language:
          type: string
          description: Language of the returned version of the post, as an hl code
        text:
          type: string
          description: Text of the post, with paragraphs and list items on their own lines
        thumbnail:
          type: string
          description: Artwork the post sets for its card, which Steam can replace with the app's default art
        header_image:
          type: string
          description: Image Steam shows at the top of the post page
        video_link:
          type: string
          description: Link to the YouTube video Steam plays on the card of the post
        upvotes:
          type: integer
          description: Number of upvotes the post has
        downvotes:
          type: integer
          description: Number of downvotes the post has
        comments:
          type: integer
          description: Number of comments on the post
        build_id:
          type: integer
          description: Steam build ID the post announces
    Pagination:
      type: object
      required: [current_page]
      properties:
        current_page:
          type: integer
          description: Number of the current page
        next_page:
          type: integer
          description: Number of the next page, to pass as page
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
