Stack Exchange Tags API

Operations for retrieving and managing tags used to categorize questions.

OpenAPI Specification

stack-exchange-tags-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Stack Exchange Answers Tags API
  description: The Stack Exchange API v2.3 provides programmatic access to the Stack Exchange network of Q&A sites, including Stack Overflow, Server Fault, Super User, and hundreds of other communities. The API supports reading and writing questions, answers, comments, tags, users, and other content. Authentication is via OAuth 2.0 with access tokens. All responses are JSON-encoded and support GZIP compression.
  version: '2.3'
  contact:
    name: Stack Exchange API Support
    url: http://stackapps.com/
    email: team+api@stackexchange.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: Tags
  description: Operations for retrieving and managing tags used to categorize questions.
paths:
  /tags:
    get:
      operationId: getTags
      summary: Get All Tags
      description: Returns the tags on a Stack Exchange site. Tags are used to categorize questions and help users find relevant content.
      tags:
      - Tags
      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'
      - name: inname
        in: query
        schema:
          type: string
        description: Filter tags whose name contains this string
      - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: A list of tags
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagsResponse'
  /tags/{tags}/info:
    get:
      operationId: getTagInfo
      summary: Get Tag Info
      description: Returns detailed information about the tags specified in the tags parameter. Tags are semicolon-delimited.
      tags:
      - Tags
      parameters:
      - name: tags
        in: path
        required: true
        schema:
          type: string
        description: Semicolon-delimited list of tag names
        example: javascript;python
      - $ref: '#/components/parameters/site'
      - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: Tag information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagsResponse'
  /tags/{tags}/related:
    get:
      operationId: getRelatedTags
      summary: Get Related Tags
      description: Returns the tags that are most related to the provided semicolon- delimited list of tags.
      tags:
      - Tags
      parameters:
      - name: tags
        in: path
        required: true
        schema:
          type: string
        description: Semicolon-delimited list of tag names
      - $ref: '#/components/parameters/site'
      - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: Tags related to the provided tags
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagsResponse'
components:
  parameters:
    order:
      name: order
      in: query
      schema:
        type: string
        enum:
        - asc
        - desc
        default: desc
      description: Sort order for results
    site:
      name: site
      in: query
      required: true
      schema:
        type: string
        default: stackoverflow
      description: The Stack Exchange site to query. Use the API name of the site, e.g., stackoverflow, serverfault, superuser.
      example: stackoverflow
    todate:
      name: todate
      in: query
      schema:
        type: integer
      description: Unix timestamp for the maximum creation date
    fromdate:
      name: fromdate
      in: query
      schema:
        type: integer
      description: Unix timestamp for the minimum creation date
    filter:
      name: filter
      in: query
      schema:
        type: string
      description: A filter to control which fields are returned in the response. Use the /filter endpoint to create custom filters.
    page:
      name: page
      in: query
      schema:
        type: integer
        minimum: 1
        default: 1
      description: The page number to return (1-indexed)
    pagesize:
      name: pagesize
      in: query
      schema:
        type: integer
        minimum: 0
        maximum: 100
        default: 30
      description: Number of results to return per page (max 100)
    sort:
      name: sort
      in: query
      schema:
        type: string
      description: The field to sort results by (varies by endpoint)
  schemas:
    Tag:
      type: object
      description: A tag used to categorize questions on a Stack Exchange site
      properties:
        name:
          type: string
          description: The tag name
        count:
          type: integer
          description: Number of questions tagged with this tag
        is_moderator_only:
          type: boolean
          description: Whether only moderators can apply this tag
        is_required:
          type: boolean
          description: Whether this tag is required on questions
        has_synonyms:
          type: boolean
          description: Whether this tag has synonyms
        last_activity_date:
          type: integer
          description: Unix timestamp of last activity on this tag
    TagsResponse:
      allOf:
      - $ref: '#/components/schemas/Wrapper'
      - type: object
        properties:
          items:
            type: array
            items:
              $ref: '#/components/schemas/Tag'
    Wrapper:
      type: object
      description: Standard Stack Exchange API response wrapper containing items, pagination info, and backoff/quota information.
      properties:
        items:
          type: array
          description: The list of items returned
          items:
            type: object
        has_more:
          type: boolean
          description: Whether there are more results available
        quota_max:
          type: integer
          description: Maximum number of requests allowed per day
        quota_remaining:
          type: integer
          description: Number of requests remaining for today
        backoff:
          type: integer
          description: Number of seconds to wait before making additional requests if the API has asked for backoff
        total:
          type: integer
          description: Total number of items available
        page:
          type: integer
          description: Current page number
        page_size:
          type: integer
          description: Number of items per page
        type:
          type: string
          description: The type of items in the response
        error_id:
          type: integer
          description: Error identifier if an error occurred
        error_message:
          type: string
          description: Human-readable error description
        error_name:
          type: string
          description: Machine-readable error name
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0 authentication for Stack Exchange API. Register an application at http://stackapps.com/apps/oauth to obtain client 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