Fake Store API Products API

Product catalog operations.

OpenAPI Specification

fake-store-api-products-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Fake Store Auth Products API
  description: Fake Store API exposes a sample REST API for e-commerce data including products, carts, users, and authentication. It is intended for prototyping, teaching, and integration testing — write operations return fabricated responses and do not persist data on the server.
  version: 1.0.0
  contact:
    name: Fake Store API
    url: https://fakestoreapi.com/
  license:
    name: MIT
servers:
- url: https://fakestoreapi.com
  description: Production
tags:
- name: Products
  description: Product catalog operations.
paths:
  /products:
    get:
      tags:
      - Products
      summary: List products
      operationId: listProducts
      parameters:
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Sort'
      responses:
        '200':
          description: Array of products
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Product'
    post:
      tags:
      - Products
      summary: Create a product
      operationId: createProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductInput'
      responses:
        '200':
          description: Created product (fabricated)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
  /products/{id}:
    parameters:
    - $ref: '#/components/parameters/ProductId'
    get:
      tags:
      - Products
      summary: Get a product
      operationId: getProduct
      responses:
        '200':
          description: Product
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
    put:
      tags:
      - Products
      summary: Replace a product
      operationId: replaceProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductInput'
      responses:
        '200':
          description: Updated product (fabricated)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
    patch:
      tags:
      - Products
      summary: Partially update a product
      operationId: updateProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductInput'
      responses:
        '200':
          description: Updated product (fabricated)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
    delete:
      tags:
      - Products
      summary: Delete a product
      operationId: deleteProduct
      responses:
        '200':
          description: Deleted product (fabricated)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
  /products/categories:
    get:
      tags:
      - Products
      summary: List product categories
      operationId: listCategories
      responses:
        '200':
          description: Array of category names
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /products/category/{category}:
    parameters:
    - in: path
      name: category
      required: true
      schema:
        type: string
      description: Category name
    get:
      tags:
      - Products
      summary: List products in a category
      operationId: listProductsByCategory
      parameters:
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Sort'
      responses:
        '200':
          description: Array of products in the category
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Product'
components:
  schemas:
    Product:
      type: object
      properties:
        id:
          type: integer
        title:
          type: string
        price:
          type: number
        category:
          type: string
        description:
          type: string
        image:
          type: string
          format: uri
        rating:
          type: object
          properties:
            rate:
              type: number
            count:
              type: integer
    ProductInput:
      type: object
      required:
      - title
      - price
      - category
      - description
      - image
      properties:
        title:
          type: string
        price:
          type: number
        category:
          type: string
        description:
          type: string
        image:
          type: string
          format: uri
  parameters:
    ProductId:
      in: path
      name: id
      required: true
      schema:
        type: integer
      description: Product ID
    Sort:
      in: query
      name: sort
      schema:
        type: string
        enum:
        - asc
        - desc
      description: Sort order for results
    Limit:
      in: query
      name: limit
      schema:
        type: integer
        minimum: 1
      description: Maximum number of results to return