API Documentation Generator
Run ID: 69cc022204066a6c4a1687e62026-03-31Development
PantheraHive BOS
BOS Dashboard

API Documentation Generator: Architecture Plan

This document outlines the detailed architecture plan for the "API Documentation Generator," a system designed to automate and enhance the creation of professional, comprehensive API documentation. This plan focuses on a robust, scalable, and AI-powered solution capable of ingesting various API definitions and generating high-quality, actionable documentation for developers and consumers alike.


1. Introduction & Objectives

The primary objective of the API Documentation Generator is to streamline the documentation process, ensuring accuracy, consistency, and completeness across all APIs. By leveraging AI (specifically Large Language Models - LLMs), the generator will not only parse existing API definitions but also intelligently generate descriptions, usage examples, authentication guides, and SDK snippets, significantly reducing manual effort and improving documentation quality.

This architecture plan details the core components, their interactions, key technologies, and a project plan for the architectural design and initial development phase.

2. High-Level Architecture Overview

The system will follow a modular, microservices-oriented architecture to ensure scalability, flexibility, and maintainability. It consists of several interconnected layers responsible for API definition ingestion, intelligent content generation, output formatting, and user interaction.

Conceptual Diagram:

text • 1,625 chars
+---------------------+      +-----------------------------+      +---------------------------+
| API Definition      |      | Core Processing Engine      |      | Output Generation &       |
| Ingestion Layer     |----->| (LLM-Integrated)            |----->| Publishing Layer          |
|                     |      | - Internal API Model        |      | - Templating Engine       |
| - OpenAPI/Swagger   |      | - Content Generation Module |      | - Static Site Generators  |
| - Postman Collections|      | - Example Generation        |      | - Format Converters       |
| - Code Annotations  |      | - SDK Usage Generation      |      | - Publishing Connectors   |
+---------------------+      +-----------------------------+      +---------------------------+
         ^                                  ^
         |                                  |
         |         +---------------------------------------+
         |         | Data Storage Layer                    |
         |         | - API Definitions (if persisted)      |
         |         | - Generated Content                   |
         |         | - Configurations, User Data           |
         |         +---------------------------------------+
         |                                  ^
         |                                  |
         +---------------------------------------+
         | User Interface & API Management Layer |
         | - Web UI for Configuration/Preview    |
         | - REST API for Programmatic Access    |
         | - Version Control for Docs            |
         +---------------------------------------+
Sandboxed live preview

3. Detailed Architectural Components

3.1. API Definition Ingestion Layer

This layer is responsible for receiving and parsing various API definitions from different sources.

  • Input Adapters/Parsers:

* OpenAPI/Swagger Parser: Support for YAML and JSON formats (v2.0, v3.0, v3.1).

Postman Collection Parser: Ingest .json Postman collection files.

* RAML Parser: Support for RAML definitions.

* Code Annotation Scanners: (Optional, for advanced integration) Tools to extract API definitions directly from source code comments (e.g., JSDoc, PHPDoc, GoDoc annotations).

* Custom DSL Parser: If an internal domain-specific language is used for API definitions.

  • Validation Module: Ensures that the ingested API definitions conform to their respective schemas and are syntactically correct.
  • Source Control Integrations: Connectors to Git repositories (GitHub, GitLab, Bitbucket) for automatically fetching API definitions upon changes or on a schedule.
  • API Gateway Integrations: (Future consideration) Direct integration with API Gateways (e.g., AWS API Gateway, Azure API Management, Kong) to fetch live API definitions.

3.2. Core Processing Engine (LLM-Integrated)

This is the brain of the generator, responsible for transforming raw API definitions into rich, human-readable content using an internal API model and AI capabilities.

  • Internal API Model (Canonical Representation):

* A standardized, technology-agnostic data structure to represent API entities (endpoints, methods, parameters, schemas, security schemes) regardless of the input format. This acts as the single source of truth for content generation.

  • Content Generation Module (LLM Orchestrator):

* Prompt Engineering & Management: Dynamically constructs prompts for the LLM based on the internal API model's data (endpoint summaries, parameter details, schema definitions).

* LLM Integration: Interfaces with external LLM providers (e.g., Google Gemini, OpenAI GPT) to generate:

* Detailed Endpoint Descriptions: Beyond what's in the spec, including use cases, business context, and potential pitfalls.

* Request/Response Examples: Generating realistic and relevant examples based on defined schemas, including edge cases.

* Error Handling Guides: Explanations for common error codes and how to handle them.

* Authentication & Authorization Explanations: Clear, concise guides for implementing different security schemes (OAuth2, API Keys, JWT, Basic Auth).

* Contextualization Engine: Manages and feeds relevant contextual information (e.g., common patterns across multiple APIs, company-specific terminology) to the LLM to ensure consistent and accurate output.

  • Example Generation Logic:

* Schema-based Example Generation: Automatically creates valid JSON/XML examples from OpenAPI schemas.

* Mock Data Integration: Utilizes mock data libraries (e.g., Faker) to populate examples with realistic values.

  • SDK Usage Generation Module:

* Code Template Library: Stores templates for common programming languages (Python, JavaScript, Java, Go, C#) for making API calls.

* LLM-Assisted Code Generation: Leverages the LLM to fill in code templates with specific endpoint details, parameters, and authentication logic, providing ready-to-use SDK snippets.

* Language-Specific Best Practices: Incorporates common patterns and error handling for each language.

3.3. Output Generation & Publishing Layer

This layer takes the processed and enriched API content and renders it into various documentation formats and publishes it to target destinations.

  • Templating Engine:

* Utilizes a flexible templating system (e.g., Jinja2, Handlebars) to generate documentation in structured formats.

* Customizable Templates: Allows users to define and apply custom templates for branding and specific layout requirements.

  • Static Site Generator Integration:

* Adapters for Popular SSGs: Integrates with static site generators like Docusaurus, Next.js, Gatsby, or Hugo to produce interactive, searchable web documentation.

* Markdown/MDX Output: Generates content in Markdown or MDX format, compatible with most static site generators.

  • Format Converters:

* HTML Generation: Renders documentation directly to standalone HTML files.

* PDF/Print Generation: Converts documentation to PDF for offline viewing or printing.

  • Publishing Connectors:

* Git Repository Publisher: Pushes generated static site content to a specified Git branch (e.g., gh-pages or docs branch).

* Cloud Storage Publisher: Uploads documentation artifacts to cloud storage services (e.g., AWS S3, Azure Blob Storage, Google Cloud Storage).

* Internal Portal Integration: APIs for pushing documentation to internal developer portals or content management systems.

3.4. User Interface & API Management Layer

This layer provides the interface for users to configure, manage, and trigger documentation generation, as well as programmatic access.

  • Web User Interface (UI):

* Dashboard: Overview of configured APIs, generation status, and history.

* Configuration Editor: For setting up input sources, output formats, publishing destinations, and LLM parameters.

* Preview Functionality: Allows users to preview generated documentation before publishing.

* Version Management: Tools to manage different versions of API definitions and their corresponding documentation.

* User & Role Management: For multi-user environments with different access levels.

  • RESTful API:

* Programmatic Access: Enables CI/CD pipelines and other automated systems to trigger documentation generation, fetch status, and manage configurations.

* Webhooks: Support for triggering generation on external events (e.g., Git push).

3.5. Data Storage Layer

This layer handles the persistence of various data types required by the system.

  • Relational Database (e.g., PostgreSQL):

* Stores system configurations, user accounts, roles, generation history, and metadata about API definitions.

  • Document Database (e.g., MongoDB - Optional):

* Could be used for storing complex, semi-structured API definitions or generated content artifacts if flexible schema is preferred.

  • File Storage (e.g., AWS S3, Google Cloud Storage, or local disk):

* Stores raw API definition files (if not dynamically fetched).

* Stores generated documentation outputs before publishing.

* Stores custom templates and assets.

3.6. Security & Scalability Considerations

  • Authentication & Authorization: OAuth2, JWT for user access; API keys for programmatic access. Role-Based Access Control (RBAC).
  • Data Encryption: Encryption at rest and in transit for all sensitive data (API definitions, LLM API keys).
  • Rate Limiting & Throttling: To protect the LLM API and prevent abuse.
  • Scalability: Containerization (Docker) and orchestration (Kubernetes) for horizontal scaling of processing units. Asynchronous processing queues (e.g., RabbitMQ, Kafka) for long-running generation tasks.
  • Observability: Comprehensive logging, monitoring (metrics, traces), and alerting for system health and performance.

3.7. Monitoring & Logging

  • Centralized Logging: Aggregating logs from all components (e.g., ELK stack, Splunk, Datadog).
  • Performance Monitoring: Tracking generation times, LLM API response times, resource utilization.
  • Alerting: Proactive notifications for failures, performance degradation, or security incidents.

4. Technology Stack Recommendations

  • Backend & Core Processing: Python (FastAPI/Django) or Node.js (Express)

* LLM Integration: langchain or custom API wrappers for Google Gemini/OpenAI.

* OpenAPI Parsing: python-openapi-parser, swagger-parser (JS).

* Templating: Jinja2 (Python), Handlebars (JS).

* Asynchronous Processing: Celery (Python) with Redis/RabbitMQ.

  • Frontend (Web UI): React.js, Vue.js, or Angular.
  • Database: PostgreSQL (for relational data), Redis (for caching/queues).
  • File Storage: AWS S3, Google Cloud Storage, Azure Blob Storage.
  • Containerization: Docker.
  • Orchestration: Kubernetes.
  • CI/CD: GitHub Actions, GitLab CI, Jenkins.
  • Static Site Generators: Docusaurus, Next.js (for documentation features), Hugo.

5. Project Plan for Architecture Design & Development Phase

gemini Output

As part of the "API Documentation Generator" workflow, this deliverable provides comprehensive, detailed, and professionally structured API documentation. This output includes endpoint descriptions, request/response examples, authentication guides, and SDK usage examples, designed to be immediately useful for developers integrating with the API.


Product Catalog API Documentation

Welcome to the Product Catalog API documentation. This API allows you to programmatically manage your product listings, including creating, retrieving, updating, and deleting product information. This guide provides detailed information on how to authenticate, interact with various endpoints, and integrate using SDKs.

1. Introduction

The Product Catalog API is a RESTful API designed to provide a robust and scalable interface for managing product data. It supports standard CRUD (Create, Read, Update, Delete) operations and ensures data consistency and security through authentication and authorization mechanisms.

2. Base URL

All API requests should be made to the following base URL:

https://api.yourcompany.com/v1

3. Authentication

The Product Catalog API uses API Key authentication. To access protected resources, you must include your unique API key in the Authorization header of every request.

How to obtain an API Key:

  1. Log in to your developer dashboard at https://developer.yourcompany.com.
  2. Navigate to the "API Keys" section.
  3. Generate a new API key.
  4. Keep your API key secure and do not share it publicly.

Authentication Header Example:


Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with the actual API key generated from your dashboard.

Example: Authenticated Request (cURL)


curl -X GET \
  https://api.yourcompany.com/v1/products \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

Example: Authenticated Request (Python)


import requests

API_KEY = "YOUR_API_KEY" # Replace with your actual API Key
BASE_URL = "https://api.yourcompany.com/v1"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.get(f"{BASE_URL}/products", headers=headers)
    response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
    print("Products fetched successfully:")
    print(response.json())
except requests.exceptions.RequestException as e:
    print(f"Error fetching products: {e}")

4. Error Handling

The API uses standard HTTP status codes to indicate the success or failure of an API request. In case of an error, the response body will contain a JSON object with details about the error.

| HTTP Status Code | Meaning | Description |

| :--------------- | :------------- | :------------------------------------------------------------------------------------------------------ |

| 200 OK | Success | The request was successful. |

| 201 Created | Success | The resource was successfully created. |

| 204 No Content | Success | The request was successful, but there is no content to return (e.g., successful deletion). |

| 400 Bad Request| Client Error | The request was malformed or invalid. Check the request body/parameters. |

| 401 Unauthorized| Client Error | Authentication failed or was not provided. Invalid or missing API key. |

| 403 Forbidden | Client Error | The authenticated user does not have permission to access the resource. |

| 404 Not Found | Client Error | The requested resource could not be found. |

| 405 Method Not Allowed| Client Error | The HTTP method used is not supported for this endpoint. |

| 409 Conflict | Client Error | The request could not be completed due to a conflict with the current state of the resource (e.g., duplicate ID). |

| 429 Too Many Requests| Client Error | The request was rate-limited. Retry after the specified duration. |

| 500 Internal Server Error| Server Error | An unexpected error occurred on the server. Please try again later. |

Error Response Example:


{
  "code": "resource_not_found",
  "message": "Product with ID 'prod_xyz' not found.",
  "details": [
    {
      "field": "productId",
      "value": "prod_xyz",
      "reason": "Invalid resource identifier"
    }
  ]
}

5. Rate Limiting

To ensure fair usage and system stability, the API enforces rate limits.

  • Requests per minute: 100 requests per minute per API key.
  • Headers:

* X-RateLimit-Limit: The maximum number of requests allowed in the current time window.

* X-RateLimit-Remaining: The number of requests remaining in the current time window.

* X-RateLimit-Reset: The UTC epoch seconds when the current rate limit window resets.

If you exceed the rate limit, you will receive a 429 Too Many Requests error. Implement exponential backoff in your client applications to handle rate limits gracefully.

6. Endpoints

This section details all available endpoints, their methods, parameters, and example requests/responses.

6.1. Get All Products

Retrieves a list of all products in the catalog.

  • HTTP Method: GET
  • Path: /products
  • Description: Returns an array of product objects. Supports pagination and filtering.

Query Parameters:

| Name | Type | Description | Required | Default |

| :-------- | :------- | :------------------------------------------------------------------------ | :------- | :------ |

| limit | integer| Maximum number of products to return. | No | 10 |

| offset | integer| Number of products to skip before starting to collect the result set. | No | 0 |

| category| string | Filter products by category (e.g., "electronics", "books"). | No | All |

| sort_by | string | Field to sort by (e.g., "name", "price", "createdAt"). | No | createdAt |

| order | string | Sort order: asc for ascending, desc for descending. | No | asc |

Request Example (cURL):


curl -X GET \
  'https://api.yourcompany.com/v1/products?limit=5&category=electronics&sort_by=price&order=desc' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

Response Structure (200 OK):


{
  "data": [
    {
      "id": "prod_001",
      "name": "Wireless Headphones",
      "description": "Premium over-ear headphones with noise cancellation.",
      "category": "electronics",
      "price": 199.99,
      "currency": "USD",
      "stock": 150,
      "imageUrl": "https://example.com/images/headphones.jpg",
      "createdAt": "2023-01-15T10:00:00Z",
      "updatedAt": "2023-01-20T14:30:00Z"
    },
    {
      "id": "prod_002",
      "name": "Ergonomic Office Chair",
      "description": "Comfortable chair for long working hours.",
      "category": "office_furniture",
      "price": 349.00,
      "currency": "USD",
      "stock": 75,
      "imageUrl": "https://example.com/images/chair.jpg",
      "createdAt": "2023-02-01T09:15:00Z",
      "updatedAt": "2023-02-01T09:15:00Z"
    }
  ],
  "meta": {
    "total": 2,
    "limit": 5,
    "offset": 0,
    "hasMore": false
  }
}

6.2. Get Product by ID

Retrieves a single product by its unique identifier.

  • HTTP Method: GET
  • Path: /products/{productId}
  • Description: Returns a single product object matching the provided ID.

Path Parameters:

| Name | Type | Description | Required |

| :---------- | :------- | :-------------------------- | :------- |

| productId | string | The unique ID of the product. | Yes |

Request Example (cURL):


curl -X GET \
  https://api.yourcompany.com/v1/products/prod_001 \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

Response Structure (200 OK):


{
  "id": "prod_001",
  "name": "Wireless Headphones",
  "description": "Premium over-ear headphones with noise cancellation.",
  "category": "electronics",
  "price": 199.99,
  "currency": "USD",
  "stock": 150,
  "imageUrl": "https://example.com/images/headphones.jpg",
  "createdAt": "2023-01-15T10:00:00Z",
  "updatedAt": "2023-01-20T14:30:00Z"
}

Error Response Example (404 Not Found):


{
  "code": "resource_not_found",
  "message": "Product with ID 'prod_999' not found."
}

6.3. Create a New Product

Adds a new product to the catalog.

  • HTTP Method: POST
  • Path: /products
  • Description: Creates a new product entry. Returns the newly created product object.

Request Body Parameters (JSON):

| Name | Type | Description | Required |

| :---------- | :------- | :---------------------------------------------- | :------- |

| name | string | The name of the product. | Yes |

| description| string | A brief description of the product. | Yes |

| category | string | The category the product belongs to. | Yes |

| price | number | The price of the product. | Yes |

| currency | string | The currency of the price (e.g., "USD", "EUR"). | Yes |

| stock | integer| The current stock quantity. | Yes |

| imageUrl | string | URL to the product's image. | No |

Request Example (cURL):


curl -X POST \
  https://api.yourcompany.com/v1/products \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "Smartwatch Pro",
        "description": "Advanced smartwatch with health tracking.",
        "category": "electronics",
        "price": 249.99,
        "currency": "USD",
        "stock": 200,
        "imageUrl": "https://example.com/images/smartwatch.jpg"
      }'

Response Structure (201 Created):


{
  "id": "prod_003",
  "name": "Smartwatch Pro",
  "description": "Advanced smartwatch with health tracking.",
  "category": "electronics",
  "price": 249.99,
  "currency": "USD",
  "stock": 200,
  "imageUrl": "https://example.com/images/smartwatch.jpg",
  "createdAt": "2023-03-01T11:00:00Z",
  "updatedAt": "2023-03-01T11:00:00Z"
}

Error Response Example (400 Bad Request):


{
  "code": "invalid_payload",
  "message": "Request body contains invalid data.",
  "details": [
    {
      "field": "name",
      "reason": "Name is required and cannot be empty."
    },
    {
      "field": "price",
      "reason": "Price must be a positive number."
    }
  ]
}

6.4. Update an Existing Product

Updates an existing product's information.

  • HTTP Method: PUT
  • Path: /products/{productId}
  • Description: Updates the specified product. Only fields provided in the request body will be updated.

Path Parameters:

| Name | Type | Description | Required |

| :---------- | :------- | :-------------------------- | :------- |

| productId | string | The unique ID of the product. | Yes |

Request Body Parameters (JSON):

| Name | Type | Description | Required |

| :---------- | :------- | :---------------------------------------------- | :------- |

| name | string | The updated name of the product. | No |

| description| string | An updated brief description of the product. | No |

| category | string | The updated category the product belongs to. | No

gemini Output

This document provides a comprehensive and detailed guide for integrating with the Panthera Products API. It covers everything from authentication and general API conventions to specific endpoint details, request/response examples, and SDK usage.


Panthera Products API Documentation

Welcome to the Panthera Products API documentation! This API allows you to programmatically manage your product catalog, including retrieving product details, adding new products, updating existing ones, and deleting products. This documentation is designed to help developers quickly understand and integrate with our services.

Table of Contents

  1. [Introduction](#1-introduction)
  2. [Base URL](#2-base-url)
  3. [Authentication](#3-authentication)
  4. [Error Handling](#4-error-handling)
  5. [Rate Limiting](#5-rate-limiting)
  6. [Endpoints](#6-endpoints)

* [List All Products (GET /products)](#list-all-products-get-products)

* [Get Product by ID (GET /products/{id})](#get-product-by-id-get-productsid)

* [Create New Product (POST /products)](#create-new-product-post-products)

* [Update Product (PUT /products/{id})](#update-product-put-productsid)

* [Delete Product (DELETE /products/{id})](#delete-product-delete-productsid)

  1. [SDK Usage Examples](#7-sdk-usage-examples)

* [Python SDK](#python-sdk)

* [JavaScript SDK](#javascript-sdk)

  1. [Support](#8-support)

1. Introduction

The Panthera Products API provides a RESTful interface for managing product data within the Panthera ecosystem. You can integrate this API into your applications to automate product catalog updates, synchronize data, and build custom product management tools. All data is transferred over HTTPS for security.

2. Base URL

All API requests should be made to the following base URL:

https://api.pantherahive.com/v1

3. Authentication

The Panthera Products API uses API Key authentication. You must include your API key in the Authorization header of every request.

Obtaining Your API Key

  1. Log in to your PantheraHive developer dashboard.
  2. Navigate to the "API Keys" section.
  3. Generate a new API key or use an existing one. Ensure it has the necessary permissions for product management.
  4. Keep your API key secure and do not expose it in client-side code.

How to Authenticate

Include your API key as a Bearer token in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Example:


GET /v1/products HTTP/1.1
Host: api.pantherahive.com
Authorization: Bearer pk_live_YOUR_API_KEY
Content-Type: application/json

4. Error Handling

The API uses standard HTTP status codes to indicate the success or failure of a request. In case of an error, the response body will contain a JSON object with more details about the error.

| HTTP Status Code | Meaning | Description |

| :---------------- | :--------------------------- | :-------------------------------------------------------------------------- |

| 200 OK | Success | The request was successful. |

| 201 Created | Resource Created | The request resulted in a new resource being created. |

| 204 No Content | Success, No Content | The request was successful, but there's no content to return (e.g., DELETE).|

| 400 Bad Request | Invalid Input | The request was malformed or missing required parameters. |

| 401 Unauthorized| Authentication Required | No valid API key provided. |

| 403 Forbidden | Access Denied | The API key does not have sufficient permissions to perform the action. |

| 404 Not Found | Resource Not Found | The requested resource (e.g., product ID) does not exist. |

| 405 Method Not Allowed| Invalid Method | The HTTP method used is not supported for this endpoint. |

| 429 Too Many Requests| Rate Limit Exceeded | You have sent too many requests in a given amount of time. |

| 500 Internal Server Error| Server Error | An unexpected error occurred on the server. |

Example Error Response:


{
  "error": {
    "code": "resource_not_found",
    "message": "Product with ID 'prod_xyz123' not found.",
    "details": [
      {
        "field": "id",
        "value": "prod_xyz123",
        "reason": "The specified product ID does not exist."
      }
    ]
  }
}

5. Rate Limiting

To ensure fair usage and stability, the Panthera Products API enforces rate limits.

Currently, the limit is 100 requests per minute per API key.

If you exceed the rate limit, you will receive a 429 Too Many Requests HTTP status code.

Rate Limit Headers:

The following headers are included in every API response to help you manage your request rates:

  • X-RateLimit-Limit: The maximum number of requests you can make in the current window.
  • X-RateLimit-Remaining: The number of requests remaining in the current window.
  • X-RateLimit-Reset: The time (in UTC epoch seconds) when the current rate limit window resets.

6. Endpoints

This section details all available endpoints for the Panthera Products API.

Product Object Structure

Most endpoints will return or expect a Product object with the following structure:

| Field | Type | Description | Required (Create) |

| :------------ | :-------- | :------------------------------------------------------------- | :---------------- |

| id | string | Unique identifier for the product (read-only). | No |

| name | string | Name of the product. | Yes |

| description | string | Detailed description of the product. | No |

| price | number | Current price of the product. | Yes |

| currency | string | 3-letter ISO currency code (e.g., "USD", "EUR"). | Yes |

| sku | string | Stock Keeping Unit for the product (must be unique). | Yes |

| category | string | Category the product belongs to. | No |

| in_stock | boolean | Indicates if the product is currently in stock. | No |

| created_at | string | Timestamp when the product was created (ISO 8601). | No |

| updated_at | string | Timestamp when the product was last updated (ISO 8601). | No |


List All Products (GET /products)

Retrieves a list of all products in your catalog. Supports pagination and filtering.

  • Method: GET
  • Path: /products

##### Parameters

| Name | Type | Description | Required | Default |

| :-------- | :------- | :------------------------------------------------------------------------ | :------- | :-------- |

| limit | integer| Maximum number of products to return per page (min 1, max 100). | No | 10 |

| offset | integer| Number of products to skip before starting to collect the result set. | No | 0 |

| category| string | Filter products by category. | No | null |

| in_stock| boolean| Filter products by stock status (true for in stock, false for out). | No | null |

##### Request Example


curl -X GET \
  'https://api.pantherahive.com/v1/products?limit=5&category=Electronics' \
  -H 'Authorization: Bearer pk_live_YOUR_API_KEY'

##### Response

Status: 200 OK

Body Schema:


{
  "data": [
    {
      "id": "prod_123abc",
      "name": "Wireless Headphones",
      "description": "Premium noise-cancelling wireless headphones.",
      "price": 199.99,
      "currency": "USD",
      "sku": "WH001",
      "category": "Electronics",
      "in_stock": true,
      "created_at": "2023-01-15T10:00:00Z",
      "updated_at": "2023-08-20T14:30:00Z"
    },
    // ... more product objects
  ],
  "meta": {
    "total": 25,
    "limit": 5,
    "offset": 0,
    "next_offset": 5
  }
}

Get Product by ID (GET /products/{id})

Retrieves the details of a single product by its unique identifier.

  • Method: GET
  • Path: /products/{id}

##### Parameters

| Name | Type | Description | Required |

| :--- | :------- | :---------------------- | :------- |

| id | string | The unique product ID. | Yes |

##### Request Example


curl -X GET \
  'https://api.pantherahive.com/v1/products/prod_123abc' \
  -H 'Authorization: Bearer pk_live_YOUR_API_KEY'

##### Response

Status: 200 OK

Body Schema: (See [Product Object Structure](#product-object-structure))


{
  "id": "prod_123abc",
  "name": "Wireless Headphones",
  "description": "Premium noise-cancelling wireless headphones with 24-hour battery life.",
  "price": 199.99,
  "currency": "USD",
  "sku": "WH001",
  "category": "Electronics",
  "in_stock": true,
  "created_at": "2023-01-15T10:00:00Z",
  "updated_at": "2023-08-20T14:30:00Z"
}

Error Response (404 Not Found):


{
  "error": {
    "code": "resource_not_found",
    "message": "Product with ID 'prod_nonexistent' not found."
  }
}

Create New Product (POST /products)

Creates a new product in your catalog.

  • Method: POST
  • Path: /products

##### Request Body

Expects a JSON object conforming to the [Product Object Structure](#product-object-structure), but without the id, created_at, and updated_at fields. All other fields marked "Required (Create)" must be present.


{
  "name": "Smart Watch Pro",
  "description": "Advanced smart watch with health tracking and notifications.",
  "price": 299.99,
  "currency": "USD",
  "sku": "SWP001",
  "category": "Wearables",
  "in_stock": true
}

##### Request Example


curl -X POST \
  'https://api.pantherahive.com/v1/products' \
  -H 'Authorization: Bearer pk_live_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "Smart Watch Pro",
        "description": "Advanced smart watch with health tracking and notifications.",
        "price": 299.99,
        "currency": "USD",
        "sku": "SWP001",
        "category": "Wearables",
        "in_stock": true
      }'

##### Response

Status: 201 Created

Body Schema: (See [Product Object Structure](#product-object-structure))

The response will include the newly created product object, including its generated id and timestamps.


{
  "id": "prod_456def",
  "name": "Smart Watch Pro",
  "description": "Advanced smart watch with health tracking and notifications.",
  "price": 299.99,
  "currency": "USD",
  "sku": "SWP001",
  "category": "Wearables",
  "in_stock": true,
  "created_at": "2023-09-01T09:00:00Z",
  "updated_at": "2023-09-01T09
api_documentation_generator.txt
Download source file
Copy all content
Full output as text
Download ZIP
IDE-ready project ZIP
Copy share link
Permanent URL for this run
Get Embed Code
Embed this result on any website
Print / Save PDF
Use browser print dialog
\n\n\n"); var hasSrcMain=Object.keys(extracted).some(function(k){return k.indexOf("src/main")>=0;}); if(!hasSrcMain) zip.file(folder+"src/main."+ext,"import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\nimport './index.css'\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n \n \n \n)\n"); var hasSrcApp=Object.keys(extracted).some(function(k){return k==="src/App."+ext||k==="App."+ext;}); if(!hasSrcApp) zip.file(folder+"src/App."+ext,"import React from 'react'\nimport './App.css'\n\nfunction App(){\n return(\n
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n
\n )\n}\nexport default App\n"); zip.file(folder+"src/index.css","*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;color:#1a1a2e}\n.app{min-height:100vh;display:flex;flex-direction:column}\n.app-header{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px}\nh1{font-size:2.5rem;font-weight:700}\n"); zip.file(folder+"src/App.css",""); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/pages/.gitkeep",""); zip.file(folder+"src/hooks/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\n## Open in IDE\nOpen the project folder in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Vue (Vite + Composition API + TypeScript) --- */ function buildVue(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "type": "module",\n "scripts": {\n "dev": "vite",\n "build": "vue-tsc -b && vite build",\n "preview": "vite preview"\n },\n "dependencies": {\n "vue": "^3.5.13",\n "vue-router": "^4.4.5",\n "pinia": "^2.3.0",\n "axios": "^1.7.9"\n },\n "devDependencies": {\n "@vitejs/plugin-vue": "^5.2.1",\n "typescript": "~5.7.3",\n "vite": "^6.0.5",\n "vue-tsc": "^2.2.0"\n }\n}\n'); zip.file(folder+"vite.config.ts","import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport { resolve } from 'path'\n\nexport default defineConfig({\n plugins: [vue()],\n resolve: { alias: { '@': resolve(__dirname,'src') } }\n})\n"); zip.file(folder+"tsconfig.json",'{"files":[],"references":[{"path":"./tsconfig.app.json"},{"path":"./tsconfig.node.json"}]}\n'); zip.file(folder+"tsconfig.app.json",'{\n "compilerOptions":{\n "target":"ES2020","useDefineForClassFields":true,"module":"ESNext","lib":["ES2020","DOM","DOM.Iterable"],\n "skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,\n "isolatedModules":true,"moduleDetection":"force","noEmit":true,"jsxImportSource":"vue",\n "strict":true,"paths":{"@/*":["./src/*"]}\n },\n "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"]\n}\n'); zip.file(folder+"env.d.ts","/// \n"); zip.file(folder+"index.html","\n\n\n \n \n "+slugTitle(pn)+"\n\n\n
\n \n\n\n"); var hasMain=Object.keys(extracted).some(function(k){return k==="src/main.ts"||k==="main.ts";}); if(!hasMain) zip.file(folder+"src/main.ts","import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport App from './App.vue'\nimport './assets/main.css'\n\nconst app = createApp(App)\napp.use(createPinia())\napp.mount('#app')\n"); var hasApp=Object.keys(extracted).some(function(k){return k.indexOf("App.vue")>=0;}); if(!hasApp) zip.file(folder+"src/App.vue","\n\n\n\n\n"); zip.file(folder+"src/assets/main.css","*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui,sans-serif;background:#fff;color:#213547}\n"); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/views/.gitkeep",""); zip.file(folder+"src/stores/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\nOpen in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- Angular (v19 standalone) --- */ function buildAngular(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var sel=pn.replace(/_/g,"-"); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test"\n },\n "dependencies": {\n "@angular/animations": "^19.0.0",\n "@angular/common": "^19.0.0",\n "@angular/compiler": "^19.0.0",\n "@angular/core": "^19.0.0",\n "@angular/forms": "^19.0.0",\n "@angular/platform-browser": "^19.0.0",\n "@angular/platform-browser-dynamic": "^19.0.0",\n "@angular/router": "^19.0.0",\n "rxjs": "~7.8.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.15.0"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "^19.0.0",\n "@angular/cli": "^19.0.0",\n "@angular/compiler-cli": "^19.0.0",\n "typescript": "~5.6.0"\n }\n}\n'); zip.file(folder+"angular.json",'{\n "$schema": "./node_modules/@angular/cli/lib/config/schema.json",\n "version": 1,\n "newProjectRoot": "projects",\n "projects": {\n "'+pn+'": {\n "projectType": "application",\n "root": "",\n "sourceRoot": "src",\n "prefix": "app",\n "architect": {\n "build": {\n "builder": "@angular-devkit/build-angular:application",\n "options": {\n "outputPath": "dist/'+pn+'",\n "index": "src/index.html",\n "browser": "src/main.ts",\n "tsConfig": "tsconfig.app.json",\n "styles": ["src/styles.css"],\n "scripts": []\n }\n },\n "serve": {"builder":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"'+pn+':build:production"},"development":{"buildTarget":"'+pn+':build:development"}},"defaultConfiguration":"development"}\n }\n }\n }\n}\n'); zip.file(folder+"tsconfig.json",'{\n "compileOnSave": false,\n "compilerOptions": {"baseUrl":"./","outDir":"./dist/out-tsc","forceConsistentCasingInFileNames":true,"strict":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"paths":{"@/*":["src/*"]},"skipLibCheck":true,"esModuleInterop":true,"sourceMap":true,"declaration":false,"experimentalDecorators":true,"moduleResolution":"bundler","importHelpers":true,"target":"ES2022","module":"ES2022","useDefineForClassFields":false,"lib":["ES2022","dom"]},\n "references":[{"path":"./tsconfig.app.json"}]\n}\n'); zip.file(folder+"tsconfig.app.json",'{\n "extends":"./tsconfig.json",\n "compilerOptions":{"outDir":"./dist/out-tsc","types":[]},\n "files":["src/main.ts"],\n "include":["src/**/*.d.ts"]\n}\n'); zip.file(folder+"src/index.html","\n\n\n \n "+slugTitle(pn)+"\n \n \n \n\n\n \n\n\n"); zip.file(folder+"src/main.ts","import { bootstrapApplication } from '@angular/platform-browser';\nimport { appConfig } from './app/app.config';\nimport { AppComponent } from './app/app.component';\n\nbootstrapApplication(AppComponent, appConfig)\n .catch(err => console.error(err));\n"); zip.file(folder+"src/styles.css","* { margin: 0; padding: 0; box-sizing: border-box; }\nbody { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: #111827; }\n"); var hasComp=Object.keys(extracted).some(function(k){return k.indexOf("app.component")>=0;}); if(!hasComp){ zip.file(folder+"src/app/app.component.ts","import { Component } from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css'\n})\nexport class AppComponent {\n title = '"+pn+"';\n}\n"); zip.file(folder+"src/app/app.component.html","
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n \n
\n"); zip.file(folder+"src/app/app.component.css",".app-header{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:16px}h1{font-size:2.5rem;font-weight:700;color:#6366f1}\n"); } zip.file(folder+"src/app/app.config.ts","import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\nimport { provideRouter } from '@angular/router';\nimport { routes } from './app.routes';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideZoneChangeDetection({ eventCoalescing: true }),\n provideRouter(routes)\n ]\n};\n"); zip.file(folder+"src/app/app.routes.ts","import { Routes } from '@angular/router';\n\nexport const routes: Routes = [];\n"); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nng serve\n# or: npm start\n\`\`\`\n\n## Build\n\`\`\`bash\nng build\n\`\`\`\n\nOpen in VS Code with Angular Language Service extension.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n.angular/\n"); } /* --- Python --- */ function buildPython(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var reqMap={"numpy":"numpy","pandas":"pandas","sklearn":"scikit-learn","tensorflow":"tensorflow","torch":"torch","flask":"flask","fastapi":"fastapi","uvicorn":"uvicorn","requests":"requests","sqlalchemy":"sqlalchemy","pydantic":"pydantic","dotenv":"python-dotenv","PIL":"Pillow","cv2":"opencv-python","matplotlib":"matplotlib","seaborn":"seaborn","scipy":"scipy"}; var reqs=[]; Object.keys(reqMap).forEach(function(k){if(src.indexOf("import "+k)>=0||src.indexOf("from "+k)>=0)reqs.push(reqMap[k]);}); var reqsTxt=reqs.length?reqs.join("\n"):"# add dependencies here\n"; zip.file(folder+"main.py",src||"# "+title+"\n# Generated by PantheraHive BOS\n\nprint(title+\" loaded\")\n"); zip.file(folder+"requirements.txt",reqsTxt); zip.file(folder+".env.example","# Environment variables\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\`\`\`\n\n## Run\n\`\`\`bash\npython main.py\n\`\`\`\n"); zip.file(folder+".gitignore",".venv/\n__pycache__/\n*.pyc\n.env\n.DS_Store\n"); } /* --- Node.js --- */ function buildNode(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/m,"").trim(); var depMap={"mongoose":"^8.0.0","dotenv":"^16.4.5","axios":"^1.7.9","cors":"^2.8.5","bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2","socket.io":"^4.7.4","uuid":"^9.0.1","zod":"^3.22.4","express":"^4.18.2"}; var deps={}; Object.keys(depMap).forEach(function(k){if(src.indexOf(k)>=0)deps[k]=depMap[k];}); if(!deps["express"])deps["express"]="^4.18.2"; var pkgJson=JSON.stringify({"name":pn,"version":"1.0.0","main":"src/index.js","scripts":{"start":"node src/index.js","dev":"nodemon src/index.js"},"dependencies":deps,"devDependencies":{"nodemon":"^3.0.3"}},null,2)+"\n"; zip.file(folder+"package.json",pkgJson); var fallback="const express=require(\"express\");\nconst app=express();\napp.use(express.json());\n\napp.get(\"/\",(req,res)=>{\n res.json({message:\""+title+" API\"});\n});\n\nconst PORT=process.env.PORT||3000;\napp.listen(PORT,()=>console.log(\"Server on port \"+PORT));\n"; zip.file(folder+"src/index.js",src||fallback); zip.file(folder+".env.example","PORT=3000\n"); zip.file(folder+".gitignore","node_modules/\n.env\n.DS_Store\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\n\`\`\`\n\n## Run\n\`\`\`bash\nnpm run dev\n\`\`\`\n"); } /* --- Vanilla HTML --- */ function buildVanillaHtml(zip,folder,app,code){ var title=slugTitle(app); var isFullDoc=code.trim().toLowerCase().indexOf("=0||code.trim().toLowerCase().indexOf("=0; var indexHtml=isFullDoc?code:"\n\n\n\n\n"+title+"\n\n\n\n"+code+"\n\n\n\n"; zip.file(folder+"index.html",indexHtml); zip.file(folder+"style.css","/* "+title+" — styles */\n*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#1a1a2e}\n"); zip.file(folder+"script.js","/* "+title+" — scripts */\n"); zip.file(folder+"assets/.gitkeep",""); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Open\nDouble-click \`index.html\` in your browser.\n\nOr serve locally:\n\`\`\`bash\nnpx serve .\n# or\npython3 -m http.server 3000\n\`\`\`\n"); zip.file(folder+".gitignore",".DS_Store\nnode_modules/\n.env\n"); } /* ===== MAIN ===== */ var sc=document.createElement("script"); sc.src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"; sc.onerror=function(){ if(lbl)lbl.textContent="Download ZIP"; alert("JSZip load failed — check connection."); }; sc.onload=function(){ var zip=new JSZip(); var base=(_phFname||"output").replace(/\.[^.]+$/,""); var app=base.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"my_app"; var folder=app+"/"; var vc=document.getElementById("panel-content"); var panelTxt=vc?(vc.innerText||vc.textContent||""):""; var lang=detectLang(_phCode,panelTxt); if(_phIsHtml){ buildVanillaHtml(zip,folder,app,_phCode); } else if(lang==="flutter"){ buildFlutter(zip,folder,app,_phCode,panelTxt); } else if(lang==="react-native"){ buildReactNative(zip,folder,app,_phCode,panelTxt); } else if(lang==="swift"){ buildSwift(zip,folder,app,_phCode,panelTxt); } else if(lang==="kotlin"){ buildKotlin(zip,folder,app,_phCode,panelTxt); } else if(lang==="react"){ buildReact(zip,folder,app,_phCode,panelTxt); } else if(lang==="vue"){ buildVue(zip,folder,app,_phCode,panelTxt); } else if(lang==="angular"){ buildAngular(zip,folder,app,_phCode,panelTxt); } else if(lang==="python"){ buildPython(zip,folder,app,_phCode); } else if(lang==="node"){ buildNode(zip,folder,app,_phCode); } else { /* Document/content workflow */ var title=app.replace(/_/g," "); var md=_phAll||_phCode||panelTxt||"No content"; zip.file(folder+app+".md",md); var h=""+title+""; h+="

"+title+"

"; var hc=md.replace(/&/g,"&").replace(//g,">"); hc=hc.replace(/^### (.+)$/gm,"

$1

"); hc=hc.replace(/^## (.+)$/gm,"

$1

"); hc=hc.replace(/^# (.+)$/gm,"

$1

"); hc=hc.replace(/\*\*(.+?)\*\*/g,"$1"); hc=hc.replace(/\n{2,}/g,"

"); h+="

"+hc+"

Generated by PantheraHive BOS
"; zip.file(folder+app+".html",h); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\nFiles:\n- "+app+".md (Markdown)\n- "+app+".html (styled HTML)\n"); } zip.generateAsync({type:"blob"}).then(function(blob){ var a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download=app+".zip"; a.click(); URL.revokeObjectURL(a.href); if(lbl)lbl.textContent="Download ZIP"; }); }; document.head.appendChild(sc); } function phShare(){navigator.clipboard.writeText(window.location.href).then(function(){var el=document.getElementById("ph-share-lbl");if(el){el.textContent="Link copied!";setTimeout(function(){el.textContent="Copy share link";},2500);}});}function phEmbed(){var runId=window.location.pathname.split("/").pop().replace(".html","");var embedUrl="https://pantherahive.com/embed/"+runId;var code='';navigator.clipboard.writeText(code).then(function(){var el=document.getElementById("ph-embed-lbl");if(el){el.textContent="Embed code copied!";setTimeout(function(){el.textContent="Get Embed Code";},2500);}});}