Upload Doc Delete Doc New Category Delete Category List Categories

List Categories

View all available categories for your client.

GET https://metisai.yoyek.com/api/categories

PHP Code Example

<?php

$apiUrl = 'https://metisai.yoyek.com/api/categories';
$apiKey = 'client-api-key-here';

// Initialize cURL
$ch = curl_init($apiUrl);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'X-API-Key: ' . $apiKey
    ]
]);

// Execute request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Process response
$result = json_decode($response, true);

if ($httpCode === 200 && $result['success']) {
    echo "Client: " . $result['clientName'] . "\n";
    echo "Total categories: " . count($result['categories']) . "\n\n";

    foreach ($result['categories'] as $category) {
        echo "Name: " . $category['name'] . "\n";
        echo "Label: " . $category['label'] . "\n";
        if (!empty($category['description'])) {
            echo "Description: " . $category['description'] . "\n";
        }
        echo "---\n";
    }
} else {
    echo "Error: " . ($result['error'] ?? 'Unknown error') . "\n";
}

/* Success Response (HTTP 200):
{
  "success": true,
  "categories": [
    {
      "id": "35824745-a9a8-4b70-8e49-dd0ba1276912",
      "name": "products",
      "label": "Products",
      "description": "Brick It product catalog"
    },
    {
      "id": "c4ad5b1d-f88f-4908-a990-9985107b41d4",
      "name": "documents",
      "label": "Documents",
      "description": "Technical documents and specifications"
    }
  ],
  "count": 2,
  "clientId": "8a0d31c1-6029-4b57-930d-5daccfa34edd",
  "clientName": "Brick It"
}

Error Response (HTTP 401):
{
  "error": "Invalid or inactive API key"
}
*/