US Department of Commerce Blogs API

Blog posts published on Commerce.gov

OpenAPI Specification

us-department-of-commerce-blogs-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Commerce.gov Blogs API
  description: The Commerce.gov API provides programmatic access to news and blog content published on the Commerce.gov website. Version 2.0 introduced a complete rewrite to reflect the redesign of the Commerce.gov D8 website, supporting news, blogs, and image endpoints. Response fields are preserved for backward compatibility.
  version: '2.0'
  contact:
    url: https://www.commerce.gov/data-and-reports/developer-resources/commercegov-api
  license:
    name: US Government Work
    url: https://www.usa.gov/government-works
servers:
- url: https://www.commerce.gov
  description: Commerce.gov Production Server
tags:
- name: Blogs
  description: Blog posts published on Commerce.gov
paths:
  /api/blog:
    get:
      operationId: listBlogs
      summary: List Blog Posts
      description: Returns a paginated list of blog posts published on Commerce.gov.
      tags:
      - Blogs
      parameters:
      - name: page
        in: query
        description: Page number for pagination
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
      - name: items_per_page
        in: query
        description: Number of items to return per page
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 50
          default: 10
      - name: sort_by
        in: query
        description: Field to sort results by
        required: false
        schema:
          type: string
          enum:
          - created
          - changed
      - name: sort_order
        in: query
        description: Sort direction
        required: false
        schema:
          type: string
          enum:
          - ASC
          - DESC
          default: DESC
      responses:
        '200':
          description: A list of blog posts
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/BlogPost'
                  meta:
                    $ref: '#/components/schemas/PaginationMeta'
        '400':
          description: Bad request
  /api/blog/{id}:
    get:
      operationId: getBlogPost
      summary: Get Blog Post
      description: Returns a single blog post by ID.
      tags:
      - Blogs
      parameters:
      - name: id
        in: path
        description: Unique identifier of the blog post
        required: true
        schema:
          type: string
      responses:
        '200':
          description: A blog post
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlogPost'
        '404':
          description: Blog post not found
components:
  schemas:
    BlogPost:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the blog post
        title:
          type: string
          description: Title of the blog post
        body:
          type: string
          description: Full HTML body content of the blog post
        summary:
          type: string
          description: Short summary of the blog post
        created:
          type: string
          format: date-time
          description: Date and time the blog post was created
        changed:
          type: string
          format: date-time
          description: Date and time the blog post was last modified
        url:
          type: string
          description: Relative URL path to the blog post on Commerce.gov
        author:
          type: string
          description: Author of the blog post
        tags:
          type: array
          items:
            type: string
          description: Topic tags associated with the blog post
    PaginationMeta:
      type: object
      properties:
        total:
          type: integer
          description: Total number of items available
        page:
          type: integer
          description: Current page number
        items_per_page:
          type: integer
          description: Number of items per page