Starship Rewards API

Categories & Subcategories

Access product categories and subcategories for organization

Categories & Subcategories

Access product categories and subcategories to organize and filter products effectively.

List Categories

Get all product categories available in the system.

Endpoint

GET /api/v1/categories

Authentication: API Key + Secret required

Query Parameters

ParameterTypeRequiredDescription
limitnumberNoNumber of results per page (default: 50)
pagenumberNoPage number to retrieve (default: 1)
include_subcategoriesbooleanNoInclude subcategories in response (default: false)
active_onlybooleanNoOnly return active categories (default: true)

Response

Response Headers

HTTP/1.1 200 OK
Content-Type: application/json
X-Page: 1
X-Per-Page: 50
X-Total-Count: 15
X-Total-Pages: 1
X-Page-Size: 3
X-Has-More: false

Response Body

[
  {
    "id": 1,
    "name": "Gift Cards",
    "slug": "gift-cards",
    "description": "Digital and physical gift cards for retail stores",
    "icon": "gift-card",
    "is_active": true,
    "product_count": 1247,
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  },
  {
    "id": 2,
    "name": "Mobile Top-up",
    "slug": "mobile-topup",
    "description": "Mobile phone credit and data plans",
    "icon": "mobile",
    "is_active": true,
    "product_count": 856,
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  },
  {
    "id": 3,
    "name": "Digital Services",
    "slug": "digital-services",
    "description": "Online services and subscriptions",
    "icon": "cloud",
    "is_active": true,
    "product_count": 342,
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  }
]

Category Object

FieldTypeDescription
idnumberUnique category identifier
namestringCategory display name
slugstringURL-friendly category identifier
descriptionstringCategory description
iconstringIcon identifier for UI
is_activebooleanWhether category is currently active
product_countnumberNumber of products in this category
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp

With Subcategories

[
  {
    "id": 1,
    "name": "Gift Cards",
    "slug": "gift-cards",
    "description": "Digital and physical gift cards for retail stores",
    "icon": "gift-card",
    "is_active": true,
    "product_count": 1247,
    "subcategories": [
      {
        "id": 101,
        "name": "Retail Stores",
        "slug": "retail-stores",
        "description": "Gift cards for department stores and retailers",
        "product_count": 523,
        "is_active": true
      },
      {
        "id": 102,
        "name": "Restaurants",
        "slug": "restaurants",
        "description": "Gift cards for dining and food delivery",
        "product_count": 287,
        "is_active": true
      }
    ],
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  }
]

Examples

# Get all categories
curl -X GET "{{host}}/api/v1/categories" \
  -H "X-API-Key: sk_live_abc123def456" \
  -H "X-API-Secret: your-secret-here"

# Get categories with subcategories
curl -X GET "{{host}}/api/v1/categories?include_subcategories=true" \
  -H "X-API-Key: sk_live_abc123def456" \
  -H "X-API-Secret: your-secret-here"

List Subcategories

Get all subcategories, optionally filtered by parent category.

Endpoint

GET /api/v1/subcategories

Authentication: API Key + Secret required

Query Parameters

ParameterTypeRequiredDescription
category_idnumberNoFilter by parent category ID
limitnumberNoNumber of results per page (default: 50)
pagenumberNoPage number to retrieve (default: 1)
active_onlybooleanNoOnly return active subcategories (default: true)

Response

Response Headers

HTTP/1.1 200 OK
Content-Type: application/json
X-Page: 1
X-Per-Page: 50
X-Total-Count: 47
X-Total-Pages: 1
X-Page-Size: 2
X-Has-More: true

Response Body

[
  {
    "id": 101,
    "category_id": 1,
    "name": "Retail Stores",
    "slug": "retail-stores",
    "description": "Gift cards for department stores and retailers",
    "is_active": true,
    "product_count": 523,
    "category": {
      "id": 1,
      "name": "Gift Cards",
      "slug": "gift-cards"
    },
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  },
  {
    "id": 102,
    "category_id": 1,
    "name": "Restaurants",
    "slug": "restaurants",
    "description": "Gift cards for dining and food delivery",
    "is_active": true,
    "product_count": 287,
    "category": {
      "id": 1,
      "name": "Gift Cards",
      "slug": "gift-cards"
    },
    "created_at": "2023-01-01T00:00:00Z",
    "updated_at": "2023-01-01T00:00:00Z"
  }
]

Subcategory Object

FieldTypeDescription
idnumberUnique subcategory identifier
category_idnumberParent category ID
namestringSubcategory display name
slugstringURL-friendly subcategory identifier
descriptionstringSubcategory description
is_activebooleanWhether subcategory is currently active
product_countnumberNumber of products in this subcategory
categoryobjectParent category information
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp

Examples

# Get all subcategories
curl -X GET "{{host}}/api/v1/subcategories" \
  -H "X-API-Key: sk_live_abc123def456" \
  -H "X-API-Secret: your-secret-here"

# Get subcategories for a specific category
curl -X GET "{{host}}/api/v1/subcategories?category_id=1" \
  -H "X-API-Key: sk_live_abc123def456" \
  -H "X-API-Secret: your-secret-here"

Category Navigation UI

React Component Example

Search and Filter

Error Responses

401 Unauthorized

{
  "error": "Unauthorized",
  "message": "Invalid or expired access token"
}

404 Not Found

{
  "error": "Not Found",
  "message": "Category not found"
}

500 Internal Server Error

{
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}

Use Cases

Product Catalog Navigation

  • Build hierarchical navigation menus
  • Create category-based filtering systems
  • Generate breadcrumb navigation

Analytics and Reporting

  • Track popular categories and subcategories
  • Monitor product distribution across categories
  • Generate category-based sales reports

Admin Management

  • Manage product categorization
  • Update category metadata
  • Monitor category performance

Next Steps

  • Explore Products to see how categories are used
  • Learn about filtering products by category in the products API
  • Use categories to organize and search your product catalog