Stack Overflow Comments API

Operations for retrieving and writing comments on Stack Overflow posts.

Operations 1

GET /comments Get All Comments #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/stack-overflow-comments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

stack-overflow-comments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Stack Overflow Comments API
  description: The Stack Overflow API v2.3 provides programmatic read and write access to Stack Overflow questions, answers, comments, users, tags, and badges. Authentication is via OAuth 2.0. Register an application at http://stackapps.com/apps/oauth to obtain OAuth credentials. All responses are JSON-encoded and support GZIP compression with field-level filtering.
  version: '2.3'
  contact:
    name: Stack Overflow API Support
    url: http://stackapps.com/
  termsOfService: https://stackexchange.com/legal/api-terms-of-use
servers:
- url: https://api.stackexchange.com/2.3
  description: Stack Exchange API v2.3
security:
- oauth2: []
- {}
tags:
- name: Comments
  description: Operations for retrieving and writing comments on Stack Overflow posts.
paths:
  /comments:
    get:
      operationId: getComments
      summary: Get All Comments
      description: Returns comments on Stack Overflow posts sorted by creation date or vote score.
      tags:
      - Comments
      parameters:
      - $ref: '#/components/parameters/site'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/pagesize'
      - $ref: '#/components/parameters/fromdate'
      - $ref: '#/components/parameters/todate'
      - $ref: '#/components/parameters/order'
      - $ref: '#/components/parameters/sort'
      - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: A list of comments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommentsResponse'
components:
  schemas:
    Comment:
      type: object
      properties:
        comment_id:
          type: integer
        post_id:
          type: integer
        body:
          type: string
        score:
          type: integer
        creation_date:
          type: integer
        owner:
          $ref: '#/components/schemas/ShallowUser'
        link:
          type: string
          format: uri
    ShallowUser:
      type: object
      properties:
        user_id:
          type: integer
        display_name:
          type: string
        reputation:
          type: integer
        user_type:
          type: string
          enum:
          - unregistered
          - registered
          - moderator
        profile_image:
          type: string
          format: uri
        link:
          type: string
          format: uri
    Wrapper:
      type: object
      properties:
        items:
          type: array
          items:
            type: object
        has_more:
          type: boolean
        quota_max:
          type: integer
        quota_remaining:
          type: integer
        backoff:
          type: integer
        total:
          type: integer
    CommentsResponse:
      allOf:
      - $ref: '#/components/schemas/Wrapper'
      - type: object
        properties:
          items:
            type: array
            items:
              $ref: '#/components/schemas/Comment'
  parameters:
    filter:
      name: filter
      in: query
      schema:
        type: string
      description: Filter to control which fields are returned
    order:
      name: order
      in: query
      schema:
        type: string
        enum:
        - asc
        - desc
        default: desc
      description: Sort order
    pagesize:
      name: pagesize
      in: query
      schema:
        type: integer
        minimum: 0
        maximum: 100
        default: 30
      description: Number of results per page (max 100)
    fromdate:
      name: fromdate
      in: query
      schema:
        type: integer
      description: Unix timestamp for minimum creation date
    page:
      name: page
      in: query
      schema:
        type: integer
        minimum: 1
        default: 1
      description: Page number (1-indexed)
    todate:
      name: todate
      in: query
      schema:
        type: integer
      description: Unix timestamp for maximum creation date
    site:
      name: site
      in: query
      required: true
      schema:
        type: string
        default: stackoverflow
      description: Stack Exchange site identifier (use stackoverflow for Stack Overflow)
    sort:
      name: sort
      in: query
      schema:
        type: string
      description: Field to sort results by
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0 authentication. Register an application at http://stackapps.com/apps/oauth to obtain credentials.
      flows:
        authorizationCode:
          authorizationUrl: https://stackoverflow.com/oauth
          tokenUrl: https://stackoverflow.com/oauth/access_token/json
          scopes:
            no_expiry: Issues an access token that does not expire
            write_access: Allows write access to a user's data
            private_info: Access a user's private information
externalDocs:
  description: Stack Exchange API Documentation
  url: https://api.stackexchange.com/docs