Skip to content
Menu

Search the site

Type to search guides, blog, API and product.

↑ ↓ to move · Enter to open · Esc to close

API Reference

API

Categories

List the category facets of your catalog

View as Markdown

Categories are facets derived from the category_tags of your active products. Each category includes the number of products tagged with it. Use the category name as the tag parameter when listing products.

MethodPathDescription
GET/v1/categoriesList category facets

List Categories

GET/v1/categories
curl "https://rest-api.tbit.app/v1/categories" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/categories', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/categories',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/categories',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/categories');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

Categories with their product counts, plus the total number of active items in the catalog:

json
{
  "data": {
    "categories": [
      { "name": "fiestas", "count": 42 },
      { "name": "infantil", "count": 27 },
      { "name": "decoracion", "count": 18 }
    ],
    "total_items": 134
  }
}