> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a category

> Create a new product category in the store. Requires the WRITE_CATEGORIES scope.

Creates a new product category in the store; a URL-friendly slug is generated automatically from the name. The store is bound to your app token server-side — never send a shop id.


## OpenAPI

````yaml POST /categories
openapi: 3.1.0
info:
  title: Salesive Apps API — Customers & Categories
  version: 1.0.0
  description: >-
    Read and manage the store's customers and product categories from an
    installed third-party app. Every endpoint authenticates with an
    installed-app access token (prefix `app_`) and requires a specific OAuth
    scope. The target store is bound to the token server-side from the
    installation — never send a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
paths:
  /categories:
    post:
      tags:
        - Categories
      summary: Create a category
      description: >-
        Creates a new product category in the store. A URL-friendly slug is
        generated automatically from the name. The store is bound to the app
        token server-side from the installation — never send a shop id. Requires
        the `WRITE_CATEGORIES` scope.
      operationId: createCategory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryCreate'
            example:
              name: Electronics
              description: Phones, audio and accessories
              image: https://cdn.example.com/c/electronics.png
      responses:
        '201':
          description: The created category.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Category'
              example:
                status: 201
                success: true
                message: Category created successfully
                data:
                  _id: 6651ab12cd34ef56ab78cd90
                  name: Electronics
                  slug: electronics
                  description: Phones, audio and accessories
                  image: https://cdn.example.com/c/electronics.png
                  deleted: false
                  deletedAt: null
                  shop: 664f0e2a1c2b3d4e5f6a7b8c
                  createdAt: '2026-06-28T08:00:00.000Z'
                  updatedAt: '2026-06-28T08:00:00.000Z'
                  id: 6651ab12cd34ef56ab78cd90
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    CategoryCreate:
      type: object
      description: Fields accepted when creating a category.
      required:
        - name
      properties:
        name:
          type: string
          description: Category name. Used to auto-generate the slug.
        description:
          type:
            - string
            - 'null'
          description: Category description. May be null or empty.
        image:
          type:
            - string
            - 'null'
          format: uri
          description: >-
            Category image URL. Must be a valid URI if provided; may be null or
            empty.
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
          description: HTTP status code, echoed in the body.
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Human-readable result message.
    Category:
      type: object
      description: >-
        A store-scoped product category. The `productCount` field is included on
        list and get responses.
      properties:
        _id:
          type: string
        id:
          type: string
          description: Virtual alias of `_id`.
        name:
          type: string
        slug:
          type: string
          description: URL-friendly slug auto-generated from the name.
        description:
          type:
            - string
            - 'null'
        image:
          type:
            - string
            - 'null'
        deleted:
          type: boolean
        deletedAt:
          type:
            - string
            - 'null'
          format: date-time
        shop:
          type: string
          description: The store id (bound server-side).
        productCount:
          type: integer
          description: Number of products assigned to this category.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Envelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              description: Operation-specific payload (object, array, or null).
  responses:
    Unauthorized:
      description: Missing or invalid app access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 401
            success: false
            message: Authentication required
            data: null
    Forbidden:
      description: The app token is missing the OAuth scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 403
            success: false
            message: Insufficient scope
            data: null
  securitySchemes:
    AppToken:
      type: http
      scheme: bearer
      description: >-
        Installed-app access token (prefix app_), issued by the OAuth install
        flow. The store is bound to the token server-side — never send a shop
        id.

````