Product Categories API

Learn how to manage product categories in AchieveApex using the REST API.

Overview

The Product Categories API allows you to manage categories for your products. You can list, retrieve, create, update, and delete product categories.

Base Endpoint

/product-categories

Product Category Object

The product category object contains information about a category used to organize products.

Product Category Object
{
  "id": 5,
  "name": "Subscriptions",
  "organization_id": 27,
  "created_at": "2025-03-15T10:30:20.391Z",
  "updated_at": "2025-03-15T10:30:20.391Z",
  "deleted_at": null
}

List Product Categories

Retrieve a list of product categories in your organization with optional filtering and pagination.

Request
GET /product-categories

curl -X GET https://api.achieveapex.com/product-categories \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": {
      "organization_id": 27,
      "$limit": 10,
      "$skip": 0,
      "$sort": { "name": 1 }
    }
  }'
Response
{
  "total": 3,
  "limit": 10,
  "skip": 0,
  "data": [
    {
      "id": 5,
      "name": "Subscriptions",
      "organization_id": 27,
      "created_at": "2025-03-15T10:30:20.391Z",
      "updated_at": "2025-03-15T10:30:20.391Z",
      "deleted_at": null
    },
    {
      "id": 6,
      "name": "Hardware",
      "organization_id": 27,
      "created_at": "2025-03-15T10:32:15.845Z",
      "updated_at": "2025-03-15T10:32:15.845Z",
      "deleted_at": null
    },
    {
      "id": 7,
      "name": "Consulting Services",
      "organization_id": 27,
      "created_at": "2025-03-15T10:35:38.217Z",
      "updated_at": "2025-03-15T10:35:38.217Z",
      "deleted_at": null
    }
  ]
}

Query Parameters

ParameterTypeDescription
organization_idNumberID of the organization (required)
nameStringFilter categories by name (supports partial matching)
$limitNumberNumber of categories to return (default: 10)
$skipNumberNumber of categories to skip (for pagination)
$sortObjectSort criteria (e.g., { "name": 1 } for name ascending)

Get a Product Category

Retrieve a single product category by ID.

Request
GET /product-categories/:id

curl -X GET https://api.achieveapex.com/product-categories/5 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"
Response
{
  "id": 5,
  "name": "Subscriptions",
  "organization_id": 27,
  "created_at": "2025-03-15T10:30:20.391Z",
  "updated_at": "2025-03-15T10:30:20.391Z",
  "deleted_at": null,
  "products": [
    {
      "id": 123,
      "name": "Premium Subscription"
    },
    {
      "id": 124,
      "name": "Standard Subscription"
    }
  ]
}

Create a Product Category

Create a new product category in your organization.

Request
POST /product-categories

curl -X POST https://api.achieveapex.com/product-categories \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": 27,
    "name": "Software Tools"
  }'
Response
{
  "id": 8,
  "name": "Software Tools",
  "organization_id": 27,
  "created_at": "2025-03-22T16:15:44.782Z",
  "updated_at": "2025-03-22T16:15:44.782Z",
  "deleted_at": null
}

Update a Product Category

Update an existing product category in your organization.

Request
PATCH /product-categories/:id

curl -X PATCH https://api.achieveapex.com/product-categories/8 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Software Solutions"
  }'
Response
{
  "id": 8,
  "name": "Software Solutions",
  "organization_id": 27,
  "created_at": "2025-03-22T16:15:44.782Z",
  "updated_at": "2025-03-22T16:20:12.345Z",
  "deleted_at": null
}

Delete a Product Category

Delete a product category from your organization.

Request
DELETE /product-categories/:id

curl -X DELETE https://api.achieveapex.com/product-categories/8 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response
{
  "id": 8,
  "name": "Software Solutions",
  "organization_id": 27,
  "created_at": "2025-03-22T16:15:44.782Z",
  "updated_at": "2025-03-22T16:25:33.678Z",
  "deleted_at": "2025-03-22T16:25:33.678Z"
}

Note on Category Deletion

When a category is deleted, the system performs a soft delete by setting the deleted_at timestamp. Products associated with this category will not be deleted, but their product_category_id will be set to null.

Report an issue with this documentation

Please log in to report issues with our documentation.