/**
 * API Documentation Data
 *
 * Static structured documentation for all public Admin APIs.
 * This data is used by the frontend documentation viewer and can also
 * be accessed programmatically via GET /api/v1/admin/api-docs.
 *
 * Organized by module groups (Foundation, Marketing, System) matching the
 * platform's module system defined in src/lib/modules.ts.
 */

export interface ApiDocParam {
  name: string;
  type: string;
  required: boolean;
  description: string;
  default?: string;
}

export interface ApiDocError {
  code: number;
  message: string;
  body?: Record<string, any>;
}

export interface ApiDocEndpoint {
  id: string;
  name: string;
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
  path: string;
  purpose: string;
  whenToUse: string;
  auth: string;
  headers?: ApiDocParam[];
  queryParams?: ApiDocParam[];
  pathParams?: ApiDocParam[];
  requestBody?: Record<string, any>;
  successResponse: { status: number; description: string; body: Record<string, any> };
  errorResponses: ApiDocError[];
  curlExample: string;
  jsExample: string;
  axiosExample: string;
  nodeExample: string;
  pythonExample: string;
  phpExample: string;
  responseFields?: { field: string; type: string; description: string }[];
  notes?: string[];
  commonMistakes?: string[];
  rateLimits: string;
  requiredPermissions: string[];
  relatedApis: string[];
}

export interface ApiDocCategory {
  id: string;
  name: string;
  description: string;
  endpoints: ApiDocEndpoint[];
}

export interface ApiDocGroup {
  id: string;
  name: string;
  description: string;
  icon: string;
  color: string;
  categories: ApiDocCategory[];
}

const BASE_URL = '/api/v1/admin';

export const API_DOCS: { groups: ApiDocGroup[] } = {
  groups: [
    // ==========================================
    // FOUNDATION GROUP
    // ==========================================
    {
      id: 'foundation',
      name: 'Foundation',
      description: 'Core business data and settings',
      icon: 'Layers',
      color: '#7C6BF0',
      categories: [
        // --- Business Profile ---
        {
          id: 'business-profile',
          name: 'Business Profile',
          description: 'Company management endpoints — CRUD, stats, cloning, and validation.',
          endpoints: [
            {
              id: 'bp-get-companies',
              name: 'Get All Companies',
              method: 'GET',
              path: '/api/companies',
              purpose: 'Retrieve all companies the authenticated user belongs to.',
              whenToUse: 'Use this endpoint to list all companies in your account, e.g. to populate a company selector.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              successResponse: {
                status: 200,
                description: 'List of companies',
                body: [
                  { id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true, createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/companies \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const companies = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/companies', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/companies', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/companies',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'Company name' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the company is active' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the company was created' },
              ],
              notes: ['Returns only companies the authenticated user has access to.'],
              commonMistakes: ['Expecting all companies in the system — only the user\'s companies are returned.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['bp-get-company', 'bp-get-company-stats'],
            },
            {
              id: 'bp-get-company',
              name: 'Get Company',
              method: 'GET',
              path: '/api/companies/:id',
              purpose: 'Retrieve a single company by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Company details',
                body: { id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true, description: 'A leading tech company', notificationEmail: 'admin@acme.com', websiteUrl: 'https://acme.com' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const company = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active' },
                { field: 'description', type: 'string', description: 'Company description' },
                { field: 'notificationEmail', type: 'string', description: 'Notification email address' },
                { field: 'websiteUrl', type: 'string', description: 'Company website URL' },
              ],
              notes: ['You can only access companies you belong to.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['bp-get-companies', 'bp-update-company', 'bp-get-company-stats'],
            },
            {
              id: 'bp-get-company-stats',
              name: 'Get Company Stats',
              method: 'GET',
              path: '/api/companies/:id/stats',
              purpose: 'Retrieve dashboard summary statistics for a company.',
              whenToUse: 'Use this endpoint to get an overview of key metrics for your company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Company ID' }],
              successResponse: {
                status: 200,
                description: 'Dashboard stats',
                body: { companyId: '507f1f77bcf86cd799439012', companyName: 'Acme Corp', totalModules: 5, isActive: true, createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/stats \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/stats', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/stats', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID/stats', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/stats', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/stats');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'companyName', type: 'string', description: 'Company name' },
                { field: 'totalModules', type: 'number', description: 'Total number of modules with data' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the company was created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the company was last updated' },
              ],
              notes: ['Data is scoped to the authenticated company.'],
              commonMistakes: ['Not including the companyId path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['bp-get-company', 'bp-get-companies'],
            },
            {
              id: 'bp-create-company',
              name: 'Create Company',
              method: 'POST',
              path: '/api/companies',
              purpose: 'Create a new company.',
              whenToUse: 'Use this endpoint to add a new company to your account.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Company name', description: 'string (optional) — Company description', notificationEmail: 'string (optional) — Notification email', websiteUrl: 'string (optional) — Company website URL' },
              successResponse: { status: 201, description: 'Company created', body: { id: '507f1f77bcf86cd799439012', name: 'New Corp', isActive: true, createdAt: '2026-07-21T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Company limit reached' },
                { code: 409, message: 'Company name/email/URL already exists' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/companies \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "New Corp", "description": "A new company"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'New Corp', description: 'A new company' }),
});
const company = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/companies',
  { name: 'New Corp', description: 'A new company' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'New Corp', description: 'A new company' });
const options = { hostname: 'api.mengo.ai', path: '/api/companies', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/companies',
    json={'name': 'New Corp', 'description': 'A new company'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'New Corp', 'description' => 'A new company']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New company ID' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active (defaults to true)' },
              ],
              notes: ['The company name must be unique (case-insensitive).', 'The notification email and website URL must also be unique if provided.', 'Subscription limits apply — a 403 error is returned if the company limit is reached.'],
              commonMistakes: ['Using a name that already exists — returns 409.', 'Forgetting to include Content-Type header.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.create'],
              relatedApis: ['bp-get-companies', 'bp-update-company'],
            },
            {
              id: 'bp-update-company',
              name: 'Update Company',
              method: 'PUT',
              path: '/api/companies/:id',
              purpose: 'Update company details.',
              whenToUse: 'Use this endpoint to modify company name, description, email, or website URL.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID' },
              ],
              requestBody: { name: 'string (optional) — Updated company name', description: 'string (optional) — Updated description', notificationEmail: 'string (optional) — Updated notification email', websiteUrl: 'string (optional) — Updated website URL' },
              successResponse: { status: 200, description: 'Company updated', body: { id: '507f1f77bcf86cd799439012', name: 'Updated Corp', isActive: true } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Company not found' },
                { code: 409, message: 'Duplicate name/email/URL' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Corp"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Corp' }),
});
const company = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID',
  { name: 'Updated Corp' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Corp' });
const options = { hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID',
    json={'name': 'Updated Corp'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Corp']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Updated company name' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'Name, email, and URL uniqueness are checked against other companies.'],
              commonMistakes: ['Using PATCH instead of PUT — this endpoint uses PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.edit'],
              relatedApis: ['bp-get-company', 'bp-create-company', 'bp-toggle-status'],
            },
            {
              id: 'bp-toggle-status',
              name: 'Toggle Company Status',
              method: 'PATCH',
              path: '/api/companies/:id/status',
              purpose: 'Activate or deactivate a company.',
              whenToUse: 'Use this endpoint to change the isActive status of a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID' },
              ],
              requestBody: { isActive: 'boolean (required) — true to activate, false to deactivate' },
              successResponse: { status: 200, description: 'Company status updated', body: { id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: false } },
              errorResponses: [
                { code: 400, message: 'isActive must be a boolean or cannot deactivate current company' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X PATCH https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/status \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"isActive": false}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/status', {
  method: 'PATCH',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ isActive: false }),
});
const company = await response.json();`,
              axiosExample: `const { data } = await axios.patch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/status',
  { isActive: false },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ isActive: false });
const options = { hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID/status', method: 'PATCH',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.patch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/status',
    json={'isActive': False},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/status');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['isActive' => false]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Company ID' },
                { field: 'isActive', type: 'boolean', description: 'Updated active status' },
              ],
              notes: ['You cannot deactivate the company you are currently using. Switch to another company first.'],
              commonMistakes: ['Trying to deactivate the currently active company — will return 400.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.edit'],
              relatedApis: ['bp-update-company', 'bp-delete-company'],
            },
            {
              id: 'bp-delete-company',
              name: 'Delete Company',
              method: 'DELETE',
              path: '/api/companies/:id',
              purpose: 'Permanently delete a company and all its data.',
              whenToUse: 'Use this endpoint to remove a company entirely. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID to delete' },
              ],
              successResponse: { status: 200, description: 'Company deleted', body: { message: 'Company deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'All module data associated with the company is also deleted.'],
              commonMistakes: ['Not verifying the company ID before deleting — there is no undo.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.delete'],
              relatedApis: ['bp-get-company', 'bp-toggle-status', 'bp-clone-company'],
            },
            {
              id: 'bp-clone-company',
              name: 'Clone Company',
              method: 'POST',
              path: '/api/companies/:id/clone',
              purpose: 'Clone a company with all its module data.',
              whenToUse: 'Use this endpoint to create a copy of an existing company, optionally including content and AI context.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Source company ID to clone' },
              ],
              requestBody: { name: 'string (optional) — Name for the cloned company (defaults to "Original (Copy)")', includeContent: 'boolean (optional, default true) — Clone module content data', includeAIContext: 'boolean (optional, default false) — Clone AI context data' },
              successResponse: { status: 201, description: 'Company cloned', body: { company: { id: '507f1f77bcf86cd799439013', name: 'Acme Corp (Copy)', isActive: true }, stats: { modulesCloned: 12, aiContextCloned: 0 } } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Source company not found' },
                { code: 409, message: 'Clone name already exists' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/clone \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Acme Corp Copy", "includeContent": true, "includeAIContext": false}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/clone', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Acme Corp Copy', includeContent: true, includeAIContext: false }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/clone',
  { name: 'Acme Corp Copy', includeContent: true, includeAIContext: false },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Acme Corp Copy', includeContent: true });
const options = { hostname: 'api.mengo.ai', path: '/api/companies/YOUR_COMPANY_ID/clone', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/clone',
    json={'name': 'Acme Corp Copy', 'includeContent': True, 'includeAIContext': False},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/YOUR_COMPANY_ID/clone');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Acme Corp Copy', 'includeContent' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'company.id', type: 'string', description: 'New cloned company ID' },
                { field: 'company.name', type: 'string', description: 'Name of the cloned company' },
                { field: 'stats.modulesCloned', type: 'number', description: 'Number of modules cloned' },
                { field: 'stats.aiContextCloned', type: 'number', description: 'Number of AI contexts cloned' },
              ],
              notes: ['The clone name must be unique (case-insensitive).', 'includeContent is true by default; includeAIContext is false by default.', 'The source company remains unchanged.'],
              commonMistakes: ['Using a name that already exists — returns 409.', 'Not specifying includeAIContext when AI context cloning is needed.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.create'],
              relatedApis: ['bp-create-company', 'bp-get-company'],
            },
            {
              id: 'bp-validate-name',
              name: 'Validate Company Name',
              method: 'POST',
              path: '/api/companies/validate-name',
              purpose: 'Check if a company name, email, or URL is available (no duplicates) and valid.',
              whenToUse: 'Use this endpoint before creating a company to validate the name, email, and URL in real-time.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Company name to validate', email: 'string (optional) — Notification email to validate', websiteUrl: 'string (optional) — Website URL to validate', excludeId: 'string (optional) — Company ID to exclude from duplicate check (for updates)' },
              successResponse: { status: 200, description: 'Validation result', body: { valid: true } },
              errorResponses: [
                { code: 400, message: 'Validation error — name is required' },
                { code: 401, message: 'Not authenticated' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/companies/validate-name \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Acme Corp", "email": "admin@acme.com", "websiteUrl": "https://acme.com"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/companies/validate-name', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Acme Corp', email: 'admin@acme.com', websiteUrl: 'https://acme.com' }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/companies/validate-name',
  { name: 'Acme Corp', email: 'admin@acme.com', websiteUrl: 'https://acme.com' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Acme Corp', email: 'admin@acme.com' });
const options = { hostname: 'api.mengo.ai', path: '/api/companies/validate-name', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/companies/validate-name',
    json={'name': 'Acme Corp', 'email': 'admin@acme.com', 'websiteUrl': 'https://acme.com'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/companies/validate-name');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Acme Corp', 'email' => 'admin@acme.com']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'valid', type: 'boolean', description: 'Whether all checks passed' },
                { field: 'reason', type: 'string', description: 'If invalid: "duplicate", "gibberish", or "invalid"' },
                { field: 'field', type: 'string', description: 'If invalid: which field failed validation ("name", "email", or "url")' },
              ],
              notes: ['Checks for duplicate name, email, and URL (case-insensitive).', 'Also uses AI to detect gibberish names and invalid emails/URLs.', 'Returns { valid: true } when all checks pass.'],
              commonMistakes: ['Not using this endpoint before creating a company — may get a 409 duplicate error instead.'],
              rateLimits: '20 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['bp-create-company', 'bp-update-company'],
            },
            {
              id: 'bp-get-profile',
              name: 'Get Business Profile Data',
              method: 'GET',
              path: '/api/business-profiles/:companyId',
              purpose: 'Retrieve the business profile for a company — including name, stage, mission, vision, social profiles, and more.',
              whenToUse: 'Use this endpoint to fetch the company\'s full business profile information.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Business profile data', body: { _id: '...', name: 'Acme Corp', companyId: '...', stage: 'growth', mission: '...', vision: '...', description: '...', email: 'admin@acme.com', website: 'https://acme.com', country: 'India', city: 'Pune', socialProfiles: { linkedIn: '...', website: '...' }, isFounderPublic: true, isRevenuePublic: false, createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
                { code: 404, message: 'Business profile not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/business-profiles/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/business-profiles/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const profile = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/business-profiles/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/business-profiles/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/business-profiles/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/business-profiles/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Profile document ID' },
                { field: 'name', type: 'string', description: 'Business name' },
                { field: 'companyId', type: 'string', description: 'Company ID this profile belongs to' },
                { field: 'stage', type: 'string', description: 'Business stage (idea, mvp, early, growth, scale, established)' },
                { field: 'mission', type: 'string', description: 'Company mission statement' },
                { field: 'vision', type: 'string', description: 'Company vision statement' },
                { field: 'description', type: 'string', description: 'Short description' },
                { field: 'descriptionLong', type: 'string', description: 'Long description' },
                { field: 'coreValues', type: 'string', description: 'Core values' },
                { field: 'usp', type: 'string', description: 'Unique selling proposition' },
                { field: 'primaryIndustry', type: 'string', description: 'Primary industry' },
                { field: 'secondaryIndustries', type: 'string', description: 'Comma-separated secondary industries' },
                { field: 'targetGeography', type: 'string', description: 'Target geography/market' },
                { field: 'businessModel', type: 'string', description: 'Business model (b2b, b2c, saas, etc.)' },
                { field: 'primaryOffering', type: 'string', description: 'Primary product or service' },
                { field: 'email', type: 'string', description: 'Business email' },
                { field: 'website', type: 'string', description: 'Business website URL' },
                { field: 'phone', type: 'string', description: 'Contact phone number' },
                { field: 'country', type: 'string', description: 'Country' },
                { field: 'city', type: 'string', description: 'City' },
                { field: 'socialProfiles', type: 'object', description: 'Social media links (linkedIn, twitter, instagram, facebook, etc.)' },
                { field: 'isFounderPublic', type: 'boolean', description: 'Whether founder info is publicly visible' },
                { field: 'isRevenuePublic', type: 'boolean', description: 'Whether revenue info is publicly visible' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the profile was created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the profile was last updated' },
              ],
              notes: ['Returns a 404 if no business profile exists for the company yet.', 'Data is scoped to the authenticated user\'s company.'],
              commonMistakes: ['Using the profile _id instead of the companyId in the URL — the path parameter is the companyId, not the profile ID.', 'Expecting an empty object {} for missing profiles — this endpoint returns 404 instead.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'business-profile.view'],
              relatedApis: ['bp-create-profile', 'bp-update-profile', 'bp-get-company'],
            },
            {
              id: 'bp-create-profile',
              name: 'Create Business Profile',
              method: 'POST',
              path: '/api/business-profiles',
              purpose: 'Create a new business profile for a company.',
              whenToUse: 'Use this endpoint to set up a company\'s business profile for the first time.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required, 3-50 chars) — Business name', stage: 'string (required) — Business stage: idea, mvp, early, growth, scale, established', mission: 'string (optional) — Mission statement', vision: 'string (optional) — Vision statement', description: 'string (optional) — Short description', email: 'string (optional) — Business email', website: 'string (optional) — Website URL', country: 'string (optional) — Country', city: 'string (optional) — City' },
              successResponse: { status: 201, description: 'Business profile created', body: { _id: '...', name: 'Acme Corp', companyId: '...', stage: 'growth', mission: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (e.g. name too short, invalid stage, gibberish detected)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/business-profiles \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Acme Corp", "stage": "growth", "mission": "Our mission", "vision": "Our vision"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/business-profiles', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', stage: 'growth', mission: 'Our mission' }),
});
const profile = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/business-profiles',
  { companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', stage: 'growth', mission: 'Our mission' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', stage: 'growth' });
const options = { hostname: 'api.mengo.ai', path: '/api/business-profiles', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/business-profiles',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Acme Corp', 'stage': 'growth', 'mission': 'Our mission'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/business-profiles');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Acme Corp', 'stage' => 'growth']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New profile document ID' },
                { field: 'name', type: 'string', description: 'Business name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'stage', type: 'string', description: 'Business stage' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the profile was created' },
              ],
              notes: ['companyId and name are required fields. stage must be one of: idea, mvp, early, growth, scale, established.', 'The API validates for gibberish in names and descriptions.'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.', 'Using an invalid stage value — must be one of the six allowed values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.create'],
              relatedApis: ['bp-get-profile', 'bp-update-profile'],
            },
            {
              id: 'bp-update-profile',
              name: 'Update Business Profile',
              method: 'PUT',
              path: '/api/business-profiles/:id',
              purpose: 'Update an existing business profile.',
              whenToUse: 'Use this endpoint to modify any fields of an existing business profile (name, mission, vision, social profiles, etc.).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Business profile document ID (the _id field from GET response)' },
              ],
              requestBody: { name: 'string (optional) — Updated business name', mission: 'string (optional) — Updated mission', vision: 'string (optional) — Updated vision', description: 'string (optional) — Updated short description', email: 'string (optional) — Updated email', website: 'string (optional) — Updated website', country: 'string (optional) — Updated country', city: 'string (optional) — Updated city' },
              successResponse: { status: 200, description: 'Business profile updated', body: { _id: '...', name: 'Updated Corp', mission: 'Updated mission', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Business profile not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/business-profiles/PROFILE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"mission": "Updated mission", "vision": "Updated vision"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/business-profiles/PROFILE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ mission: 'Updated mission', vision: 'Updated vision' }),
});
const profile = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/business-profiles/PROFILE_ID',
  { mission: 'Updated mission', vision: 'Updated vision' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ mission: 'Updated mission' });
const options = { hostname: 'api.mengo.ai', path: '/api/business-profiles/PROFILE_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/business-profiles/PROFILE_ID',
    json={'mission': 'Updated mission', 'vision': 'Updated vision'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/business-profiles/PROFILE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['mission' => 'Updated mission']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Profile document ID' },
                { field: 'name', type: 'string', description: 'Updated business name' },
                { field: 'mission', type: 'string', description: 'Updated mission statement' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the profile was last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the profile _id (not the companyId). Get it from the GET response.'],
              commonMistakes: ['Using companyId in the URL path instead of the profile _id — the PUT endpoint uses the profile document ID.', 'Using PATCH instead of PUT — this endpoint uses PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'business-profile.edit'],
              relatedApis: ['bp-get-profile', 'bp-create-profile'],
            },
          ],
        },
        // --- Founders ---
        {
          id: 'founders',
          name: 'Founders',
          description: 'Manage company founders — list, create, update, and delete founder profiles.',
          endpoints: [
            {
              id: 'founder-get-all',
              name: 'Get All Founders',
              method: 'GET',
              path: '/api/founders/:companyId',
              purpose: 'Retrieve all founders for a company.',
              whenToUse: 'Use this endpoint to list all founders associated with a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of founders', body: [{ _id: '...', name: 'Jane Doe', designation: 'CEO', email: 'jane@acme.com', companyId: '...', expertise: ['marketing', 'strategy'], responsibilityArea: 'vision', bio: '...', socialProfiles: { linkedIn: '...' }, createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/founders/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/founders/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const founders = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/founders/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/founders/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/founders/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/founders/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Founder document ID' },
                { field: '[].name', type: 'string', description: 'Founder name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].designation', type: 'string', description: 'Job title / designation' },
                { field: '[].email', type: 'string', description: 'Founder email' },
                { field: '[].phone', type: 'string', description: 'Phone number' },
                { field: '[].country', type: 'string', description: 'Country' },
                { field: '[].city', type: 'string', description: 'City' },
                { field: '[].expertise', type: 'string[]', description: 'Areas of expertise' },
                { field: '[].responsibilityArea', type: 'string', description: 'Primary responsibility area (vision, tech, sales, etc.)' },
                { field: '[].bio', type: 'string', description: 'Biography' },
                { field: '[].socialProfiles', type: 'object', description: 'Social media links (linkedIn, twitter, etc.)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the founder was created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when the founder was last updated' },
              ],
              notes: ['Returns an empty array if no founders exist for the company.', 'Only returns founders for companies the authenticated user has access to.'],
              commonMistakes: ['Using the founder _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'founders.view'],
              relatedApis: ['founder-get-detail', 'founder-create'],
            },
            {
              id: 'founder-get-detail',
              name: 'Get Founder Detail',
              method: 'GET',
              path: '/api/founders/detail/:id',
              purpose: 'Retrieve a single founder by their document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific founder.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'Founder details', body: { _id: '...', name: 'Jane Doe', designation: 'CEO', email: 'jane@acme.com', phone: '1234567890', phoneCountryCode: '+1', city: 'San Francisco', state: 'CA', country: 'USA', dateOfBirth: '1985-06-15', workAnniversary: '2015-03-01', expertise: ['marketing', 'strategy'], responsibilityArea: 'vision', bio: '...', socialProfiles: { linkedIn: 'https://linkedin.com/in/janedoe' }, assets: [], photos: [], companyId: '...', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/founders/detail/FOUNDER_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/founders/detail/FOUNDER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const founder = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/founders/detail/FOUNDER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/founders/detail/FOUNDER_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/founders/detail/FOUNDER_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/founders/detail/FOUNDER_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Founder document ID' },
                { field: 'name', type: 'string', description: 'Founder name' },
                { field: 'designation', type: 'string', description: 'Job title / designation' },
                { field: 'email', type: 'string', description: 'Founder email' },
                { field: 'phone', type: 'string', description: 'Phone number' },
                { field: 'phoneCountryCode', type: 'string', description: 'Phone country code (e.g. +1, +91)' },
                { field: 'city', type: 'string', description: 'City' },
                { field: 'state', type: 'string', description: 'State / province' },
                { field: 'country', type: 'string', description: 'Country' },
                { field: 'dateOfBirth', type: 'string', description: 'Date of birth (YYYY-MM-DD)' },
                { field: 'workAnniversary', type: 'string', description: 'Work anniversary date (YYYY-MM-DD)' },
                { field: 'expertise', type: 'string[]', description: 'Areas of expertise' },
                { field: 'responsibilityArea', type: 'string', description: 'Primary responsibility (vision, tech, sales, marketing, operations, finance, product, hr)' },
                { field: 'bio', type: 'string', description: 'Biography text' },
                { field: 'socialProfiles', type: 'object', description: 'Social media links' },
                { field: 'assets', type: 'array', description: 'Founder assets (headshots, bios, resumes, etc.)' },
                { field: 'photos', type: 'string[]', description: 'Photo URLs' },
                { field: 'companyId', type: 'string', description: 'Company ID this founder belongs to' },
              ],
              notes: ['The id path parameter is the founder document _id, not the companyId.', 'Access is verified — you can only view founders of companies you belong to.'],
              commonMistakes: ['Using companyId instead of the founder _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'founders.view'],
              relatedApis: ['founder-get-all', 'founder-update'],
            },
            {
              id: 'founder-create',
              name: 'Create Founder',
              method: 'POST',
              path: '/api/founders',
              purpose: 'Create a new founder profile for a company.',
              whenToUse: 'Use this endpoint to add a founder/co-founder to a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — Founder name', designation: 'string (optional) — Job title', email: 'string (optional) — Email address', phone: 'string (optional) — Phone number', phoneCountryCode: 'string (optional but required if phone is provided) — Country code e.g. +1', city: 'string (optional) — City', country: 'string (optional) — Country', expertise: 'string[] (optional) — Areas of expertise', responsibilityArea: 'string (optional) — One of: vision, tech, sales, marketing, operations, finance, product, hr', bio: 'string (optional) — Biography', socialProfiles: 'object (optional) — Social media links' },
              successResponse: { status: 201, description: 'Founder created', body: { _id: '...', name: 'Jane Doe', designation: 'CEO', companyId: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (e.g. name is required, phoneCountryCode missing)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/founders \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Jane Doe", "designation": "CEO", "email": "jane@acme.com"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/founders', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Jane Doe', designation: 'CEO' }),
});
const founder = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/founders',
  { companyId: 'YOUR_COMPANY_ID', name: 'Jane Doe', designation: 'CEO' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Jane Doe', designation: 'CEO' });
const options = { hostname: 'api.mengo.ai', path: '/api/founders', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/founders',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Jane Doe', 'designation': 'CEO'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/founders');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Jane Doe', 'designation' => 'CEO']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New founder document ID' },
                { field: 'name', type: 'string', description: 'Founder name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'designation', type: 'string', description: 'Job title' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the founder was created' },
              ],
              notes: ['companyId and name are required fields.', 'If you provide a phone number, phoneCountryCode is also required.'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.', 'Providing a phone number without the phoneCountryCode field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'founders.create'],
              relatedApis: ['founder-get-all', 'founder-update', 'founder-delete'],
            },
            {
              id: 'founder-update',
              name: 'Update Founder',
              method: 'PUT',
              path: '/api/founders/:id',
              purpose: 'Update an existing founder profile.',
              whenToUse: 'Use this endpoint to modify any fields of an existing founder profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', designation: 'string (optional) — Updated designation', email: 'string (optional) — Updated email', phone: 'string (optional) — Updated phone', phoneCountryCode: 'string (optional) — Updated phone country code', city: 'string (optional) — Updated city', country: 'string (optional) — Updated country', expertise: 'string[] (optional) — Updated expertise areas', responsibilityArea: 'string (optional) — Updated responsibility area', bio: 'string (optional) — Updated biography', socialProfiles: 'object (optional) — Updated social media links' },
              successResponse: { status: 200, description: 'Founder updated', body: { _id: '...', name: 'Jane Doe', designation: 'CTO', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/founders/FOUNDER_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"designation": "CTO", "bio": "Updated biography"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/founders/FOUNDER_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ designation: 'CTO', bio: 'Updated biography' }),
});
const founder = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/founders/FOUNDER_ID',
  { designation: 'CTO', bio: 'Updated biography' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ designation: 'CTO' });
const options = { hostname: 'api.mengo.ai', path: '/api/founders/FOUNDER_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/founders/FOUNDER_ID',
    json={'designation': 'CTO', 'bio': 'Updated biography'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/founders/FOUNDER_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['designation' => 'CTO']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Founder document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'designation', type: 'string', description: 'Updated designation' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the founder was last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the founder _id, not the companyId.'],
              commonMistakes: ['Using companyId in the URL path instead of the founder _id.', 'Using PATCH instead of PUT — this endpoint uses PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'founders.edit'],
              relatedApis: ['founder-get-detail', 'founder-create'],
            },
            {
              id: 'founder-delete',
              name: 'Delete Founder',
              method: 'DELETE',
              path: '/api/founders/:id',
              purpose: 'Permanently delete a founder profile.',
              whenToUse: 'Use this endpoint to remove a founder from the company. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Founder deleted', body: { message: 'Founder deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/founders/FOUNDER_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/founders/FOUNDER_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/founders/FOUNDER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/founders/FOUNDER_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/founders/FOUNDER_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/founders/FOUNDER_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the founder ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'founders.delete'],
              relatedApis: ['founder-get-detail', 'founder-get-all'],
            },
          ],
        },
        // --- Employees ---
        {
          id: 'employees',
          name: 'Employees',
          description: 'Manage company employees — list, create, update, and delete employee profiles.',
          endpoints: [
            {
              id: 'employee-get-all',
              name: 'Get All Employees',
              method: 'GET',
              path: '/api/employees/:companyId',
              purpose: 'Retrieve all employees for a company.',
              whenToUse: 'Use this endpoint to list all employees associated with a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of employees', body: [{ _id: '...', name: 'John Smith', designation: 'Software Engineer', department: 'engineering', level: 'senior', email: 'john@acme.com', companyId: '...', expertise: ['javascript', 'react'], responsibilityArea: 'tech', bio: '...', socialProfiles: {}, createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/employees/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const employees = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/employees/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/employees/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/employees/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Employee document ID' },
                { field: '[].name', type: 'string', description: 'Employee name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].designation', type: 'string', description: 'Job title / designation' },
                { field: '[].department', type: 'string', description: 'Department (engineering, marketing, sales, design, operations, hr, finance, customer-success, product, legal, other)' },
                { field: '[].level', type: 'string', description: 'Employee level (intern, junior, mid, senior, lead, manager, director, vp, c-suite)' },
                { field: '[].email', type: 'string', description: 'Employee email' },
                { field: '[].phone', type: 'string', description: 'Phone number' },
                { field: '[].country', type: 'string', description: 'Country' },
                { field: '[].city', type: 'string', description: 'City' },
                { field: '[].expertise', type: 'string[]', description: 'Areas of expertise' },
                { field: '[].responsibilityArea', type: 'string', description: 'Responsibility area (vision, tech, sales, marketing, operations, finance, product, hr)' },
                { field: '[].bio', type: 'string', description: 'Biography' },
                { field: '[].socialProfiles', type: 'object', description: 'Social media links' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the employee was created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty array if no employees exist for the company.', 'Only returns employees for companies the authenticated user has access to.'],
              commonMistakes: ['Using the employee _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'employees.view'],
              relatedApis: ['employee-get-detail', 'employee-create'],
            },
            {
              id: 'employee-get-detail',
              name: 'Get Employee Detail',
              method: 'GET',
              path: '/api/employees/detail/:id',
              purpose: 'Retrieve a single employee by their document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific employee.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Employee document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'Employee details', body: { _id: '...', name: 'John Smith', designation: 'Software Engineer', department: 'engineering', level: 'senior', email: 'john@acme.com', phone: '1234567890', phoneCountryCode: '+1', city: 'San Francisco', state: 'CA', country: 'USA', dateOfBirth: '1990-03-15', workAnniversary: '2020-06-01', expertise: ['javascript', 'react'], responsibilityArea: 'tech', reportsTo: '...', bio: '...', socialProfiles: { linkedIn: 'https://linkedin.com/in/johnsmith' }, assets: [], photos: [], companyId: '...', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Employee not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/employees/detail/EMPLOYEE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees/detail/EMPLOYEE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const employee = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/employees/detail/EMPLOYEE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/employees/detail/EMPLOYEE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/employees/detail/EMPLOYEE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees/detail/EMPLOYEE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Employee document ID' },
                { field: 'name', type: 'string', description: 'Employee name' },
                { field: 'designation', type: 'string', description: 'Job title / designation' },
                { field: 'department', type: 'string', description: 'Department' },
                { field: 'level', type: 'string', description: 'Employee level (intern, junior, mid, senior, lead, manager, director, vp, c-suite)' },
                { field: 'email', type: 'string', description: 'Employee email' },
                { field: 'phone', type: 'string', description: 'Phone number' },
                { field: 'phoneCountryCode', type: 'string', description: 'Phone country code' },
                { field: 'city', type: 'string', description: 'City' },
                { field: 'state', type: 'string', description: 'State / province' },
                { field: 'country', type: 'string', description: 'Country' },
                { field: 'dateOfBirth', type: 'string', description: 'Date of birth (YYYY-MM-DD)' },
                { field: 'workAnniversary', type: 'string', description: 'Work anniversary date' },
                { field: 'expertise', type: 'string[]', description: 'Areas of expertise' },
                { field: 'responsibilityArea', type: 'string', description: 'Responsibility area' },
                { field: 'reportsTo', type: 'string', description: 'Name or ID of the person this employee reports to' },
                { field: 'bio', type: 'string', description: 'Biography text' },
                { field: 'socialProfiles', type: 'object', description: 'Social media links' },
                { field: 'assets', type: 'array', description: 'Employee assets' },
                { field: 'photos', type: 'string[]', description: 'Photo URLs' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
              ],
              notes: ['The id path parameter is the employee document _id, not the companyId.', 'Access is verified — you can only view employees of companies you belong to.'],
              commonMistakes: ['Using companyId instead of the employee _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'employees.view'],
              relatedApis: ['employee-get-all', 'employee-update'],
            },
            {
              id: 'employee-create',
              name: 'Create Employee',
              method: 'POST',
              path: '/api/employees',
              purpose: 'Create a new employee profile for a company.',
              whenToUse: 'Use this endpoint to add an employee to a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — Employee name', designation: 'string (optional) — Job title', department: 'string (optional) — One of: engineering, marketing, sales, design, operations, hr, finance, customer-success, product, legal, other', level: 'string (optional) — One of: intern, junior, mid, senior, lead, manager, director, vp, c-suite', email: 'string (optional) — Email address (must be unique within company)', phone: 'string (optional) — Phone number', phoneCountryCode: 'string (optional but required if phone provided) — Country code e.g. +1', city: 'string (optional) — City', country: 'string (optional) — Country', expertise: 'string[] (optional) — Areas of expertise', responsibilityArea: 'string (optional) — One of: vision, tech, sales, marketing, operations, finance, product, hr', bio: 'string (optional) — Biography', socialProfiles: 'object (optional) — Social media links' },
              successResponse: { status: 201, description: 'Employee created', body: { _id: '...', name: 'John Smith', designation: 'Software Engineer', department: 'engineering', level: 'senior', companyId: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (e.g. name required, duplicate name/email, phoneCountryCode missing)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/employees \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "John Smith", "designation": "Software Engineer", "department": "engineering", "level": "senior"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'John Smith', designation: 'Software Engineer', department: 'engineering' }),
});
const employee = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/employees',
  { companyId: 'YOUR_COMPANY_ID', name: 'John Smith', designation: 'Software Engineer', department: 'engineering' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'John Smith', designation: 'Software Engineer' });
const options = { hostname: 'api.mengo.ai', path: '/api/employees', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/employees',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'John Smith', 'designation': 'Software Engineer', 'department': 'engineering'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'John Smith', 'designation' => 'Software Engineer']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New employee document ID' },
                { field: 'name', type: 'string', description: 'Employee name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'designation', type: 'string', description: 'Job title' },
                { field: 'department', type: 'string', description: 'Department' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the employee was created' },
              ],
              notes: ['companyId and name are required fields.', 'Employee name and email must be unique within a company.', 'If you provide a phone number, phoneCountryCode is also required.'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Creating an employee with a name or email that already exists in the company — will return 400.', 'Providing a phone number without phoneCountryCode.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'employees.create'],
              relatedApis: ['employee-get-all', 'employee-update', 'employee-delete'],
            },
            {
              id: 'employee-update',
              name: 'Update Employee',
              method: 'PUT',
              path: '/api/employees/:id',
              purpose: 'Update an existing employee profile.',
              whenToUse: 'Use this endpoint to modify any fields of an existing employee profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Employee document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', designation: 'string (optional) — Updated designation', department: 'string (optional) — Updated department', level: 'string (optional) — Updated level', email: 'string (optional) — Updated email (must be unique)', phone: 'string (optional) — Updated phone', phoneCountryCode: 'string (optional) — Updated phone country code', city: 'string (optional) — Updated city', country: 'string (optional) — Updated country', expertise: 'string[] (optional) — Updated expertise areas', responsibilityArea: 'string (optional) — Updated responsibility area', bio: 'string (optional) — Updated biography', socialProfiles: 'object (optional) — Updated social media links' },
              successResponse: { status: 200, description: 'Employee updated', body: { _id: '...', name: 'John Smith', designation: 'Senior Engineer', department: 'engineering', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (e.g. duplicate name/email)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Employee not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/employees/EMPLOYEE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"designation": "Senior Engineer", "level": "senior"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees/EMPLOYEE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ designation: 'Senior Engineer', level: 'senior' }),
});
const employee = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/employees/EMPLOYEE_ID',
  { designation: 'Senior Engineer', level: 'senior' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ designation: 'Senior Engineer' });
const options = { hostname: 'api.mengo.ai', path: '/api/employees/EMPLOYEE_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/employees/EMPLOYEE_ID',
    json={'designation': 'Senior Engineer', 'level': 'senior'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees/EMPLOYEE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['designation' => 'Senior Engineer']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Employee document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'designation', type: 'string', description: 'Updated designation' },
                { field: 'department', type: 'string', description: 'Updated department' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the employee _id, not the companyId.', 'Updating name or email checks for duplicates within the same company.'],
              commonMistakes: ['Using companyId in the URL path instead of the employee _id.', 'Using PATCH instead of PUT — this endpoint uses PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'employees.edit'],
              relatedApis: ['employee-get-detail', 'employee-create'],
            },
            {
              id: 'employee-delete',
              name: 'Delete Employee',
              method: 'DELETE',
              path: '/api/employees/:id',
              purpose: 'Permanently delete an employee profile.',
              whenToUse: 'Use this endpoint to remove an employee from the company. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Employee document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Employee deleted', body: { message: 'Employee deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Employee not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/employees/EMPLOYEE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees/EMPLOYEE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/employees/EMPLOYEE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/employees/EMPLOYEE_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/employees/EMPLOYEE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees/EMPLOYEE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the employee ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'employees.delete'],
              relatedApis: ['employee-get-detail', 'employee-get-all'],
            },
            {
              id: 'employee-clear-all',
              name: 'Clear All Employees',
              method: 'DELETE',
              path: '/api/employees/clear/:companyId',
              purpose: 'Delete all employees for a company at once.',
              whenToUse: 'Use this endpoint to remove all employees from a company in a single operation. This is useful for resetting or bulk-clearing employee data.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to clear all employees from' },
              ],
              successResponse: { status: 200, description: 'All employees cleared', body: { message: 'Employees cleared successfully', deletedCount: 15 } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/employees/clear/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/employees/clear/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/employees/clear/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/employees/clear/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/employees/clear/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/employees/clear/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
                { field: 'deletedCount', type: 'number', description: 'Number of employees deleted' },
              ],
              notes: ['This is a bulk delete operation — all employees for the company are permanently removed.', 'This action cannot be undone.'],
              commonMistakes: ['Using the employee _id instead of companyId — this endpoint uses companyId, not employee ID.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'employees.delete'],
              relatedApis: ['employee-delete', 'employee-get-all'],
            },
          ],
        },
        // --- Products ---
        {
          id: 'products',
          name: 'Products',
          description: 'Manage products and product categories — list, create, update, and delete.',
          endpoints: [
            {
              id: 'product-get-all',
              name: 'Get All Products',
              method: 'GET',
              path: '/api/products/:companyId',
              purpose: 'Retrieve all products for a company.',
              whenToUse: 'Use this endpoint to list all products associated with a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of products', body: [{ _id: '...', name: 'Cloud Platform', categoryId: '...', price: 29.99, currency: 'USD', status: 'active', audienceType: 'b2b', usp: '...', description: '...', features: ['fast', 'reliable'], companyId: '...', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/products/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const products = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/products/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/products/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/products/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Product document ID' },
                { field: '[].name', type: 'string', description: 'Product name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].categoryId', type: 'string', description: 'Product category ID' },
                { field: '[].price', type: 'number', description: 'Product price' },
                { field: '[].currency', type: 'string', description: 'Currency code (INR, USD, EUR, GBP, AED)' },
                { field: '[].status', type: 'string', description: 'Product status (active, draft, discontinued)' },
                { field: '[].audienceType', type: 'string', description: 'Audience type (b2b, b2c, both)' },
                { field: '[].usp', type: 'string', description: 'Unique selling proposition' },
                { field: '[].description', type: 'string', description: 'Product description' },
                { field: '[].features', type: 'string[]', description: 'List of product features' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the product was created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty array if no products exist for the company.'],
              commonMistakes: ['Using the product _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'products.view'],
              relatedApis: ['product-get-detail', 'product-create'],
            },
            {
              id: 'product-get-detail',
              name: 'Get Product Detail',
              method: 'GET',
              path: '/api/products/detail/:id',
              purpose: 'Retrieve a single product by its document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific product.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Product document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'Product details', body: { _id: '...', name: 'Cloud Platform', categoryId: '...', price: 29.99, currency: 'USD', status: 'active', audienceType: 'b2b', usp: 'Fast and reliable', description: '...', features: ['fast', 'reliable'], icpIds: [], personaIds: [], marketingCopy: '...', images: [], catalogPdfUrl: '', videoUrls: [], designUrl: '', companyId: '...', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Product not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/products/detail/PRODUCT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products/detail/PRODUCT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const product = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/products/detail/PRODUCT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/products/detail/PRODUCT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/products/detail/PRODUCT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products/detail/PRODUCT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Product document ID' },
                { field: 'name', type: 'string', description: 'Product name' },
                { field: 'categoryId', type: 'string', description: 'Product category ID' },
                { field: 'price', type: 'number', description: 'Product price' },
                { field: 'currency', type: 'string', description: 'Currency code (INR, USD, EUR, GBP, AED)' },
                { field: 'status', type: 'string', description: 'Status (active, draft, discontinued)' },
                { field: 'audienceType', type: 'string', description: 'Audience type (b2b, b2c, both)' },
                { field: 'usp', type: 'string', description: 'Unique selling proposition' },
                { field: 'description', type: 'string', description: 'Product description' },
                { field: 'features', type: 'string[]', description: 'List of product features' },
                { field: 'icpIds', type: 'string[]', description: 'Linked ICP IDs' },
                { field: 'personaIds', type: 'string[]', description: 'Linked persona IDs' },
                { field: 'marketingCopy', type: 'string', description: 'Marketing copy text' },
                { field: 'images', type: 'string[]', description: 'Image URLs' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
              ],
              notes: ['The id path parameter is the product document _id, not the companyId.'],
              commonMistakes: ['Using companyId instead of the product _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'products.view'],
              relatedApis: ['product-get-all', 'product-update'],
            },
            {
              id: 'product-create',
              name: 'Create Product',
              method: 'POST',
              path: '/api/products',
              purpose: 'Create a new product for a company.',
              whenToUse: 'Use this endpoint to add a product to a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — Product name', status: 'string (required) — One of: active, draft, discontinued', audienceType: 'string (required) — One of: b2b, b2c, both', categoryId: 'string (optional) — Product category ID', price: 'number (optional) — Product price', currency: 'string (optional) — One of: INR, USD, EUR, GBP, AED (defaults to INR)', usp: 'string (optional) — Unique selling proposition', description: 'string (optional) — Product description', features: 'string[] (optional) — List of features', marketingCopy: 'string (optional) — Marketing copy' },
              successResponse: { status: 201, description: 'Product created', body: { _id: '...', name: 'Cloud Platform', status: 'draft', audienceType: 'b2b', companyId: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name required, invalid status/audienceType)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/products \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Cloud Platform", "status": "draft", "audienceType": "b2b", "price": 29.99, "currency": "USD"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Cloud Platform', status: 'draft', audienceType: 'b2b', price: 29.99 }),
});
const product = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/products',
  { companyId: 'YOUR_COMPANY_ID', name: 'Cloud Platform', status: 'draft', audienceType: 'b2b', price: 29.99 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Cloud Platform', status: 'draft', audienceType: 'b2b' });
const options = { hostname: 'api.mengo.ai', path: '/api/products', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/products',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Cloud Platform', 'status': 'draft', 'audienceType': 'b2b', 'price': 29.99},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Cloud Platform', 'status' => 'draft', 'audienceType' => 'b2b']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New product document ID' },
                { field: 'name', type: 'string', description: 'Product name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'status', type: 'string', description: 'Product status' },
                { field: 'audienceType', type: 'string', description: 'Audience type' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the product was created' },
              ],
              notes: ['companyId, name, status, and audienceType are required fields.', 'status must be one of: active, draft, discontinued.', 'audienceType must be one of: b2b, b2c, both.', 'currency defaults to INR if not provided.'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Using an invalid status or audienceType value.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'products.create'],
              relatedApis: ['product-get-all', 'product-update', 'product-delete'],
            },
            {
              id: 'product-update',
              name: 'Update Product',
              method: 'PUT',
              path: '/api/products/:id',
              purpose: 'Update an existing product.',
              whenToUse: 'Use this endpoint to modify any fields of an existing product.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Product document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', status: 'string (optional) — Updated status', audienceType: 'string (optional) — Updated audience type', price: 'number (optional) — Updated price', usp: 'string (optional) — Updated USP', description: 'string (optional) — Updated description', features: 'string[] (optional) — Updated features', marketingCopy: 'string (optional) — Updated marketing copy' },
              successResponse: { status: 200, description: 'Product updated', body: { _id: '...', name: 'Cloud Platform Pro', status: 'active', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Product not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/products/PRODUCT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Cloud Platform Pro", "status": "active"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products/PRODUCT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Cloud Platform Pro', status: 'active' }),
});
const product = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/products/PRODUCT_ID',
  { name: 'Cloud Platform Pro', status: 'active' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Cloud Platform Pro', status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/products/PRODUCT_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type: 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/products/PRODUCT_ID',
    json={'name': 'Cloud Platform Pro', 'status': 'active'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products/PRODUCT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Cloud Platform Pro']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Product document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the product _id, not the companyId.'],
              commonMistakes: ['Using companyId in the URL path instead of the product _id.', 'Using PATCH instead of PUT — this endpoint uses PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'products.edit'],
              relatedApis: ['product-get-detail', 'product-create'],
            },
            {
              id: 'product-delete',
              name: 'Delete Product',
              method: 'DELETE',
              path: '/api/products/:id',
              purpose: 'Permanently delete a product.',
              whenToUse: 'Use this endpoint to remove a product. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Product document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Product deleted', body: { message: 'Product deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Product not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/products/PRODUCT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products/PRODUCT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/products/PRODUCT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/products/PRODUCT_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/products/PRODUCT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products/PRODUCT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the product ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'products.delete'],
              relatedApis: ['product-get-detail', 'product-get-all'],
            },
            {
              id: 'product-categories',
              name: 'Get Product Categories',
              method: 'GET',
              path: '/api/products/categories/:companyId',
              purpose: 'Retrieve all product categories for a company.',
              whenToUse: 'Use this endpoint to list all product categories (used to organize products).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of product categories', body: [{ _id: '...', name: 'Software', companyId: '...', description: 'Software products', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/products/categories/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/products/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const categories = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/products/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/products/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/products/categories/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/products/categories/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Category document ID' },
                { field: '[].name', type: 'string', description: 'Category name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].description', type: 'string', description: 'Category description' },
              ],
              notes: ['Categories are sorted alphabetically by name.', 'Returns an empty array if no categories exist.'],
              commonMistakes: ['Using the category _id instead of companyId in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'products.view'],
              relatedApis: ['product-get-all', 'product-create'],
            },
          ],
        },
        // --- ICP & Personas ---
        {
          id: 'icp-personas',
          name: 'ICP & Personas',
          description: 'Manage Ideal Customer Profiles and buyer personas.',
          endpoints: [
            {
              id: 'icp-get-all',
              name: 'Get All ICPs',
              method: 'GET',
              path: '/api/icps/:companyId',
              purpose: 'Retrieve all Ideal Customer Profiles (ICPs) for a company.',
              whenToUse: 'Use this endpoint to list all ICPs associated with a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of ICPs', body: [{ _id: '...', name: 'Tech Startups', companyId: '...', description: '...', isActive: true, status: 'active', industry: 'technology', companySize: '1-50', location: 'USA', revenueRange: '$1M-$10M', fitScore: 85, priority: 'high', personaIds: ['...'], productIds: ['...'], createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/icps/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/icps/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst icps = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/icps/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/icps/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/icps/YOUR_COMPANY_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/icps/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'ICP document ID' },
                { field: '[].name', type: 'string', description: 'ICP name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].description', type: 'string', description: 'ICP description' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the ICP is active' },
                { field: '[].status', type: 'string', description: 'Status (active, draft, in-review, archived)' },
                { field: '[].industry', type: 'string', description: 'Target industry' },
                { field: '[].companySize', type: 'string', description: 'Target company size' },
                { field: '[].location', type: 'string', description: 'Target location' },
                { field: '[].revenueRange', type: 'string', description: 'Target revenue range' },
                { field: '[].fundingStage', type: 'string', description: 'Funding stage (bootstrapped, seed, series-a, etc.)' },
                { field: '[].fitScore', type: 'number', description: 'Fit score (0-100)' },
                { field: '[].priority', type: 'string', description: 'Priority (low, medium, high)' },
                { field: '[].personaIds', type: 'string[]', description: 'Linked persona IDs' },
                { field: '[].productIds', type: 'string[]', description: 'Linked product IDs' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the ICP was created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty array if no ICPs exist for the company.'],
              commonMistakes: ['Using the ICP _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'icp-personas.view'],
              relatedApis: ['icp-get-detail', 'icp-create', 'persona-get-all'],
            },
            {
              id: 'icp-get-detail',
              name: 'Get ICP Detail',
              method: 'GET',
              path: '/api/icps/detail/:id',
              purpose: 'Retrieve a single ICP by its document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific ICP.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'ICP document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'ICP details', body: { _id: '...', name: 'Tech Startups', companyId: '...', description: '...', isActive: true, status: 'active', industry: 'technology', companySize: '1-50', location: 'USA', revenueRange: '$1M-$10M', fundingStage: 'seed', employeeCount: 25, techStack: ['React', 'Node.js'], toolsUsed: ['Slack', 'Jira'], platforms: ['AWS'], buyingProcess: '...', decisionTimeframe: '...', budgetAuthority: 'high', priceSensitivity: 'medium', businessGoals: ['growth', 'scale'], challenges: ['hiring', 'market'], painPoints: ['...'], priorities: ['...'], triggerEvents: ['...'], fitScore: 85, priority: 'high', personaIds: ['...'], productIds: ['...'], createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'ICP not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/icps/detail/ICP_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/icps/detail/ICP_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst icp = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/icps/detail/ICP_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/icps/detail/ICP_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/icps/detail/ICP_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/icps/detail/ICP_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'ICP document ID' },
                { field: 'name', type: 'string', description: 'ICP name' },
                { field: 'description', type: 'string', description: 'ICP description' },
                { field: 'isActive', type: 'boolean', description: 'Whether active' },
                { field: 'status', type: 'string', description: 'Status (active, draft, in-review, archived)' },
                { field: 'industry', type: 'string', description: 'Target industry' },
                { field: 'companySize', type: 'string', description: 'Target company size' },
                { field: 'location', type: 'string', description: 'Target location' },
                { field: 'revenueRange', type: 'string', description: 'Target revenue range' },
                { field: 'fundingStage', type: 'string', description: 'Funding stage' },
                { field: 'techStack', type: 'string[]', description: 'Technology stack' },
                { field: 'toolsUsed', type: 'string[]', description: 'Tools used' },
                { field: 'businessGoals', type: 'string[]', description: 'Business goals' },
                { field: 'challenges', type: 'string[]', description: 'Challenges' },
                { field: 'painPoints', type: 'string[]', description: 'Pain points' },
                { field: 'fitScore', type: 'number', description: 'Fit score (0-100)' },
                { field: 'priority', type: 'string', description: 'Priority (low, medium, high)' },
                { field: 'personaIds', type: 'string[]', description: 'Linked persona IDs' },
                { field: 'productIds', type: 'string[]', description: 'Linked product IDs' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
              ],
              notes: ['The id path parameter is the ICP document _id, not the companyId.'],
              commonMistakes: ['Using companyId instead of the ICP _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'icp-personas.view'],
              relatedApis: ['icp-get-all', 'icp-update'],
            },
            {
              id: 'icp-create',
              name: 'Create ICP',
              method: 'POST',
              path: '/api/icps',
              purpose: 'Create a new Ideal Customer Profile for a company.',
              whenToUse: 'Use this endpoint to add an ICP to a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — ICP name', description: 'string (optional) — Description', industry: 'string (optional) — Target industry', companySize: 'string (optional) — Target company size', location: 'string (optional) — Target location', revenueRange: 'string (optional) — Target revenue range', fundingStage: 'string (optional) — One of: bootstrapped, seed, series-a, series-b, series-c, ipo, enterprise', fitScore: 'number (optional, 0-100) — Fit score', priority: 'string (optional) — One of: low, medium, high', personaIds: 'string[] (optional) — Linked persona IDs', productIds: 'string[] (optional) — Linked product IDs' },
              successResponse: { status: 201, description: 'ICP created', body: { _id: '...', name: 'Tech Startups', companyId: '...', isActive: true, status: 'active', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/icps \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Tech Startups", "industry": "technology", "priority": "high"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/icps', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Tech Startups', industry: 'technology', priority: 'high' }),\n});\nconst icp = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/icps',\n  { companyId: 'YOUR_COMPANY_ID', name: 'Tech Startups', industry: 'technology', priority: 'high' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Tech Startups', industry: 'technology' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/icps', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(payload); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/icps',\n    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Tech Startups', 'industry': 'technology', 'priority': 'high'},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/icps');\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Tech Startups']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New ICP document ID' },
                { field: 'name', type: 'string', description: 'ICP name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'isActive', type: 'boolean', description: 'Whether the ICP is active (defaults to true)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the ICP was created' },
              ],
              notes: ['companyId and name are required fields.', 'isActive defaults to true. status defaults to active.'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.create'],
              relatedApis: ['icp-get-all', 'icp-update', 'icp-delete'],
            },
            {
              id: 'icp-update',
              name: 'Update ICP',
              method: 'PUT',
              path: '/api/icps/:id',
              purpose: 'Update an existing ICP.',
              whenToUse: 'Use this endpoint to modify any fields of an existing ICP.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'ICP document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', description: 'string (optional) — Updated description', industry: 'string (optional) — Updated industry', companySize: 'string (optional) — Updated company size', location: 'string (optional) — Updated location', fitScore: 'number (optional) — Updated fit score (0-100)', priority: 'string (optional) — Updated priority', businessGoals: 'string[] (optional) — Updated goals', challenges: 'string[] (optional) — Updated challenges', painPoints: 'string[] (optional) — Updated pain points', personaIds: 'string[] (optional) — Updated linked persona IDs', productIds: 'string[] (optional) — Updated linked product IDs' },
              successResponse: { status: 200, description: 'ICP updated', body: { _id: '...', name: 'Tech Startups', priority: 'high', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'ICP not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/icps/ICP_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"priority": "high", "fitScore": 90}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/icps/ICP_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ priority: 'high', fitScore: 90 }),\n});\nconst icp = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/icps/ICP_ID',\n  { priority: 'high', fitScore: 90 },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ priority: 'high', fitScore: 90 });\nconst options = { hostname: 'api.mengo.ai', path: '/api/icps/ICP_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests\nresponse = requests.put('https://app.mengoengine.com/api/icps/ICP_ID',\n    json={'priority': 'high', 'fitScore': 90},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/icps/ICP_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['priority' => 'high']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'ICP document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'priority', type: 'string', description: 'Updated priority' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the ICP _id, not the companyId.'],
              commonMistakes: ['Using companyId in the URL path instead of the ICP _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.edit'],
              relatedApis: ['icp-get-detail', 'icp-create'],
            },
            {
              id: 'icp-delete',
              name: 'Delete ICP',
              method: 'DELETE',
              path: '/api/icps/:id',
              purpose: 'Permanently delete an ICP.',
              whenToUse: 'Use this endpoint to remove an ICP. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'ICP document ID to delete' },
              ],
              successResponse: { status: 200, description: 'ICP deleted', body: { message: 'ICP deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'ICP not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/icps/ICP_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/icps/ICP_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/icps/ICP_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/icps/ICP_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests\nresponse = requests.delete('https://app.mengoengine.com/api/icps/ICP_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/icps/ICP_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting an ICP also cascades: all child Personas are deleted, and references in Products are cleaned up.'],
              commonMistakes: ['Not verifying the ICP ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.delete'],
              relatedApis: ['icp-get-detail', 'icp-get-all'],
            },
            {
              id: 'persona-get-all',
              name: 'Get All Personas',
              method: 'GET',
              path: '/api/personas/:companyId',
              purpose: 'Retrieve all personas for a company.',
              whenToUse: 'Use this endpoint to list all buyer personas associated with a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of personas', body: [{ _id: '...', name: 'Marketing Mary', companyId: '...', icpId: '...', isActive: true, jobTitle: 'Marketing Director', seniorityLevel: 'senior', department: 'marketing', bio: '...', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/personas/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst personas = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/personas/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/personas/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/personas/YOUR_COMPANY_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Persona document ID' },
                { field: '[].name', type: 'string', description: 'Persona name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].icpId', type: 'string', description: 'Linked ICP ID' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the persona is active' },
                { field: '[].jobTitle', type: 'string', description: 'Job title' },
                { field: '[].seniorityLevel', type: 'string', description: 'Seniority (entry, mid, senior, c-level, founder)' },
                { field: '[].department', type: 'string', description: 'Department' },
                { field: '[].bio', type: 'string', description: 'Persona bio' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty array if no personas exist for the company.'],
              commonMistakes: ['Using the persona _id instead of companyId in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'icp-personas.view'],
              relatedApis: ['persona-get-detail', 'icp-get-all'],
            },
            {
              id: 'persona-get-by-icp',
              name: 'Get Personas by ICP',
              method: 'GET',
              path: '/api/personas/icp/:icpId',
              purpose: 'Retrieve all personas linked to a specific ICP.',
              whenToUse: 'Use this endpoint to list all personas belonging to a given ICP.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'icpId', type: 'string', required: true, description: 'ICP document ID' },
              ],
              successResponse: { status: 200, description: 'List of personas for the ICP', body: [{ _id: '...', name: 'Marketing Mary', companyId: '...', icpId: 'ICP_ID', isActive: true, jobTitle: 'Marketing Director', seniorityLevel: 'senior', department: 'marketing' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/personas/icp/ICP_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas/icp/ICP_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst personas = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/personas/icp/ICP_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/personas/icp/ICP_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/personas/icp/ICP_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas/icp/ICP_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Persona document ID' },
                { field: '[].name', type: 'string', description: 'Persona name' },
                { field: '[].icpId', type: 'string', description: 'Parent ICP ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].jobTitle', type: 'string', description: 'Job title' },
                { field: '[].seniorityLevel', type: 'string', description: 'Seniority level' },
                { field: '[].department', type: 'string', description: 'Department' },
                { field: '[].isActive', type: 'boolean', description: 'Whether active' },
              ],
              notes: ['Returns an empty array if no personas are linked to this ICP.'],
              commonMistakes: ['Using companyId instead of the ICP _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'icp-personas.view'],
              relatedApis: ['persona-get-all', 'icp-get-detail'],
            },
            {
              id: 'persona-get-detail',
              name: 'Get Persona Detail',
              method: 'GET',
              path: '/api/personas/detail/:id',
              purpose: 'Retrieve a single persona by its document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific persona.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Persona document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'Persona details', body: { _id: '...', name: 'Marketing Mary', companyId: '...', icpId: '...', isActive: true, ageRange: '30-45', gender: 'female', jobTitle: 'Marketing Director', seniorityLevel: 'senior', department: 'marketing', industry: 'technology', experience: '10+ years', skills: ['SEO', 'content strategy'], goals: ['brand growth'], painPoints: ['budget constraints'], motivations: ['career advancement'], decisionMakingStyle: 'analytical', budgetAuthority: true, influenceLevel: 'high', buyingRole: 'decision-maker', bio: '...', productIds: ['...'], createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Persona not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/personas/detail/PERSONA_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas/detail/PERSONA_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst persona = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/personas/detail/PERSONA_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/personas/detail/PERSONA_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/personas/detail/PERSONA_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas/detail/PERSONA_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Persona document ID' },
                { field: 'name', type: 'string', description: 'Persona name' },
                { field: 'icpId', type: 'string', description: 'Linked ICP ID' },
                { field: 'isActive', type: 'boolean', description: 'Whether active' },
                { field: 'jobTitle', type: 'string', description: 'Job title' },
                { field: 'seniorityLevel', type: 'string', description: 'Seniority (entry, mid, senior, c-level, founder)' },
                { field: 'department', type: 'string', description: 'Department' },
                { field: 'ageRange', type: 'string', description: 'Age range' },
                { field: 'gender', type: 'string', description: 'Gender' },
                { field: 'goals', type: 'string[]', description: 'Goals' },
                { field: 'painPoints', type: 'string[]', description: 'Pain points' },
                { field: 'motivations', type: 'string[]', description: 'Motivations' },
                { field: 'decisionMakingStyle', type: 'string', description: 'Decision making style (analytical, intuitive, collaborative, authoritative)' },
                { field: 'budgetAuthority', type: 'boolean', description: 'Whether persona has budget authority' },
                { field: 'influenceLevel', type: 'string', description: 'Influence level (low, medium, high)' },
                { field: 'buyingRole', type: 'string', description: 'Buying role (champion, decision-maker, influencer, end-user, blocker)' },
                { field: 'bio', type: 'string', description: 'Persona bio' },
                { field: 'productIds', type: 'string[]', description: 'Linked product IDs' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
              ],
              notes: ['The id path parameter is the persona document _id, not the companyId.'],
              commonMistakes: ['Using companyId instead of the persona _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'icp-personas.view'],
              relatedApis: ['persona-get-all', 'persona-update'],
            },
            {
              id: 'persona-create',
              name: 'Create Persona',
              method: 'POST',
              path: '/api/personas',
              purpose: 'Create a new buyer persona for a company.',
              whenToUse: 'Use this endpoint to add a persona linked to an ICP.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — Persona name', icpId: 'string (required) — Linked ICP ID', jobTitle: 'string (optional) — Job title', seniorityLevel: 'string (optional) — One of: entry, mid, senior, c-level, founder', department: 'string (optional) — Department', industry: 'string (optional) — Industry', bio: 'string (optional) — Persona bio', goals: 'string[] (optional) — Goals', painPoints: 'string[] (optional) — Pain points', budgetAuthority: 'boolean (optional) — Has budget authority (defaults to false)', influenceLevel: 'string (optional) — One of: low, medium, high', buyingRole: 'string (optional) — One of: champion, decision-maker, influencer, end-user, blocker' },
              successResponse: { status: 201, description: 'Persona created', body: { _id: '...', name: 'Marketing Mary', icpId: '...', companyId: '...', isActive: true, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name and icpId required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/personas \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Marketing Mary", "icpId": "ICP_ID", "jobTitle": "Marketing Director", "seniorityLevel": "senior"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Marketing Mary', icpId: 'ICP_ID', jobTitle: 'Marketing Director' }),\n});\nconst persona = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/personas',\n  { companyId: 'YOUR_COMPANY_ID', name: 'Marketing Mary', icpId: 'ICP_ID', jobTitle: 'Marketing Director' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Marketing Mary', icpId: 'ICP_ID' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/personas', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(payload); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/personas',\n    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Marketing Mary', 'icpId': 'ICP_ID'},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas');\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Marketing Mary', 'icpId' => 'ICP_ID']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New persona document ID' },
                { field: 'name', type: 'string', description: 'Persona name' },
                { field: 'icpId', type: 'string', description: 'Linked ICP ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'isActive', type: 'boolean', description: 'Whether active (defaults to true)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId, name, and icpId are required fields.', 'isActive defaults to true.'],
              commonMistakes: ['Forgetting to include icpId — it is required to link the persona to an ICP.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.create'],
              relatedApis: ['persona-get-all', 'persona-update', 'persona-delete'],
            },
            {
              id: 'persona-update',
              name: 'Update Persona',
              method: 'PUT',
              path: '/api/personas/:id',
              purpose: 'Update an existing persona.',
              whenToUse: 'Use this endpoint to modify any fields of an existing persona.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Persona document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', jobTitle: 'string (optional) — Updated job title', seniorityLevel: 'string (optional) — Updated seniority', department: 'string (optional) — Updated department', bio: 'string (optional) — Updated bio', goals: 'string[] (optional) — Updated goals', painPoints: 'string[] (optional) — Updated pain points', budgetAuthority: 'boolean (optional) — Updated budget authority', influenceLevel: 'string (optional) — Updated influence level', buyingRole: 'string (optional) — Updated buying role' },
              successResponse: { status: 200, description: 'Persona updated', body: { _id: '...', name: 'Marketing Mary', jobTitle: 'VP Marketing', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Persona not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/personas/PERSONA_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"jobTitle": "VP Marketing", "budgetAuthority": true}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas/PERSONA_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ jobTitle: 'VP Marketing', budgetAuthority: true }),\n});\nconst persona = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/personas/PERSONA_ID',\n  { jobTitle: 'VP Marketing', budgetAuthority: true },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ jobTitle: 'VP Marketing' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/personas/PERSONA_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests\nresponse = requests.put('https://app.mengoengine.com/api/personas/PERSONA_ID',\n    json={'jobTitle': 'VP Marketing', 'budgetAuthority': True},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas/PERSONA_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['jobTitle' => 'VP Marketing']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Persona document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'jobTitle', type: 'string', description: 'Updated job title' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the persona _id, not the companyId.'],
              commonMistakes: ['Using companyId in the URL path instead of the persona _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.edit'],
              relatedApis: ['persona-get-detail', 'persona-create'],
            },
            {
              id: 'persona-delete',
              name: 'Delete Persona',
              method: 'DELETE',
              path: '/api/personas/:id',
              purpose: 'Permanently delete a persona.',
              whenToUse: 'Use this endpoint to remove a persona. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Persona document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Persona deleted', body: { message: 'Persona deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Persona not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/personas/PERSONA_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/personas/PERSONA_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/personas/PERSONA_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/personas/PERSONA_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests\nresponse = requests.delete('https://app.mengoengine.com/api/personas/PERSONA_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/personas/PERSONA_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting a persona also cleans up references in Products and parent ICPs.'],
              commonMistakes: ['Not verifying the persona ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'icp-personas.delete'],
              relatedApis: ['persona-get-detail', 'persona-get-all'],
            },
          ],
        },
        // --- Competitors ---
        {
          id: 'competitors',
          name: 'Competitors',
          description: 'Manage competitive intelligence — track competitor profiles, market position, SWOT analysis, and strategic insights.',
          endpoints: [
            {
              id: 'competitor-get-all',
              name: 'Get All Competitors',
              method: 'GET',
              path: '/api/competitors/:companyId',
              purpose: 'Retrieve all competitors for a company.',
              whenToUse: 'Use this endpoint to list all competitors tracked by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of competitors', body: [{ _id: '...', name: 'Acme Corp', companyId: '...', isActive: true, competitorType: 'direct', threatLevel: 'high', marketPosition: 'leader', website: 'https://acme.com', primaryProduct: 'Acme Suite', createdAt: '2026-01-15T10:00:00Z', updatedAt: '2026-07-21T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/competitors/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/competitors/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst competitors = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/competitors/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/competitors/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/competitors/YOUR_COMPANY_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/competitors/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Competitor document ID' },
                { field: '[].name', type: 'string', description: 'Competitor name' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the competitor is active' },
                { field: '[].competitorType', type: 'string', description: 'Type (direct, indirect, potential, replacement)' },
                { field: '[].threatLevel', type: 'string', description: 'Threat level (low, medium, high, critical)' },
                { field: '[].marketPosition', type: 'string', description: 'Market position (leader, challenger, follower, niche)' },
                { field: '[].website', type: 'string', description: 'Competitor website URL' },
                { field: '[].primaryProduct', type: 'string', description: 'Primary product name' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty array if no competitors exist for the company.'],
              commonMistakes: ['Using the competitor _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'competitors.view'],
              relatedApis: ['competitor-get-detail', 'competitor-create'],
            },
            {
              id: 'competitor-get-detail',
              name: 'Get Competitor Detail',
              method: 'GET',
              path: '/api/competitors/detail/:id',
              purpose: 'Retrieve a single competitor by its document ID.',
              whenToUse: 'Use this endpoint to get full details of a specific competitor including SWOT analysis and strategic insights.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Competitor document ID (the _id field)' },
              ],
              successResponse: { status: 200, description: 'Competitor details', body: { _id: '...', name: 'Acme Corp', companyId: '...', isActive: true, competitorType: 'direct', threatLevel: 'high', marketPosition: 'leader', marketShare: '25%', website: 'https://acme.com', logoUrl: '...', foundedYear: 2010, headquarters: 'San Francisco, CA', companySize: '500-1000', fundingStage: 'series-c', fundingRaised: '$50M', employeeCount: 750, revenueEstimate: '$100M', primaryProduct: 'Acme Suite', productCategories: ['SaaS', 'Analytics'], keyFeatures: ['Reporting', 'Dashboards', 'AI Insights'], pricingStrategy: 'premium', pricingDetails: '$99-$499/mo', freeTrial: true, demoAvailable: true, valueProposition: '...', tagline: '...', messaging: '...', differentiators: ['...'], marketingChannels: ['SEO', 'PPC', 'Content'], contentStrategy: '...', seoKeywords: ['...'], socialMediaPresence: {}, adSpendEstimate: '$500K/mo', strengths: ['...'], weaknesses: ['...'], opportunities: ['...'], threats: ['...'], swotSummary: '...', ourAdvantages: ['...'], ourVulnerabilities: ['...'], recommendedStrategy: '...', battlecards: '...', recentNews: ['...'], productUpdates: ['...'], pricingChanges: ['...'], notes: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Competitor not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/competitors/detail/COMPETITOR_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/competitors/detail/COMPETITOR_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst competitor = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/competitors/detail/COMPETITOR_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/competitors/detail/COMPETITOR_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/competitors/detail/COMPETITOR_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/competitors/detail/COMPETITOR_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Competitor document ID' },
                { field: 'name', type: 'string', description: 'Competitor name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'isActive', type: 'boolean', description: 'Whether the competitor is active' },
                { field: 'competitorType', type: 'string', description: 'Type (direct, indirect, potential, replacement)' },
                { field: 'threatLevel', type: 'string', description: 'Threat level (low, medium, high, critical)' },
                { field: 'marketPosition', type: 'string', description: 'Market position (leader, challenger, follower, niche)' },
                { field: 'marketShare', type: 'string', description: 'Estimated market share' },
                { field: 'website', type: 'string', description: 'Competitor website URL' },
                { field: 'foundedYear', type: 'number', description: 'Year founded' },
                { field: 'headquarters', type: 'string', description: 'Headquarters location' },
                { field: 'companySize', type: 'string', description: 'Company size range' },
                { field: 'fundingStage', type: 'string', description: 'Funding stage' },
                { field: 'fundingRaised', type: 'string', description: 'Total funding raised' },
                { field: 'employeeCount', type: 'number', description: 'Number of employees' },
                { field: 'revenueEstimate', type: 'string', description: 'Estimated revenue' },
                { field: 'primaryProduct', type: 'string', description: 'Primary product name' },
                { field: 'productCategories', type: 'string[]', description: 'Product categories' },
                { field: 'keyFeatures', type: 'string[]', description: 'Key product features' },
                { field: 'pricingStrategy', type: 'string', description: 'Pricing strategy (premium, competitive, economy, freemium, unknown)' },
                { field: 'pricingDetails', type: 'string', description: 'Pricing details' },
                { field: 'freeTrial', type: 'boolean', description: 'Whether free trial is available' },
                { field: 'demoAvailable', type: 'boolean', description: 'Whether demo is available' },
                { field: 'valueProposition', type: 'string', description: 'Value proposition' },
                { field: 'tagline', type: 'string', description: 'Tagline' },
                { field: 'messaging', type: 'string', description: 'Messaging strategy' },
                { field: 'differentiators', type: 'string[]', description: 'Key differentiators' },
                { field: 'marketingChannels', type: 'string[]', description: 'Marketing channels used' },
                { field: 'contentStrategy', type: 'string', description: 'Content strategy' },
                { field: 'seoKeywords', type: 'string[]', description: 'SEO keywords targeted' },
                { field: 'adSpendEstimate', type: 'string', description: 'Estimated ad spend' },
                { field: 'strengths', type: 'string[]', description: 'Competitor strengths' },
                { field: 'weaknesses', type: 'string[]', description: 'Competitor weaknesses' },
                { field: 'opportunities', type: 'string[]', description: 'Market opportunities' },
                { field: 'threats', type: 'string[]', description: 'Market threats' },
                { field: 'swotSummary', type: 'string', description: 'SWOT analysis summary' },
                { field: 'ourAdvantages', type: 'string[]', description: 'Our competitive advantages' },
                { field: 'ourVulnerabilities', type: 'string[]', description: 'Our vulnerabilities vs this competitor' },
                { field: 'recommendedStrategy', type: 'string', description: 'Recommended competitive strategy' },
                { field: 'battlecards', type: 'string', description: 'Battlecard content' },
                { field: 'recentNews', type: 'string[]', description: 'Recent news about competitor' },
                { field: 'productUpdates', type: 'string[]', description: 'Recent product updates' },
                { field: 'pricingChanges', type: 'string[]', description: 'Recent pricing changes' },
                { field: 'notes', type: 'string', description: 'Additional notes' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['The id path parameter is the competitor _id, not the companyId.', 'This endpoint returns all fields including SWOT analysis and strategic insights.'],
              commonMistakes: ['Using companyId instead of the competitor _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'competitors.view'],
              relatedApis: ['competitor-get-all', 'competitor-update'],
            },
            {
              id: 'competitor-create',
              name: 'Create Competitor',
              method: 'POST',
              path: '/api/competitors',
              purpose: 'Create a new competitor profile for a company.',
              whenToUse: 'Use this endpoint to add a competitor to track.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (required) — Competitor name', threatLevel: 'string (required) — One of: low, medium, high, critical', competitorType: 'string (optional) — One of: direct, indirect, potential, replacement (default: direct)', marketPosition: 'string (optional) — One of: leader, challenger, follower, niche (default: follower)', website: 'string (optional) — Competitor website URL', headquarters: 'string (optional) — Headquarters location', companySize: 'string (optional) — Company size', fundingStage: 'string (optional) — Funding stage', fundingRaised: 'string (optional) — Total funding raised (must be non-negative)', primaryProduct: 'string (optional) — Primary product name', pricingStrategy: 'string (optional) — One of: premium, competitive, economy, freemium, unknown', strengths: 'string[] (optional) — Competitor strengths', weaknesses: 'string[] (optional) — Competitor weaknesses' },
              successResponse: { status: 201, description: 'Competitor created', body: { _id: '...', name: 'Acme Corp', companyId: '...', isActive: true, competitorType: 'direct', threatLevel: 'high', marketPosition: 'follower', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name, companyId, and threatLevel required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/competitors \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Acme Corp", "threatLevel": "high", "competitorType": "direct"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/competitors', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', threatLevel: 'high', competitorType: 'direct' }),\n});\nconst competitor = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/competitors',\n  { companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', threatLevel: 'high', competitorType: 'direct' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Corp', threatLevel: 'high' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/competitors', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(payload); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/competitors',\n    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Acme Corp', 'threatLevel': 'high', 'competitorType': 'direct'},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/competitors');\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Acme Corp', 'threatLevel' => 'high']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New competitor document ID' },
                { field: 'name', type: 'string', description: 'Competitor name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'isActive', type: 'boolean', description: 'Whether active (defaults to true)' },
                { field: 'competitorType', type: 'string', description: 'Type (default: direct)' },
                { field: 'threatLevel', type: 'string', description: 'Threat level' },
                { field: 'marketPosition', type: 'string', description: 'Market position (default: follower)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId, name, and threatLevel are required fields.', 'isActive defaults to true. competitorType defaults to "direct". marketPosition defaults to "follower".', 'fundingRaised and marketShare must be non-negative numeric values if provided.'],
              commonMistakes: ['Forgetting to include threatLevel — it is required and must be one of: low, medium, high, critical.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'competitors.create'],
              relatedApis: ['competitor-get-all', 'competitor-update', 'competitor-delete'],
            },
            {
              id: 'competitor-update',
              name: 'Update Competitor',
              method: 'PUT',
              path: '/api/competitors/:id',
              purpose: 'Update an existing competitor profile.',
              whenToUse: 'Use this endpoint to modify any fields of an existing competitor — e.g. update SWOT analysis, change threat level, add battlecards.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Competitor document ID (the _id field)' },
              ],
              requestBody: { name: 'string (optional) — Updated name', threatLevel: 'string (optional) — Updated threat level (low, medium, high, critical)', competitorType: 'string (optional) — Updated type (direct, indirect, potential, replacement)', marketPosition: 'string (optional) — Updated market position (leader, challenger, follower, niche)', website: 'string (optional) — Updated website', headquarters: 'string (optional) — Updated headquarters', companySize: 'string (optional) — Updated company size', strengths: 'string[] (optional) — Updated strengths', weaknesses: 'string[] (optional) — Updated weaknesses', swotSummary: 'string (optional) — Updated SWOT summary', ourAdvantages: 'string[] (optional) — Updated our advantages', battlecards: 'string (optional) — Updated battlecard content', recommendedStrategy: 'string (optional) — Updated recommended strategy' },
              successResponse: { status: 200, description: 'Competitor updated', body: { _id: '...', name: 'Acme Corp', threatLevel: 'critical', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Competitor not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/competitors/COMPETITOR_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"threatLevel": "critical", "swotSummary": "Updated SWOT analysis"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/competitors/COMPETITOR_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ threatLevel: 'critical', swotSummary: 'Updated SWOT analysis' }),\n});\nconst competitor = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/competitors/COMPETITOR_ID',\n  { threatLevel: 'critical', swotSummary: 'Updated SWOT analysis' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ threatLevel: 'critical' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/competitors/COMPETITOR_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests\nresponse = requests.put('https://app.mengoengine.com/api/competitors/COMPETITOR_ID',\n    json={'threatLevel': 'critical', 'swotSummary': 'Updated SWOT analysis'},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/competitors/COMPETITOR_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['threatLevel' => 'critical']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Competitor document ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'threatLevel', type: 'string', description: 'Updated threat level' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The id path parameter is the competitor _id, not the companyId.', 'fundingRaised and marketShare must be non-negative if provided.'],
              commonMistakes: ['Using companyId in the URL path instead of the competitor _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'competitors.edit'],
              relatedApis: ['competitor-get-detail', 'competitor-create'],
            },
            {
              id: 'competitor-delete',
              name: 'Delete Competitor',
              method: 'DELETE',
              path: '/api/competitors/:id',
              purpose: 'Permanently delete a competitor profile.',
              whenToUse: 'Use this endpoint to remove a competitor. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Competitor document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Competitor deleted', body: { message: 'Competitor deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Competitor not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/competitors/COMPETITOR_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/competitors/COMPETITOR_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/competitors/COMPETITOR_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/competitors/COMPETITOR_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests\nresponse = requests.delete('https://app.mengoengine.com/api/competitors/COMPETITOR_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/competitors/COMPETITOR_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the competitor ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'competitors.delete'],
              relatedApis: ['competitor-get-detail', 'competitor-get-all'],
            },
          ],
        },
        // --- Contacts ---
        {
          id: 'contacts',
          name: 'Contacts',
          description: 'Endpoints for managing contacts and email lists.',
          endpoints: [
            {
              id: 'contacts-get-all',
              name: 'Get All Contacts',
              method: 'GET',
              path: '/api/module-data/contacts/:companyId',
              purpose: 'Retrieve a list of all contacts for the authenticated company.',
              whenToUse: 'Use this endpoint to fetch all contact records for synchronization or display in your external application.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to filter contacts by' },
              ],
              successResponse: {
                status: 200,
                description: 'Contacts retrieved successfully',
                body: { data: [{ id: '507f1f77bcf86cd799439012', email: 'contact@example.com', name: 'Jane Smith', status: 'active' }], total: 150 },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Insufficient permissions' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/module-data/contacts/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/contacts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const contacts = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/module-data/contacts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/module-data/contacts/YOUR_COMPANY_ID',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.get(options, (res) => { let body = ''; res.on('data', c => body += c); res.on('end', () => console.log(JSON.parse(body))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/module-data/contacts/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/contacts/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of contact objects' },
                { field: 'total', type: 'number', description: 'Total number of contacts' },
              ],
              notes: ['Results are scoped to the authenticated user\'s company.', 'Returns an empty object {} if no contacts data exists for this company.'],
              commonMistakes: ['Using ?companyId= as a query parameter — it must be a path parameter: /contacts/YOUR_COMPANY_ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'contacts.read'],
              relatedApis: ['bp-get-company'],
            },
          ],
        },
        // --- Authentication ---
        {
          id: 'authentication',
          name: 'Authentication',
          description: 'Login, register, and manage user sessions. Authenticate with email and password to obtain a JWT token, then use it to access protected endpoints.',
          endpoints: [
            {
              id: 'auth-login',
              name: 'Login',
              method: 'POST',
              path: `${BASE_URL.replace('/admin', '')}/auth/login`,
              purpose: 'Authenticate a user with email and password to obtain a JWT token and the list of companies they belong to.',
              whenToUse: 'Use this endpoint when a user needs to sign in. The response includes a JWT token (for subsequent API calls), user profile data, and all companies the user has access to. This is the primary entry point for any external integration.',
              auth: 'None (public endpoint — no token required)',
              headers: [
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                email: 'user@example.com',
                password: 'YourSecurePassword1!',
              },
              successResponse: {
                status: 200,
                description: 'Login successful — returns JWT token, user info, and companies',
                body: {
                  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
                  user: {
                    id: '507f1f77bcf86cd799439011',
                    email: 'user@example.com',
                    name: 'John Doe',
                    role: 'admin',
                    isOrgAdmin: true,
                    apiManagementAccess: true,
                    companyIds: ['507f1f77bcf86cd799439012', '507f1f77bcf86cd799439013'],
                    activeCompanyId: '507f1f77bcf86cd799439012',
                  },
                  companies: [
                    { id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true },
                    { id: '507f1f77bcf86cd799439013', name: 'Beta Inc', isActive: true },
                  ],
                },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — email or password missing/invalid' },
                { code: 401, message: 'Email is not registered' },
                { code: 401, message: 'Incorrect password' },
                { code: 429, message: 'Too many login attempts — rate limited' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/auth/login \\\n  -H "Content-Type: application/json" \\\n  -d '{"email": "user@example.com", "password": "YourSecurePassword1!"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/auth/login', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ email: 'user@example.com', password: 'YourSecurePassword1!' }),\n});\nconst data = await response.json();\nconsole.log(data.token, data.companies);`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/auth/login', {\n  email: 'user@example.com',\n  password: 'YourSecurePassword1!',\n});\nconsole.log(data.token, data.companies);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ email: 'user@example.com', password: 'YourSecurePassword1!' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/auth/login', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/auth/login', json={\n    'email': 'user@example.com',\n    'password': 'YourSecurePassword1!',\n})\ndata = response.json()\nprint(data['token'], data['companies'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/auth/login');\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['email' => 'user@example.com', 'password' => 'YourSecurePassword1!']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$data = json_decode($response, true);\necho $data['token'];`,
              responseFields: [
                { field: 'token', type: 'string', description: 'JWT token for authenticating subsequent requests (Bearer token)' },
                { field: 'user.id', type: 'string', description: 'Unique user identifier' },
                { field: 'user.email', type: 'string', description: 'User email address' },
                { field: 'user.name', type: 'string', description: 'User display name' },
                { field: 'user.role', type: 'string', description: 'User role: super-admin, admin, manager, editor, or viewer' },
                { field: 'user.isOrgAdmin', type: 'boolean', description: 'Whether the user is an organization admin' },
                { field: 'user.companyIds', type: 'string[]', description: 'Array of company IDs the user belongs to' },
                { field: 'user.activeCompanyId', type: 'string', description: 'The currently active company ID' },
                { field: 'companies', type: 'array', description: 'List of companies the user has access to' },
                { field: 'companies[].id', type: 'string', description: 'Company ID' },
                { field: 'companies[].name', type: 'string', description: 'Company name' },
                { field: 'companies[].isActive', type: 'boolean', description: 'Whether the company is active' },
              ],
              notes: [
                'The JWT token expires after the period configured in JWT_EXPIRES_IN (default: 7 days).',
                'Always store the token securely — never expose it in client-side URLs or logs.',
                'The companies array includes ALL companies the user has access to, not just the active one.',
                'Rate-limited to prevent brute-force attacks.',
              ],
              commonMistakes: [
                'Sending the password in a query parameter instead of the request body.',
                'Not storing the returned token for subsequent authenticated requests.',
                'Assuming the first company in the array is the active one — use activeCompanyId instead.',
                'Forgetting to include Content-Type: application/json header.',
              ],
              rateLimits: '5 requests per minute per IP address (rate-limited to prevent brute-force)',
              requiredPermissions: ['None (public endpoint)'],
              relatedApis: ['auth-register', 'auth-me', 'auth-switch-company', 'comp-list'],
            },
            {
              id: 'auth-register',
              name: 'Register',
              method: 'POST',
              path: `${BASE_URL.replace('/admin', '')}/auth/register`,
              purpose: 'Create a new user account with email, password, and company name. Returns a JWT token and the newly created company.',
              whenToUse: 'Use this endpoint when a new user needs to sign up. It creates the user account, a default company, seeds org roles, and returns authentication credentials.',
              auth: 'None (public endpoint — no token required)',
              headers: [
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                email: 'newuser@example.com',
                password: 'YourSecurePassword1!',
                name: 'Jane Smith',
                companyName: 'My New Company',
              },
              successResponse: {
                status: 201,
                description: 'User registered successfully',
                body: {
                  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
                  user: {
                    id: '507f1f77bcf86cd799439014',
                    email: 'newuser@example.com',
                    name: 'Jane Smith',
                    role: 'admin',
                    isOrgAdmin: true,
                    apiManagementAccess: false,
                    companyIds: ['507f1f77bcf86cd799439015'],
                    activeCompanyId: '507f1f77bcf86cd799439015',
                  },
                  company: {
                    id: '507f1f77bcf86cd799439015',
                    name: 'My New Company',
                  },
                },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — missing or invalid fields' },
                { code: 400, message: 'User already exists' },
                { code: 429, message: 'Too many registration attempts — rate limited' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/auth/register \\\n  -H "Content-Type: application/json" \\\n  -d '{"email": "newuser@example.com", "password": "YourSecurePassword1!", "name": "Jane Smith", "companyName": "My New Company"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/auth/register', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ email: 'newuser@example.com', password: 'YourSecurePassword1!', name: 'Jane Smith', companyName: 'My New Company' }),\n});\nconst data = await response.json();\nconsole.log(data.token, data.company);`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/auth/register', {\n  email: 'newuser@example.com',\n  password: 'YourSecurePassword1!',\n  name: 'Jane Smith',\n  companyName: 'My New Company',\n});\nconsole.log(data.token, data.company);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ email: 'newuser@example.com', password: 'YourSecurePassword1!', name: 'Jane Smith', companyName: 'My New Company' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/auth/register', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/auth/register', json={\n    'email': 'newuser@example.com',\n    'password': 'YourSecurePassword1!',\n    'name': 'Jane Smith',\n    'companyName': 'My New Company',\n})\ndata = response.json()\nprint(data['token'], data['company'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/auth/register');\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['email' => 'newuser@example.com', 'password' => 'YourSecurePassword1!', 'name' => 'Jane Smith', 'companyName' => 'My New Company']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$data = json_decode($response, true);\necho $data['token'];`,
              responseFields: [
                { field: 'token', type: 'string', description: 'JWT token for authenticating subsequent requests' },
                { field: 'user.id', type: 'string', description: 'Unique user identifier' },
                { field: 'user.email', type: 'string', description: 'User email address' },
                { field: 'user.role', type: 'string', description: 'User role (defaults to "admin" for new registrations)' },
                { field: 'user.isOrgAdmin', type: 'boolean', description: 'Always true for the registering user' },
                { field: 'user.companyIds', type: 'string[]', description: 'Array with the newly created company ID' },
                { field: 'company.id', type: 'string', description: 'Newly created company ID' },
                { field: 'company.name', type: 'string', description: 'Company name' },
              ],
              notes: [
                'Password must be at least 8 characters with uppercase, lowercase, number, and special character.',
                'The registering user automatically becomes an org admin (isOrgAdmin: true) with "admin" role.',
                'A default company is created with the provided companyName.',
                'Org-scoped default roles are seeded automatically for the new company.',
              ],
              commonMistakes: [
                'Using a weak password that does not meet complexity requirements.',
                'Registering with an email that already exists — check with the Check Email endpoint first.',
                'Not saving the returned token for subsequent API calls.',
                'Forgetting the companyName field — it is required.',
              ],
              rateLimits: '3 requests per minute per IP address',
              requiredPermissions: ['None (public endpoint)'],
              relatedApis: ['auth-login', 'auth-check-email', 'auth-me'],
            },
            {
              id: 'auth-me',
              name: 'Get Current User',
              method: 'GET',
              path: `${BASE_URL.replace('/admin', '')}/auth/me`,
              purpose: 'Retrieve the authenticated user profile and their associated companies.',
              whenToUse: 'Use this endpoint to get the current user details and companies list after authentication. Works with both JWT session tokens and API access tokens.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              successResponse: {
                status: 200,
                description: 'Current user profile and companies',
                body: {
                  user: {
                    id: '507f1f77bcf86cd799439011',
                    email: 'user@example.com',
                    name: 'John Doe',
                    role: 'admin',
                    isOrgAdmin: true,
                    apiManagementAccess: true,
                    companyIds: ['507f1f77bcf86cd799439012', '507f1f77bcf86cd799439013'],
                    activeCompanyId: '507f1f77bcf86cd799439012',
                    avatar: 'https://cdn.mengo.ai/avatars/user1.png',
                  },
                  companies: [
                    { id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true },
                    { id: '507f1f77bcf86cd799439013', name: 'Beta Inc', isActive: true },
                  ],
                },
              },
              errorResponses: [
                { code: 401, message: 'Unauthorized — invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/auth/me \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/auth/me', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst data = await response.json();\nconsole.log(data.user, data.companies);`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/auth/me', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconsole.log(data.user, data.companies);`,
              nodeExample: `https.get({ hostname: 'api.mengo.ai', path: '/api/auth/me', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/auth/me', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ndata = response.json()\nprint(data['user'], data['companies'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/auth/me');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$data = json_decode($response, true);\necho $data['user']['name'];`,
              responseFields: [
                { field: 'user.id', type: 'string', description: 'Unique user identifier' },
                { field: 'user.email', type: 'string', description: 'User email address' },
                { field: 'user.role', type: 'string', description: 'User role' },
                { field: 'user.companyIds', type: 'string[]', description: 'Array of company IDs the user belongs to' },
                { field: 'user.activeCompanyId', type: 'string', description: 'Currently active company ID' },
                { field: 'companies', type: 'array', description: 'List of companies with id, name, and isActive status' },
              ],
              notes: [
                'This endpoint accepts both JWT session tokens and API access tokens (mng_ prefix).',
                'The companies array is always returned alongside user data for convenience.',
                'Use this endpoint to refresh user data after switching companies.',
              ],
              commonMistakes: [
                'Using an expired token — tokens have a limited lifespan.',
                'Not including the Authorization header with the Bearer prefix.',
                'Confusing the API access token (mng_*) with the session JWT — both work with this endpoint.',
              ],
              rateLimits: '30 requests per minute per user',
              requiredPermissions: ['Authenticated user'],
              relatedApis: ['auth-login', 'auth-switch-company', 'comp-list'],
            },
            {
              id: 'auth-switch-company',
              name: 'Switch Company',
              method: 'POST',
              path: `${BASE_URL.replace('/admin', '')}/auth/switch-company`,
              purpose: 'Switch the authenticated user active company context. After switching, all company-scoped API calls will use the new active company.',
              whenToUse: 'Use this endpoint when a user belongs to multiple companies and needs to switch their active context. This affects which company data is returned by other endpoints.',
              auth: 'Bearer Token Required (session JWT only — API tokens are not supported)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_JWT_TOKEN' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                companyId: '507f1f77bcf86cd799439013',
              },
              successResponse: {
                status: 200,
                description: 'Company switched successfully',
                body: {
                  message: 'Company switched successfully',
                  activeCompanyId: '507f1f77bcf86cd799439013',
                },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — companyId is missing' },
                { code: 404, message: 'Company not found' },
                { code: 401, message: 'Unauthorized — invalid or expired token' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/auth/switch-company \\\n  -H "Authorization: Bearer YOUR_JWT_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "507f1f77bcf86cd799439013"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/auth/switch-company', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_JWT_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: '507f1f77bcf86cd799439013' }),\n});\nconst data = await response.json();\nconsole.log(data.activeCompanyId);`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/auth/switch-company',\n  { companyId: '507f1f77bcf86cd799439013' },\n  { headers: { 'Authorization': 'Bearer YOUR_JWT_TOKEN' } },\n);\nconsole.log(data.activeCompanyId);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ companyId: '507f1f77bcf86cd799439013' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/auth/switch-company', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_JWT_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/auth/switch-company', json={\n    'companyId': '507f1f77bcf86cd799439013',\n}, headers={'Authorization': 'Bearer YOUR_JWT_TOKEN'})\ndata = response.json()\nprint(data['activeCompanyId'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/auth/switch-company');\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => '507f1f77bcf86cd799439013']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_JWT_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$data = json_decode($response, true);\necho $data['activeCompanyId'];`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Success message' },
                { field: 'activeCompanyId', type: 'string', description: 'The newly active company ID' },
              ],
              notes: [
                'This endpoint requires a session JWT — it does not accept API access tokens.',
                'The companyId must be one the user already belongs to (listed in user.companyIds).',
                'After switching, all subsequent API calls will use the new company context.',
                'If the companyId is not in the user companyIds array, it will be automatically added.',
              ],
              commonMistakes: [
                'Using an API access token instead of a session JWT — only session JWTs are accepted.',
                'Passing a companyId that the user does not belong to.',
                'Not updating the activeCompanyId on the client side after switching.',
              ],
              rateLimits: '30 requests per minute per user',
              requiredPermissions: ['Authenticated user (JWT session only)'],
              relatedApis: ['auth-login', 'auth-me', 'comp-list'],
            },
            {
              id: 'auth-check-email',
              name: 'Check Email',
              method: 'POST',
              path: `${BASE_URL.replace('/admin', '')}/auth/check-email`,
              purpose: 'Check if an email address is already registered. Useful for pre-validating during registration flows.',
              whenToUse: 'Use this endpoint before the registration flow to check if an email is already in use. This helps provide immediate feedback in signup forms.',
              auth: 'None (public endpoint — no token required)',
              headers: [
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                email: 'user@example.com',
              },
              successResponse: {
                status: 200,
                description: 'Email found — the address is registered',
                body: {
                  message: 'Email found',
                  email: 'user@example.com',
                },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — invalid email format' },
                { code: 404, message: 'This email is not registered' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/auth/check-email \\\n  -H "Content-Type: application/json" \\\n  -d '{"email": "user@example.com"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/auth/check-email', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ email: 'user@example.com' }),\n});\nconst data = await response.json();\nconsole.log(data.message);`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/auth/check-email', {\n  email: 'user@example.com',\n});\nconsole.log(data.message);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ email: 'user@example.com' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/auth/check-email', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/auth/check-email', json={\n    'email': 'user@example.com',\n})\ndata = response.json()\nprint(data['message'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/auth/check-email');\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['email' => 'user@example.com']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$data = json_decode($response, true);\necho $data['message'];`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message ("Email found")' },
                { field: 'email', type: 'string', description: 'The normalized email address' },
              ],
              notes: [
                'This endpoint is rate-limited to prevent email enumeration attacks.',
                'A 404 response means the email is NOT registered — you can proceed with registration.',
                'A 200 response means the email IS registered — direct the user to login instead.',
              ],
              commonMistakes: [
                'Using this endpoint as a login check — it only confirms if an email exists, not if credentials are valid.',
                'Not handling the 404 case (email not registered) properly in your application flow.',
              ],
              rateLimits: '10 requests per minute per IP address',
              requiredPermissions: ['None (public endpoint)'],
              relatedApis: ['auth-login', 'auth-register'],
            },
          ],
        },
        // --- Companies ---
        {
          id: 'companies',
          name: 'Companies',
          description: 'Company management endpoints — list, create, update, and manage companies within your organization.',
          endpoints: [
            {
              id: 'comp-list',
              name: 'List Companies',
              method: 'GET',
              path: `${BASE_URL}/companies`,
              purpose: 'Retrieve all companies the authenticated user belongs to.',
              whenToUse: 'Use this endpoint to get a list of all companies for the current user. Useful for populating company selectors or dashboards.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              successResponse: {
                status: 200,
                description: 'List of companies the user has access to',
                body: [
                  { _id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true, notificationEmail: 'info@acme.com', userIds: ['507f1f77bcf86cd799439011'], createdAt: '2026-01-15T10:00:00Z' },
                  { _id: '507f1f77bcf86cd799439013', name: 'Beta Inc', isActive: true, notificationEmail: 'hello@beta.io', userIds: ['507f1f77bcf86cd799439011'], createdAt: '2026-02-20T14:30:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Unauthorized — invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/v1/admin/companies \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst companies = await response.json();\nconsole.log(companies);`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/v1/admin/companies', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconsole.log(data);`,
              nodeExample: `https.get({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/v1/admin/companies', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ncompanies = response.json()\nprint(companies)`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$companies = json_decode($response, true);\nprint_r($companies);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Unique company identifier' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active' },
                { field: 'notificationEmail', type: 'string', description: 'Company notification email (optional)' },
                { field: 'userIds', type: 'string[]', description: 'IDs of users belonging to this company' },
                { field: 'createdAt', type: 'string', description: 'ISO timestamp of company creation' },
              ],
              notes: [
                'Returns only companies the authenticated user has access to.',
                'Works with both JWT session tokens and API access tokens.',
              ],
              commonMistakes: [
                "Assuming this returns all companies in the system — it only returns the user's own companies.",
                'Not handling the case where the user has no companies.',
              ],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['Authenticated user'],
              relatedApis: ['auth-login', 'auth-me', 'comp-detail', 'comp-create'],
            },
            {
              id: 'comp-detail',
              name: 'Get Company',
              method: 'GET',
              path: `${BASE_URL}/companies/:id`,
              purpose: 'Retrieve details of a specific company by ID.',
              whenToUse: 'Use this endpoint to get full details of a single company. The user must have access to the company (its ID must be in their companyIds array).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Company details',
                body: { _id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: true, notificationEmail: 'info@acme.com', websiteUrl: 'https://acme.com', description: 'A technology company', userIds: ['507f1f77bcf86cd799439011'], createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Unauthorized — invalid or expired token' },
                { code: 404, message: 'Company not found or access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst company = await response.json();\nconsole.log(company);`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconsole.log(data);`,
              nodeExample: `https.get({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ncompany = response.json()\nprint(company)`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$company = json_decode($response, true);\nprint_r($company);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Unique company identifier' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Whether the company is active' },
                { field: 'notificationEmail', type: 'string', description: 'Company notification email' },
                { field: 'websiteUrl', type: 'string', description: 'Company website URL' },
                { field: 'description', type: 'string', description: 'Company description' },
                { field: 'userIds', type: 'string[]', description: 'IDs of users belonging to this company' },
              ],
              notes: [
                'Only returns companies the authenticated user has access to.',
                'Admin and super-admin users can access any company.',
              ],
              commonMistakes: [
                'Using a company ID that the user does not have access to — will return 404.',
                'Confusing the company ID with the user ID.',
              ],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['Authenticated user'],
              relatedApis: ['comp-list', 'comp-update', 'comp-stats'],
            },
            {
              id: 'comp-create',
              name: 'Create Company',
              method: 'POST',
              path: `${BASE_URL}/companies`,
              purpose: 'Create a new company. The authenticated user is automatically added as a member.',
              whenToUse: 'Use this endpoint to add a new company to the system. The creator is automatically added to the company userIds array.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                name: 'New Company Name',
                notificationEmail: 'info@newcompany.com',
                websiteUrl: 'https://newcompany.com',
                description: 'A description of the new company',
              },
              successResponse: {
                status: 201,
                description: 'Company created successfully',
                body: { _id: '507f1f77bcf86cd799439016', name: 'New Company Name', isActive: true, notificationEmail: 'info@newcompany.com', websiteUrl: 'https://newcompany.com', description: 'A description of the new company', userIds: ['507f1f77bcf86cd799439011'], createdAt: '2026-07-23T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — name is required' },
                { code: 401, message: 'Unauthorized — invalid or expired token' },
                { code: 409, message: 'A company with this name already exists' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/v1/admin/companies \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"name": "New Company Name", "notificationEmail": "info@newcompany.com"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ name: 'New Company Name', notificationEmail: 'info@newcompany.com' }),\n});\nconst company = await response.json();\nconsole.log(company);`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/v1/admin/companies',\n  { name: 'New Company Name', notificationEmail: 'info@newcompany.com' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } },\n);\nconsole.log(data);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ name: 'New Company Name', notificationEmail: 'info@newcompany.com' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/v1/admin/companies', json={\n    'name': 'New Company Name',\n    'notificationEmail': 'info@newcompany.com',\n}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ncompany = response.json()\nprint(company)`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies');\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'New Company Name', 'notificationEmail' => 'info@newcompany.com']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$company = json_decode($response, true);\nprint_r($company);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Unique company identifier (auto-generated)' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Defaults to true' },
                { field: 'userIds', type: 'string[]', description: 'Includes the creator user ID' },
                { field: 'createdAt', type: 'string', description: 'ISO timestamp of creation' },
              ],
              notes: [
                'The name field is required and must be between 2 and 100 characters.',
                'The creating user is automatically added to the userIds array.',
                'Duplicate company names are checked (case-insensitive) and will return 409.',
              ],
              commonMistakes: [
                'Forgetting the Authorization header — this is not a public endpoint.',
                'Creating a company with a name that already exists.',
              ],
              rateLimits: '30 requests per minute per user',
              requiredPermissions: ['admin.write', 'companies.create'],
              relatedApis: ['comp-list', 'comp-detail', 'comp-update'],
            },
            {
              id: 'comp-update',
              name: 'Update Company',
              method: 'PUT',
              path: `${BASE_URL}/companies/:id`,
              purpose: "Update an existing company's details (name, description, notification email, website URL).",
              whenToUse: 'Use this endpoint to modify company information. Only fields provided in the request body will be updated.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID to update' },
              ],
              requestBody: {
                name: 'Updated Company Name',
                description: 'Updated company description',
                notificationEmail: 'updated@company.com',
                websiteUrl: 'https://updated-company.com',
              },
              successResponse: {
                status: 200,
                description: 'Company updated successfully',
                body: { _id: '507f1f77bcf86cd799439012', name: 'Updated Company Name', isActive: true, notificationEmail: 'updated@company.com', websiteUrl: 'https://updated-company.com', description: 'Updated company description', updatedAt: '2026-07-23T12:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — invalid field values' },
                { code: 401, message: 'Unauthorized — invalid or expired token' },
                { code: 404, message: 'Company not found' },
                { code: 409, message: 'A company with this name already exists' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"name": "Updated Company Name", "description": "Updated description"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ name: 'Updated Company Name', description: 'Updated description' }),\n});\nconst company = await response.json();\nconsole.log(company);`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID',\n  { name: 'Updated Company Name', description: 'Updated description' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } },\n);\nconsole.log(data);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ name: 'Updated Company Name', description: 'Updated description' });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies/YOUR_COMPANY_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.put('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID', json={\n    'name': 'Updated Company Name',\n    'description': 'Updated description',\n}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ncompany = response.json()\nprint(company)`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Company Name', 'description' => 'Updated description']));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$company = json_decode($response, true);\nprint_r($company);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Company identifier (unchanged)' },
                { field: 'name', type: 'string', description: 'Updated company name' },
                { field: 'updatedAt', type: 'string', description: 'ISO timestamp of last update' },
              ],
              notes: [
                'Only provided fields are updated — omit fields you do not want to change.',
                'Duplicate name validation is case-insensitive.',
              ],
              commonMistakes: [
                'Using PATCH instead of PUT — this endpoint uses PUT for full updates.',
                'Trying to update a company the user does not have access to.',
              ],
              rateLimits: '30 requests per minute per user',
              requiredPermissions: ['admin.write', 'companies.edit'],
              relatedApis: ['comp-detail', 'comp-create', 'comp-status'],
            },
            {
              id: 'comp-status',
              name: 'Toggle Company Status',
              method: 'PATCH',
              path: `${BASE_URL}/companies/:id/status`,
              purpose: 'Activate or deactivate a company by toggling its isActive status.',
              whenToUse: 'Use this endpoint to temporarily disable a company without deleting it. Inactive companies are excluded from most queries.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID to toggle' },
              ],
              requestBody: {
                isActive: false,
              },
              successResponse: {
                status: 200,
                description: 'Company status updated',
                body: { _id: '507f1f77bcf86cd799439012', name: 'Acme Corp', isActive: false, updatedAt: '2026-07-23T12:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — isActive must be a boolean' },
                { code: 401, message: 'Unauthorized — invalid or expired token' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X PATCH https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/status \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"isActive": false}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/status', {\n  method: 'PATCH',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ isActive: false }),\n});\nconst company = await response.json();\nconsole.log(company.isActive);`,
              axiosExample: `const { data } = await axios.patch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/status',\n  { isActive: false },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } },\n);\nconsole.log(data.isActive);`,
              nodeExample: `const https = require('https');\nconst postData = JSON.stringify({ isActive: false });\nconst req = https.request({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies/YOUR_COMPANY_ID/status', method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(postData); req.end();`,
              pythonExample: `import requests\nresponse = requests.patch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/status', json={\n    'isActive': False,\n}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\ncompany = response.json()\nprint(company['isActive'])`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/status');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['isActive' => false]));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$company = json_decode($response, true);\necho $company['isActive'] ? 'active' : 'inactive';`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Company identifier' },
                { field: 'name', type: 'string', description: 'Company name' },
                { field: 'isActive', type: 'boolean', description: 'Updated active status' },
              ],
              notes: [
                'Setting isActive to false does NOT delete the company — it can be reactivated later.',
                'Inactive companies are excluded from most listing queries by default.',
              ],
              commonMistakes: [
                'Sending a string "false" instead of boolean false for isActive.',
                'Using PUT instead of PATCH for status changes.',
              ],
              rateLimits: '30 requests per minute per user',
              requiredPermissions: ['admin.write', 'companies.edit'],
              relatedApis: ['comp-detail', 'comp-update'],
            },
            {
              id: 'comp-stats',
              name: 'Company Stats',
              method: 'GET',
              path: `${BASE_URL}/companies/:id/stats`,
              purpose: 'Retrieve aggregate statistics for a specific company (counts of users, modules, AI generations, etc.).',
              whenToUse: "Use this endpoint to get a dashboard-style overview of a company's activity. Useful for admin dashboards and reporting.",
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Company statistics',
                body: { companyId: '507f1f77bcf86cd799439012', totalUsers: 5, activeUsers: 3, totalModules: 45, aiGenerations: 128, storageUsed: '2.4 GB' },
              },
              errorResponses: [
                { code: 401, message: 'Unauthorized — invalid or expired token' },
                { code: 404, message: 'Company not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/stats \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst stats = await response.json();\nconsole.log(stats);`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconsole.log(data);`,
              nodeExample: `https.get({ hostname: 'api.mengo.ai', path: '/api/v1/admin/companies/YOUR_COMPANY_ID/stats', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/stats', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})\nstats = response.json()\nprint(stats)`,
              phpExample: `$ch = curl_init('https://app.mengoengine.com/api/v1/admin/companies/YOUR_COMPANY_ID/stats');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$stats = json_decode($response, true);\nprint_r($stats);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Company identifier' },
                { field: 'totalUsers', type: 'number', description: 'Total number of users in the company' },
                { field: 'activeUsers', type: 'number', description: 'Number of active users' },
                { field: 'totalModules', type: 'number', description: 'Total number of modules configured' },
                { field: 'aiGenerations', type: 'number', description: 'Total AI content generations' },
              ],
              notes: [
                'Data is scoped to the authenticated company.',
                'Stats are computed on-the-fly and may take a moment for large organizations.',
              ],
              commonMistakes: [
                'Using ?companyId= as a query parameter — it must be a path parameter: /companies/:id/stats.',
              ],
              rateLimits: '60 requests per minute',
              requiredPermissions: ['admin.read', 'companies.read'],
              relatedApis: ['comp-detail', 'comp-list'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // BRAND GROUP
    // ==========================================
    {
      id: 'brand',
      name: 'Brand',
      description: 'Brand identity, strategy, and positioning',
      icon: 'Star',
      color: '#F59E0B',
      categories: [
        // --- Strategy ---
        {
          id: 'strategy',
          name: 'Strategy',
          description: 'Manage brand strategy data — purpose, personality, voice, positioning, and guardrails.',
          endpoints: [
            {
              id: 'strategy-get',
              name: 'Get Brand Strategy',
              method: 'GET',
              path: '/api/module-data/brand-strategy/:companyId',
              purpose: 'Retrieve the brand strategy data for a company.',
              whenToUse: 'Use this endpoint to fetch the full brand strategy including purpose, personality, voice, promise, differentiation, and guardrails.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "brand-strategy" for this endpoint' },
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Brand strategy data (or empty object if not yet created)', body: { id: '...', purposeStatement: '...', personalityPrimary: ['Innovative', 'Trustworthy'], personalitySecondary: ['Bold', 'Approachable'], voiceDescription: '...', voiceDos: ['...'], voiceDonts: ['...'], promiseStatement: '...', guardrailsDescription: '...', diffBrandSymbols: ['...'], diffSignatureExpressions: ['...'] } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst strategy = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/module-data/brand-strategy/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Module data document ID' },
                { field: 'purposeStatement', type: 'string', description: 'Brand purpose statement' },
                { field: 'personalityPrimary', type: 'string[]', description: 'Primary personality traits' },
                { field: 'personalitySecondary', type: 'string[]', description: 'Secondary personality traits' },
                { field: 'voiceDescription', type: 'string', description: 'Brand voice description' },
                { field: 'voiceDos', type: 'string[]', description: 'Voice dos (guidelines)' },
                { field: 'voiceDonts', type: 'string[]', description: 'Voice don\'ts (guidelines)' },
                { field: 'promiseStatement', type: 'string', description: 'Emotional promise statement' },
                { field: 'promiseBelievable', type: 'boolean', description: 'Promise is believable' },
                { field: 'promiseDefensible', type: 'boolean', description: 'Promise is defensible' },
                { field: 'promiseDeliverable', type: 'boolean', description: 'Promise is deliverable' },
                { field: 'diffBrandSymbols', type: 'string[]', description: 'Differentiation: brand symbols' },
                { field: 'diffSignatureExpressions', type: 'string[]', description: 'Differentiation: signature expressions' },
                { field: 'guardrailsDescription', type: 'string', description: 'Brand guardrails description' },
                { field: 'rulesVoiceForbiddenWords', type: 'string[]', description: 'Voice: forbidden words' },
                { field: 'rulesDesignForbiddenPatterns', type: 'string[]', description: 'Design: forbidden patterns' },
              ],
              notes: ['Returns an empty object {} if no strategy data exists for the company — this is a valid state for new companies.', 'The moduleId path parameter must be "brand-strategy" (literal string).', 'This is the same endpoint the UI uses to load strategy data.'],
              commonMistakes: ['Using the brand document _id instead of companyId in the URL — the path parameter is the companyId.', 'Forgetting that moduleId must be "brand-strategy" — it is part of the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'brand.view'],
              relatedApis: ['strategy-save', 'strategy-delete'],
            },
            {
              id: 'strategy-save',
              name: 'Save Brand Strategy',
              method: 'POST',
              path: '/api/module-data/brand-strategy',
              purpose: 'Save or update brand strategy data for a company. This endpoint uses upsert — it creates the data if it doesn\'t exist, or updates it if it does.',
              whenToUse: 'Use this endpoint to create or update brand strategy data — purpose, personality, voice, promise, differentiation, guardrails, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "brand-strategy" for this endpoint' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', data: 'object (required) — Strategy data object containing any of: purposeStatement, personalityPrimary, personalitySecondary, voiceDescription, voiceDos, voiceDonts, promiseStatement, promiseBelievable, promiseDefensible, promiseDeliverable, diffBrandSymbols, diffSignatureExpressions, guardrailsDescription, rulesVoiceForbiddenWords, rulesDesignForbiddenPatterns, and any other strategy fields' },
              successResponse: { status: 200, description: 'Strategy data saved', body: { purposeStatement: '...', personalityPrimary: ['Innovative', 'Trustworthy'], voiceDescription: '...', promiseStatement: '...' } },
              errorResponses: [
                { code: 400, message: 'Validation error (companyId and data required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/module-data/brand-strategy \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "YOUR_COMPANY_ID", "data": {"purposeStatement": "Empowering businesses to grow", "personalityPrimary": ["Innovative", "Trustworthy"]}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/brand-strategy', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { purposeStatement: 'Empowering businesses to grow', personalityPrimary: ['Innovative', 'Trustworthy'] } }),\n});\nconst strategy = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/module-data/brand-strategy',\n  { companyId: 'YOUR_COMPANY_ID', data: { purposeStatement: 'Empowering businesses to grow', personalityPrimary: ['Innovative', 'Trustworthy'] } },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { purposeStatement: 'Empowering businesses to grow' } });\nconst options = { hostname: 'api.mengo.ai', path: '/api/module-data/brand-strategy', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(payload); req.end();`,
              pythonExample: `import requests\nresponse = requests.post('https://app.mengoengine.com/api/module-data/brand-strategy',\n    json={'companyId': 'YOUR_COMPANY_ID', 'data': {'purposeStatement': 'Empowering businesses to grow', 'personalityPrimary': ['Innovative', 'Trustworthy']}},\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/module-data/brand-strategy');\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'data' => ['purposeStatement' => 'Empowering businesses to grow']]));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: '(response)', type: 'object', description: 'The saved strategy data object (mirrors what was sent in the data field)' },
              ],
              notes: ['This endpoint uses upsert — it creates if not found, or updates if already existing. No need to check if data exists first.', 'The moduleId path parameter must be "brand-strategy" (literal string).', 'The request body must include both companyId and data. The data field is an object containing all strategy fields.', 'Only include fields you want to save — the entire data object is replaced on each save.'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.', 'Sending strategy fields at the top level instead of inside the "data" object. All strategy fields must be nested inside the data property.', 'Using POST for partial updates — this endpoint replaces the entire data object. Include all fields you want to keep.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'brand.edit'],
              relatedApis: ['strategy-get', 'strategy-delete'],
            },
            {
              id: 'strategy-delete',
              name: 'Delete Brand Strategy',
              method: 'DELETE',
              path: '/api/module-data/brand-strategy/:companyId',
              purpose: 'Permanently delete brand strategy data for a company.',
              whenToUse: 'Use this endpoint to remove all brand strategy data. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "brand-strategy" for this endpoint' },
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Strategy data deleted', body: { message: 'Module data deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/module-data/brand-strategy/YOUR_COMPANY_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests\nresponse = requests.delete('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php\n$ch = curl_init('https://app.mengoengine.com/api/module-data/brand-strategy/YOUR_COMPANY_ID');\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'The moduleId path parameter must be "brand-strategy" (literal string).', 'Deleting strategy data does not affect the Brand model record (colors, fonts, etc.) — those are separate.'],
              commonMistakes: ['Using the strategy document _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'brand.delete'],
              relatedApis: ['strategy-get', 'strategy-save'],
            },
          ],
        },
        // --- Visual Identity ---
        {
          id: 'visual-identity',
          name: 'Visual Identity',
          description: 'Manage brand visual identity — colors, typography, spacing, border radius, icon style, and image style.',
          endpoints: [
            {
              id: 'vi-get',
              name: 'Get Visual Identity',
              method: 'GET',
              path: '/api/module-data/visual-identity/:companyId',
              purpose: 'Retrieve the visual identity data for a company.',
              whenToUse: 'Use this endpoint to fetch the full visual identity including colors, typography, spacing, border radius, icon style, and image style.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "visual-identity" for this endpoint' },
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Visual identity data (or empty object if not yet created)', body: { id: '...', companyId: '...', mode: 'preset', primaryColor: '#7C6BF0', secondaryColor: '#1E293B', accentColor: '#22D3EE', backgroundColor: '#0D1117', surfaceColor: '#161B22', textColor: '#E6EDF3', textMutedColor: '#8B949E', successColor: '#3FB950', warningColor: '#D29922', errorColor: '#F85149', infoColor: '#58A6FF', headingFont: 'Inter', bodyFont: 'Inter', accentFont: 'Playfair Display', monoFont: 'JetBrains Mono', headingLineHeight: '1.2', bodyLineHeight: '1.6', headingLetterSpacing: '-0.02em', bodyLetterSpacing: '0', borderRadiusSm: '0.375rem', borderRadiusMd: '0.5rem', borderRadiusLg: '0.75rem', borderRadiusXl: '1rem', sectionSpacing: '4rem', componentSpacing: '1.5rem', elementSpacing: '0.75rem', iconStyle: { id: 'outline', name: 'Outline' }, imageStyle: { id: 'rounded', name: 'Rounded' } } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const visualIdentity = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/module-data/visual-identity/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Module data document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'mode', type: 'string', description: 'Visual identity mode: "preset" (template-based) or "custom" (manual)' },
                { field: 'primaryColor', type: 'string', description: 'Primary brand color (hex)' },
                { field: 'secondaryColor', type: 'string', description: 'Secondary brand color (hex)' },
                { field: 'accentColor', type: 'string', description: 'Accent brand color (hex)' },
                { field: 'backgroundColor', type: 'string', description: 'Background color (hex)' },
                { field: 'surfaceColor', type: 'string', description: 'Surface/card color (hex)' },
                { field: 'textColor', type: 'string', description: 'Primary text color (hex)' },
                { field: 'textMutedColor', type: 'string', description: 'Muted/secondary text color (hex)' },
                { field: 'successColor', type: 'string', description: 'Success state color (hex)' },
                { field: 'warningColor', type: 'string', description: 'Warning state color (hex)' },
                { field: 'errorColor', type: 'string', description: 'Error state color (hex)' },
                { field: 'infoColor', type: 'string', description: 'Info state color (hex)' },
                { field: 'headingFont', type: 'string', description: 'Heading font family (e.g. Inter, Playfair Display)' },
                { field: 'bodyFont', type: 'string', description: 'Body text font family (e.g. Inter, Source Sans Pro)' },
                { field: 'accentFont', type: 'string', description: 'Accent font family (e.g. Playfair Display, Cormorant Garamond)' },
                { field: 'monoFont', type: 'string', description: 'Monospace font family (e.g. JetBrains Mono)' },
                { field: 'headingLineHeight', type: 'string', description: 'Heading line height (e.g. "1.2")' },
                { field: 'bodyLineHeight', type: 'string', description: 'Body text line height (e.g. "1.6")' },
                { field: 'headingLetterSpacing', type: 'string', description: 'Heading letter spacing (e.g. "-0.02em")' },
                { field: 'bodyLetterSpacing', type: 'string', description: 'Body letter spacing (e.g. "0")' },
                { field: 'borderRadiusSm', type: 'string', description: 'Small border radius (e.g. "0.375rem")' },
                { field: 'borderRadiusMd', type: 'string', description: 'Medium border radius (e.g. "0.5rem")' },
                { field: 'borderRadiusLg', type: 'string', description: 'Large border radius (e.g. "0.75rem")' },
                { field: 'borderRadiusXl', type: 'string', description: 'Extra-large border radius (e.g. "1rem")' },
                { field: 'sectionSpacing', type: 'string', description: 'Section spacing (e.g. "4rem")' },
                { field: 'componentSpacing', type: 'string', description: 'Component spacing (e.g. "1.5rem")' },
                { field: 'elementSpacing', type: 'string', description: 'Element spacing (e.g. "0.75rem")' },
                { field: 'iconStyle', type: 'object', description: 'Icon style object with id, name, strokeWidth, fill, defaultSize, style' },
                { field: 'imageStyle', type: 'object', description: 'Image style object with id, name, borderRadius, shadow, filter, aspectRatio' },
                { field: 'selectedTemplateId', type: 'string', description: 'ID of the selected preset template (if mode is "preset")' },
              ],
              notes: ['Returns an empty object {} if no visual identity data exists for the company — this is a valid state for new companies.', 'The moduleId path parameter must be "visual-identity" (literal string).', 'This is the same endpoint the UI uses to load visual identity data.', 'Colors are stored as hex strings (e.g. "#7C6BF0").', 'Typography fonts correspond to Google Fonts entries.', 'Spacing and border radius values use CSS units (rem, em, px).'],
              commonMistakes: ['Using the visual identity document _id instead of companyId in the URL — the path parameter is the companyId.', 'Forgetting that moduleId must be "visual-identity" — it is part of the URL path.', 'Expecting an array — this endpoint returns a single object or empty object {}.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'visual-identity.view'],
              relatedApis: ['vi-save', 'vi-delete'],
            },
            {
              id: 'vi-save',
              name: 'Save Visual Identity',
              method: 'POST',
              path: '/api/module-data/visual-identity',
              purpose: 'Save or update visual identity data for a company. This endpoint uses upsert — it creates the data if it doesn\'t exist, or updates it if it does.',
              whenToUse: 'Use this endpoint to create or update visual identity data — colors, typography, spacing, border radius, icon style, and image style.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "visual-identity" for this endpoint' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', data: 'object (required) — Visual identity data object containing any of: mode, primaryColor, secondaryColor, accentColor, backgroundColor, surfaceColor, textColor, textMutedColor, successColor, warningColor, errorColor, infoColor, headingFont, bodyFont, accentFont, monoFont, headingLineHeight, bodyLineHeight, headingLetterSpacing, bodyLetterSpacing, borderRadiusSm, borderRadiusMd, borderRadiusLg, borderRadiusXl, sectionSpacing, componentSpacing, elementSpacing, iconStyle, imageStyle, selectedTemplateId' },
              successResponse: { status: 200, description: 'Visual identity data saved', body: { primaryColor: '#7C6BF0', secondaryColor: '#1E293B', accentColor: '#22D3EE', headingFont: 'Inter', bodyFont: 'Inter', mode: 'preset' } },
              errorResponses: [
                { code: 400, message: 'Validation error (companyId and data required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/module-data/visual-identity \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "data": {"primaryColor": "#7C6BF0", "secondaryColor": "#1E293B", "accentColor": "#22D3EE", "headingFont": "Inter", "bodyFont": "Inter", "mode": "preset"}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/visual-identity', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { primaryColor: '#7C6BF0', headingFont: 'Inter', bodyFont: 'Inter', mode: 'preset' } }),
});
const visualIdentity = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/module-data/visual-identity',
  { companyId: 'YOUR_COMPANY_ID', data: { primaryColor: '#7C6BF0', headingFont: 'Inter', bodyFont: 'Inter', mode: 'preset' } },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { primaryColor: '#7C6BF0', headingFont: 'Inter', mode: 'preset' } });
const options = { hostname: 'api.mengo.ai', path: '/api/module-data/visual-identity', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/module-data/visual-identity',
    json={'companyId': 'YOUR_COMPANY_ID', 'data': {'primaryColor': '#7C6BF0', 'headingFont': 'Inter', 'bodyFont': 'Inter', 'mode': 'preset'}},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/visual-identity');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'data' => ['primaryColor' => '#7C6BF0', 'headingFont' => 'Inter', 'mode' => 'preset']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '(response)', type: 'object', description: 'The saved visual identity data object (mirrors what was sent in the data field)' },
              ],
              notes: ['This endpoint uses upsert — it creates if not found, or updates if already existing. No need to check if data exists first.', 'The moduleId path parameter must be "visual-identity" (literal string).', 'The request body must include both companyId and data. The data field is an object containing all visual identity fields.', 'Only include fields you want to save — the entire data object is replaced on each save.', 'Colors must be valid hex strings (e.g. "#7C6BF0").', 'Font values must match available Google Fonts.', 'Spacing and border radius values should use CSS units (rem, em, px).'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.', 'Sending visual identity fields at the top level instead of inside the "data" object. All fields must be nested inside the data property.', 'Using POST for partial updates — this endpoint replaces the entire data object. Include all fields you want to keep.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'visual-identity.edit'],
              relatedApis: ['vi-get', 'vi-delete'],
            },
            {
              id: 'vi-delete',
              name: 'Delete Visual Identity',
              method: 'DELETE',
              path: '/api/module-data/visual-identity/:companyId',
              purpose: 'Permanently delete visual identity data for a company.',
              whenToUse: 'Use this endpoint to remove all visual identity data. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'moduleId', type: 'string', required: true, description: 'Always "visual-identity" for this endpoint' },
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Visual identity data deleted', body: { message: 'Module data deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/module-data/visual-identity/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/visual-identity/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'The moduleId path parameter must be "visual-identity" (literal string).', 'Deleting visual identity data does not affect the Brand model record (strategy, purpose, personality, etc.) — those are separate.'],
              commonMistakes: ['Using the visual identity document _id instead of companyId in the URL — the path parameter is the companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'visual-identity.delete'],
              relatedApis: ['vi-get', 'vi-save'],
            },
          ],
        },
        // --- Brand Assets ---
        {
          id: 'brand-assets',
          name: 'Brand Assets',
          description: 'Upload, manage, and download brand assets — logos, favicons, social media images, watermarks, and more.',
          endpoints: [
            {
              id: 'ba-get-all',
              name: 'Get All Brand Assets',
              method: 'GET',
              path: '/api/brand-assets/:companyId',
              purpose: 'Retrieve all brand assets for a company.',
              whenToUse: 'Use this endpoint to list all brand assets (logos, favicons, social media images, etc.) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of brand assets', body: [{ _id: '...', companyId: '...', name: 'Primary Logo', type: 'logo', format: 'png', url: '/uploads/brand-assets/asset.png', isPrimary: true, tags: ['brand', 'logo'], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/brand-assets/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const assets = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/brand-assets/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/brand-assets/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/brand-assets/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Asset document ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'Asset name' },
                { field: '[].type', type: 'string', description: 'Asset type (logo, favicon, social-og, watermark, etc.)' },
                { field: '[].format', type: 'string', description: 'File format (svg, png, jpg, pdf, webp, ico, gif, content)' },
                { field: '[].url', type: 'string', description: 'File URL path (e.g. /uploads/brand-assets/asset.png)' },
                { field: '[].fileName', type: 'string', description: 'Original file name' },
                { field: '[].fileSize', type: 'number', description: 'File size in bytes' },
                { field: '[].fileType', type: 'string', description: 'MIME type (e.g. image/png)' },
                { field: '[].isPrimary', type: 'boolean', description: 'Whether this is the primary asset of its type' },
                { field: '[].tags', type: 'string[]', description: 'Tags for categorization' },
                { field: '[].description', type: 'string', description: 'Asset description' },
                { field: '[].sourceUrl', type: 'string', description: 'Source URL if asset was imported' },
                { field: '[].dimensions', type: 'object', description: 'Object with width and height (if available)' },
                { field: '[].founderId', type: 'string', description: 'Linked founder ID (if applicable)' },
                { field: '[].employeeId', type: 'string', description: 'Linked employee ID (if applicable)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of asset objects. The heavy base64Data field is excluded for performance.', 'Assets are sorted by creation date, newest first.', 'The type field uses specific enum values: logo, secondary-logo, wordmark, logo-icon, favicon, social-og, social-twitter, social-linkedin, social-instagram, social-facebook, social-tiktok, social-youtube, email-header, email-footer, email-signature, presentation, document, web-banner, app-icon, brandPattern, backgroundImage, watermark, virtual-background, clear-space-guidelines, minimum-size-guidelines, brand-usage-rules, dos-and-donts, other, custom.'],
              commonMistakes: ['Expecting base64Data in the response — it is excluded for performance. Use the /detail/:id endpoint for full data or /base64/:id for legacy records.', 'Using a POST body instead of a path parameter for companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'brand-assets.view'],
              relatedApis: ['ba-get-detail', 'ba-create', 'ba-update', 'ba-delete', 'ba-download'],
            },
            {
              id: 'ba-get-detail',
              name: 'Get Brand Asset Detail',
              method: 'GET',
              path: '/api/brand-assets/detail/:id',
              purpose: 'Retrieve a single brand asset by ID, including all fields.',
              whenToUse: 'Use this endpoint to get full details of a specific brand asset.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Brand asset document ID' },
              ],
              successResponse: { status: 200, description: 'Brand asset details', body: { _id: '...', companyId: '...', name: 'Primary Logo', type: 'logo', format: 'png', url: '/uploads/brand-assets/asset.png', fileName: 'logo.png', fileSize: 12345, fileType: 'image/png', isPrimary: true, tags: ['brand', 'logo'], description: 'Main company logo', source: 'upload', dimensions: { width: 512, height: 512 }, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Asset not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/brand-assets/detail/ASSET_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets/detail/ASSET_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const asset = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/brand-assets/detail/ASSET_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/brand-assets/detail/ASSET_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/brand-assets/detail/ASSET_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets/detail/ASSET_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Asset document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Asset name' },
                { field: 'type', type: 'string', description: 'Asset type enum (logo, favicon, social-og, etc.)' },
                { field: 'format', type: 'string', description: 'File format (svg, png, jpg, pdf, webp, ico, gif, content)' },
                { field: 'url', type: 'string', description: 'File URL path' },
                { field: 'fileName', type: 'string', description: 'Original file name' },
                { field: 'fileSize', type: 'number', description: 'File size in bytes' },
                { field: 'fileType', type: 'string', description: 'MIME type' },
                { field: 'isPrimary', type: 'boolean', description: 'Whether this is the primary asset of its type' },
                { field: 'tags', type: 'string[]', description: 'Tags for categorization' },
                { field: 'description', type: 'string', description: 'Asset description' },
                { field: 'sourceUrl', type: 'string', description: 'Source URL if asset was imported' },
                { field: 'source', type: 'string', description: 'Source of the asset (upload, ai-generated, etc.)' },
                { field: 'dimensions', type: 'object', description: 'Object with width and height' },
                { field: 'contentData', type: 'string', description: 'JSON string of structured guidelines content (for guidelines types)' },
                { field: 'founderId', type: 'string', description: 'Linked founder ID' },
                { field: 'employeeId', type: 'string', description: 'Linked employee ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['This endpoint returns all fields including the full document. For listing assets, use GET /:companyId instead.', 'The base64Data field is included only for legacy records. New records store files on disk and use the url field.'],
              commonMistakes: ['Using companyId instead of the asset _id in the URL — this endpoint requires the asset document ID.', 'Expecting base64Data to always be present — new records store files on disk instead.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'brand-assets.view'],
              relatedApis: ['ba-get-all', 'ba-update', 'ba-delete'],
            },
            {
              id: 'ba-download',
              name: 'Download Brand Asset',
              method: 'GET',
              path: '/api/brand-assets/:id/download',
              purpose: 'Download a brand asset in a specific format (PNG, JPG, SVG, ICO, WEBP, PDF, GIF).',
              whenToUse: 'Use this endpoint to download a brand asset file, optionally converting it to a different format.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Brand asset document ID' },
              ],
              queryParams: [
                { name: 'format', type: 'string', required: false, description: 'Desired output format: png, jpg, svg, ico, webp, pdf, gif. Defaults to png.' },
              ],
              successResponse: { status: 200, description: 'Asset file downloaded', body: { message: 'Binary file download — Content-Disposition header with filename' } },
              errorResponses: [
                { code: 400, message: 'Format not available for this asset type' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Asset not found or source file missing' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/brand-assets/ASSET_ID/download?format=png" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -o logo.png`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets/ASSET_ID/download?format=png', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const blob = await response.blob();`,
              axiosExample: `const response = await axios.get('https://app.mengoengine.com/api/brand-assets/ASSET_ID/download?format=png', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
  responseType: 'blob',
});`,
              nodeExample: `const https = require('https');
const fs = require('fs');
const options = { hostname: 'api.mengo.ai', path: '/api/brand-assets/ASSET_ID/download?format=png', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.get(options, (res) => { const ws = fs.createWriteStream('logo.png'); res.pipe(ws); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/brand-assets/ASSET_ID/download',
    params={'format': 'png'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})
with open('logo.png', 'wb') as f:
    f.write(response.content)`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets/ASSET_ID/download?format=png');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
file_put_contents('logo.png', $response);`,
              responseFields: [
                { field: '(binary)', type: 'file', description: 'Binary file download with Content-Disposition header' },
              ],
              notes: ['This endpoint returns a binary file, not JSON. The Content-Disposition header contains the filename.', 'Available formats depend on the asset type. For example, SVG assets can be converted to PNG, JPG, etc.', 'If the requested format matches the stored format, the original file is streamed directly.', 'Guidelines types (clear-space-guidelines, minimum-size-guidelines, etc.) do not support image downloads.'],
              commonMistakes: ['Expecting a JSON response — this endpoint returns a binary file.', 'Trying to download a guidelines-type asset (content format) — these types do not support image downloads.'],
              rateLimits: '60 requests per minute',
              requiredPermissions: ['admin.read', 'brand-assets.view'],
              relatedApis: ['ba-get-detail', 'ba-get-all'],
            },
            {
              id: 'ba-create',
              name: 'Create Brand Asset',
              method: 'POST',
              path: '/api/brand-assets',
              purpose: 'Create a new brand asset with JSON data (URL-based or base64).',
              whenToUse: 'Use this endpoint to create a brand asset from a URL or base64-encoded data. For file uploads, use the /upload endpoint instead.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Asset name (max 100 characters)', companyId: 'string (required) — Company ID', type: 'string (required) — Asset type (logo, secondary-logo, wordmark, logo-icon, favicon, social-og, etc.)', format: 'string (required) — File format (svg, png, jpg, pdf, webp, ico, gif, content)', url: 'string (optional) — URL to the asset file', base64Data: 'string (optional) — Base64-encoded file data (legacy, will be converted to file)', description: 'string (optional) — Asset description', sourceUrl: 'string (optional) — Source URL of the asset', source: 'string (optional) — Source type (upload, ai-generated, etc.)', isPrimary: 'boolean (optional) — Set as primary asset of this type (default: false)', tags: 'string[] (optional) — Tags for categorization', founderId: 'string (optional) — Linked founder ID', employeeId: 'string (optional) — Linked employee ID' },
              successResponse: { status: 201, description: 'Brand asset created', body: { _id: '...', companyId: '...', name: 'Primary Logo', type: 'logo', format: 'png', url: '/uploads/brand-assets/asset.png', isPrimary: true, tags: ['brand', 'logo'], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name, companyId, and type are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/brand-assets \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Primary Logo", "type": "logo", "format": "png", "url": "/uploads/brand-assets/logo.png", "isPrimary": true, "tags": ["brand", "logo"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Primary Logo', type: 'logo', format: 'png', url: '/uploads/brand-assets/logo.png', isPrimary: true, tags: ['brand', 'logo'] }),
});
const asset = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/brand-assets',
  { companyId: 'YOUR_COMPANY_ID', name: 'Primary Logo', type: 'logo', format: 'png', isPrimary: true, tags: ['brand', 'logo'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Primary Logo', type: 'logo', format: 'png', isPrimary: true });
const options = { hostname: 'api.mengo.ai', path: '/api/brand-assets', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/brand-assets',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Primary Logo', 'type': 'logo', 'format': 'png', 'isPrimary': True, 'tags': ['brand', 'logo']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Primary Logo', 'type' => 'logo', 'format' => 'png', 'isPrimary' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New asset document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Asset name' },
                { field: 'type', type: 'string', description: 'Asset type' },
                { field: 'format', type: 'string', description: 'File format' },
                { field: 'url', type: 'string', description: 'File URL path' },
                { field: 'isPrimary', type: 'boolean', description: 'Whether this is the primary asset of its type' },
                { field: 'tags', type: 'string[]', description: 'Tags' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['name, companyId, and type are required fields.', 'If isPrimary is set to true, all other primary assets of the same type will be automatically unset.', 'For file uploads, use the /upload endpoint (multipart/form-data) instead of this JSON endpoint.', 'If base64Data is provided, it will be converted to a file and stored on disk automatically.', 'The type field must be one of the valid enum values: logo, secondary-logo, wordmark, logo-icon, favicon, social-og, social-twitter, social-linkedin, social-instagram, social-facebook, social-tiktok, social-youtube, email-header, email-footer, email-signature, presentation, document, web-banner, app-icon, brandPattern, backgroundImage, watermark, virtual-background, clear-space-guidelines, minimum-size-guidelines, brand-usage-rules, dos-and-donts, other, custom.'],
              commonMistakes: ['Using this endpoint for file uploads — use POST /api/brand-assets/upload with multipart/form-data instead.', 'Forgetting to include format — it is a required field.', 'Setting isPrimary on a type that already has a primary asset — the existing primary will be automatically unset.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'brand-assets.create'],
              relatedApis: ['ba-get-all', 'ba-get-detail', 'ba-update', 'ba-delete'],
            },
            {
              id: 'ba-update',
              name: 'Update Brand Asset',
              method: 'PUT',
              path: '/api/brand-assets/:id',
              purpose: 'Update a brand asset\'s metadata (JSON). For file replacement, use PUT /:id/upload.',
              whenToUse: 'Use this endpoint to update asset metadata like name, description, tags, isPrimary, etc. For replacing the file itself, use the upload endpoint.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Brand asset document ID' },
              ],
              requestBody: { name: 'string (optional) — Updated asset name', type: 'string (optional) — Updated asset type', description: 'string (optional) — Updated description', isPrimary: 'boolean (optional) — Set as primary', tags: 'string[] (optional) — Updated tags', sourceUrl: 'string (optional) — Updated source URL' },
              successResponse: { status: 200, description: 'Asset updated', body: { _id: '...', name: 'Updated Logo', type: 'logo', isPrimary: true, updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Asset not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/brand-assets/ASSET_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Logo", "isPrimary": true, "tags": ["brand", "logo", "primary"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets/ASSET_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Logo', isPrimary: true, tags: ['brand', 'logo', 'primary'] }),
});
const asset = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/brand-assets/ASSET_ID',
  { name: 'Updated Logo', isPrimary: true, tags: ['brand', 'logo', 'primary'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Logo', isPrimary: true });
const options = { hostname: 'api.mengo.ai', path: '/api/brand-assets/ASSET_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/brand-assets/ASSET_ID',
    json={'name': 'Updated Logo', 'isPrimary': True, 'tags': ['brand', 'logo', 'primary']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets/ASSET_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Logo', 'isPrimary' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Asset document ID' },
                { field: 'name', type: 'string', description: 'Updated asset name' },
                { field: 'type', type: 'string', description: 'Updated asset type' },
                { field: 'isPrimary', type: 'boolean', description: 'Whether this is the primary asset of its type' },
                { field: 'tags', type: 'string[]', description: 'Updated tags' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'If isPrimary is set to true, all other primary assets of the same type will be automatically unset.', 'For replacing the actual file, use PUT /:id/upload (multipart/form-data) instead.', 'If base64Data is included in the update, it will be converted to a file and stored on disk.'],
              commonMistakes: ['Using companyId in the URL path instead of the asset _id. First call GET /:companyId to find the asset _id.', 'Trying to update the file itself through this JSON endpoint — use PUT /:id/upload for file replacement.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'brand-assets.edit'],
              relatedApis: ['ba-get-detail', 'ba-create', 'ba-delete'],
            },
            {
              id: 'ba-delete',
              name: 'Delete Brand Asset',
              method: 'DELETE',
              path: '/api/brand-assets/:id',
              purpose: 'Permanently delete a brand asset and its file from disk.',
              whenToUse: 'Use this endpoint to remove a brand asset. This action also deletes the associated file from disk.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Brand asset document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Asset deleted', body: { message: 'Asset deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Asset not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/brand-assets/ASSET_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/brand-assets/ASSET_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/brand-assets/ASSET_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/brand-assets/ASSET_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/brand-assets/ASSET_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/brand-assets/ASSET_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'The associated file on disk is also deleted.', 'Cached format conversions are also cleaned up.'],
              commonMistakes: ['Not verifying the asset ID before deleting — there is no undo.', 'Using companyId instead of the asset _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'brand-assets.delete'],
              relatedApis: ['ba-get-all', 'ba-get-detail', 'ba-update'],
            },
          ],
        },
        // --- Stationery ---
        {
          id: 'stationery',
          name: 'Stationery',
          description: 'Manage branded stationery items — business cards, letterheads, envelopes, email signatures, and more.',
          endpoints: [
            {
              id: 'st-get-all',
              name: 'Get All Stationery',
              method: 'GET',
              path: '/api/stationery/:companyId',
              purpose: 'Retrieve all stationery items for a company.',
              whenToUse: 'Use this endpoint to list all stationery items (business cards, letterheads, envelopes, etc.) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of stationery items', body: [{ _id: '...', companyId: '...', name: 'Business Card', type: 'business-card', status: 'approved', tags: ['brand', 'card'], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/stationery/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/stationery/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/stationery/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/stationery/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/stationery/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/stationery/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Stationery document ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'Stationery item name' },
                { field: '[].type', type: 'string', description: 'Stationery type (business-card, letterhead, envelope-a4, email-signature, etc.)' },
                { field: '[].description', type: 'string', description: 'Description of the stationery item' },
                { field: '[].status', type: 'string', description: 'Status: draft, approved, or archived' },
                { field: '[].templateUrl', type: 'string', description: 'URL to the template file' },
                { field: '[].previewImageUrl', type: 'string', description: 'URL to the preview image' },
                { field: '[].sourceUrl', type: 'string', description: 'Design file URL (Canva, Figma, etc.)' },
                { field: '[].tags', type: 'string[]', description: 'Tags for categorization' },
                { field: '[].kind', type: 'string', description: 'Creation kind: "ai" or "manual"' },
                { field: '[].founderId', type: 'string', description: 'Linked founder ID' },
                { field: '[].employeeId', type: 'string', description: 'Linked employee ID' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of stationery items, sorted by creation date (newest first).', 'The type field uses specific enum values: business-card, letterhead, envelope-a4, envelope-dl, email-signature, presentation-template, invoice-template, quotation-template, receipt-design, purchase-order, billing-format, proposal-template, thank-you-card, warranty-card, instruction-manual, product-insert-card, branded-stickers, packaging-tape, stamps, branding-print, standees-print, booth-designs, t-shirts, notebook, coffee-mug, tote-bag, newsletter-template, brochure-pdf, pitch-deck, tagline, hook-style, standees-marketing, marketing-collateral, envelope, memo-pad, folder, compliment-slip, other.', 'Status can be: draft, approved, archived.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array of stationery items.', 'Using a POST body instead of a path parameter for companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'stationery.view'],
              relatedApis: ['st-get-detail', 'st-create', 'st-update', 'st-delete'],
            },
            {
              id: 'st-get-detail',
              name: 'Get Stationery Detail',
              method: 'GET',
              path: '/api/stationery/detail/:id',
              purpose: 'Retrieve a single stationery item by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific stationery item.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Stationery document ID' },
              ],
              successResponse: { status: 200, description: 'Stationery item details', body: { _id: '...', companyId: '...', name: 'Business Card', type: 'business-card', description: 'Primary business card design', status: 'approved', templateUrl: '...', previewImageUrl: '...', sourceUrl: '...', tags: ['brand', 'card'], dimensions: { width: 90, height: 55, unit: 'mm' }, kind: 'ai', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Stationery not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/stationery/detail/ITEM_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/stationery/detail/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/stationery/detail/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/stationery/detail/ITEM_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/stationery/detail/ITEM_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/stationery/detail/ITEM_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Stationery document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Stationery item name' },
                { field: 'type', type: 'string', description: 'Stationery type (business-card, letterhead, etc.)' },
                { field: 'description', type: 'string', description: 'Description of the stationery item' },
                { field: 'status', type: 'string', description: 'Status: draft, approved, or archived' },
                { field: 'templateUrl', type: 'string', description: 'URL to the template file' },
                { field: 'previewImageUrl', type: 'string', description: 'URL to the preview image' },
                { field: 'sourceUrl', type: 'string', description: 'Design file URL (Canva, Figma, etc.)' },
                { field: 'fileName', type: 'string', description: 'Original file name' },
                { field: 'fileSize', type: 'number', description: 'File size in bytes' },
                { field: 'fileType', type: 'string', description: 'MIME type' },
                { field: 'dimensions', type: 'object', description: 'Object with width, height, and unit (mm, in, px)' },
                { field: 'approvedBy', type: 'string', description: 'User who approved the item' },
                { field: 'approvedAt', type: 'string', description: 'ISO date when approved' },
                { field: 'tags', type: 'string[]', description: 'Tags for categorization' },
                { field: 'kind', type: 'string', description: 'Creation kind: "ai" or "manual"' },
                { field: 'templateId', type: 'string', description: 'ID of the stationery template used' },
                { field: 'backTemplateId', type: 'string', description: 'ID of the back template (for double-sided items)' },
                { field: 'renderedImageUrl', type: 'string', description: 'URL of the rendered/composed image' },
                { field: 'bleedMm', type: 'number', description: 'Bleed margin in millimetres' },
                { field: 'marginMm', type: 'number', description: 'Safe margin in millimetres' },
                { field: 'exportFormats', type: 'string[]', description: 'Export formats produced (e.g. ["png", "pdf"])' },
                { field: 'founderId', type: 'string', description: 'Linked founder ID' },
                { field: 'employeeId', type: 'string', description: 'Linked employee ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full stationery item document including all fields.', 'The kind field indicates how the item was created: "ai" for AI-generated, "manual" for manually created.', 'Dimensions use the unit field (mm, in, px) to specify the measurement system.'],
              commonMistakes: ['Using companyId instead of the stationery _id in the URL — this endpoint requires the document ID.', 'Confusing templateId with the stationery document _id — templateId refers to a StationeryTemplate, not the Stationery itself.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'stationery.view'],
              relatedApis: ['st-get-all', 'st-update', 'st-delete'],
            },
            {
              id: 'st-create',
              name: 'Create Stationery',
              method: 'POST',
              path: '/api/stationery',
              purpose: 'Create a new stationery item.',
              whenToUse: 'Use this endpoint to create a new stationery item (business card, letterhead, envelope, etc.).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Stationery name (max 100 characters)', companyId: 'string (required) — Company ID', type: 'string (required) — Stationery type (business-card, letterhead, envelope-a4, envelope-dl, email-signature, presentation-template, invoice-template, etc.)', description: 'string (optional, max 500 chars) — Description of the stationery item', templateUrl: 'string (optional) — URL to the template file', previewImageUrl: 'string (optional) — URL to the preview image', sourceUrl: 'string (optional) — Design file URL (Canva, Figma, etc.)', status: 'string (optional) — Status: draft, approved, or archived (default: draft)', tags: 'string[] (optional) — Tags for categorization', founderId: 'string (optional) — Linked founder ID', employeeId: 'string (optional) — Linked employee ID', kind: 'string (optional) — Creation kind: "ai" or "manual"', templateId: 'string (optional) — ID of the stationery template used', dimensions: 'object (optional) — { width: number, height: number, unit: "mm"|"in"|"px" }' },
              successResponse: { status: 201, description: 'Stationery item created', body: { _id: '...', companyId: '...', name: 'Business Card', type: 'business-card', status: 'draft', tags: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name, companyId, and type are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/stationery \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Business Card", "type": "business-card", "description": "Primary business card design", "status": "draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/stationery', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Business Card', type: 'business-card', description: 'Primary business card design', status: 'draft' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/stationery',
  { companyId: 'YOUR_COMPANY_ID', name: 'Business Card', type: 'business-card', description: 'Primary business card design', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Business Card', type: 'business-card', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/stationery', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/stationery',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Business Card', 'type': 'business-card', 'description': 'Primary business card design', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/stationery');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Business Card', 'type' => 'business-card', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New stationery document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Stationery item name' },
                { field: 'type', type: 'string', description: 'Stationery type' },
                { field: 'status', type: 'string', description: 'Status (default: draft)' },
                { field: 'tags', type: 'string[]', description: 'Tags' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['name, companyId, and type are required fields.', 'The type field must be one of the valid enum values.', 'Description is optional but limited to 500 characters.', 'Status defaults to "draft" if not provided. Valid values: draft, approved, archived.'],
              commonMistakes: ['Forgetting to include companyId in the request body — it is required.', 'Using an invalid type value — must be one of the predefined enum values.', 'Exceeding the 500-character limit for the description field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'stationery.create'],
              relatedApis: ['st-get-all', 'st-get-detail', 'st-update', 'st-delete'],
            },
            {
              id: 'st-update',
              name: 'Update Stationery',
              method: 'PUT',
              path: '/api/stationery/:id',
              purpose: 'Update an existing stationery item.',
              whenToUse: 'Use this endpoint to modify a stationery item\'s name, type, description, status, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Stationery document ID' },
              ],
              requestBody: { name: 'string (optional) — Updated stationery name', type: 'string (optional) — Updated stationery type', description: 'string (optional) — Updated description', status: 'string (optional) — Updated status (draft, approved, archived)', tags: 'string[] (optional) — Updated tags', sourceUrl: 'string (optional) — Updated source URL', previewImageUrl: 'string (optional) — Updated preview image URL', templateUrl: 'string (optional) — Updated template URL' },
              successResponse: { status: 200, description: 'Stationery item updated', body: { _id: '...', name: 'Updated Business Card', type: 'business-card', status: 'approved', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Stationery not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/stationery/ITEM_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Business Card", "status": "approved", "tags": ["brand", "card", "primary"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/stationery/ITEM_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Business Card', status: 'approved', tags: ['brand', 'card', 'primary'] }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/stationery/ITEM_ID',
  { name: 'Updated Business Card', status: 'approved', tags: ['brand', 'card', 'primary'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Business Card', status: 'approved' });
const options = { hostname: 'api.mengo.ai', path: '/api/stationery/ITEM_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/stationery/ITEM_ID',
    json={'name': 'Updated Business Card', 'status': 'approved', 'tags': ['brand', 'card', 'primary']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/stationery/ITEM_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Business Card', 'status' => 'approved']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Stationery document ID' },
                { field: 'name', type: 'string', description: 'Updated stationery name' },
                { field: 'type', type: 'string', description: 'Updated stationery type' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'tags', type: 'string[]', description: 'Updated tags' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The status field can be changed to approve or archive items.', 'The updatedAt timestamp is automatically set on each update.'],
              commonMistakes: ['Using companyId instead of the stationery _id in the URL path.', 'Exceeding the 500-character limit for the description field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'stationery.edit'],
              relatedApis: ['st-get-all', 'st-get-detail', 'st-delete'],
            },
            {
              id: 'st-delete',
              name: 'Delete Stationery',
              method: 'DELETE',
              path: '/api/stationery/:id',
              purpose: 'Permanently delete a stationery item.',
              whenToUse: 'Use this endpoint to remove a stationery item. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Stationery document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Stationery item deleted', body: { message: 'Stationery deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Stationery not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/stationery/ITEM_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/stationery/ITEM_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/stationery/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/stationery/ITEM_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/stationery/ITEM_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/stationery/ITEM_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting a stationery item does not affect associated templates.'],
              commonMistakes: ['Not verifying the item ID before deleting — there is no undo.', 'Using companyId instead of the stationery _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'stationery.delete'],
              relatedApis: ['st-get-all', 'st-get-detail', 'st-update'],
            },
          ],
        },
        // --- HR Assets ---
        {
          id: 'hr-assets',
          name: 'HR Assets',
          description: 'Manage HR documents, templates, forms, and branding assets — offer letters, ID cards, certificates, and more.',
          endpoints: [
            {
              id: 'hr-get-all',
              name: 'Get All HR Assets',
              method: 'GET',
              path: '/api/hr-assets/:companyId',
              purpose: 'Retrieve all HR assets for a company.',
              whenToUse: 'Use this endpoint to list all HR assets (offer letters, ID cards, certificates, etc.) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of HR assets', body: [{ _id: '...', companyId: '...', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', status: 'approved', tags: ['hr', 'letters'], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/hr-assets/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/hr-assets/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/hr-assets/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/hr-assets/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'HR asset document ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'HR asset name' },
                { field: '[].type', type: 'string', description: 'Asset type (offer-letter, id-card-front, experience-certificate, etc.)' },
                { field: '[].category', type: 'string', description: 'Asset category (desk-office, legal-documents, internal-branding, letters, leave-forms, certifications, folders, recruitment, onboarding, performance, exit, other)' },
                { field: '[].description', type: 'string', description: 'Description of the HR asset' },
                { field: '[].status', type: 'string', description: 'Status: draft, approved, or archived' },
                { field: '[].department', type: 'string', description: 'Department this asset belongs to' },
                { field: '[].tags', type: 'string[]', description: 'Tags for categorization' },
                { field: '[].founderId', type: 'string', description: 'Linked founder ID' },
                { field: '[].employeeId', type: 'string', description: 'Linked employee ID' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of HR asset objects, sorted by creation date (newest first).', 'The type field uses specific enum values across categories: desk-office (notepad, diary-planner, file-folder, document-folder, pen-branding, desk-name-plate), legal-documents (nda, terms-conditions, policy-documents, employment-contract, service-agreement), internal-branding (id-card-front, id-card-back, lanyard-design, employee-badge, attendance-sheet, internal-memo, visiting-card), letters (offer-letter, relieving-letter, increment-letter, termination-letter, experience-letter, appointment-letter, promotion-letter, warning-letter), leave-forms (full-day-leave, short-leave, half-day-leave, maternity-leave, paternity-leave, medical-leave, annual-leave), certifications (experience-certificate, training-certificate, appreciation-certificate, completion-certificate, internship-certificate), folders (employee-document-folder, onboarding-folder, exit-folder, performance-folder), recruitment (job-description, job-posting-template, interview-evaluation-form, candidate-scorecard, offer-letter-template, rejection-letter), onboarding (welcome-kit, onboarding-checklist, orientation-presentation, handbook, code-of-conduct), performance (appraisal-form, kpi-template, goal-setting-form, feedback-form, pip-template), exit (exit-checklist, handover-form, exit-interview-form, clearance-certificate), other.', 'Category must be one of: desk-office, legal-documents, internal-branding, letters, leave-forms, certifications, folders, recruitment, onboarding, performance, exit, other.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array.', 'Using a POST body instead of a path parameter for companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'hr-assets.view'],
              relatedApis: ['hr-get-detail', 'hr-create', 'hr-update', 'hr-delete', 'hr-bulk-upload'],
            },
            {
              id: 'hr-get-detail',
              name: 'Get HR Asset Detail',
              method: 'GET',
              path: '/api/hr-assets/detail/:id',
              purpose: 'Retrieve a single HR asset by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific HR asset.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'HR asset document ID' },
              ],
              successResponse: { status: 200, description: 'HR asset details', body: { _id: '...', companyId: '...', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', description: 'Standard offer letter template', status: 'approved', templateUrl: '...', previewImageUrl: '...', department: 'HR', tags: ['hr', 'letters'], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'HR asset not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/hr-assets/detail/ITEM_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets/detail/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/hr-assets/detail/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/hr-assets/detail/ITEM_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/hr-assets/detail/ITEM_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets/detail/ITEM_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'HR asset document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'HR asset name' },
                { field: 'type', type: 'string', description: 'Asset type (offer-letter, id-card-front, experience-certificate, etc.)' },
                { field: 'category', type: 'string', description: 'Asset category (desk-office, legal-documents, internal-branding, letters, etc.)' },
                { field: 'description', type: 'string', description: 'Description of the HR asset' },
                { field: 'status', type: 'string', description: 'Status: draft, approved, or archived' },
                { field: 'templateUrl', type: 'string', description: 'URL to the template file' },
                { field: 'previewImageUrl', type: 'string', description: 'URL to the preview image' },
                { field: 'sourceUrl', type: 'string', description: 'Source URL (Canva, Figma, etc.)' },
                { field: 'dimensions', type: 'object', description: 'Object with width, height, and unit (mm, in, px)' },
                { field: 'department', type: 'string', description: 'Department this asset belongs to' },
                { field: 'applicableFor', type: 'string[]', description: 'Array of applicable roles or groups' },
                { field: 'validFrom', type: 'string', description: 'ISO date when the asset becomes valid' },
                { field: 'validUntil', type: 'string', description: 'ISO date when the asset expires' },
                { field: 'version', type: 'string', description: 'Version number or label' },
                { field: 'approvedBy', type: 'string', description: 'User who approved the asset' },
                { field: 'approvedAt', type: 'string', description: 'ISO date when approved' },
                { field: 'tags', type: 'string[]', description: 'Tags for categorization' },
                { field: 'founderId', type: 'string', description: 'Linked founder ID' },
                { field: 'employeeId', type: 'string', description: 'Linked employee ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full HR asset document including all fields.', 'The category field groups assets into: desk-office, legal-documents, internal-branding, letters, leave-forms, certifications, folders, recruitment, onboarding, performance, exit, other.', 'HR assets can have validity periods using validFrom and validUntil dates.', 'The applicableFor field is an array of roles or groups the asset applies to.'],
              commonMistakes: ['Using companyId instead of the HR asset _id in the URL — this endpoint requires the document ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'hr-assets.view'],
              relatedApis: ['hr-get-all', 'hr-create', 'hr-update', 'hr-delete'],
            },
            {
              id: 'hr-create',
              name: 'Create HR Asset',
              method: 'POST',
              path: '/api/hr-assets',
              purpose: 'Create a new HR asset.',
              whenToUse: 'Use this endpoint to create a new HR asset (offer letter, ID card, certificate, etc.).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required, 3-100 chars) — Asset name', companyId: 'string (required) — Company ID', type: 'string (required) — Asset type (offer-letter, id-card-front, experience-certificate, etc.)', category: 'string (required) — Category (desk-office, legal-documents, internal-branding, letters, leave-forms, certifications, folders, recruitment, onboarding, performance, exit, other)', description: 'string (optional) — Description', templateUrl: 'string (optional) — URL to template file', previewImageUrl: 'string (optional) — URL to preview image', sourceUrl: 'string (optional) — Source URL', status: 'string (optional) — Status: draft, approved, archived (default: draft)', tags: 'string[] (optional) — Tags', department: 'string (optional) — Department', applicableFor: 'string[] (optional) — Applicable roles or groups', validFrom: 'string (optional) — ISO date when asset becomes valid', validUntil: 'string (optional) — ISO date when asset expires', version: 'string (optional) — Version label', founderId: 'string (optional) — Linked founder ID', employeeId: 'string (optional) — Linked employee ID' },
              successResponse: { status: 201, description: 'HR asset created', body: { _id: '...', companyId: '...', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', status: 'draft', tags: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (name, companyId, type, and category are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/hr-assets \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Offer Letter Template", "type": "offer-letter", "category": "letters", "description": "Standard offer letter template", "status": "draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', description: 'Standard offer letter template', status: 'draft' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/hr-assets',
  { companyId: 'YOUR_COMPANY_ID', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', description: 'Standard offer letter template', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Offer Letter Template', type: 'offer-letter', category: 'letters', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/hr-assets', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/hr-assets',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Offer Letter Template', 'type': 'offer-letter', 'category': 'letters', 'description': 'Standard offer letter template', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Offer Letter Template', 'type' => 'offer-letter', 'category' => 'letters', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New HR asset document ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'HR asset name' },
                { field: 'type', type: 'string', description: 'Asset type' },
                { field: 'category', type: 'string', description: 'Asset category' },
                { field: 'status', type: 'string', description: 'Status (default: draft)' },
                { field: 'tags', type: 'string[]', description: 'Tags' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['name (3-100 chars), companyId, type, and category are required fields.', 'The name field is validated against gibberish/random input.', 'The type and category fields must be valid enum values — see the Get All endpoint notes for the full list.', 'Status defaults to "draft" if not provided. Valid values: draft, approved, archived.'],
              commonMistakes: ['Forgetting to include companyId, type, or category — all three are required.', 'Using an invalid type or category value — must be from the predefined enum list.', 'Using a name shorter than 3 characters or longer than 100 characters.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'hr-assets.create'],
              relatedApis: ['hr-get-all', 'hr-get-detail', 'hr-update', 'hr-delete', 'hr-bulk-upload'],
            },
            {
              id: 'hr-update',
              name: 'Update HR Asset',
              method: 'PUT',
              path: '/api/hr-assets/:id',
              purpose: 'Update an existing HR asset.',
              whenToUse: 'Use this endpoint to modify an HR asset\'s name, type, category, status, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'HR asset document ID' },
              ],
              requestBody: { name: 'string (optional) — Updated asset name (3-100 chars)', type: 'string (optional) — Updated asset type', category: 'string (optional) — Updated category', description: 'string (optional) — Updated description', status: 'string (optional) — Updated status (draft, approved, archived)', tags: 'string[] (optional) — Updated tags', department: 'string (optional) — Updated department', applicableFor: 'string[] (optional) — Updated applicable roles', sourceUrl: 'string (optional) — Updated source URL', previewImageUrl: 'string (optional) — Updated preview image URL' },
              successResponse: { status: 200, description: 'HR asset updated', body: { _id: '...', name: 'Updated Offer Letter', type: 'offer-letter', category: 'letters', status: 'approved', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'HR asset not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/hr-assets/ITEM_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Offer Letter", "status": "approved", "tags": ["hr", "letters", "template"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets/ITEM_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Offer Letter', status: 'approved', tags: ['hr', 'letters', 'template'] }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/hr-assets/ITEM_ID',
  { name: 'Updated Offer Letter', status: 'approved', tags: ['hr', 'letters', 'template'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Offer Letter', status: 'approved' });
const options = { hostname: 'api.mengo.ai', path: '/api/hr-assets/ITEM_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/hr-assets/ITEM_ID',
    json={'name': 'Updated Offer Letter', 'status': 'approved', 'tags': ['hr', 'letters', 'template']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets/ITEM_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Offer Letter', 'status' => 'approved']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'HR asset document ID' },
                { field: 'name', type: 'string', description: 'Updated asset name' },
                { field: 'type', type: 'string', description: 'Updated asset type' },
                { field: 'category', type: 'string', description: 'Updated category' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'tags', type: 'string[]', description: 'Updated tags' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The name field is validated against gibberish/random input if provided.', 'The status field can be changed to approve or archive items.', 'The updatedAt timestamp is automatically set on each update.'],
              commonMistakes: ['Using companyId instead of the HR asset _id in the URL path.', 'Providing a name shorter than 3 characters or longer than 100 characters.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'hr-assets.edit'],
              relatedApis: ['hr-get-all', 'hr-get-detail', 'hr-delete'],
            },
            {
              id: 'hr-delete',
              name: 'Delete HR Asset',
              method: 'DELETE',
              path: '/api/hr-assets/:id',
              purpose: 'Permanently delete an HR asset.',
              whenToUse: 'Use this endpoint to remove an HR asset. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'HR asset document ID to delete' },
              ],
              successResponse: { status: 200, description: 'HR asset deleted', body: { message: 'HR asset deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'HR asset not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/hr-assets/ITEM_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets/ITEM_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/hr-assets/ITEM_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/hr-assets/ITEM_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/hr-assets/ITEM_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets/ITEM_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the asset ID before deleting — there is no undo.', 'Using companyId instead of the HR asset _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'hr-assets.delete'],
              relatedApis: ['hr-get-all', 'hr-get-detail', 'hr-update'],
            },
            {
              id: 'hr-bulk-upload',
              name: 'Bulk Upload HR Assets',
              method: 'POST',
              path: '/api/hr-assets/bulk',
              purpose: 'Create multiple HR assets in a single request.',
              whenToUse: 'Use this endpoint to create several HR assets at once, e.g. when importing a batch of templates.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', items: 'array (required) — Array of HR asset objects, each with name, type, category, and optional fields' },
              successResponse: { status: 201, description: 'Bulk upload successful', body: { message: 'Bulk upload successful', count: 5 } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to bulk upload HR assets' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/hr-assets/bulk \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "items": [{"name": "Offer Letter", "type": "offer-letter", "category": "letters", "status": "draft"}, {"name": "ID Card Front", "type": "id-card-front", "category": "internal-branding", "status": "draft"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/hr-assets/bulk', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', items: [{ name: 'Offer Letter', type: 'offer-letter', category: 'letters', status: 'draft' }, { name: 'ID Card Front', type: 'id-card-front', category: 'internal-branding', status: 'draft' }] }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/hr-assets/bulk',
  { companyId: 'YOUR_COMPANY_ID', items: [{ name: 'Offer Letter', type: 'offer-letter', category: 'letters', status: 'draft' }, { name: 'ID Card Front', type: 'id-card-front', category: 'internal-branding', status: 'draft' }] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', items: [{ name: 'Offer Letter', type: 'offer-letter', category: 'letters', status: 'draft' }] });
const options = { hostname: 'api.mengo.ai', path: '/api/hr-assets/bulk', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/hr-assets/bulk',
    json={'companyId': 'YOUR_COMPANY_ID', 'items': [{'name': 'Offer Letter', 'type': 'offer-letter', 'category': 'letters', 'status': 'draft'}]},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/hr-assets/bulk');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'items' => [['name' => 'Offer Letter', 'type' => 'offer-letter', 'category' => 'letters', 'status' => 'draft']]]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
                { field: 'count', type: 'number', description: 'Number of assets created' },
              ],
              notes: ['Each item in the items array must include at least name, type, and category.', 'The companyId is applied to all items in the batch.', 'This endpoint requires the "hr-assets.manage" permission (not just "create").', 'If any item fails validation, the entire bulk operation will fail.'],
              commonMistakes: ['Forgetting to include name, type, or category in each item — all three are required.', 'Not wrapping the items array correctly — it should be an array of objects.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'hr-assets.manage'],
              relatedApis: ['hr-get-all', 'hr-create'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // CONTENT GROUP
    // ==========================================
    {
      id: 'content',
      name: 'Content',
      description: 'Content creation, blog management, and SEO optimization',
      icon: 'FileText',
      color: '#8B5CF6',
      categories: [
        // --- Blog Content OS ---
        {
          id: 'blog-content-os',
          name: 'Blog Content OS',
          description: 'Manage blog strategies, calendars, SEO configs, titles, posts, content chunks, exports, structures, and content sections — the complete blog content operating system.',
          endpoints: [
            // --- Strategies ---
            {
              id: 'bcos-strategies-list',
              name: 'Get All Strategies',
              method: 'GET',
              path: '/api/blog-content-os/strategies/:companyId',
              purpose: 'Retrieve all blog strategies for a company.',
              whenToUse: 'Use this endpoint to list all blog content strategies configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of strategies', body: [{ id: '...', companyId: '...', name: 'Content Strategy Q1', type: 'quarterly', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/strategies/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/strategies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/strategies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/strategies/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/strategies/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/strategies/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Strategy ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'Strategy name' },
                { field: '[].type', type: 'string', description: 'Strategy type (quarterly, monthly, etc.)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of strategy objects.', 'If no BlogContentOS document exists for the company, one is auto-created.', 'Strategies are stored as sub-documents in the BlogContentOS collection.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array.', 'Using a POST body instead of a path parameter for companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-strategy-detail', 'bcos-strategy-create', 'bcos-strategy-update', 'bcos-strategy-delete'],
            },
            {
              id: 'bcos-strategy-detail',
              name: 'Get Strategy Detail',
              method: 'GET',
              path: '/api/blog-content-os/strategies/detail/:id',
              purpose: 'Retrieve a single blog strategy by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific blog strategy.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Strategy ID' },
              ],
              successResponse: { status: 200, description: 'Strategy details', body: { id: '...', companyId: '...', name: 'Content Strategy Q1', type: 'quarterly', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Strategy not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/strategies/detail/STRATEGY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/strategies/detail/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/strategies/detail/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/strategies/detail/STRATEGY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/strategies/detail/STRATEGY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/strategies/detail/STRATEGY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Strategy ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Strategy name' },
                { field: 'type', type: 'string', description: 'Strategy type' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full strategy object including all custom fields.', 'The strategy ID is the sub-document id within the strategies array.'],
              commonMistakes: ['Using companyId instead of the strategy sub-document ID in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-strategies-list', 'bcos-strategy-create', 'bcos-strategy-update', 'bcos-strategy-delete'],
            },
            {
              id: 'bcos-strategy-create',
              name: 'Create Strategy',
              method: 'POST',
              path: '/api/blog-content-os/strategies',
              purpose: 'Create a new blog strategy.',
              whenToUse: 'Use this endpoint to add a new content strategy to a company\'s blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (optional) — Strategy name', type: 'string (optional) — Strategy type (quarterly, monthly, etc.)' },
              successResponse: { status: 201, description: 'Strategy created', body: { id: '...', companyId: '...', name: 'Content Strategy Q1', type: 'quarterly', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to create strategy' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/blog-content-os/strategies \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Content Strategy Q1", "type": "quarterly"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/strategies', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Content Strategy Q1', type: 'quarterly' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/blog-content-os/strategies',
  { companyId: 'YOUR_COMPANY_ID', name: 'Content Strategy Q1', type: 'quarterly' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Content Strategy Q1', type: 'quarterly' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/strategies', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/blog-content-os/strategies',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Content Strategy Q1', 'type': 'quarterly'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/strategies');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Content Strategy Q1', 'type' => 'quarterly']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New strategy ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Strategy name' },
                { field: 'type', type: 'string', description: 'Strategy type' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId is required in the request body.', 'If no BlogContentOS document exists for the company, one is auto-created.', 'The strategy is appended to the strategies array and the document is saved.', 'Requires blog-content-os.create permission.'],
              commonMistakes: ['Forgetting to include companyId in the request body.', 'Sending the request to /strategies/:companyId instead of /strategies with companyId in the body.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.create'],
              relatedApis: ['bcos-strategies-list', 'bcos-strategy-detail', 'bcos-strategy-update', 'bcos-strategy-delete'],
            },
            {
              id: 'bcos-strategy-update',
              name: 'Update Strategy',
              method: 'PUT',
              path: '/api/blog-content-os/strategies/:id',
              purpose: 'Update an existing blog strategy.',
              whenToUse: 'Use this endpoint to modify a strategy\'s name, type, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Strategy ID' },
              ],
              requestBody: { name: 'string (optional) — Updated strategy name', type: 'string (optional) — Updated strategy type' },
              successResponse: { status: 200, description: 'Strategy updated', body: { id: '...', name: 'Updated Strategy', type: 'monthly', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Strategy not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Strategy", "type": "monthly"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Strategy', type: 'monthly' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID',
  { name: 'Updated Strategy', type: 'monthly' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Strategy', type: 'monthly' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/strategies/STRATEGY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID',
    json={'name': 'Updated Strategy', 'type': 'monthly'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Strategy', 'type' => 'monthly']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Strategy ID' },
                { field: 'name', type: 'string', description: 'Updated strategy name' },
                { field: 'type', type: 'string', description: 'Updated strategy type' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The updatedAt timestamp is automatically set on each update.', 'Requires blog-content-os.edit permission.'],
              commonMistakes: ['Using companyId instead of the strategy sub-document ID in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.edit'],
              relatedApis: ['bcos-strategies-list', 'bcos-strategy-detail', 'bcos-strategy-delete'],
            },
            {
              id: 'bcos-strategy-delete',
              name: 'Delete Strategy',
              method: 'DELETE',
              path: '/api/blog-content-os/strategies/:id',
              purpose: 'Delete a blog strategy.',
              whenToUse: 'Use this endpoint to remove a strategy from the blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Strategy ID to delete' },
              ],
              successResponse: { status: 200, description: 'Strategy deleted', body: { message: 'Strategy deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Strategy not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/strategies/STRATEGY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/strategies/STRATEGY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires blog-content-os.delete permission.'],
              commonMistakes: ['Not verifying the strategy ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.delete'],
              relatedApis: ['bcos-strategies-list', 'bcos-strategy-detail', 'bcos-strategy-update'],
            },
            // --- Calendars ---
            {
              id: 'bcos-calendars-list',
              name: 'Get All Calendars',
              method: 'GET',
              path: '/api/blog-content-os/calendars/:companyId',
              purpose: 'Retrieve all blog calendars for a company.',
              whenToUse: 'Use this endpoint to list all content calendars configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of calendars', body: [{ id: '...', companyId: '...', name: 'Editorial Calendar 2026', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/calendars/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/calendars/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/calendars/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/calendars/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/calendars/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/calendars/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Calendar ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].name', type: 'string', description: 'Calendar name' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of calendar objects.', 'Calendars are stored as sub-documents in the BlogContentOS collection.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-calendar-detail', 'bcos-calendar-create', 'bcos-calendar-update', 'bcos-calendar-delete'],
            },
            {
              id: 'bcos-calendar-detail',
              name: 'Get Calendar Detail',
              method: 'GET',
              path: '/api/blog-content-os/calendars/detail/:id',
              purpose: 'Retrieve a single blog calendar by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific content calendar.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar ID' },
              ],
              successResponse: { status: 200, description: 'Calendar details', body: { id: '...', companyId: '...', name: 'Editorial Calendar 2026', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Calendar not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/calendars/detail/CALENDAR_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/calendars/detail/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/calendars/detail/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/calendars/detail/CALENDAR_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/calendars/detail/CALENDAR_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/calendars/detail/CALENDAR_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Calendar ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Calendar name' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full calendar object including all custom fields.'],
              commonMistakes: ['Using companyId instead of the calendar sub-document ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-calendars-list', 'bcos-calendar-create', 'bcos-calendar-update', 'bcos-calendar-delete'],
            },
            {
              id: 'bcos-calendar-create',
              name: 'Create Calendar',
              method: 'POST',
              path: '/api/blog-content-os/calendars',
              purpose: 'Create a new blog content calendar.',
              whenToUse: 'Use this endpoint to add a new content calendar to the blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', name: 'string (optional) — Calendar name' },
              successResponse: { status: 201, description: 'Calendar created', body: { id: '...', companyId: '...', name: 'Editorial Calendar 2026', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to create calendar' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/blog-content-os/calendars \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Editorial Calendar 2026"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/calendars', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Editorial Calendar 2026' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/blog-content-os/calendars',
  { companyId: 'YOUR_COMPANY_ID', name: 'Editorial Calendar 2026' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Editorial Calendar 2026' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/calendars', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/blog-content-os/calendars',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Editorial Calendar 2026'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/calendars');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Editorial Calendar 2026']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New calendar ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'name', type: 'string', description: 'Calendar name' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId is required in the request body.', 'If no BlogContentOS document exists for the company, one is auto-created.', 'Requires blog-content-os.create permission.'],
              commonMistakes: ['Forgetting to include companyId in the request body.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.create'],
              relatedApis: ['bcos-calendars-list', 'bcos-calendar-detail', 'bcos-calendar-update', 'bcos-calendar-delete'],
            },
            {
              id: 'bcos-calendar-update',
              name: 'Update Calendar',
              method: 'PUT',
              path: '/api/blog-content-os/calendars/:id',
              purpose: 'Update an existing blog calendar.',
              whenToUse: 'Use this endpoint to modify a calendar\'s fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar ID' },
              ],
              requestBody: { name: 'string (optional) — Updated calendar name' },
              successResponse: { status: 200, description: 'Calendar updated', body: { id: '...', name: 'Updated Calendar', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Calendar not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Calendar"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Calendar' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID',
  { name: 'Updated Calendar' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Calendar' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/calendars/CALENDAR_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID',
    json={'name': 'Updated Calendar'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Calendar']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Calendar ID' },
                { field: 'name', type: 'string', description: 'Updated calendar name' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The updatedAt timestamp is automatically set on each update.'],
              commonMistakes: ['Using companyId instead of the calendar ID in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.edit'],
              relatedApis: ['bcos-calendars-list', 'bcos-calendar-detail', 'bcos-calendar-delete'],
            },
            {
              id: 'bcos-calendar-delete',
              name: 'Delete Calendar',
              method: 'DELETE',
              path: '/api/blog-content-os/calendars/:id',
              purpose: 'Delete a blog content calendar.',
              whenToUse: 'Use this endpoint to remove a calendar from the blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar ID to delete' },
              ],
              successResponse: { status: 200, description: 'Calendar deleted', body: { message: 'Calendar deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Calendar not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/calendars/CALENDAR_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/calendars/CALENDAR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the calendar ID before deleting.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.delete'],
              relatedApis: ['bcos-calendars-list', 'bcos-calendar-detail', 'bcos-calendar-update'],
            },
            // --- SEO Configs ---
            {
              id: 'bcos-seo-configs-list',
              name: 'Get All SEO Configs',
              method: 'GET',
              path: '/api/blog-content-os/seo-configs/:companyId',
              purpose: 'Retrieve all SEO configurations for a company.',
              whenToUse: 'Use this endpoint to list all SEO configs configured for blog content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of SEO configs', body: [{ id: '...', companyId: '...', keywords: ['marketing', 'content'], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/seo-configs/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/seo-configs/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/seo-configs/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/seo-configs/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/seo-configs/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/seo-configs/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'SEO config ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].keywords', type: 'string[]', description: 'Target keywords' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of SEO config objects.', 'SEO configs are stored as sub-documents in the BlogContentOS collection.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-seo-config-detail', 'bcos-seo-config-create', 'bcos-seo-config-update', 'bcos-seo-config-delete'],
            },
            {
              id: 'bcos-seo-config-detail',
              name: 'Get SEO Config Detail',
              method: 'GET',
              path: '/api/blog-content-os/seo-configs/detail/:id',
              purpose: 'Retrieve a single SEO config by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific SEO configuration.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'SEO config ID' },
              ],
              successResponse: { status: 200, description: 'SEO config details', body: { id: '...', companyId: '...', keywords: ['marketing', 'content'], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'SEO config not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/seo-configs/detail/SEO_CONFIG_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'SEO config ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'keywords', type: 'string[]', description: 'Target keywords' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full SEO config object including all custom fields.'],
              commonMistakes: ['Using companyId instead of the SEO config sub-document ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-seo-configs-list', 'bcos-seo-config-create', 'bcos-seo-config-update', 'bcos-seo-config-delete'],
            },
            {
              id: 'bcos-seo-config-create',
              name: 'Create SEO Config',
              method: 'POST',
              path: '/api/blog-content-os/seo-configs',
              purpose: 'Create a new SEO configuration.',
              whenToUse: 'Use this endpoint to add a new SEO config to the blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', keywords: 'string[] (optional) — Target keywords', metaTitle: 'string (optional) — Default meta title template', metaDescription: 'string (optional) — Default meta description template' },
              successResponse: { status: 201, description: 'SEO config created', body: { id: '...', companyId: '...', keywords: ['marketing', 'content'], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to create SEO config' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/blog-content-os/seo-configs \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "keywords": ["marketing", "content"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/seo-configs', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', keywords: ['marketing', 'content'] }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/blog-content-os/seo-configs',
  { companyId: 'YOUR_COMPANY_ID', keywords: ['marketing', 'content'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', keywords: ['marketing', 'content'] });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/seo-configs', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/blog-content-os/seo-configs',
    json={'companyId': 'YOUR_COMPANY_ID', 'keywords': ['marketing', 'content']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/seo-configs');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'keywords' => ['marketing', 'content']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New SEO config ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'keywords', type: 'string[]', description: 'Target keywords' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId is required in the request body.', 'Requires blog-content-os.create permission.'],
              commonMistakes: ['Forgetting to include companyId in the request body.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.create'],
              relatedApis: ['bcos-seo-configs-list', 'bcos-seo-config-detail', 'bcos-seo-config-update', 'bcos-seo-config-delete'],
            },
            {
              id: 'bcos-seo-config-update',
              name: 'Update SEO Config',
              method: 'PUT',
              path: '/api/blog-content-os/seo-configs/:id',
              purpose: 'Update an existing SEO configuration.',
              whenToUse: 'Use this endpoint to modify an SEO config\'s fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'SEO config ID' },
              ],
              requestBody: { keywords: 'string[] (optional) — Updated keywords', metaTitle: 'string (optional) — Updated meta title template' },
              successResponse: { status: 200, description: 'SEO config updated', body: { id: '...', keywords: ['updated', 'keywords'], updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'SEO config not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"keywords": ["updated", "keywords"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ keywords: ['updated', 'keywords'] }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID',
  { keywords: ['updated', 'keywords'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ keywords: ['updated', 'keywords'] });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/seo-configs/SEO_CONFIG_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID',
    json={'keywords': ['updated', 'keywords']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['keywords' => ['updated', 'keywords']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'SEO config ID' },
                { field: 'keywords', type: 'string[]', description: 'Updated keywords' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The updatedAt timestamp is automatically set on each update.'],
              commonMistakes: ['Using companyId instead of the SEO config ID in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.edit'],
              relatedApis: ['bcos-seo-configs-list', 'bcos-seo-config-detail', 'bcos-seo-config-delete'],
            },
            {
              id: 'bcos-seo-config-delete',
              name: 'Delete SEO Config',
              method: 'DELETE',
              path: '/api/blog-content-os/seo-configs/:id',
              purpose: 'Delete an SEO configuration.',
              whenToUse: 'Use this endpoint to remove an SEO config from the blog content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'SEO config ID to delete' },
              ],
              successResponse: { status: 200, description: 'SEO config deleted', body: { message: 'SEO config deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'SEO config not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/seo-configs/SEO_CONFIG_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/seo-configs/SEO_CONFIG_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the SEO config ID before deleting.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.delete'],
              relatedApis: ['bcos-seo-configs-list', 'bcos-seo-config-detail', 'bcos-seo-config-update'],
            },
            // --- Posts ---
            {
              id: 'bcos-posts-list',
              name: 'Get All Posts',
              method: 'GET',
              path: '/api/blog-content-os/posts/:companyId',
              purpose: 'Retrieve all blog posts for a company.',
              whenToUse: 'Use this endpoint to list all blog posts stored in the content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of blog posts', body: [{ id: '...', companyId: '...', title: 'Blog Post Title', status: 'draft', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/posts/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const items = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/posts/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/posts/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/posts/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Post ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].title', type: 'string', description: 'Post title' },
                { field: '[].status', type: 'string', description: 'Post status (draft, published, etc.)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: '[].updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an array of blog post objects.', 'Posts are stored as sub-documents in the BlogContentOS collection.'],
              commonMistakes: ['Expecting a single object — this endpoint returns an array.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-post-detail', 'bcos-post-create', 'bcos-post-update', 'bcos-post-delete'],
            },
            {
              id: 'bcos-post-detail',
              name: 'Get Post Detail',
              method: 'GET',
              path: '/api/blog-content-os/posts/detail/:id',
              purpose: 'Retrieve a single blog post by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific blog post.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID' },
              ],
              successResponse: { status: 200, description: 'Post details', body: { id: '...', companyId: '...', title: 'Blog Post Title', content: '...', status: 'draft', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/blog-content-os/posts/detail/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/blog-content-os/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/blog-content-os/posts/detail/POST_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/blog-content-os/posts/detail/POST_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/posts/detail/POST_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Post ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'title', type: 'string', description: 'Post title' },
                { field: 'content', type: 'string', description: 'Post content (HTML or markdown)' },
                { field: 'status', type: 'string', description: 'Post status (draft, published, etc.)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns the full post object including content and all custom fields.'],
              commonMistakes: ['Using companyId instead of the post sub-document ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'blog-content-os.view'],
              relatedApis: ['bcos-posts-list', 'bcos-post-create', 'bcos-post-update', 'bcos-post-delete'],
            },
            {
              id: 'bcos-post-create',
              name: 'Create Post',
              method: 'POST',
              path: '/api/blog-content-os/posts',
              purpose: 'Create a new blog post.',
              whenToUse: 'Use this endpoint to add a new blog post to the content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', title: 'string (optional) — Post title', content: 'string (optional) — Post content', status: 'string (optional) — Post status (draft, published, etc.)' },
              successResponse: { status: 201, description: 'Post created', body: { id: '...', companyId: '...', title: 'New Blog Post', status: 'draft', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to create post' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/blog-content-os/posts \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "title": "New Blog Post", "status": "draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/posts', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'New Blog Post', status: 'draft' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/blog-content-os/posts',
  { companyId: 'YOUR_COMPANY_ID', title: 'New Blog Post', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'New Blog Post', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/posts', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/blog-content-os/posts',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'New Blog Post', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/posts');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'New Blog Post', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New post ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'title', type: 'string', description: 'Post title' },
                { field: 'status', type: 'string', description: 'Post status' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['companyId is required in the request body.', 'Requires blog-content-os.create permission.'],
              commonMistakes: ['Forgetting to include companyId in the request body.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.create'],
              relatedApis: ['bcos-posts-list', 'bcos-post-detail', 'bcos-post-update', 'bcos-post-delete'],
            },
            {
              id: 'bcos-post-update',
              name: 'Update Post',
              method: 'PUT',
              path: '/api/blog-content-os/posts/:id',
              purpose: 'Update an existing blog post.',
              whenToUse: 'Use this endpoint to modify a blog post\'s title, content, status, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID' },
              ],
              requestBody: { title: 'string (optional) — Updated post title', content: 'string (optional) — Updated content', status: 'string (optional) — Updated status' },
              successResponse: { status: 200, description: 'Post updated', body: { id: '...', title: 'Updated Post', status: 'published', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/blog-content-os/posts/POST_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title": "Updated Post", "status": "published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Post', status: 'published' }),
});
const item = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID',
  { title: 'Updated Post', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Post', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/posts/POST_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID',
    json={'title': 'Updated Post', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Post', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Post ID' },
                { field: 'title', type: 'string', description: 'Updated post title' },
                { field: 'status', type: 'string', description: 'Updated post status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The updatedAt timestamp is automatically set on each update.'],
              commonMistakes: ['Using companyId instead of the post ID in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.edit'],
              relatedApis: ['bcos-posts-list', 'bcos-post-detail', 'bcos-post-delete'],
            },
            {
              id: 'bcos-post-delete',
              name: 'Delete Post',
              method: 'DELETE',
              path: '/api/blog-content-os/posts/:id',
              purpose: 'Delete a blog post.',
              whenToUse: 'Use this endpoint to remove a blog post from the content OS.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID to delete' },
              ],
              successResponse: { status: 200, description: 'Post deleted', body: { message: 'Post deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/blog-content-os/posts/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/posts/POST_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Not verifying the post ID before deleting.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.delete'],
              relatedApis: ['bcos-posts-list', 'bcos-post-detail', 'bcos-post-update'],
            },
            // --- Clear All Data ---
            {
              id: 'bcos-clear-all',
              name: 'Clear All Blog Content',
              method: 'DELETE',
              path: '/api/blog-content-os/all/:companyId',
              purpose: 'Delete all blog content data for a company.',
              whenToUse: 'Use this endpoint to clear all strategies, calendars, SEO configs, titles, posts, chunks, exports, structures, and content sections for a company in one operation.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'All blog content cleared', body: { message: 'All blog content cleared successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to clear all blog content' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/blog-content-os/all/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/blog-content-os/all/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/blog-content-os/all/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/blog-content-os/all/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/blog-content-os/all/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/blog-content-os/all/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and clears ALL blog content sub-resources: strategies, calendars, SEO configs, titles, posts, chunks, exports, structures, and content sections.', 'The BlogContentOS document itself is not deleted — only the sub-document arrays are emptied.', 'Requires blog-content-os.delete permission.'],
              commonMistakes: ['Using this when you only need to delete a single item — use the individual delete endpoints instead.', 'Not confirming the companyId — all blog content for the specified company will be permanently cleared.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'blog-content-os.delete'],
              relatedApis: ['bcos-strategies-list', 'bcos-calendars-list', 'bcos-seo-configs-list', 'bcos-posts-list'],
            },
          ],
        },
        // --- Case Studies ---
        {
          id: 'case-studies',
          name: 'Case Studies',
          description: 'Manage case studies and their categories — create, update, approve, and archive success stories.',
          endpoints: [
            {
              id: 'cs-get-all',
              name: 'Get All Case Studies',
              method: 'GET',
              path: '/api/case-studies/:companyId',
              purpose: 'Retrieve all case studies for a company with optional search, filter, and pagination.',
              whenToUse: 'Use this endpoint to list and filter case studies by category, status, department, industry, or search text.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Full-text search across title, description, challenge, solution' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'department', type: 'string', required: false, description: 'Filter by department' },
                { name: 'industry', type: 'string', required: false, description: 'Filter by industry' },
                { name: 'visibility', type: 'string', required: false, description: 'Filter by visibility: private, internal, public' },
                { name: 'sort', type: 'string', required: false, description: 'Sort field (default: createdAt)' },
                { name: 'order', type: 'string', required: false, description: 'Sort order: asc or desc (default: desc)' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default: 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Items per page (default: 50)' },
              ],
              successResponse: { status: 200, description: 'List of case studies with pagination', body: { data: [{ _id: '...', caseStudyId: 'CS-001', title: 'How Acme Boosted Revenue 40%', status: 'published', department: 'marketing', industry: 'saas' }], pagination: { page: 1, limit: 50, total: 12, pages: 1 } } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/case-studies/YOUR_COMPANY_ID?status=published&limit=10" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/YOUR_COMPANY_ID?status=published&limit=10', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data, pagination } = await response.json();`,
              axiosExample: `const { data: { data, pagination } } = await axios.get('https://app.mengoengine.com/api/case-studies/YOUR_COMPANY_ID', {
  params: { status: 'published', limit: 10 },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/case-studies/YOUR_COMPANY_ID?status=published&limit=10', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/case-studies/YOUR_COMPANY_ID',
    params={'status': 'published', 'limit': 10},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/YOUR_COMPANY_ID?status=published&limit=10');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of case study objects' },
                { field: 'data[].caseStudyId', type: 'string', description: 'Unique case study ID (format: CS-001)' },
                { field: 'data[].title', type: 'string', description: 'Case study title' },
                { field: 'data[].slug', type: 'string', description: 'URL-friendly slug (auto-generated from title)' },
                { field: 'data[].status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'data[].priority', type: 'string', description: 'Priority: low, medium, high, critical' },
                { field: 'data[].department', type: 'string', description: 'Department' },
                { field: 'data[].industry', type: 'string', description: 'Industry' },
                { field: 'data[].visibility', type: 'string', description: 'Visibility: private, internal, public' },
                { field: 'data[].categoryId', type: 'string', description: 'Linked category ID' },
                { field: 'data[].clientName', type: 'string', description: 'Client name' },
                { field: 'data[].createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'pagination.page', type: 'number', description: 'Current page number' },
                { field: 'pagination.limit', type: 'number', description: 'Items per page' },
                { field: 'pagination.total', type: 'number', description: 'Total items matching filter' },
                { field: 'pagination.pages', type: 'number', description: 'Total pages' },
              ],
              notes: ['Supports full-text search on title, shortDescription, detailedDescription, challenge, and solution fields.', 'All filter parameters are optional — omit them to get all case studies.', 'The response is wrapped in { data: [...], pagination: {...} } format.', 'Status values: draft, review, approved, published, archived.', 'Priority values: low, medium, high, critical.', 'Department values: engineering, marketing, sales, design, operations, hr, finance, customer-success, product, legal, other.', 'Industry values: technology, healthcare, finance, education, retail, manufacturing, real-estate, saas, ecommerce, marketing, consulting, other.', 'Visibility values: private, internal, public.'],
              commonMistakes: ['Expecting a flat array — the response wraps data in { data, pagination }.', 'Using a POST body instead of query parameters for filtering.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'case-studies.view'],
              relatedApis: ['cs-get-detail', 'cs-create', 'cs-update', 'cs-delete', 'cs-approve', 'cs-archive'],
            },
            {
              id: 'cs-get-detail',
              name: 'Get Case Study Detail',
              method: 'GET',
              path: '/api/case-studies/detail/:id',
              purpose: 'Retrieve a single case study by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific case study, including KPIs, steps, testimonials, and version history.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Case study document ID' },
              ],
              successResponse: { status: 200, description: 'Case study details', body: { data: { _id: '...', caseStudyId: 'CS-001', title: 'How Acme Boosted Revenue 40%', shortDescription: '...', challenge: '...', solution: '...', kpis: [{ label: 'Revenue', value: '40%', changePercent: 40 }], steps: [], testimonials: [], status: 'published', approvalStatus: 'approved' } } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Case study not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/case-studies/detail/CASE_STUDY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/detail/CASE_STUDY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.get('https://app.mengoengine.com/api/case-studies/detail/CASE_STUDY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/case-studies/detail/CASE_STUDY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/case-studies/detail/CASE_STUDY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/detail/CASE_STUDY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'object', description: 'Case study object' },
                { field: 'data.caseStudyId', type: 'string', description: 'Unique case study ID (CS-001 format)' },
                { field: 'data.title', type: 'string', description: 'Case study title' },
                { field: 'data.slug', type: 'string', description: 'URL-friendly slug' },
                { field: 'data.shortDescription', type: 'string', description: 'Brief summary (max 500 chars)' },
                { field: 'data.detailedDescription', type: 'string', description: 'Full description' },
                { field: 'data.executiveSummary', type: 'string', description: 'Executive summary' },
                { field: 'data.clientName', type: 'string', description: 'Client name' },
                { field: 'data.clientIndustry', type: 'string', description: 'Client industry' },
                { field: 'data.challenge', type: 'string', description: 'Problem/challenge description' },
                { field: 'data.goals', type: 'string', description: 'Goals description' },
                { field: 'data.solution', type: 'string', description: 'Solution description' },
                { field: 'data.results', type: 'string', description: 'Results description' },
                { field: 'data.kpis', type: 'array', description: 'Array of KPI objects with label, value, beforeValue, afterValue, unit, changePercent' },
                { field: 'data.steps', type: 'array', description: 'Array of step objects with id, title, description, order, type, assignee' },
                { field: 'data.testimonials', type: 'array', description: 'Array of testimonial objects with quote, author, role, company' },
                { field: 'data.status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'data.approvalStatus', type: 'string', description: 'Approval status: pending, approved, rejected, changes_requested' },
                { field: 'data.version', type: 'number', description: 'Current version number' },
                { field: 'data.versionHistory', type: 'array', description: 'Array of version entries with version number, change summary, modifiedBy, modifiedAt' },
                { field: 'data.viewCount', type: 'number', description: 'Number of views (auto-incremented on each detail fetch)' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['The viewCount is automatically incremented each time this endpoint is called.', 'The response is wrapped in { data: {...} } format.', 'Includes full KPIs, steps, testimonials, and version history.'],
              commonMistakes: ['Using caseStudyId (CS-001) instead of the MongoDB _id in the URL.', 'Expecting a flat object — the response wraps data in { data }.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'case-studies.view'],
              relatedApis: ['cs-get-all', 'cs-create', 'cs-update', 'cs-approve', 'cs-archive'],
            },
            {
              id: 'cs-create',
              name: 'Create Case Study',
              method: 'POST',
              path: '/api/case-studies',
              purpose: 'Create a new case study.',
              whenToUse: 'Use this endpoint to create a new case study. A unique caseStudyId (CS-XXX format) is auto-generated.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', title: 'string (required, max 300 chars) — Case study title', department: 'string (required) — Department enum', shortDescription: 'string (optional, max 500 chars) — Brief summary', challenge: 'string (optional) — Problem/challenge description', solution: 'string (optional) — Solution description', results: 'string (optional) — Results description', clientName: 'string (optional) — Client name', industry: 'string (optional) — Industry enum', categoryId: 'string (optional) — Category ID', status: 'string (optional) — Status enum (default: draft)', priority: 'string (optional) — Priority enum (default: medium)', visibility: 'string (optional) — Visibility enum (default: internal)', tags: 'string[] (optional) — Tags', kpis: 'array (optional) — KPI objects { label, value, beforeValue, afterValue, unit, changePercent }', steps: 'array (optional) — Step objects { id, title, description, order, type }', testimonials: 'array (optional) — { quote, author, role, company }' },
              successResponse: { status: 201, description: 'Case study created', body: { data: { _id: '...', caseStudyId: 'CS-001', title: 'How Acme Boosted Revenue 40%', status: 'draft', department: 'marketing', industry: 'saas' } } },
              errorResponses: [
                { code: 400, message: 'Validation error (title, companyId, and department are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to create case study (duplicate caseStudyId race condition)' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/case-studies \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "title": "How Acme Boosted Revenue 40%", "department": "marketing", "industry": "saas", "challenge": "Low conversion rates", "solution": "Implemented targeted campaigns"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'How Acme Boosted Revenue 40%', department: 'marketing', industry: 'saas' }),
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.post('https://app.mengoengine.com/api/case-studies',
  { companyId: 'YOUR_COMPANY_ID', title: 'How Acme Boosted Revenue 40%', department: 'marketing', industry: 'saas' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'How Acme Boosted Revenue 40%', department: 'marketing', industry: 'saas' });
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/case-studies',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'How Acme Boosted Revenue 40%', 'department': 'marketing', 'industry': 'saas'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'How Acme Boosted Revenue 40%', 'department' => 'marketing', 'industry' => 'saas']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.caseStudyId', type: 'string', description: 'Auto-generated unique ID (CS-001 format)' },
                { field: 'data.title', type: 'string', description: 'Case study title' },
                { field: 'data.status', type: 'string', description: 'Status (default: draft)' },
                { field: 'data.department', type: 'string', description: 'Department' },
                { field: 'data.slug', type: 'string', description: 'Auto-generated slug from title' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['title, companyId, and department are required fields.', 'A unique caseStudyId (CS-XXX format) is auto-generated with retry logic to handle race conditions.', 'If a categoryId is provided, the category\'s caseStudyCount is automatically incremented.', 'The slug is auto-generated from the title.', 'Department values: engineering, marketing, sales, design, operations, hr, finance, customer-success, product, legal, other.', 'Industry values: technology, healthcare, finance, education, retail, manufacturing, real-estate, saas, ecommerce, marketing, consulting, other.'],
              commonMistakes: ['Forgetting to include department — it is required.', 'Providing a manually generated caseStudyId — this is auto-generated and will be overwritten.', 'Not using valid enum values for department, industry, status, priority, or visibility.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.create'],
              relatedApis: ['cs-get-all', 'cs-get-detail', 'cs-update', 'cs-delete', 'cs-approve'],
            },
            {
              id: 'cs-update',
              name: 'Update Case Study',
              method: 'PUT',
              path: '/api/case-studies/:id',
              purpose: 'Update an existing case study.',
              whenToUse: 'Use this endpoint to modify a case study\'s content, status, or other fields. Content edits automatically create a version history entry.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Case study document ID' },
              ],
              requestBody: { title: 'string (optional) — Updated title', shortDescription: 'string (optional) — Updated summary', challenge: 'string (optional) — Updated challenge', solution: 'string (optional) — Updated solution', results: 'string (optional) — Updated results', status: 'string (optional) — Updated status', priority: 'string (optional) — Updated priority', visibility: 'string (optional) — Updated visibility', categoryId: 'string (optional) — Updated category (auto-updates counts)', kpis: 'array (optional) — Updated KPIs', steps: 'array (optional) — Updated steps', testimonials: 'array (optional) — Updated testimonials', changeSummary: 'string (optional) — Description of changes for version history' },
              successResponse: { status: 200, description: 'Case study updated', body: { data: { _id: '...', caseStudyId: 'CS-001', title: 'Updated Title', version: 2, updatedAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Case study not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"challenge": "Updated challenge", "solution": "Improved solution", "changeSummary": "Updated challenge and solution sections"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ challenge: 'Updated challenge', solution: 'Improved solution', changeSummary: 'Updated challenge and solution sections' }),
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID',
  { challenge: 'Updated challenge', solution: 'Improved solution', changeSummary: 'Updated challenge and solution sections' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ challenge: 'Updated challenge', solution: 'Improved solution' });
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/CASE_STUDY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID',
    json={'challenge': 'Updated challenge', 'solution': 'Improved solution', 'changeSummary': 'Updated challenge and solution sections'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['challenge' => 'Updated challenge', 'solution' => 'Improved solution']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.caseStudyId', type: 'string', description: 'Case study ID' },
                { field: 'data.title', type: 'string', description: 'Updated title' },
                { field: 'data.version', type: 'number', description: 'Incremented version number (if content was edited)' },
                { field: 'data.versionHistory', type: 'array', description: 'Version history entries' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'Editing challenge, solution, detailedDescription, results, or steps automatically increments the version number and adds a version history entry.', 'If you change categoryId, the caseStudyCount is automatically updated on both old and new categories.', 'The changeSummary field is used in version history when content is edited.', 'The response wraps data in { data: {...} } format.'],
              commonMistakes: ['Using caseStudyId (CS-001) instead of the MongoDB _id in the URL.', 'Not providing changeSummary when editing content fields — it defaults to "Updated case study content".'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.edit'],
              relatedApis: ['cs-get-all', 'cs-get-detail', 'cs-delete', 'cs-approve', 'cs-archive'],
            },
            {
              id: 'cs-delete',
              name: 'Delete Case Study',
              method: 'DELETE',
              path: '/api/case-studies/:id',
              purpose: 'Permanently delete a case study.',
              whenToUse: 'Use this endpoint to remove a case study. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Case study document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Case study deleted', body: { data: { message: 'Case study deleted' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Case study not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/CASE_STUDY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'If the case study had a categoryId, the category\'s caseStudyCount is automatically decremented.'],
              commonMistakes: ['Using caseStudyId (CS-001) instead of the MongoDB _id in the URL.', 'Not verifying the case study ID before deleting — there is no undo.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.delete'],
              relatedApis: ['cs-get-all', 'cs-get-detail', 'cs-update'],
            },
            {
              id: 'cs-approve',
              name: 'Approve Case Study',
              method: 'PUT',
              path: '/api/case-studies/:id/approve',
              purpose: 'Approve and publish a case study.',
              whenToUse: 'Use this endpoint to approve a case study. This sets approvalStatus to "approved" and status to "published".',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Case study document ID' },
              ],
              successResponse: { status: 200, description: 'Case study approved', body: { data: { _id: '...', caseStudyId: 'CS-001', approvalStatus: 'approved', status: 'published', approvedBy: '...', approvedAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Case study not found' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/approve" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/approve', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/approve', {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/CASE_STUDY_ID/approve', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/approve',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/approve');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.approvalStatus', type: 'string', description: 'Set to "approved"' },
                { field: 'data.status', type: 'string', description: 'Set to "published"' },
                { field: 'data.approvedBy', type: 'string', description: 'User ID who approved' },
                { field: 'data.approvedAt', type: 'string', description: 'ISO date when approved' },
              ],
              notes: ['This sets approvalStatus to "approved" and status to "published" simultaneously.', 'The approvedBy and approvedAt fields are set automatically.', 'Requires case-studies.edit permission.'],
              commonMistakes: ['Sending a body with status/approvalStatus — the endpoint sets both automatically.', 'Using caseStudyId instead of the MongoDB _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.edit'],
              relatedApis: ['cs-get-all', 'cs-get-detail', 'cs-update', 'cs-archive'],
            },
            {
              id: 'cs-archive',
              name: 'Archive Case Study',
              method: 'PUT',
              path: '/api/case-studies/:id/archive',
              purpose: 'Archive a case study.',
              whenToUse: 'Use this endpoint to archive a case study. This sets the status to "archived".',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Case study document ID' },
              ],
              successResponse: { status: 200, description: 'Case study archived', body: { data: { _id: '...', caseStudyId: 'CS-001', status: 'archived' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Case study not found' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/archive" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/archive', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/archive', {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/CASE_STUDY_ID/archive', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/archive',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/CASE_STUDY_ID/archive');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.status', type: 'string', description: 'Set to "archived"' },
              ],
              notes: ['This sets the status to "archived". The case study is not deleted and can be restored via a regular update.', 'Requires case-studies.edit permission.'],
              commonMistakes: ['Confusing archive with delete — archiving preserves the record.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.edit'],
              relatedApis: ['cs-get-all', 'cs-get-detail', 'cs-update', 'cs-approve'],
            },
            // --- Categories ---
            {
              id: 'cs-categories-list',
              name: 'Get All Case Study Categories',
              method: 'GET',
              path: '/api/case-studies/categories/:companyId',
              purpose: 'Retrieve all case study categories for a company.',
              whenToUse: 'Use this endpoint to list all categories used to organize case studies.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of categories', body: { data: [{ _id: '...', companyId: '...', name: 'Customer Success', slug: 'customer-success', status: 'published', caseStudyCount: 3, order: 1 }] } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/case-studies/categories/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.get('https://app.mengoengine.com/api/case-studies/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/case-studies/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/case-studies/categories/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/categories/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of category objects' },
                { field: 'data[].name', type: 'string', description: 'Category name' },
                { field: 'data[].slug', type: 'string', description: 'URL-friendly slug (auto-generated)' },
                { field: 'data[].description', type: 'string', description: 'Category description' },
                { field: 'data[].parentId', type: 'string', description: 'Parent category ID (for hierarchy)' },
                { field: 'data[].status', type: 'string', description: 'Status: draft, review, approved, published' },
                { field: 'data[].caseStudyCount', type: 'number', description: 'Number of case studies in this category' },
                { field: 'data[].order', type: 'number', description: 'Sort order' },
              ],
              notes: ['Categories are sorted by order, then name.', 'The slug is auto-generated from the name.', 'Categories support hierarchical structure via parentId.', 'Status values: draft, review, approved, published.', 'The response wraps data in { data: [...] } format.'],
              commonMistakes: ['Expecting a flat array — the response wraps data in { data }.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'case-studies.view'],
              relatedApis: ['cs-category-detail', 'cs-category-create', 'cs-category-update', 'cs-category-delete'],
            },
            {
              id: 'cs-category-create',
              name: 'Create Case Study Category',
              method: 'POST',
              path: '/api/case-studies/categories',
              purpose: 'Create a new case study category.',
              whenToUse: 'Use this endpoint to create a category for organizing case studies.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required, max 100 chars) — Category name', companyId: 'string (required) — Company ID', description: 'string (optional) — Category description', parentId: 'string (optional) — Parent category ID for hierarchy', icon: 'string (optional) — Icon identifier', colour: 'string (optional) — Color code', order: 'number (optional) — Sort order (default: 0)', status: 'string (optional) — Status: draft, review, approved, published (default: draft)' },
              successResponse: { status: 201, description: 'Category created', body: { data: { _id: '...', companyId: '...', name: 'Customer Success', slug: 'customer-success', status: 'draft', caseStudyCount: 0 } } },
              errorResponses: [
                { code: 400, message: 'Validation error (name and companyId are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/case-studies/categories \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Customer Success", "description": "Customer success stories"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/categories', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Customer Success', description: 'Customer success stories' }),
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.post('https://app.mengoengine.com/api/case-studies/categories',
  { companyId: 'YOUR_COMPANY_ID', name: 'Customer Success', description: 'Customer success stories' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Customer Success' });
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/categories', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/case-studies/categories',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Customer Success', 'description': 'Customer success stories'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/categories');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Customer Success', 'description' => 'Customer success stories']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.name', type: 'string', description: 'Category name' },
                { field: 'data.slug', type: 'string', description: 'Auto-generated URL slug' },
                { field: 'data.status', type: 'string', description: 'Status (default: draft)' },
                { field: 'data.caseStudyCount', type: 'number', description: 'Number of case studies (0 for new category)' },
              ],
              notes: ['name and companyId are required.', 'The slug is auto-generated from the name.', 'Categories support hierarchical structure via parentId.', 'Status values: draft, review, approved, published.'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Using a name longer than 100 characters.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.create'],
              relatedApis: ['cs-categories-list', 'cs-category-update', 'cs-category-delete'],
            },
            {
              id: 'cs-category-update',
              name: 'Update Case Study Category',
              method: 'PUT',
              path: '/api/case-studies/categories/:id',
              purpose: 'Update a case study category.',
              whenToUse: 'Use this endpoint to modify a category\'s name, description, order, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category document ID' },
              ],
              requestBody: { name: 'string (optional) — Updated category name', description: 'string (optional) — Updated description', parentId: 'string (optional) — Updated parent category ID', icon: 'string (optional) — Updated icon', colour: 'string (optional) — Updated color', order: 'number (optional) — Updated sort order', status: 'string (optional) — Updated status' },
              successResponse: { status: 200, description: 'Category updated', body: { data: { _id: '...', name: 'Updated Category', slug: 'updated-category', updatedAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Category", "status": "published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Category', status: 'published' }),
});
const { data } = await response.json();`,
              axiosExample: `const { data: { data } } = await axios.put('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID',
  { name: 'Updated Category', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Category', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/categories/CATEGORY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID',
    json={'name': 'Updated Category', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Category', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.name', type: 'string', description: 'Updated category name' },
                { field: 'data.slug', type: 'string', description: 'Auto-updated slug' },
                { field: 'data.status', type: 'string', description: 'Updated status' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The slug is auto-regenerated if the name changes.', 'The response wraps data in { data: {...} } format.'],
              commonMistakes: ['Using companyId instead of the category _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.edit'],
              relatedApis: ['cs-categories-list', 'cs-category-detail', 'cs-category-delete'],
            },
            {
              id: 'cs-category-delete',
              name: 'Delete Case Study Category',
              method: 'DELETE',
              path: '/api/case-studies/categories/:id',
              purpose: 'Delete a case study category.',
              whenToUse: 'Use this endpoint to remove a category. Case studies in this category will have their categoryId unset.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Category deleted', body: { data: { message: 'Category deleted' } } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/case-studies/categories/CATEGORY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/case-studies/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Case studies that were in this category will have their categoryId field unset (not deleted).'],
              commonMistakes: ['Not verifying the category ID before deleting — case studies in it will lose their category assignment.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'case-studies.delete'],
              relatedApis: ['cs-categories-list', 'cs-category-update'],
            },
          ],
        },
        // --- Testimonials ---
        {
          id: 'testimonials',
          name: 'Testimonials',
          description: 'Manage customer testimonials with advanced filtering, search, bulk operations, approval workflows, and media uploads.',
          endpoints: [
            {
              id: 'test-get-all',
              name: 'Get All Testimonials',
              method: 'GET',
              path: '/api/testimonials/:companyId',
              purpose: 'Retrieve all testimonials for a company with optional filtering by type, status, product, founder, employee, industry, public status, and consent.',
              whenToUse: 'Use this endpoint to list and filter testimonials. Supports text search across customer name, company, headline, and quote fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'type', type: 'string', required: false, description: 'Filter by type: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: pending, approved, rejected, featured, archived' },
                { name: 'productId', type: 'string', required: false, description: 'Filter by product ID' },
                { name: 'founderId', type: 'string', required: false, description: 'Filter by founder ID' },
                { name: 'employeeId', type: 'string', required: false, description: 'Filter by employee ID' },
                { name: 'industry', type: 'string', required: false, description: 'Filter by industry tag' },
                { name: 'isPublic', type: 'string', required: false, description: 'Filter by public status: true or false' },
                { name: 'consentVerified', type: 'string', required: false, description: 'Filter by consent verification: true or false' },
                { name: 'search', type: 'string', required: false, description: 'Full-text search across customerName, customerCompany, headline, shortQuote, fullTestimonial' },
              ],
              successResponse: { status: 200, description: 'List of testimonials', body: [{ _id: '...', customerName: 'Jane Doe', customerCompany: 'Acme Inc', type: 'text', status: 'approved', headline: 'Transformed our workflow', shortQuote: 'Amazing product!', isPublic: true, consentVerified: true, trustScore: 85 }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/testimonials/YOUR_COMPANY_ID?status=approved&type=text" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/YOUR_COMPANY_ID?status=approved&type=text', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const testimonials = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/testimonials/YOUR_COMPANY_ID', {
  params: { status: 'approved', type: 'text' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/testimonials/YOUR_COMPANY_ID?status=approved&type=text', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/testimonials/YOUR_COMPANY_ID',
    params={'status': 'approved', 'type': 'text'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/YOUR_COMPANY_ID?status=approved&type=text');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Testimonial document ID' },
                { field: '[].customerName', type: 'string', description: 'Customer name' },
                { field: '[].customerCompany', type: 'string', description: 'Customer company name' },
                { field: '[].type', type: 'string', description: 'Testimonial type: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study' },
                { field: '[].status', type: 'string', description: 'Status: pending, approved, rejected, featured, archived' },
                { field: '[].headline', type: 'string', description: 'Testimonial headline' },
                { field: '[].shortQuote', type: 'string', description: 'Short quote (max 500 chars)' },
                { field: '[].isPublic', type: 'boolean', description: 'Whether testimonial is publicly visible' },
                { field: '[].consentVerified', type: 'boolean', description: 'Whether consent has been verified' },
                { field: '[].trustScore', type: 'number', description: 'Trust score (0-100)' },
              ],
              notes: ['Response is a flat array (not wrapped in { data }).', 'Supports text search across customerName, customerCompany, headline, shortQuote, fullTestimonial.', 'Filter by productId, founderId, employeeId uses $in operator (can match multiple).', 'Type values: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study. Status values: pending, approved, rejected, featured, archived.'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat array.', 'Using POST body for filtering instead of query parameters.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'testimonials.view'],
              relatedApis: ['test-get-detail', 'test-create', 'test-search', 'test-stats'],
            },
            {
              id: 'test-get-detail',
              name: 'Get Testimonial Detail',
              method: 'GET',
              path: '/api/testimonials/detail/:id',
              purpose: 'Retrieve a single testimonial by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific testimonial, including all content, media, scores, and consent information.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Testimonial document ID' },
              ],
              successResponse: { status: 200, description: 'Testimonial details', body: { _id: '...', customerName: 'Jane Doe', customerCompany: 'Acme Inc', type: 'text', status: 'approved', headline: 'Transformed our workflow', fullTestimonial: 'Full testimonial text...', keyResults: ['50% faster deployment', '30% cost reduction'], roiMetrics: [{ metric: 'ROI', value: '300', unit: '%' }], trustScore: 85, consentVerified: true, isPublic: true } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Testimonial not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/testimonials/detail/TESTIMONIAL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/detail/TESTIMONIAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const testimonial = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/testimonials/detail/TESTIMONIAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/testimonials/detail/TESTIMONIAL_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/testimonials/detail/TESTIMONIAL_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/detail/TESTIMONIAL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'customerName', type: 'string', description: 'Customer name (required, max 200 chars)' },
                { field: 'customerCompany', type: 'string', description: 'Customer company name' },
                { field: 'customerDesignation', type: 'string', description: 'Customer job title/designation' },
                { field: 'type', type: 'string', description: 'Testimonial type enum' },
                { field: 'category', type: 'string', description: 'Category: product-quality, customer-service, value-for-money, ease-of-use, implementation, trust-security, results-roi, partnership, problem-solved, user-experience, industry-expertise, integration' },
                { field: 'status', type: 'string', description: 'Status: pending, approved, rejected, featured, archived' },
                { field: 'headline', type: 'string', description: 'Headline (max 200 chars)' },
                { field: 'shortQuote', type: 'string', description: 'Short quote (max 500 chars)' },
                { field: 'fullTestimonial', type: 'string', description: 'Full testimonial text' },
                { field: 'story', type: 'string', description: 'Long-form story' },
                { field: 'keyResults', type: 'array', description: 'Array of key result strings' },
                { field: 'roiMetrics', type: 'array', description: 'Array of { metric, value, unit } objects' },
                { field: 'beforeState', type: 'string', description: 'Before state description' },
                { field: 'duringState', type: 'string', description: 'During state description' },
                { field: 'afterState', type: 'string', description: 'After state description' },
                { field: 'videoUrl', type: 'string', description: 'Video URL' },
                { field: 'audioUrl', type: 'string', description: 'Audio URL' },
                { field: 'imageUrl', type: 'string', description: 'Image URL' },
                { field: 'screenshotUrl', type: 'string', description: 'Screenshot URL' },
                { field: 'externalLinks', type: 'array', description: 'Array of { type, url, label } external links' },
                { field: 'authenticityScore', type: 'number', description: 'Authenticity score (0-100)' },
                { field: 'emotionalImpactScore', type: 'number', description: 'Emotional impact score (0-100)' },
                { field: 'conversionPotential', type: 'number', description: 'Conversion potential score (0-100)' },
                { field: 'authorityLevel', type: 'string', description: 'Authority level: executive, manager, specialist, individual' },
                { field: 'trustScore', type: 'number', description: 'Trust score (0-100)' },
                { field: 'consentVerified', type: 'boolean', description: 'Whether consent has been verified' },
                { field: 'isPublic', type: 'boolean', description: 'Whether testimonial is publicly visible' },
                { field: 'marketingUsagePermission', type: 'boolean', description: 'Whether marketing usage is permitted' },
                { field: 'collectionMethod', type: 'string', description: 'Collection method: form, email, interview, imported' },
                { field: 'translations', type: 'array', description: 'Array of { language, headline, shortQuote, fullTestimonial, story } translations' },
              ],
              notes: ['Response is a flat object (not wrapped in { data }).', 'Includes all fields: content, media URLs, scores, consent info, entity mapping, and translations.'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat object.', 'Using the MongoDB _id vs testimonial-specific ID — there is no custom ID, use the MongoDB _id.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'testimonials.view'],
              relatedApis: ['test-get-all', 'test-create', 'test-update', 'test-delete'],
            },
            {
              id: 'test-create',
              name: 'Create Testimonial',
              method: 'POST',
              path: '/api/testimonials',
              purpose: 'Create a new testimonial.',
              whenToUse: 'Use this endpoint to create a testimonial. Customer name and company ID are required.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { customerName: 'string (required, max 200 chars) — Customer name', companyId: 'string (required) — Company ID', type: 'string (optional) — Type: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study (default: text)', category: 'string (optional) — Category enum (default: product-quality)', status: 'string (optional) — Status: pending, approved, rejected, featured, archived (default: pending)', headline: 'string (optional, max 200 chars) — Headline', shortQuote: 'string (optional, max 500 chars) — Short quote', fullTestimonial: 'string (optional) — Full testimonial text', story: 'string (optional) — Long-form story', keyResults: 'string[] (optional) — Array of key results', customerCompany: 'string (optional) — Customer company', customerDesignation: 'string (optional) — Customer job title', isPublic: 'boolean (optional, default: true) — Public visibility', consentVerified: 'boolean (optional, default: false) — Consent verification', marketingUsagePermission: 'boolean (optional, default: false) — Marketing usage permission' },
              successResponse: { status: 201, description: 'Testimonial created', body: { _id: '...', customerName: 'Jane Doe', companyId: '...', type: 'text', status: 'pending', isPublic: true, consentVerified: false, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (customerName and companyId are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/testimonials \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "customerName": "Jane Doe", "customerCompany": "Acme Inc", "type": "text", "headline": "Transformed our workflow", "shortQuote": "Amazing product!", "fullTestimonial": "Full testimonial text...", "status": "pending"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', customerName: 'Jane Doe', customerCompany: 'Acme Inc', type: 'text', headline: 'Transformed our workflow', shortQuote: 'Amazing product!' }),
});
const testimonial = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/testimonials',
  { companyId: 'YOUR_COMPANY_ID', customerName: 'Jane Doe', customerCompany: 'Acme Inc', type: 'text', headline: 'Transformed our workflow', shortQuote: 'Amazing product!' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', customerName: 'Jane Doe', type: 'text' });
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/testimonials',
    json={'companyId': 'YOUR_COMPANY_ID', 'customerName': 'Jane Doe', 'customerCompany': 'Acme Inc', 'type': 'text', 'headline': 'Transformed our workflow', 'shortQuote': 'Amazing product!'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'customerName' => 'Jane Doe', 'type' => 'text', 'headline' => 'Transformed our workflow']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'customerName', type: 'string', description: 'Customer name' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'type', type: 'string', description: 'Testimonial type (default: text)' },
                { field: 'status', type: 'string', description: 'Status (default: pending)' },
                { field: 'isPublic', type: 'boolean', description: 'Public visibility (default: true)' },
                { field: 'consentVerified', type: 'boolean', description: 'Consent verification status (default: false)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['customerName and companyId are required fields.', 'Response is a flat object (not wrapped in { data }).', 'Type enum: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study.', 'Category enum: product-quality, customer-service, value-for-money, ease-of-use, implementation, trust-security, results-roi, partnership, problem-solved, user-experience, industry-expertise, integration.', 'For file uploads (video, audio, image, screenshot types), use the /with-file endpoint instead.'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Using a POST body for type values not in the enum.', 'Trying to upload files via this JSON endpoint — use /with-file for file uploads.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.create'],
              relatedApis: ['test-get-all', 'test-get-detail', 'test-update', 'test-delete', 'test-create-with-file'],
            },
            {
              id: 'test-update',
              name: 'Update Testimonial',
              method: 'PUT',
              path: '/api/testimonials/:id',
              purpose: "Update an existing testimonial.",
              whenToUse: "Use this endpoint to modify a testimonial's content, status, scores, or other fields. Setting status to 'approved' automatically sets approvedBy and approvedAt.",
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Testimonial document ID' },
              ],
              requestBody: { customerName: 'string (optional) — Updated customer name', headline: 'string (optional) — Updated headline', shortQuote: 'string (optional) — Updated short quote', fullTestimonial: 'string (optional) — Updated full text', status: 'string (optional) — Updated status (setting to "approved" auto-sets approvedBy/approvedAt)', keyResults: 'string[] (optional) — Updated key results', trustScore: 'number (optional) — Updated trust score (0-100)', isPublic: 'boolean (optional) — Updated public visibility', consentVerified: 'boolean (optional) — Updated consent status' },
              successResponse: { status: 200, description: 'Testimonial updated', body: { _id: '...', customerName: 'Jane Doe', status: 'approved', approvedBy: '...', approvedAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Testimonial not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status": "approved", "headline": "Updated headline"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'approved', headline: 'Updated headline' }),
});
const testimonial = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID',
  { status: 'approved', headline: 'Updated headline' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ status: 'approved', headline: 'Updated headline' });
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials/TESTIMONIAL_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID',
    json={'status': 'approved', 'headline': 'Updated headline'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'approved', 'headline' => 'Updated headline']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Testimonial ID' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'approvedBy', type: 'string', description: 'User ID who approved (set automatically when status → approved)' },
                { field: 'approvedAt', type: 'string', description: 'ISO date when approved (set automatically when status → approved)' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'When you set status to "approved", the approvedBy and approvedAt fields are set automatically.', 'Response is a flat object (not wrapped in { data }).', 'For file uploads, use the /:id/with-file endpoint instead.'],
              commonMistakes: ['Setting approvedBy/approvedAt manually — these are set automatically when status → approved.', 'Using POST instead of PUT.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.edit'],
              relatedApis: ['test-get-all', 'test-get-detail', 'test-delete', 'test-bulk-update'],
            },
            {
              id: 'test-delete',
              name: 'Delete Testimonial',
              method: 'DELETE',
              path: '/api/testimonials/:id',
              purpose: 'Permanently delete a testimonial.',
              whenToUse: 'Use this endpoint to remove a testimonial. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Testimonial document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Testimonial deleted', body: { message: 'Testimonial deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Testimonial not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials/TESTIMONIAL_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/TESTIMONIAL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Response is a flat object with message field (not wrapped in { data }).'],
              commonMistakes: ['Expecting a { data: {...} } response — this endpoint returns { message: "..." }.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.delete'],
              relatedApis: ['test-get-all', 'test-get-detail', 'test-update'],
            },
            {
              id: 'test-search',
              name: 'Advanced Search Testimonials',
              method: 'GET',
              path: '/api/testimonials/search/:companyId',
              purpose: 'Advanced search and filter testimonials with pagination, sorting, score ranges, and multi-criteria filtering.',
              whenToUse: 'Use this endpoint for paginated, sorted, and filtered testimonial searches with scoring ranges and tag-based filtering.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'query', type: 'string', required: false, description: 'Full-text search across customerName, customerCompany, headline, shortQuote, fullTestimonial, keyResults' },
                { name: 'type', type: 'string', required: false, description: 'Filter by type: text, video, audio, image, screenshot, social-media, email, whatsapp, linkedin-recommendation, google-review, case-study' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: pending, approved, rejected, featured, archived' },
                { name: 'authorityLevel', type: 'string', required: false, description: 'Filter by authority level: executive, manager, specialist, individual' },
                { name: 'minScore', type: 'number', required: false, description: 'Minimum trustScore filter' },
                { name: 'maxScore', type: 'number', required: false, description: 'Maximum trustScore filter' },
                { name: 'productId', type: 'string', required: false, description: 'Filter by product ID' },
                { name: 'founderId', type: 'string', required: false, description: 'Filter by founder ID' },
                { name: 'employeeId', type: 'string', required: false, description: 'Filter by employee ID' },
                { name: 'industryTag', type: 'string', required: false, description: 'Filter by industry tag' },
                { name: 'campaignTag', type: 'string', required: false, description: 'Filter by campaign tag' },
                { name: 'hasConsent', type: 'string', required: false, description: 'Filter by consent verification: true or false' },
                { name: 'isPublic', type: 'string', required: false, description: 'Filter by public status: true or false' },
                { name: 'sortBy', type: 'string', required: false, description: 'Sort field (default: createdAt)' },
                { name: 'sortOrder', type: 'string', required: false, description: 'Sort order: asc or desc (default: desc)' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default: 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Items per page (default: 20)' },
              ],
              successResponse: { status: 200, description: 'Paginated testimonial search results', body: { testimonials: [{ _id: '...', customerName: 'Jane Doe', type: 'text', status: 'approved', trustScore: 85 }], pagination: { total: 50, page: 1, limit: 20, pages: 3 } } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/testimonials/search/YOUR_COMPANY_ID?status=approved&minScore=70&sortBy=trustScore&sortOrder=desc&limit=10" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/search/YOUR_COMPANY_ID?status=approved&minScore=70&limit=10', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { testimonials, pagination } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/testimonials/search/YOUR_COMPANY_ID', {
  params: { status: 'approved', minScore: 70, sortBy: 'trustScore', sortOrder: 'desc', limit: 10 },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/testimonials/search/YOUR_COMPANY_ID?status=approved&minScore=70&limit=10', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/testimonials/search/YOUR_COMPANY_ID',
    params={'status': 'approved', 'minScore': 70, 'sortBy': 'trustScore', 'sortOrder': 'desc', 'limit': 10},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/search/YOUR_COMPANY_ID?status=approved&minScore=70&limit=10');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'testimonials', type: 'array', description: 'Array of testimonial objects' },
                { field: 'testimonials[].customerName', type: 'string', description: 'Customer name' },
                { field: 'testimonials[].type', type: 'string', description: 'Testimonial type' },
                { field: 'testimonials[].status', type: 'string', description: 'Status' },
                { field: 'testimonials[].trustScore', type: 'number', description: 'Trust score (0-100)' },
                { field: 'pagination.total', type: 'number', description: 'Total items matching filter' },
                { field: 'pagination.page', type: 'number', description: 'Current page number' },
                { field: 'pagination.limit', type: 'number', description: 'Items per page' },
                { field: 'pagination.pages', type: 'number', description: 'Total pages' },
              ],
              notes: ['This endpoint returns { testimonials: [...], pagination: {...} } — different from the simple list endpoint which returns a flat array.', 'Supports score range filtering with minScore/maxScore on trustScore.', 'Supports tag-based filtering: industryTag and campaignTag.', 'authorityLevel filter: executive, manager, specialist, individual.', 'Default sort is createdAt descending, default limit is 20.'],
              commonMistakes: ['Confusing the response format with the simple list endpoint — this returns { testimonials, pagination }, not a flat array.', 'Using the simple list endpoint when you need pagination — use this endpoint instead.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'testimonials.view'],
              relatedApis: ['test-get-all', 'test-get-detail', 'test-stats'],
            },
            {
              id: 'test-stats',
              name: 'Get Testimonial Statistics',
              method: 'GET',
              path: '/api/testimonials/stats/:companyId',
              purpose: 'Get aggregate statistics for a company\'s testimonials including counts by status, type, authority level, and average scores.',
              whenToUse: 'Use this endpoint to get dashboard-level statistics for testimonials — total count, breakdown by status and type, consent counts, featured counts, and average quality scores.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Testimonial statistics', body: { total: 50, byStatus: { pending: 10, approved: 30, featured: 5, rejected: 3, archived: 2 }, byType: { text: 25, video: 10, linkedin: 8, 'google-review': 7 }, withConsent: 35, featured: 5, avgScores: { avgAuthenticity: 78.5, avgEmotionalImpact: 82.1, avgConversionPotential: 75.3, avgTrustScore: 79.2 }, byAuthority: { executive: 12, manager: 20, specialist: 10, individual: 8 } } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/testimonials/stats/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/stats/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const stats = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/testimonials/stats/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/testimonials/stats/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/testimonials/stats/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/stats/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'total', type: 'number', description: 'Total number of testimonials' },
                { field: 'byStatus', type: 'object', description: 'Count by status: { pending, approved, rejected, featured, archived }' },
                { field: 'byType', type: 'object', description: 'Count by type: { text, video, audio, etc. }' },
                { field: 'withConsent', type: 'number', description: 'Number of testimonials with verified consent' },
                { field: 'featured', type: 'number', description: 'Number of featured testimonials' },
                { field: 'avgScores.avgAuthenticity', type: 'number', description: 'Average authenticity score' },
                { field: 'avgScores.avgEmotionalImpact', type: 'number', description: 'Average emotional impact score' },
                { field: 'avgScores.avgConversionPotential', type: 'number', description: 'Average conversion potential' },
                { field: 'avgScores.avgTrustScore', type: 'number', description: 'Average trust score' },
                { field: 'byAuthority', type: 'object', description: 'Count by authority level: { executive, manager, specialist, individual }' },
              ],
              notes: ['Uses MongoDB aggregation for efficient counting.', 'avgScores returns 0 for all scores if there are no testimonials.', 'This is a lightweight endpoint suitable for dashboard widgets.'],
              commonMistakes: ['Expecting a testimonials array — this endpoint returns aggregate statistics only.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'testimonials.view'],
              relatedApis: ['test-get-all', 'test-search'],
            },
            {
              id: 'test-bulk-import',
              name: 'Bulk Import Testimonials',
              method: 'POST',
              path: '/api/testimonials/bulk-import',
              purpose: 'Import multiple testimonials at once.',
              whenToUse: 'Use this endpoint to create multiple testimonials in a single request. Each testimonial defaults to "pending" status unless specified.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', testimonials: 'array (required) — Array of testimonial objects, each with at least customerName' },
              successResponse: { status: 201, description: 'Testimonials imported', body: { count: 5, testimonials: ['...'] } },
              errorResponses: [
                { code: 400, message: 'companyId and testimonials array are required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/testimonials/bulk-import \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "testimonials": [{"customerName": "Jane Doe", "customerCompany": "Acme Inc", "type": "text", "shortQuote": "Great product!"}, {"customerName": "John Smith", "customerCompany": "Beta Corp", "type": "video", "shortQuote": "Outstanding service!"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/bulk-import', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', testimonials: [{ customerName: 'Jane Doe', type: 'text', shortQuote: 'Great product!' }] }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/testimonials/bulk-import',
  { companyId: 'YOUR_COMPANY_ID', testimonials: [{ customerName: 'Jane Doe', type: 'text', shortQuote: 'Great product!' }] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', testimonials: [{ customerName: 'Jane Doe', type: 'text', shortQuote: 'Great product!' }] });
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials/bulk-import', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/testimonials/bulk-import',
    json={'companyId': 'YOUR_COMPANY_ID', 'testimonials': [{'customerName': 'Jane Doe', 'type': 'text', 'shortQuote': 'Great product!'}]},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/bulk-import');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'testimonials' => [['customerName' => 'Jane Doe', 'type' => 'text', 'shortQuote' => 'Great product!']]]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'count', type: 'number', description: 'Number of testimonials created' },
                { field: 'testimonials', type: 'array', description: 'Array of created testimonial objects' },
              ],
              notes: ['companyId and testimonials array are required.', 'Each testimonial object should have at least customerName.', 'Status defaults to "pending" if not specified for each testimonial.', 'companyId is automatically added to each testimonial in the array.'],
              commonMistakes: ['Sending a single testimonial object instead of an array.', 'Forgetting to include companyId at the top level.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.import'],
              relatedApis: ['test-create', 'test-bulk-update'],
            },
            {
              id: 'test-bulk-update',
              name: 'Bulk Update Testimonials',
              method: 'PUT',
              path: '/api/testimonials/bulk-update',
              purpose: 'Update multiple testimonials at once with the same changes.',
              whenToUse: 'Use this endpoint to apply the same updates to multiple testimonials (e.g., bulk-approving, bulk-archiving).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { ids: 'string[] (required) — Array of testimonial IDs to update', updates: 'object (required) — Fields to update on all specified testimonials. Setting status to "approved" auto-sets approvedBy/approvedAt.' },
              successResponse: { status: 200, description: 'Testimonials updated', body: { modified: 5 } },
              errorResponses: [
                { code: 400, message: 'ids array is required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied or no authorized testimonials found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/testimonials/bulk-update \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"ids": ["ID1", "ID2", "ID3"], "updates": {"status": "approved"}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/testimonials/bulk-update', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'approved' } }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/testimonials/bulk-update',
  { ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'approved' } },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'approved' } });
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials/bulk-update', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/testimonials/bulk-update',
    json={'ids': ['ID1', 'ID2', 'ID3'], 'updates': {'status': 'approved'}},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/bulk-update');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['ids' => ['ID1', 'ID2', 'ID3'], 'updates' => ['status' => 'approved']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'modified', type: 'number', description: 'Number of testimonials actually modified' },
              ],
              notes: ['ids array and updates object are both required.', 'Only testimonials belonging to the user\'s companies are updated — others are silently skipped.', 'When updates.status is "approved", approvedBy and approvedAt are set automatically.', 'The response returns the count of modified documents, not the updated testimonials themselves.'],
              commonMistakes: ['Expecting updated testimonial objects — this endpoint returns { modified: count } only.', 'Including IDs of testimonials from other companies — these are silently skipped.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.edit'],
              relatedApis: ['test-update', 'test-bulk-import'],
            },
            {
              id: 'test-upload',
              name: 'Upload Testimonial Media',
              method: 'POST',
              path: '/api/testimonials/upload',
              purpose: 'Upload a media file (image, video, or audio) for testimonials.',
              whenToUse: 'Use this endpoint to upload a media file separately, then reference the returned URL when creating or updating a testimonial.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'multipart/form-data' },
              ],
              requestBody: { file: 'file (required) — Image, video, or audio file to upload' },
              successResponse: { status: 200, description: 'File uploaded successfully', body: { url: '/uploads/testimonials/filename.jpg', filename: '1690000000000-file.jpg', originalName: 'photo.jpg', mimeType: 'image/jpeg', size: 1048576, type: 'image' } },
              errorResponses: [
                { code: 400, message: 'No file uploaded' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/testimonials/upload \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -F "file=@/path/to/photo.jpg"`,
              jsExample: `const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('https://app.mengoengine.com/api/testimonials/upload', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
  body: formData,
});
const result = await response.json();`,
              axiosExample: `const formData = new FormData();
formData.append('file', fileInput.files[0]);
const { data } = await axios.post('https://app.mengoengine.com/api/testimonials/upload', formData, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'multipart/form-data' },
});`,
              nodeExample: `// Use multer or form-data package for file uploads in Node.js
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('file', fs.createReadStream('/path/to/photo.jpg'));
const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/testimonials/upload', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', ...form.getHeaders() } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
form.pipe(req);`,
              pythonExample: `import requests
with open('/path/to/photo.jpg', 'rb') as f:
    response = requests.post('https://app.mengoengine.com/api/testimonials/upload',
        files={'file': f},
        headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/testimonials/upload');
$cfile = new CURLFile('/path/to/photo.jpg', 'image/jpeg', 'photo.jpg');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => $cfile]);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'url', type: 'string', description: 'Relative URL path to the uploaded file (/uploads/testimonials/filename)' },
                { field: 'filename', type: 'string', description: 'Server-generated filename' },
                { field: 'originalName', type: 'string', description: 'Original uploaded file name' },
                { field: 'mimeType', type: 'string', description: 'MIME type of the file' },
                { field: 'size', type: 'number', description: 'File size in bytes' },
                { field: 'type', type: 'string', description: 'File type category: image, video, or audio' },
              ],
              notes: ['Accepts image, video, and audio files.', 'Returns a relative URL path that can be used in imageUrl, videoUrl, audioUrl, or screenshotUrl fields.', 'The type field in the response is derived from the MIME type: image/* → "image", video/* → "video", audio/* → "audio".', 'For creating a testimonial with a file in one request, use the /with-file endpoint instead.'],
              commonMistakes: ['Sending JSON Content-Type — this endpoint requires multipart/form-data.', 'Not setting the file field name to "file".'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'testimonials.create'],
              relatedApis: ['test-create', 'test-create-with-file', 'test-update-with-file'],
            },
          ],
        },
        // --- FAQ Bank ---
        {
          id: 'faq-bank',
          name: 'FAQ Bank',
          description: 'Manage FAQ categories and questions with search, filtering, bulk operations, AI generation, and multi-format export.',
          endpoints: [
            {
              id: 'faq-list',
              name: 'Get All FAQs',
              method: 'GET',
              path: '/api/faq-bank/faqs/:companyId',
              purpose: 'Retrieve all FAQs for a company with optional search, filtering, and pagination.',
              whenToUse: 'Use this endpoint to list and filter FAQs by category, type, status, priority, product, tags, audience, and funnel stage.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Full-text search across title, question, answer, shortAnswer' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'faqType', type: 'string', required: false, description: 'Filter by type: customer, sales, technical, internal, ai-training, website, blog, newsletter, support, onboarding, legal, hr, sop' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'productId', type: 'string', required: false, description: 'Filter by product ID' },
                { name: 'tags', type: 'string', required: false, description: 'Comma-separated tag filter' },
                { name: 'audienceType', type: 'string', required: false, description: 'Filter by audience: public, internal, team-specific, department-specific, admin-only' },
                { name: 'funnelStage', type: 'string', required: false, description: 'Filter by funnel: tofu, mofu, bofu, post-sale, general' },
                { name: 'sort', type: 'string', required: false, description: 'Sort field (default: order)' },
                { name: 'order', type: 'string', required: false, description: 'Sort order: asc or desc (default: asc)' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default: 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Items per page (default: 50)' },
              ],
              successResponse: { status: 200, description: 'List of FAQs with pagination', body: { data: [{ _id: '...', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-CMO is...', faqType: 'customer', status: 'published', priority: 'high' }], total: 25, page: 1, limit: 50, totalPages: 1 } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/faq-bank/faqs/YOUR_COMPANY_ID?status=published&faqType=customer&limit=10" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/YOUR_COMPANY_ID?status=published&faqType=customer&limit=10', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data, total, page } = await response.json();`,
              axiosExample: `const { data: { data, total, page } } = await axios.get('https://app.mengoengine.com/api/faq-bank/faqs/YOUR_COMPANY_ID', {
  params: { status: 'published', faqType: 'customer', limit: 10 },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/YOUR_COMPANY_ID?status=published&faqType=customer&limit=10', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/faq-bank/faqs/YOUR_COMPANY_ID',
    params={'status': 'published', 'faqType': 'customer', 'limit': 10},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/YOUR_COMPANY_ID?status=published&faqType=customer&limit=10');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of FAQ objects' },
                { field: 'data[].title', type: 'string', description: 'FAQ title (max 300 chars)' },
                { field: 'data[].question', type: 'string', description: 'FAQ question (max 500 chars)' },
                { field: 'data[].answer', type: 'string', description: 'Full answer' },
                { field: 'data[].faqType', type: 'string', description: 'FAQ type enum' },
                { field: 'data[].status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'data[].priority', type: 'string', description: 'Priority: low, medium, high, critical' },
                { field: 'total', type: 'number', description: 'Total items matching filter' },
                { field: 'page', type: 'number', description: 'Current page number' },
                { field: 'totalPages', type: 'number', description: 'Total pages' },
              ],
              notes: ['Response format: { data: [...], total, page, limit, totalPages }.', 'Search filters across title, question, answer, and shortAnswer fields.', 'Tags filter accepts comma-separated values (matches any).', 'faqType values: customer, sales, technical, internal, ai-training, website, blog, newsletter, support, onboarding, legal, hr, sop.', 'audienceType values: public, internal, team-specific, department-specific, admin-only.', 'funnelStage values: tofu, mofu, bofu, post-sale, general.'],
              commonMistakes: ['Using a POST body for filtering instead of query parameters.', 'Not including the companyId in the path — it is required.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'faq-bank.view'],
              relatedApis: ['faq-detail', 'faq-create', 'faq-update', 'faq-delete', 'faq-categories-list'],
            },
            {
              id: 'faq-detail',
              name: 'Get FAQ Detail',
              method: 'GET',
              path: '/api/faq-bank/faqs/detail/:id',
              purpose: 'Retrieve a single FAQ by ID. Automatically increments view count.',
              whenToUse: 'Use this endpoint to get full details of a specific FAQ including all SEO, AI, and relationship fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'FAQ document ID' },
              ],
              successResponse: { status: 200, description: 'FAQ details', body: { _id: '...', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'Full answer...', shortAnswer: 'Brief answer', faqType: 'customer', status: 'published', seoKeywords: ['ai', 'marketing'], viewCount: 42 } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'FAQ not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/faq-bank/faqs/detail/FAQ_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/detail/FAQ_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const faq = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/faq-bank/faqs/detail/FAQ_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/detail/FAQ_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/faq-bank/faqs/detail/FAQ_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/detail/FAQ_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'title', type: 'string', description: 'FAQ title' },
                { field: 'question', type: 'string', description: 'FAQ question' },
                { field: 'answer', type: 'string', description: 'Full answer' },
                { field: 'shortAnswer', type: 'string', description: 'Concise TL;DR answer (max 300 chars)' },
                { field: 'detailedAnswer', type: 'string', description: 'Extended detailed answer' },
                { field: 'faqType', type: 'string', description: 'FAQ type enum' },
                { field: 'status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'priority', type: 'string', description: 'Priority: low, medium, high, critical' },
                { field: 'audienceType', type: 'string', description: 'Audience: public, internal, team-specific, department-specific, admin-only' },
                { field: 'funnelStage', type: 'string', description: 'Funnel stage: tofu, mofu, bofu, post-sale, general' },
                { field: 'seoKeywords', type: 'array', description: 'SEO keywords array' },
                { field: 'searchIntent', type: 'string', description: 'Search intent: informational, navigational, transactional, commercial' },
                { field: 'aiContextWeight', type: 'number', description: 'AI context weight (1-10)' },
                { field: 'viewCount', type: 'number', description: 'Number of views (auto-incremented)' },
                { field: 'helpfulCount', type: 'number', description: 'Helpful vote count' },
                { field: 'relatedFaqIds', type: 'array', description: 'Related FAQ IDs' },
                { field: 'version', type: 'number', description: 'Version number' },
              ],
              notes: ['View count is automatically incremented each time this endpoint is called.', 'Response is a flat object (not wrapped in { data }).'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat object.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'faq-bank.view'],
              relatedApis: ['faq-list', 'faq-create', 'faq-update', 'faq-delete'],
            },
            {
              id: 'faq-create',
              name: 'Create FAQ',
              method: 'POST',
              path: '/api/faq-bank/faqs',
              purpose: 'Create a new FAQ.',
              whenToUse: 'Use this endpoint to create a FAQ. Title, question, and answer are required.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required, max 300 chars) — FAQ title', question: 'string (required, max 500 chars) — The question', answer: 'string (required) — The full answer', companyId: 'string (required) — Company ID', categoryId: 'string (optional) — Category ID', faqType: 'string (optional) — Type: customer, sales, technical, internal, ai-training, website, blog, newsletter, support, onboarding, legal, hr, sop (default: customer)', status: 'string (optional) — Status: draft, review, approved, published, archived (default: draft)', priority: 'string (optional) — Priority: low, medium, high, critical (default: medium)', shortAnswer: 'string (optional, max 300 chars) — Concise TL;DR answer', audienceType: 'string (optional) — Audience: public, internal, team-specific, department-specific, admin-only (default: public)', funnelStage: 'string (optional) — Funnel: tofu, mofu, bofu, post-sale, general (default: general)', tags: 'string[] (optional) — Tags array', seoKeywords: 'string[] (optional) — SEO keywords' },
              successResponse: { status: 201, description: 'FAQ created', body: { _id: '...', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-CMO is...', faqType: 'customer', status: 'draft', priority: 'medium', viewCount: 0 } },
              errorResponses: [
                { code: 400, message: 'Validation error (title, question, answer, companyId are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/faq-bank/faqs \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "title": "What is AI-CMO?", "question": "What is AI-CMO?", "answer": "AI-CMO is an AI-powered marketing platform.", "faqType": "customer", "status": "draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-CMO is an AI-powered marketing platform.', faqType: 'customer' }),
});
const faq = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/faq-bank/faqs',
  { companyId: 'YOUR_COMPANY_ID', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-CMO is an AI-powered marketing platform.', faqType: 'customer' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-CMO is an AI-powered marketing platform.' });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/faq-bank/faqs',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'What is AI-CMO?', 'question': 'What is AI-CMO?', 'answer': 'AI-CMO is an AI-powered marketing platform.', 'faqType': 'customer'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'What is AI-CMO?', 'question' => 'What is AI-CMO?', 'answer' => 'AI-CMO is an AI-powered marketing platform.']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'title', type: 'string', description: 'FAQ title' },
                { field: 'question', type: 'string', description: 'FAQ question' },
                { field: 'answer', type: 'string', description: 'Full answer' },
                { field: 'faqType', type: 'string', description: 'FAQ type (default: customer)' },
                { field: 'status', type: 'string', description: 'Status (default: draft)' },
                { field: 'priority', type: 'string', description: 'Priority (default: medium)' },
                { field: 'viewCount', type: 'number', description: 'View count (starts at 0)' },
              ],
              notes: ['title, question, answer, and companyId are required fields.', 'If categoryId is provided, the category\'s faqCount is automatically incremented.', 'Response is a flat object (not wrapped in { data }).', 'Default values: faqType=customer, status=draft, priority=medium, audienceType=public, funnelStage=general, order=0.'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Expecting a wrapped { data } response — this endpoint returns a flat object.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.create'],
              relatedApis: ['faq-list', 'faq-detail', 'faq-update', 'faq-delete', 'faq-categories-list'],
            },
            {
              id: 'faq-update',
              name: 'Update FAQ',
              method: 'PUT',
              path: '/api/faq-bank/faqs/:id',
              purpose: 'Update an existing FAQ.',
              whenToUse: "Use this endpoint to modify an FAQ's content, status, or other fields. Changing categoryId automatically updates faqCount on old and new categories.",
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'FAQ document ID' },
              ],
              requestBody: { title: 'string (optional) — Updated title', question: 'string (optional) — Updated question', answer: 'string (optional) — Updated answer', shortAnswer: 'string (optional) — Updated short answer', categoryId: 'string (optional) — Updated category (auto-updates faqCount)', status: 'string (optional) — Updated status', priority: 'string (optional) — Updated priority', tags: 'string[] (optional) — Updated tags' },
              successResponse: { status: 200, description: 'FAQ updated', body: { _id: '...', title: 'Updated title', question: 'Updated question', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'FAQ not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"answer": "Updated answer text", "status": "published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ answer: 'Updated answer text', status: 'published' }),
});
const faq = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID',
  { answer: 'Updated answer text', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ answer: 'Updated answer text', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/FAQ_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID',
    json={'answer': 'Updated answer text', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['answer' => 'Updated answer text', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'FAQ ID' },
                { field: 'title', type: 'string', description: 'Updated title' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'If you change categoryId, faqCount is automatically decremented on the old category and incremented on the new one.', 'Response is a flat object (not wrapped in { data }).'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat object.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.edit'],
              relatedApis: ['faq-list', 'faq-detail', 'faq-delete', 'faq-bulk-update'],
            },
            {
              id: 'faq-delete',
              name: 'Delete FAQ',
              method: 'DELETE',
              path: '/api/faq-bank/faqs/:id',
              purpose: 'Permanently delete an FAQ.',
              whenToUse: 'Use this endpoint to remove an FAQ. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'FAQ document ID to delete' },
              ],
              successResponse: { status: 200, description: 'FAQ deleted', body: { message: 'FAQ deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'FAQ not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/FAQ_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/FAQ_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'If the FAQ had a categoryId, the category\'s faqCount is automatically decremented.', 'Response is { message: "FAQ deleted successfully" } (not wrapped in { data }).'],
              commonMistakes: ['Expecting a { data: {...} } response — this endpoint returns { message: "..." }.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.delete'],
              relatedApis: ['faq-list', 'faq-detail', 'faq-update', 'faq-bulk-delete'],
            },
            {
              id: 'faq-export',
              name: 'Export FAQs',
              method: 'GET',
              path: '/api/faq-bank/faqs/export/:companyId',
              purpose: 'Export all FAQs for a company in JSON, CSV, or Markdown format.',
              whenToUse: 'Use this endpoint to bulk export FAQs. Default format is JSON; specify format=csv or format=markdown for alternatives.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'format', type: 'string', required: false, description: 'Export format: json (default), csv, or markdown' },
              ],
              successResponse: { status: 200, description: 'Exported FAQs. JSON format returns { data, count }. CSV/Markdown return raw text with Content-Disposition header.', body: { data: ['...'], count: 25 } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/faq-bank/faqs/export/YOUR_COMPANY_ID?format=json" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/export/YOUR_COMPANY_ID?format=json', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/faq-bank/faqs/export/YOUR_COMPANY_ID', {
  params: { format: 'json' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/export/YOUR_COMPANY_ID?format=json', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/faq-bank/faqs/export/YOUR_COMPANY_ID',
    params={'format': 'json'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/export/YOUR_COMPANY_ID?format=json');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of FAQ objects (JSON format only)' },
                { field: 'count', type: 'number', description: 'Total number of exported FAQs (JSON format only)' },
              ],
              notes: ['JSON format returns { data: [...], count }.', 'CSV format returns Content-Type: text/csv with Content-Disposition: attachment; filename=faqs.csv.', 'Markdown format returns Content-Type: text/markdown with Content-Disposition: attachment; filename=faqs.md.', 'FAQs are sorted by order, then by createdAt descending.'],
              commonMistakes: ['Expecting JSON response when requesting CSV or Markdown format — these return raw text content, not JSON.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.read', 'faq-bank.view'],
              relatedApis: ['faq-list', 'faq-bulk-import'],
            },
            {
              id: 'faq-bulk-import',
              name: 'Bulk Import FAQs',
              method: 'POST',
              path: '/api/faq-bank/faqs/bulk-import',
              purpose: 'Import multiple FAQs at once (max 200 per request).',
              whenToUse: 'Use this endpoint to create multiple FAQs in a single request. Each FAQ defaults to draft status unless specified.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', faqs: 'array (required, max 200) — Array of FAQ objects, each with at least title, question, answer' },
              successResponse: { status: 201, description: 'FAQs imported', body: { message: 'Successfully imported 5 FAQs', count: 5, data: ['...'] } },
              errorResponses: [
                { code: 400, message: 'Company ID is required / FAQs array is required and must not be empty / Maximum 200 FAQs per import' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/faq-bank/faqs/bulk-import \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "faqs": [{"title": "What is AI-CMO?", "question": "What is AI-CMO?", "answer": "AI-CMO is an AI-powered marketing platform."}, {"title": "How much does it cost?", "question": "How much does it cost?", "answer": "Pricing starts at $29/month."}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/bulk-import', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', faqs: [{ title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-powered marketing platform.' }] }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/faq-bank/faqs/bulk-import',
  { companyId: 'YOUR_COMPANY_ID', faqs: [{ title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-powered marketing platform.' }] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', faqs: [{ title: 'What is AI-CMO?', question: 'What is AI-CMO?', answer: 'AI-powered marketing platform.' }] });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/bulk-import', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/faq-bank/faqs/bulk-import',
    json={'companyId': 'YOUR_COMPANY_ID', 'faqs': [{'title': 'What is AI-CMO?', 'question': 'What is AI-CMO?', 'answer': 'AI-powered marketing platform.'}]},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/bulk-import');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'faqs' => [['title' => 'What is AI-CMO?', 'question' => 'What is AI-CMO?', 'answer' => 'AI-powered marketing platform.']]]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Success message with count' },
                { field: 'count', type: 'number', description: 'Number of FAQs created' },
                { field: 'data', type: 'array', description: 'Array of created FAQ objects' },
              ],
              notes: ['companyId and faqs array are required.', 'Maximum 200 FAQs per import request.', 'Each FAQ object should have at least title, question, and answer.', 'Default values: status=draft, faqType=customer, priority=medium, audienceType=public, funnelStage=general.', 'If a categoryId is provided on any FAQ, the category\'s faqCount is automatically incremented.'],
              commonMistakes: ['Sending more than 200 FAQs per request — maximum is 200.', 'Forgetting to include companyId at the top level.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.import'],
              relatedApis: ['faq-create', 'faq-bulk-update', 'faq-bulk-delete'],
            },
            {
              id: 'faq-bulk-update',
              name: 'Bulk Update FAQs',
              method: 'PUT',
              path: '/api/faq-bank/faqs/bulk-update',
              purpose: 'Update multiple FAQs at once with the same changes.',
              whenToUse: 'Use this endpoint to apply the same updates to multiple FAQs (e.g., bulk-publish, change category).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { ids: 'string[] (required) — Array of FAQ IDs to update', updates: 'object (required) — Fields to update. Allowed: status, categoryId, faqType, priority, audienceType, tags. Changing categoryId auto-updates faqCount on old/new categories.' },
              successResponse: { status: 200, description: 'FAQs updated', body: { message: 'Updated 5 FAQs', updatedCount: 5 } },
              errorResponses: [
                { code: 400, message: 'FAQ IDs array is required / Updates object is required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/faq-bank/faqs/bulk-update \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"ids": ["ID1", "ID2", "ID3"], "updates": {"status": "published"}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/bulk-update', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'published' } }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/faq-bank/faqs/bulk-update',
  { ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'published' } },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'], updates: { status: 'published' } });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/bulk-update', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/faq-bank/faqs/bulk-update',
    json={'ids': ['ID1', 'ID2', 'ID3'], 'updates': {'status': 'published'}},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/bulk-update');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['ids' => ['ID1', 'ID2', 'ID3'], 'updates' => ['status' => 'published']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Success message with count' },
                { field: 'updatedCount', type: 'number', description: 'Number of FAQs actually updated' },
              ],
              notes: ['Only allowed update fields are: status, categoryId, faqType, priority, audienceType, tags.', 'Only FAQs belonging to the user\'s companies are updated — others are silently skipped.', 'If categoryId is changed, faqCount is automatically updated on both old and new categories.', 'Response returns count of updated documents, not the updated FAQs themselves.'],
              commonMistakes: ['Trying to update fields like title, question, or answer via bulk update — these are not allowed.', 'Expecting updated FAQ objects — this endpoint returns { message, updatedCount } only.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.edit'],
              relatedApis: ['faq-update', 'faq-bulk-import', 'faq-bulk-delete'],
            },
            {
              id: 'faq-bulk-delete',
              name: 'Bulk Delete FAQs',
              method: 'POST',
              path: '/api/faq-bank/faqs/bulk-delete',
              purpose: 'Delete multiple FAQs at once.',
              whenToUse: 'Use this endpoint to delete several FAQs in a single request.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { ids: 'string[] (required) — Array of FAQ IDs to delete' },
              successResponse: { status: 200, description: 'FAQs deleted', body: { message: 'Deleted 3 FAQs', deletedCount: 3 } },
              errorResponses: [
                { code: 400, message: 'FAQ IDs array is required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/faq-bank/faqs/bulk-delete \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"ids": ["ID1", "ID2", "ID3"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/faqs/bulk-delete', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'] }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/faq-bank/faqs/bulk-delete',
  { ids: ['ID1', 'ID2', 'ID3'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ ids: ['ID1', 'ID2', 'ID3'] });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/faqs/bulk-delete', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/faq-bank/faqs/bulk-delete',
    json={'ids': ['ID1', 'ID2', 'ID3']},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/faqs/bulk-delete');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['ids' => ['ID1', 'ID2', 'ID3']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Success message with count' },
                { field: 'deletedCount', type: 'number', description: 'Number of FAQs actually deleted' },
              ],
              notes: ['Only FAQs belonging to the user\'s companies are deleted — others are silently skipped.', 'Category faqCount is automatically decremented for each deleted FAQ that had a categoryId.', 'Uses POST method (not DELETE) because it accepts a body with an array of IDs.'],
              commonMistakes: ['Using DELETE method — this endpoint uses POST.', 'Expecting a different response format — returns { message, deletedCount }.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.delete'],
              relatedApis: ['faq-delete', 'faq-bulk-import', 'faq-bulk-update'],
            },
            // --- FAQ Categories ---
            {
              id: 'faq-categories-list',
              name: 'Get All FAQ Categories',
              method: 'GET',
              path: '/api/faq-bank/categories/:companyId',
              purpose: 'Retrieve all FAQ categories for a company.',
              whenToUse: 'Use this endpoint to list all categories used to organize FAQs.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of categories', body: [{ _id: '...', companyId: '...', name: 'Product FAQs', slug: 'product-faqs', faqCount: 12, order: 1, isActive: true }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/faq-bank/categories/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const categories = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/faq-bank/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/faq-bank/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/faq-bank/categories/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/categories/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Category document ID' },
                { field: '[].name', type: 'string', description: 'Category name' },
                { field: '[].slug', type: 'string', description: 'URL-friendly slug (auto-generated)' },
                { field: '[].description', type: 'string', description: 'Category description' },
                { field: '[].parentId', type: 'string', description: 'Parent category ID (for hierarchy)' },
                { field: '[].faqCount', type: 'number', description: 'Number of FAQs in this category' },
                { field: '[].order', type: 'number', description: 'Sort order' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the category is active' },
              ],
              notes: ['Categories are sorted by order, then createdAt.', 'The slug is auto-generated from the name.', 'Categories support hierarchical structure via parentId.', 'Response is a flat array (not wrapped in { data }).', 'Category types: general, product, service, pricing, technical, support, billing, onboarding, legal, hr, sop, custom.'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat array.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'faq-bank.view'],
              relatedApis: ['faq-category-create', 'faq-category-update', 'faq-category-delete'],
            },
            {
              id: 'faq-category-create',
              name: 'Create FAQ Category',
              method: 'POST',
              path: '/api/faq-bank/categories',
              purpose: 'Create a new FAQ category.',
              whenToUse: 'Use this endpoint to create a category for organizing FAQs.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required, max 100 chars) — Category name', companyId: 'string (required) — Company ID', description: 'string (optional) — Category description', parentId: 'string (optional) — Parent category ID for hierarchy', icon: 'string (optional) — Icon identifier', colour: 'string (optional) — Color code', order: 'number (optional) — Sort order (default: 0)', isActive: 'boolean (optional) — Whether active (default: true)' },
              successResponse: { status: 201, description: 'Category created', body: { _id: '...', companyId: '...', name: 'Product FAQs', slug: 'product-faqs', faqCount: 0, isActive: true } },
              errorResponses: [
                { code: 400, message: 'Validation error (name and companyId are required)' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/faq-bank/categories \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "name": "Product FAQs", "description": "Frequently asked questions about our products"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/categories', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product FAQs', description: 'Frequently asked questions about our products' }),
});
const category = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/faq-bank/categories',
  { companyId: 'YOUR_COMPANY_ID', name: 'Product FAQs', description: 'FAQ about products' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product FAQs' });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/categories', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/faq-bank/categories',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Product FAQs', 'description': 'FAQ about products'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/categories');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product FAQs', 'description' => 'FAQ about products']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Category document ID' },
                { field: 'name', type: 'string', description: 'Category name' },
                { field: 'slug', type: 'string', description: 'Auto-generated URL slug' },
                { field: 'faqCount', type: 'number', description: 'Number of FAQs (0 for new category)' },
                { field: 'isActive', type: 'boolean', description: 'Whether the category is active' },
              ],
              notes: ['name and companyId are required.', 'The slug is auto-generated from the name.', 'Categories support hierarchical structure via parentId.', 'Response is a flat object (not wrapped in { data }).'],
              commonMistakes: ['Forgetting to include companyId — it is required.', 'Using a name longer than 100 characters.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.create'],
              relatedApis: ['faq-categories-list', 'faq-category-update', 'faq-category-delete'],
            },
            {
              id: 'faq-category-update',
              name: 'Update FAQ Category',
              method: 'PUT',
              path: '/api/faq-bank/categories/:id',
              purpose: "Update an FAQ category.",
              whenToUse: "Use this endpoint to modify a category's name, description, order, or other fields.",
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category document ID' },
              ],
              requestBody: { name: 'string (optional) — Updated category name', description: 'string (optional) — Updated description', parentId: 'string (optional) — Updated parent category ID', order: 'number (optional) — Updated sort order', isActive: 'boolean (optional) — Updated active status' },
              successResponse: { status: 200, description: 'Category updated', body: { _id: '...', name: 'Updated Category', slug: 'updated-category', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Category", "isActive": true}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Category', isActive: true }),
});
const category = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID',
  { name: 'Updated Category', isActive: true },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Category', isActive: true });
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/categories/CATEGORY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID',
    json={'name': 'Updated Category', 'isActive': True},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Category', 'isActive' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Category ID' },
                { field: 'name', type: 'string', description: 'Updated category name' },
                { field: 'slug', type: 'string', description: 'Auto-updated slug' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'The slug is auto-regenerated if the name changes.', 'Response is a flat object (not wrapped in { data }).'],
              commonMistakes: ['Using companyId instead of the category _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.edit'],
              relatedApis: ['faq-categories-list', 'faq-category-delete'],
            },
            {
              id: 'faq-category-delete',
              name: 'Delete FAQ Category',
              method: 'DELETE',
              path: '/api/faq-bank/categories/:id',
              purpose: 'Delete an FAQ category.',
              whenToUse: 'Use this endpoint to remove a category. FAQs in this category will have their categoryId and subcategoryId unset.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Category deleted', body: { message: 'Category deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/faq-bank/categories/CATEGORY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/faq-bank/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'FAQs that were in this category will have their categoryId and subcategoryId unset (not deleted).', 'Response is { message: "Category deleted successfully" } (not wrapped in { data }).'],
              commonMistakes: ['Not verifying the category ID before deleting — FAQs in it will lose their category assignment.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'faq-bank.delete'],
              relatedApis: ['faq-categories-list', 'faq-category-update'],
            },
          ],
        },
        // --- Website Planner ---
        {
          id: 'website-planner',
          name: 'Website Planner',
          description: 'Manage website pages (CRUD) and planner configuration for website structure and content.',
          endpoints: [
            // --- Website Pages ---
            {
              id: 'wp-pages-list',
              name: 'Get All Website Pages',
              method: 'GET',
              path: '/api/website-pages/:companyId',
              purpose: 'Retrieve all website pages for a company, sorted by order and creation date.',
              whenToUse: 'Use this endpoint to list all pages for a company website.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of website pages', body: [{ _id: '...', companyId: '...', title: 'Home', slug: 'home', type: 'home', status: 'published', isHomepage: true, order: 0 }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/website-pages/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/website-pages/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const pages = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/website-pages/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/website-pages/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/website-pages/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/website-pages/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Page document ID' },
                { field: '[].title', type: 'string', description: 'Page title (max 200 chars)' },
                { field: '[].slug', type: 'string', description: 'URL-friendly slug' },
                { field: '[].type', type: 'string', description: 'Page type: home, about, contact, landing, product, service, blog, custom' },
                { field: '[].status', type: 'string', description: 'Status: draft, published, archived' },
                { field: '[].isHomepage', type: 'boolean', description: 'Whether this is the homepage' },
                { field: '[].order', type: 'number', description: 'Sort order' },
                { field: '[].parentId', type: 'string', description: 'Parent page ID (for hierarchy)' },
              ],
              notes: ['Response is a flat array (not wrapped in { data }).', 'Pages are sorted by order ascending, then createdAt descending.', 'Each page has a unique slug per company.', 'type values: home, about, contact, landing, product, service, blog, custom. Status values: draft, published, archived.'],
              commonMistakes: ['Expecting a wrapped { data } response — this endpoint returns a flat array.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'website-planner.view'],
              relatedApis: ['wp-page-detail', 'wp-page-create', 'wp-page-update', 'wp-page-delete', 'wp-planner-get'],
            },
            {
              id: 'wp-page-detail',
              name: 'Get Website Page Detail',
              method: 'GET',
              path: '/api/website-pages/detail/:id',
              purpose: 'Retrieve a single website page by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific page including content, SEO, and template info.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Website page document ID' },
              ],
              successResponse: { status: 200, description: 'Page details', body: { _id: '...', title: 'About Us', slug: 'about-us', type: 'about', status: 'published', content: '...', metaTitle: 'About Us - Company', metaDescription: 'Learn about our company', metaKeywords: ['about', 'company'], isHomepage: false, order: 1 } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Page not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/website-pages/detail/PAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/website-pages/detail/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const page = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/website-pages/detail/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/website-pages/detail/PAGE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/website-pages/detail/PAGE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/website-pages/detail/PAGE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'title', type: 'string', description: 'Page title' },
                { field: 'slug', type: 'string', description: 'URL-friendly slug' },
                { field: 'type', type: 'string', description: 'Page type: home, about, contact, landing, product, service, blog, custom' },
                { field: 'status', type: 'string', description: 'Status: draft, published, archived' },
                { field: 'content', type: 'string', description: 'Page HTML/content' },
                { field: 'metaTitle', type: 'string', description: 'SEO meta title' },
                { field: 'metaDescription', type: 'string', description: 'SEO meta description' },
                { field: 'metaKeywords', type: 'array', description: 'SEO meta keywords' },
                { field: 'featuredImage', type: 'string', description: 'Featured image URL' },
                { field: 'template', type: 'string', description: 'Page template name' },
                { field: 'isHomepage', type: 'boolean', description: 'Whether this is the homepage' },
                { field: 'order', type: 'number', description: 'Sort order' },
                { field: 'parentId', type: 'string', description: 'Parent page ID' },
                { field: 'publishedAt', type: 'string', description: 'ISO date when published' },
              ],
              notes: ['Response is a flat object (not wrapped in { data }).', 'Includes SEO fields: metaTitle, metaDescription, metaKeywords.', 'Pages support hierarchy via parentId.'],
              commonMistakes: ['Using the slug instead of the MongoDB _id in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'website-planner.view'],
              relatedApis: ['wp-pages-list', 'wp-page-create', 'wp-page-update', 'wp-page-delete'],
            },
            {
              id: 'wp-page-create',
              name: 'Create Website Page',
              method: 'POST',
              path: '/api/website-pages',
              purpose: 'Create a new website page.',
              whenToUse: 'Use this endpoint to create a page. Title, slug, and companyId are required. Slug must be unique per company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required, max 200 chars) — Page title', slug: 'string (required) — URL-friendly slug (must be unique per company)', companyId: 'string (required) — Company ID', type: 'string (optional) — Page type: home, about, contact, landing, product, service, blog, custom (default: custom)', status: 'string (optional) — Status: draft, published, archived (default: draft)', content: 'string (optional) — Page HTML/content', isHomepage: 'boolean (optional, default: false) — Whether this is the homepage', order: 'number (optional, default: 0) — Sort order', parentId: 'string (optional) — Parent page ID for hierarchy', metaTitle: 'string (optional) — SEO meta title', metaDescription: 'string (optional) — SEO meta description', metaKeywords: 'string[] (optional) — SEO meta keywords', featuredImage: 'string (optional) — Featured image URL', template: 'string (optional) — Page template name' },
              successResponse: { status: 201, description: 'Page created', body: { _id: '...', title: 'About Us', slug: 'about-us', type: 'about', status: 'draft', isHomepage: false, order: 0, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error (title, slug, companyId are required) or duplicate slug' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/website-pages \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "title": "About Us", "slug": "about-us", "type": "about", "status": "draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/website-pages', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'About Us', slug: 'about-us', type: 'about', status: 'draft' }),
});
const page = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/website-pages',
  { companyId: 'YOUR_COMPANY_ID', title: 'About Us', slug: 'about-us', type: 'about', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'About Us', slug: 'about-us', type: 'about' });
const options = { hostname: 'api.mengo.ai', path: '/api/website-pages', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/website-pages',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'About Us', 'slug': 'about-us', 'type': 'about', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/website-pages');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'About Us', 'slug' => 'about-us', 'type' => 'about']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'title', type: 'string', description: 'Page title' },
                { field: 'slug', type: 'string', description: 'URL-friendly slug (unique per company)' },
                { field: 'type', type: 'string', description: 'Page type (default: custom)' },
                { field: 'status', type: 'string', description: 'Status (default: draft)' },
                { field: 'isHomepage', type: 'boolean', description: 'Whether this is the homepage (default: false)' },
                { field: 'order', type: 'number', description: 'Sort order (default: 0)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
              ],
              notes: ['title, slug, and companyId are required fields.', 'Slug must be unique per company — duplicates will return a 400 error.', 'Response is a flat object (not wrapped in { data }).', 'type values: home, about, contact, landing, product, service, blog, custom.', 'status values: draft, published, archived.'],
              commonMistakes: ['Using a slug that already exists for the same company — this will return a 400 error.', 'Forgetting to include companyId — it is required.', 'Not lowercasing the slug — slugs are automatically lowercased.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'website-planner.create'],
              relatedApis: ['wp-pages-list', 'wp-page-detail', 'wp-page-update', 'wp-page-delete'],
            },
            {
              id: 'wp-page-update',
              name: 'Update Website Page',
              method: 'PUT',
              path: '/api/website-pages/:id',
              purpose: 'Update an existing website page.',
              whenToUse: "Use this endpoint to modify a page's content, SEO fields, status, or other fields. Changing slug checks for uniqueness.",
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Website page document ID' },
              ],
              requestBody: { title: 'string (optional) — Updated title', slug: 'string (optional) — Updated slug (must be unique per company)', status: 'string (optional) — Updated status', content: 'string (optional) — Updated content', isHomepage: 'boolean (optional) — Updated homepage flag', order: 'number (optional) — Updated sort order', metaTitle: 'string (optional) — Updated SEO meta title', metaDescription: 'string (optional) — Updated SEO meta description' },
              successResponse: { status: 200, description: 'Page updated', body: { _id: '...', title: 'About Us - Updated', slug: 'about-us', status: 'published', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Duplicate slug — a page with this slug already exists for this company' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Page not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/website-pages/PAGE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status": "published", "content": "Updated content"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/website-pages/PAGE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'published', content: 'Updated content' }),
});
const page = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/website-pages/PAGE_ID',
  { status: 'published', content: 'Updated content' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ status: 'published', content: 'Updated content' });
const options = { hostname: 'api.mengo.ai', path: '/api/website-pages/PAGE_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/website-pages/PAGE_ID',
    json={'status': 'published', 'content': 'Updated content'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/website-pages/PAGE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'published', 'content' => 'Updated content']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Page ID' },
                { field: 'title', type: 'string', description: 'Updated title' },
                { field: 'slug', type: 'string', description: 'Updated slug' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.', 'If you change the slug, uniqueness is checked against other pages in the same company.', 'Response is a flat object (not wrapped in { data }).'],
              commonMistakes: ['Changing slug to one that already exists for the same company — returns 400.', 'Using the page slug instead of the MongoDB _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'website-planner.edit'],
              relatedApis: ['wp-pages-list', 'wp-page-detail', 'wp-page-delete'],
            },
            {
              id: 'wp-page-delete',
              name: 'Delete Website Page',
              method: 'DELETE',
              path: '/api/website-pages/:id',
              purpose: 'Permanently delete a website page.',
              whenToUse: 'Use this endpoint to remove a page. This action is irreversible.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Website page document ID to delete' },
              ],
              successResponse: { status: 200, description: 'Page deleted', body: { message: 'Page deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Page not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/website-pages/PAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/website-pages/PAGE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/website-pages/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/website-pages/PAGE_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/website-pages/PAGE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/website-pages/PAGE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Response is { message: "Page deleted successfully" } (not wrapped in { data }).'],
              commonMistakes: ['Expecting a { data: {...} } response — this endpoint returns { message: "..." }.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'website-planner.delete'],
              relatedApis: ['wp-pages-list', 'wp-page-detail', 'wp-page-update'],
            },
            // --- Planner Configuration (module-data) ---
            {
              id: 'wp-planner-get',
              name: 'Get Website Planner Configuration',
              method: 'GET',
              path: '/api/module-data/website-planner/:companyId',
              purpose: 'Retrieve the website planner configuration for a company.',
              whenToUse: 'Use this endpoint to get the website planner data including site structure, page layouts, navigation, and design settings.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Website planner configuration', body: { _id: '...', moduleId: 'website-planner', companyId: '...', data: { siteStructure: ['...'], navigation: ['...'], designSettings: ['...'] }, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const planner = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/module-data/website-planner/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Document ID' },
                { field: 'moduleId', type: 'string', description: 'Always "website-planner"' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'data', type: 'object', description: 'Website planner configuration data (site structure, navigation, design settings)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['Returns an empty object {} if no planner data exists for the company — this is a valid state for new companies.', 'The moduleId path parameter must be "website-planner" (literal string).', 'This is the same endpoint the UI uses to load planner configuration data.'],
              commonMistakes: ['Using the document _id instead of companyId in the URL — the path parameter is the companyId.', 'Forgetting that moduleId must be "website-planner" — it is part of the URL path.', 'Expecting an array — this endpoint returns a single object or empty object {}.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'website-planner.view'],
              relatedApis: ['wp-planner-save', 'wp-planner-delete', 'wp-pages-list'],
            },
            {
              id: 'wp-planner-save',
              name: 'Save Website Planner Configuration',
              method: 'POST',
              path: '/api/module-data/website-planner',
              purpose: 'Save or update the website planner configuration for a company. Uses upsert — creates if not found, updates if existing.',
              whenToUse: 'Use this endpoint to save the entire website planner configuration in one request.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', data: 'object (required) — Website planner configuration object containing site structure, navigation, design settings, etc.' },
              successResponse: { status: 200, description: 'Planner configuration saved', body: { _id: '...', moduleId: 'website-planner', companyId: '...', data: { siteStructure: ['...'], navigation: ['...'], designSettings: ['...'] }, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 400, message: 'companyId and data are required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/module-data/website-planner \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId": "YOUR_COMPANY_ID", "data": {"siteStructure": [{"title": "Home", "slug": "home", "type": "home"}], "navigation": [{"label": "Home", "slug": "/home"}]}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/website-planner', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { siteStructure: [{ title: 'Home', slug: 'home', type: 'home' }], navigation: [{ label: 'Home', slug: '/home' }] } }),
});
const planner = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/module-data/website-planner',
  { companyId: 'YOUR_COMPANY_ID', data: { siteStructure: [{ title: 'Home', slug: 'home', type: 'home' }], navigation: [{ label: 'Home', slug: '/home' }] } },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', data: { siteStructure: [{ title: 'Home', slug: 'home', type: 'home' }] } });
const options = { hostname: 'api.mengo.ai', path: '/api/module-data/website-planner', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/module-data/website-planner',
    json={'companyId': 'YOUR_COMPANY_ID', 'data': {'siteStructure': [{'title': 'Home', 'slug': 'home', 'type': 'home'}]}},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/website-planner');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'data' => ['siteStructure' => [['title' => 'Home', 'slug' => 'home']]]]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Document ID' },
                { field: 'moduleId', type: 'string', description: 'Always "website-planner"' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'data', type: 'object', description: 'Saved website planner configuration' },
                { field: 'createdAt', type: 'string', description: 'ISO date when created' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when last updated' },
              ],
              notes: ['This endpoint uses upsert — it creates if not found, or updates if already existing. No need to check if data exists first.', 'The moduleId path parameter must be "website-planner" (literal string).', 'The request body must include both companyId and data. The data field is an object containing all planner fields.', 'Only include fields you want to save — the entire data object is replaced on each save.'],
              commonMistakes: ['Forgetting to include the data field — both companyId and data are required.', 'Sending partial updates expecting a merge — the entire data object is replaced.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'website-planner.edit'],
              relatedApis: ['wp-planner-get', 'wp-planner-delete'],
            },
            {
              id: 'wp-planner-delete',
              name: 'Delete Website Planner Configuration',
              method: 'DELETE',
              path: '/api/module-data/website-planner/:companyId',
              purpose: 'Delete the website planner configuration for a company.',
              whenToUse: 'Use this endpoint to remove the planner configuration. Website pages are not affected — they are stored separately.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Planner configuration deleted', body: { message: 'Module data deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied for this company' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/module-data/website-planner/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/module-data/website-planner/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'The moduleId path parameter must be "website-planner" (literal string).', 'Deleting planner configuration does not affect website pages — those are stored in a separate collection.'],
              commonMistakes: ['Using the document _id instead of companyId in the URL.', 'Thinking this deletes website pages — it only deletes the planner configuration.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'website-planner.delete'],
              relatedApis: ['wp-planner-get', 'wp-planner-save'],
            },
          ],
        },
        // --- Newsletter Content OS ---
        {
          id: 'newsletter-content-os',
          name: 'Newsletter Content OS',
          description: 'Manage newsletter strategies, calendars, titles, posts, content chunks, exports, and campaigns — the complete newsletter content operating system.',
          endpoints: [
            // --- Strategies ---
            {
              id: 'ncos-strategies-list',
              name: 'Get All Strategies',
              method: 'GET',
              path: '/api/newsletter-content-os/strategies/:companyId',
              purpose: 'Retrieve all newsletter strategies for a company.',
              whenToUse: 'Use this endpoint to list all newsletter content strategies configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve strategies for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter strategies', body: { data: [{ id: 'nl-strat-1', name: 'Weekly Digest', audience: 'Subscribers', industry: 'Technology', objective: 'education', funnelStage: 'tofu', contentDepth: 'standard', communicationTone: 'Professional', ctaGoal: 'Subscribe', companyId: '...', linkedData: {}, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get strategies' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/strategies/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/strategies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const strategies = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/strategies/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/strategies/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.get(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/strategies/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/strategies/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique strategy identifier' },
                { field: 'name', type: 'string', description: 'Strategy name' },
                { field: 'audience', type: 'string', description: 'Target audience description' },
                { field: 'industry', type: 'string', description: 'Industry focus' },
                { field: 'objective', type: 'string', description: 'Strategy objective: education, product-awareness, community-building, brand-awareness, customer-engagement, retention, updates, founder-communication, thought-leadership' },
                { field: 'funnelStage', type: 'string', description: 'Marketing funnel stage: tofu, mofu, bofu' },
                { field: 'contentDepth', type: 'string', description: 'Content depth level: brief, standard, deep, comprehensive' },
                { field: 'communicationTone', type: 'string', description: 'Communication tone style' },
                { field: 'ctaGoal', type: 'string', description: 'Call-to-action goal' },
                { field: 'linkedData', type: 'object', description: 'Linked reference data' },
              ],
              notes: ['Returns an empty array if no strategies exist for the company.', 'Strategies are auto-created when the company data is first accessed via getCompanyData.'],
              commonMistakes: ['Using the strategy _id instead of companyId in the URL — the path parameter is the companyId.', 'Expecting a paginated response — this endpoint returns a flat array of all strategies.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-strategy-detail', 'ncos-strategy-create'],
            },
            {
              id: 'ncos-strategy-detail',
              name: 'Get Strategy Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/strategies/detail/:id',
              purpose: 'Retrieve a single newsletter strategy by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific strategy.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The strategy ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single strategy object', body: { id: 'nl-strat-1', name: 'Weekly Digest', audience: 'Subscribers', industry: 'Technology', objective: 'education', funnelStage: 'tofu', contentDepth: 'standard', communicationTone: 'Professional', ctaGoal: 'Subscribe', companyId: '...', linkedData: {}, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Strategy not found' },
                { code: 500, message: 'Failed to get strategy' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/strategies/detail/STRATEGY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/strategies/detail/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const strategy = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/strategies/detail/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/strategies/detail/STRATEGY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/strategies/detail/STRATEGY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/strategies/detail/STRATEGY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique strategy identifier' },
                { field: 'name', type: 'string', description: 'Strategy name' },
                { field: 'audience', type: 'string', description: 'Target audience description' },
                { field: 'industry', type: 'string', description: 'Industry focus' },
                { field: 'objective', type: 'string', description: 'Strategy objective' },
                { field: 'funnelStage', type: 'string', description: 'Marketing funnel stage' },
                { field: 'contentDepth', type: 'string', description: 'Content depth level' },
                { field: 'communicationTone', type: 'string', description: 'Communication tone' },
                { field: 'ctaGoal', type: 'string', description: 'Call-to-action goal' },
              ],
              notes: ['The id parameter in the URL is the strategy id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the strategy id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-strategies-list', 'ncos-strategy-update'],
            },
            {
              id: 'ncos-strategy-create',
              name: 'Create Strategy',
              method: 'POST',
              path: '/api/newsletter-content-os/strategies',
              purpose: 'Create a new newsletter strategy for a company.',
              whenToUse: 'Use this endpoint to define a new newsletter content strategy with targeting and communication parameters.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Weekly Product Update', audience: 'Active Subscribers', industry: 'SaaS', objective: 'education', funnelStage: 'mofu', contentDepth: 'standard', communicationTone: 'Friendly', ctaGoal: 'Try Feature' },
              successResponse: { status: 201, description: 'Created strategy', body: { id: 'nl-strat-2', name: 'Weekly Product Update', audience: 'Active Subscribers', industry: 'SaaS', objective: 'education', funnelStage: 'mofu', contentDepth: 'standard', communicationTone: 'Friendly', ctaGoal: 'Try Feature', companyId: '...', linkedData: {}, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation failed — name must be 3-100 characters and contain meaningful words', body: { error: 'Validation failed', details: [{ msg: 'Name must be 3-100 characters' }] } },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create strategy' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/strategies \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Weekly Product Update","audience":"Active Subscribers","industry":"SaaS","objective":"education","funnelStage":"mofu","contentDepth":"standard","communicationTone":"Friendly","ctaGoal":"Try Feature"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/strategies', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Weekly Product Update', audience: 'Active Subscribers', industry: 'SaaS', objective: 'education', funnelStage: 'mofu', contentDepth: 'standard', communicationTone: 'Friendly', ctaGoal: 'Try Feature' })
});
const strategy = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/strategies',
  { companyId: 'YOUR_COMPANY_ID', name: 'Weekly Product Update', audience: 'Active Subscribers', industry: 'SaaS', objective: 'education', funnelStage: 'mofu', contentDepth: 'standard', communicationTone: 'Friendly', ctaGoal: 'Try Feature' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Weekly Product Update', audience: 'Active Subscribers', industry: 'SaaS', objective: 'education', funnelStage: 'mofu', contentDepth: 'standard', communicationTone: 'Friendly', ctaGoal: 'Try Feature' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/strategies', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/strategies',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Weekly Product Update', 'audience': 'Active Subscribers', 'industry': 'SaaS', 'objective': 'education', 'funnelStage': 'mofu', 'contentDepth': 'standard', 'communicationTone': 'Friendly', 'ctaGoal': 'Try Feature'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/strategies');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Weekly Product Update', 'audience' => 'Active Subscribers', 'industry' => 'SaaS', 'objective' => 'education', 'funnelStage' => 'mofu', 'contentDepth' => 'standard', 'communicationTone' => 'Friendly', 'ctaGoal' => 'Try Feature']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'name', type: 'string', description: 'Strategy name (3-100 chars, must contain meaningful words)' },
                { field: 'audience', type: 'string', description: 'Target audience (max 150 chars)' },
                { field: 'industry', type: 'string', description: 'Industry focus (max 80 chars)' },
                { field: 'objective', type: 'string', description: 'Required. One of: education, product-awareness, community-building, brand-awareness, customer-engagement, retention, updates, founder-communication, thought-leadership' },
                { field: 'funnelStage', type: 'string', description: 'Required. One of: tofu, mofu, bofu' },
                { field: 'contentDepth', type: 'string', description: 'Required. One of: brief, standard, deep, comprehensive' },
                { field: 'communicationTone', type: 'string', description: 'Tone style (max 100 chars)' },
                { field: 'ctaGoal', type: 'string', description: 'Call-to-action goal (max 100 chars)' },
              ],
              notes: ['name is required and must be 3-100 characters with meaningful words.', 'objective, funnelStage, and contentDepth are required and must match the allowed enum values.', 'audience, industry, communicationTone, and ctaGoal are optional but validated if provided.'],
              commonMistakes: ['Omitting the required companyId field in the request body.', 'Using invalid enum values for objective, funnelStage, or contentDepth.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-strategies-list', 'ncos-strategy-update'],
            },
            {
              id: 'ncos-strategy-update',
              name: 'Update Strategy',
              method: 'PUT',
              path: '/api/newsletter-content-os/strategies/:id',
              purpose: 'Update an existing newsletter strategy.',
              whenToUse: 'Use this endpoint to modify strategy parameters like audience, objective, tone, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The strategy ID to update' },
              ],
              requestBody: { name: 'Updated Strategy Name', audience: 'New Audience', objective: 'thought-leadership' },
              successResponse: { status: 200, description: 'Updated strategy', body: { id: 'nl-strat-1', name: 'Updated Strategy Name', audience: 'New Audience', objective: 'thought-leadership', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Strategy not found' },
                { code: 500, message: 'Failed to update strategy' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Strategy Name","audience":"New Audience"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Strategy Name', audience: 'New Audience' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID',
  { name: 'Updated Strategy Name', audience: 'New Audience' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Strategy Name', audience: 'New Audience' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/strategies/STRATEGY_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Strategy Name', 'audience': 'New Audience'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Strategy Name', 'audience' => 'New Audience']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Strategy identifier (unchanged)' },
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the strategy is merged with existing data.', 'The updatedAt timestamp is automatically set to the current time.'],
              commonMistakes: ['Sending the entire strategy object when only updating a few fields — partial updates are supported.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-strategy-detail', 'ncos-strategy-create'],
            },
            {
              id: 'ncos-strategy-delete',
              name: 'Delete Strategy',
              method: 'DELETE',
              path: '/api/newsletter-content-os/strategies/:id',
              purpose: 'Delete a newsletter strategy.',
              whenToUse: 'Use this endpoint to permanently remove a strategy from the company data.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The strategy ID to delete' },
              ],
              successResponse: { status: 200, description: 'Strategy deleted', body: { message: 'Strategy deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Strategy not found' },
                { code: 500, message: 'Failed to delete strategy' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/strategies/STRATEGY_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/strategies/STRATEGY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Strategy deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting a strategy does not affect other sub-resources (calendars, posts, etc.).'],
              commonMistakes: ['Using the MongoDB _id instead of the strategy id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-strategies-list', 'ncos-strategy-update'],
            },
            // --- Calendars ---
            {
              id: 'ncos-calendars-list',
              name: 'Get All Calendars',
              method: 'GET',
              path: '/api/newsletter-content-os/calendars/:companyId',
              purpose: 'Retrieve all newsletter calendars for a company.',
              whenToUse: 'Use this endpoint to list all newsletter content calendars (editorial schedules) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve calendars for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter calendars', body: { data: [{ id: 'nl-cal-1', name: 'Q3 Editorial Calendar', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get calendars' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/calendars/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/calendars/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const calendars = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/calendars/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/calendars/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/calendars/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/calendars/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique calendar identifier' },
                { field: 'companyId', type: 'string', description: 'Company the calendar belongs to' },
              ],
              notes: ['Returns an empty array if no calendars exist for the company.'],
              commonMistakes: ['Using the calendar _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-calendar-detail', 'ncos-calendar-create'],
            },
            {
              id: 'ncos-calendar-detail',
              name: 'Get Calendar Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/calendars/detail/:id',
              purpose: 'Retrieve a single newsletter calendar by its ID.',
              whenToUse: 'Use this endpoint when you need full details of a specific calendar.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The calendar ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single calendar object', body: { id: 'nl-cal-1', name: 'Q3 Editorial Calendar', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Calendar not found' },
                { code: 500, message: 'Failed to get calendar' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/calendars/detail/CALENDAR_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/calendars/detail/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const calendar = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/calendars/detail/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/calendars/detail/CALENDAR_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/calendars/detail/CALENDAR_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/calendars/detail/CALENDAR_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique calendar identifier' },
                { field: 'companyId', type: 'string', description: 'Company the calendar belongs to' },
              ],
              notes: ['The id parameter is the calendar id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the calendar id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-calendars-list', 'ncos-calendar-update'],
            },
            {
              id: 'ncos-calendar-create',
              name: 'Create Calendar',
              method: 'POST',
              path: '/api/newsletter-content-os/calendars',
              purpose: 'Create a new newsletter calendar for a company.',
              whenToUse: 'Use this endpoint to create a new editorial calendar or scheduling entry.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Editorial Calendar', frequency: 'weekly', startDate: '2026-07-01' },
              successResponse: { status: 201, description: 'Created calendar', body: { id: 'nl-cal-2', name: 'Q3 Editorial Calendar', frequency: 'weekly', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create calendar' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/calendars \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q3 Editorial Calendar","frequency":"weekly"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/calendars', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Editorial Calendar', frequency: 'weekly' })
});
const calendar = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/calendars',
  { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Editorial Calendar', frequency: 'weekly' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Editorial Calendar', frequency: 'weekly' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/calendars', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/calendars',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q3 Editorial Calendar', 'frequency': 'weekly'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/calendars');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q3 Editorial Calendar', 'frequency' => 'weekly']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the calendar for' },
              ],
              notes: ['companyId is required in the request body.', 'All other fields from the request body are stored as-is.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-calendars-list', 'ncos-calendar-update'],
            },
            {
              id: 'ncos-calendar-update',
              name: 'Update Calendar',
              method: 'PUT',
              path: '/api/newsletter-content-os/calendars/:id',
              purpose: 'Update an existing newsletter calendar.',
              whenToUse: 'Use this endpoint to modify calendar properties like name, frequency, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The calendar ID to update' },
              ],
              requestBody: { name: 'Updated Calendar Name', frequency: 'bi-weekly' },
              successResponse: { status: 200, description: 'Updated calendar', body: { id: 'nl-cal-1', name: 'Updated Calendar Name', frequency: 'bi-weekly', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Calendar not found' },
                { code: 500, message: 'Failed to update calendar' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Calendar Name"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Calendar Name' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID',
  { name: 'Updated Calendar Name' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Calendar Name' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/calendars/CALENDAR_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Calendar Name'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Calendar Name']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the calendar is merged with existing data.'],
              commonMistakes: ['Sending the entire calendar object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-calendar-detail', 'ncos-calendar-create'],
            },
            {
              id: 'ncos-calendar-delete',
              name: 'Delete Calendar',
              method: 'DELETE',
              path: '/api/newsletter-content-os/calendars/:id',
              purpose: 'Delete a newsletter calendar.',
              whenToUse: 'Use this endpoint to permanently remove a calendar.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The calendar ID to delete' },
              ],
              successResponse: { status: 200, description: 'Calendar deleted', body: { message: 'Calendar deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Calendar not found' },
                { code: 500, message: 'Failed to delete calendar' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/calendars/CALENDAR_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/calendars/CALENDAR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Calendar deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the calendar id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-calendars-list', 'ncos-calendar-update'],
            },
            // --- Titles ---
            {
              id: 'ncos-titles-list',
              name: 'Get All Titles',
              method: 'GET',
              path: '/api/newsletter-content-os/titles/:companyId',
              purpose: 'Retrieve all newsletter titles (subject lines) for a company.',
              whenToUse: 'Use this endpoint to list all newsletter title/subject line suggestions for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve titles for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter titles', body: { data: [{ id: 'nl-title-1', title: 'Weekly Insights #42', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get titles' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/titles/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/titles/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const titles = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/titles/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/titles/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/titles/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/titles/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique title identifier' },
                { field: 'title', type: 'string', description: 'Newsletter subject line or title text' },
                { field: 'companyId', type: 'string', description: 'Company the title belongs to' },
              ],
              notes: ['Returns an empty array if no titles exist for the company.'],
              commonMistakes: ['Using the title _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-title-detail', 'ncos-title-create'],
            },
            {
              id: 'ncos-title-detail',
              name: 'Get Title Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/titles/detail/:id',
              purpose: 'Retrieve a single newsletter title by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific title.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The title ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single title object', body: { id: 'nl-title-1', title: 'Weekly Insights #42', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Title not found' },
                { code: 500, message: 'Failed to get title' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/titles/detail/TITLE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/titles/detail/TITLE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const title = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/titles/detail/TITLE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/titles/detail/TITLE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/titles/detail/TITLE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/titles/detail/TITLE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique title identifier' },
                { field: 'title', type: 'string', description: 'Newsletter subject line text' },
              ],
              notes: ['The id parameter is the title id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the title id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-titles-list', 'ncos-title-update'],
            },
            {
              id: 'ncos-title-create',
              name: 'Create Title',
              method: 'POST',
              path: '/api/newsletter-content-os/titles',
              purpose: 'Create a new newsletter title/subject line for a company.',
              whenToUse: 'Use this endpoint to add a new newsletter subject line suggestion.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Monthly Product Roundup', status: 'draft' },
              successResponse: { status: 201, description: 'Created title', body: { id: 'nl-title-2', title: 'Monthly Product Roundup', status: 'draft', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create title' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/titles \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Monthly Product Roundup","status":"draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/titles', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Monthly Product Roundup', status: 'draft' })
});
const title = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/titles',
  { companyId: 'YOUR_COMPANY_ID', title: 'Monthly Product Roundup', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Monthly Product Roundup', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/titles', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/titles',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Monthly Product Roundup', 'status': 'draft'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/titles');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Monthly Product Roundup', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the title for' },
                { field: 'title', type: 'string', description: 'Newsletter subject line text' },
              ],
              notes: ['companyId is required in the request body.', 'All other fields from the request body are stored as-is.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-titles-list', 'ncos-title-update'],
            },
            {
              id: 'ncos-title-update',
              name: 'Update Title',
              method: 'PUT',
              path: '/api/newsletter-content-os/titles/:id',
              purpose: 'Update an existing newsletter title.',
              whenToUse: 'Use this endpoint to modify title properties like text, status, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The title ID to update' },
              ],
              requestBody: { title: 'Updated Newsletter Subject Line', status: 'approved' },
              successResponse: { status: 200, description: 'Updated title', body: { id: 'nl-title-1', title: 'Updated Newsletter Subject Line', status: 'approved', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Title not found' },
                { code: 500, message: 'Failed to update title' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Newsletter Subject Line"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Newsletter Subject Line' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID',
  { title: 'Updated Newsletter Subject Line' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ title: 'Updated Newsletter Subject Line' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/titles/TITLE_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'title': 'Updated Newsletter Subject Line'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Newsletter Subject Line']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the title is merged with existing data.'],
              commonMistakes: ['Sending the entire title object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-title-detail', 'ncos-title-create'],
            },
            {
              id: 'ncos-title-delete',
              name: 'Delete Title',
              method: 'DELETE',
              path: '/api/newsletter-content-os/titles/:id',
              purpose: 'Delete a newsletter title.',
              whenToUse: 'Use this endpoint to permanently remove a title.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The title ID to delete' },
              ],
              successResponse: { status: 200, description: 'Title deleted', body: { message: 'Title deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Title not found' },
                { code: 500, message: 'Failed to delete title' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/titles/TITLE_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/titles/TITLE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Title deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the title id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-titles-list', 'ncos-title-update'],
            },
            // --- Posts ---
            {
              id: 'ncos-posts-list',
              name: 'Get All Posts',
              method: 'GET',
              path: '/api/newsletter-content-os/posts/:companyId',
              purpose: 'Retrieve all newsletter posts for a company.',
              whenToUse: 'Use this endpoint to list all newsletter content posts for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve posts for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter posts', body: { data: [{ id: 'nl-post-1', title: 'Newsletter Issue #5', content: '...', status: 'published', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get posts' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/posts/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const posts = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/posts/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/posts/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/posts/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique post identifier' },
                { field: 'title', type: 'string', description: 'Post title' },
                { field: 'content', type: 'string', description: 'Post content body' },
                { field: 'status', type: 'string', description: 'Post status (draft, published, etc.)' },
                { field: 'companyId', type: 'string', description: 'Company the post belongs to' },
              ],
              notes: ['Returns an empty array if no posts exist for the company.'],
              commonMistakes: ['Using the post _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-post-detail', 'ncos-post-create'],
            },
            {
              id: 'ncos-post-detail',
              name: 'Get Post Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/posts/detail/:id',
              purpose: 'Retrieve a single newsletter post by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific post.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The post ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single post object', body: { id: 'nl-post-1', title: 'Newsletter Issue #5', content: 'Full content...', status: 'published', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to get post' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/posts/detail/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const post = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/posts/detail/POST_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/posts/detail/POST_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/posts/detail/POST_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique post identifier' },
                { field: 'title', type: 'string', description: 'Post title' },
                { field: 'content', type: 'string', description: 'Full post content' },
              ],
              notes: ['The id parameter is the post id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the post id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-posts-list', 'ncos-post-update'],
            },
            {
              id: 'ncos-post-create',
              name: 'Create Post',
              method: 'POST',
              path: '/api/newsletter-content-os/posts',
              purpose: 'Create a new newsletter post for a company.',
              whenToUse: 'Use this endpoint to create a new newsletter content piece.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Weekly Update #12', content: 'This week we cover...', status: 'draft' },
              successResponse: { status: 201, description: 'Created post', body: { id: 'nl-post-2', title: 'Weekly Update #12', content: 'This week we cover...', status: 'draft', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create post' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/posts \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Weekly Update #12","content":"This week we cover...","status":"draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/posts', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Weekly Update #12', content: 'This week we cover...', status: 'draft' })
});
const post = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/posts',
  { companyId: 'YOUR_COMPANY_ID', title: 'Weekly Update #12', content: 'This week we cover...', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Weekly Update #12', content: 'This week we cover...', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/posts', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/posts',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Weekly Update #12', 'content': 'This week we cover...', 'status': 'draft'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/posts');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Weekly Update #12', 'content' => 'This week we cover...', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the post for' },
                { field: 'title', type: 'string', description: 'Post title' },
                { field: 'content', type: 'string', description: 'Post content body' },
              ],
              notes: ['companyId is required in the request body.', 'All other fields from the request body are stored as-is.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-posts-list', 'ncos-post-update'],
            },
            {
              id: 'ncos-post-update',
              name: 'Update Post',
              method: 'PUT',
              path: '/api/newsletter-content-os/posts/:id',
              purpose: 'Update an existing newsletter post.',
              whenToUse: 'Use this endpoint to modify post content, status, or other properties.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The post ID to update' },
              ],
              requestBody: { title: 'Updated Newsletter Title', status: 'published' },
              successResponse: { status: 200, description: 'Updated post', body: { id: 'nl-post-1', title: 'Updated Newsletter Title', status: 'published', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to update post' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Newsletter Title","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Newsletter Title', status: 'published' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID',
  { title: 'Updated Newsletter Title', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ title: 'Updated Newsletter Title', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/posts/POST_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'title': 'Updated Newsletter Title', 'status': 'published'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Newsletter Title', 'status' => 'published']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the post is merged with existing data.'],
              commonMistakes: ['Sending the entire post object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-post-detail', 'ncos-post-create'],
            },
            {
              id: 'ncos-post-delete',
              name: 'Delete Post',
              method: 'DELETE',
              path: '/api/newsletter-content-os/posts/:id',
              purpose: 'Delete a newsletter post.',
              whenToUse: 'Use this endpoint to permanently remove a post.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The post ID to delete' },
              ],
              successResponse: { status: 200, description: 'Post deleted', body: { message: 'Post deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to delete post' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/posts/POST_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Post deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the post id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-posts-list', 'ncos-post-update'],
            },
            // --- Chunks ---
            {
              id: 'ncos-chunks-list',
              name: 'Get All Chunks',
              method: 'GET',
              path: '/api/newsletter-content-os/chunks/:companyId',
              purpose: 'Retrieve all newsletter content chunks for a company.',
              whenToUse: 'Use this endpoint to list all reusable content chunks/snippets for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve chunks for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter content chunks', body: { data: [{ id: 'nl-chunk-1', name: 'Welcome Section', content: '...', type: 'section', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get chunks' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/chunks/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/chunks/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const chunks = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/chunks/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/chunks/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/chunks/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/chunks/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique chunk identifier' },
                { field: 'name', type: 'string', description: 'Chunk name or label' },
                { field: 'content', type: 'string', description: 'Chunk content body' },
                { field: 'type', type: 'string', description: 'Chunk type (section, snippet, etc.)' },
              ],
              notes: ['Returns an empty array if no chunks exist for the company.', 'Chunks are reusable content pieces that can be assembled into newsletter posts.'],
              commonMistakes: ['Using the chunk _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-chunk-detail', 'ncos-chunk-create'],
            },
            {
              id: 'ncos-chunk-detail',
              name: 'Get Chunk Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/chunks/detail/:id',
              purpose: 'Retrieve a single content chunk by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific chunk.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The chunk ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single chunk object', body: { id: 'nl-chunk-1', name: 'Welcome Section', content: 'Full content...', type: 'section', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Chunk not found' },
                { code: 500, message: 'Failed to get chunk' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/chunks/detail/CHUNK_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/chunks/detail/CHUNK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const chunk = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/chunks/detail/CHUNK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/chunks/detail/CHUNK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/chunks/detail/CHUNK_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/chunks/detail/CHUNK_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique chunk identifier' },
                { field: 'name', type: 'string', description: 'Chunk name' },
                { field: 'content', type: 'string', description: 'Chunk content body' },
              ],
              notes: ['The id parameter is the chunk id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the chunk id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-chunks-list', 'ncos-chunk-update'],
            },
            {
              id: 'ncos-chunk-create',
              name: 'Create Chunk',
              method: 'POST',
              path: '/api/newsletter-content-os/chunks',
              purpose: 'Create a new content chunk for a company.',
              whenToUse: 'Use this endpoint to create a reusable content snippet for newsletter assembly.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Welcome Section', content: 'Welcome to our newsletter!', type: 'section' },
              successResponse: { status: 201, description: 'Created chunk', body: { id: 'nl-chunk-2', name: 'Welcome Section', content: 'Welcome to our newsletter!', type: 'section', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create chunk' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/chunks \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Welcome Section","content":"Welcome to our newsletter!","type":"section"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/chunks', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Welcome Section', content: 'Welcome to our newsletter!', type: 'section' })
});
const chunk = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/chunks',
  { companyId: 'YOUR_COMPANY_ID', name: 'Welcome Section', content: 'Welcome to our newsletter!', type: 'section' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Welcome Section', content: 'Welcome to our newsletter!', type: 'section' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/chunks', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/chunks',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Welcome Section', 'content': 'Welcome to our newsletter!', 'type': 'section'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/chunks');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Welcome Section', 'content' => 'Welcome to our newsletter!', 'type' => 'section']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the chunk for' },
                { field: 'name', type: 'string', description: 'Chunk name or label' },
                { field: 'content', type: 'string', description: 'Chunk content body' },
                { field: 'type', type: 'string', description: 'Chunk type (section, snippet, etc.)' },
              ],
              notes: ['companyId is required in the request body.', 'All other fields from the request body are stored as-is.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-chunks-list', 'ncos-chunk-update'],
            },
            {
              id: 'ncos-chunk-update',
              name: 'Update Chunk',
              method: 'PUT',
              path: '/api/newsletter-content-os/chunks/:id',
              purpose: 'Update an existing content chunk.',
              whenToUse: 'Use this endpoint to modify chunk content, type, or other properties.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The chunk ID to update' },
              ],
              requestBody: { name: 'Updated Welcome Section', content: 'Updated content...' },
              successResponse: { status: 200, description: 'Updated chunk', body: { id: 'nl-chunk-1', name: 'Updated Welcome Section', content: 'Updated content...', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Chunk not found' },
                { code: 500, message: 'Failed to update chunk' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Welcome Section"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Welcome Section' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID',
  { name: 'Updated Welcome Section' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Welcome Section' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/chunks/CHUNK_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Welcome Section'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Welcome Section']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the chunk is merged with existing data.'],
              commonMistakes: ['Sending the entire chunk object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-chunk-detail', 'ncos-chunk-create'],
            },
            {
              id: 'ncos-chunk-delete',
              name: 'Delete Chunk',
              method: 'DELETE',
              path: '/api/newsletter-content-os/chunks/:id',
              purpose: 'Delete a content chunk.',
              whenToUse: 'Use this endpoint to permanently remove a chunk.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The chunk ID to delete' },
              ],
              successResponse: { status: 200, description: 'Chunk deleted', body: { message: 'Chunk deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Chunk not found' },
                { code: 500, message: 'Failed to delete chunk' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/chunks/CHUNK_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/chunks/CHUNK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Chunk deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the chunk id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-chunks-list', 'ncos-chunk-update'],
            },
            // --- Exports ---
            {
              id: 'ncos-exports-list',
              name: 'Get All Exports',
              method: 'GET',
              path: '/api/newsletter-content-os/exports/:companyId',
              purpose: 'Retrieve all newsletter exports for a company.',
              whenToUse: 'Use this endpoint to list all newsletter export records for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve exports for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter exports', body: { data: [{ id: 'nl-export-1', format: 'html', status: 'completed', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get exports' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/exports/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/exports/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const exports = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/exports/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/exports/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/exports/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/exports/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique export identifier' },
                { field: 'format', type: 'string', description: 'Export format (html, pdf, etc.)' },
                { field: 'status', type: 'string', description: 'Export status (pending, completed, failed)' },
                { field: 'companyId', type: 'string', description: 'Company the export belongs to' },
              ],
              notes: ['Returns an empty array if no exports exist for the company.'],
              commonMistakes: ['Using the export _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-export-detail', 'ncos-export-create'],
            },
            {
              id: 'ncos-export-detail',
              name: 'Get Export Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/exports/detail/:id',
              purpose: 'Retrieve a single newsletter export by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific export.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The export ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single export object', body: { id: 'nl-export-1', format: 'html', status: 'completed', content: '...', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Export not found' },
                { code: 500, message: 'Failed to get export' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/exports/detail/EXPORT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/exports/detail/EXPORT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const exportItem = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/exports/detail/EXPORT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/exports/detail/EXPORT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/exports/detail/EXPORT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/exports/detail/EXPORT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique export identifier' },
                { field: 'format', type: 'string', description: 'Export format' },
                { field: 'status', type: 'string', description: 'Export status' },
                { field: 'content', type: 'string', description: 'Exported content' },
              ],
              notes: ['The id parameter is the export id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the export id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-exports-list', 'ncos-export-update'],
            },
            {
              id: 'ncos-export-create',
              name: 'Create Export',
              method: 'POST',
              path: '/api/newsletter-content-os/exports',
              purpose: 'Create a new newsletter export record for a company.',
              whenToUse: 'Use this endpoint to create an export record for a newsletter content piece.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', format: 'html', postId: 'nl-post-1', status: 'pending' },
              successResponse: { status: 201, description: 'Created export', body: { id: 'nl-export-2', format: 'html', postId: 'nl-post-1', status: 'pending', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create export' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/exports \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","format":"html","status":"pending"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/exports', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', format: 'html', status: 'pending' })
});
const exportItem = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/exports',
  { companyId: 'YOUR_COMPANY_ID', format: 'html', status: 'pending' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', format: 'html', status: 'pending' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/exports', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/exports',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'format': 'html', 'status': 'pending'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/exports');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'format' => 'html', 'status' => 'pending']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the export for' },
                { field: 'format', type: 'string', description: 'Export format (html, pdf, etc.)' },
                { field: 'status', type: 'string', description: 'Export status (pending, completed, failed)' },
              ],
              notes: ['companyId is required in the request body.', 'Requires newsletter-content-os export permission.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.export'],
              relatedApis: ['ncos-exports-list', 'ncos-export-update'],
            },
            {
              id: 'ncos-export-update',
              name: 'Update Export',
              method: 'PUT',
              path: '/api/newsletter-content-os/exports/:id',
              purpose: 'Update an existing newsletter export record.',
              whenToUse: 'Use this endpoint to modify export properties like status, format, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The export ID to update' },
              ],
              requestBody: { status: 'completed', content: '<html>...</html>' },
              successResponse: { status: 200, description: 'Updated export', body: { id: 'nl-export-1', status: 'completed', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Export not found' },
                { code: 500, message: 'Failed to update export' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status":"completed"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'completed' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID',
  { status: 'completed' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ status: 'completed' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/exports/EXPORT_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'status': 'completed'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'completed']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the export is merged with existing data.'],
              commonMistakes: ['Sending the entire export object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-export-detail', 'ncos-export-create'],
            },
            {
              id: 'ncos-export-delete',
              name: 'Delete Export',
              method: 'DELETE',
              path: '/api/newsletter-content-os/exports/:id',
              purpose: 'Delete a newsletter export record.',
              whenToUse: 'Use this endpoint to permanently remove an export record.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The export ID to delete' },
              ],
              successResponse: { status: 200, description: 'Export deleted', body: { message: 'Export deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Export not found' },
                { code: 500, message: 'Failed to delete export' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/exports/EXPORT_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/exports/EXPORT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Export deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the export id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-exports-list', 'ncos-export-update'],
            },
            // --- Campaigns ---
            {
              id: 'ncos-campaigns-list',
              name: 'Get All Campaigns',
              method: 'GET',
              path: '/api/newsletter-content-os/campaigns/:companyId',
              purpose: 'Retrieve all newsletter campaigns for a company.',
              whenToUse: 'Use this endpoint to list all newsletter campaigns (wizard-driven campaigns) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve campaigns for' },
              ],
              successResponse: { status: 200, description: 'Array of newsletter campaigns', body: { data: [{ id: 'nl-1721640000000', name: 'Summer Campaign', status: 'draft', companyId: '...', createdAt: '...', updatedAt: '...' }] } },
              errorResponses: [
                { code: 500, message: 'Failed to fetch campaigns' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaigns = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/campaigns/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique campaign identifier (auto-generated as nl-{timestamp})' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'status', type: 'string', description: 'Campaign status (draft, active, completed, etc.)' },
                { field: 'companyId', type: 'string', description: 'Company the campaign belongs to' },
              ],
              notes: ['Returns an empty array if no campaigns exist for the company.', 'Campaign IDs are auto-generated as nl-{timestamp} if not provided.'],
              commonMistakes: ['Using the campaign _id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-campaign-detail', 'ncos-campaign-create'],
            },
            {
              id: 'ncos-campaign-detail',
              name: 'Get Campaign Detail',
              method: 'GET',
              path: '/api/newsletter-content-os/campaigns/detail/:id',
              purpose: 'Retrieve a single newsletter campaign by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific campaign.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single campaign object', body: { id: 'nl-1721640000000', name: 'Summer Campaign', status: 'draft', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Failed to fetch campaign' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/campaigns/detail/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Campaign identifier (auto-generated as nl-{timestamp})' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'status', type: 'string', description: 'Campaign status' },
              ],
              notes: ['The id parameter is the campaign id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the campaign id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'newsletter-content-os.view'],
              relatedApis: ['ncos-campaigns-list', 'ncos-campaign-update'],
            },
            {
              id: 'ncos-campaign-create',
              name: 'Create Campaign',
              method: 'POST',
              path: '/api/newsletter-content-os/campaigns',
              purpose: 'Create a new newsletter campaign for a company.',
              whenToUse: 'Use this endpoint to create a new newsletter campaign (wizard-driven).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Summer Campaign', status: 'draft', strategyId: 'nl-strat-1' },
              successResponse: { status: 201, description: 'Created campaign', body: { id: 'nl-1721640000000', name: 'Summer Campaign', status: 'draft', strategyId: 'nl-strat-1', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 500, message: 'Failed to create campaign' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/newsletter-content-os/campaigns \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Summer Campaign","status":"draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/campaigns', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Summer Campaign', status: 'draft' })
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/newsletter-content-os/campaigns',
  { companyId: 'YOUR_COMPANY_ID', name: 'Summer Campaign', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Summer Campaign', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/campaigns', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/newsletter-content-os/campaigns',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Summer Campaign', 'status': 'draft'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/campaigns');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Summer Campaign', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the campaign for' },
                { field: 'id', type: 'string', description: 'Auto-generated campaign ID (nl-{timestamp}) if not provided' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'status', type: 'string', description: 'Campaign status' },
              ],
              notes: ['companyId is required in the request body.', 'Campaign ID is auto-generated as nl-{timestamp} if not provided.', 'All other fields from the request body are stored as-is.'],
              commonMistakes: ['Omitting the required companyId field in the request body.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.create'],
              relatedApis: ['ncos-campaigns-list', 'ncos-campaign-update'],
            },
            {
              id: 'ncos-campaign-update',
              name: 'Update Campaign',
              method: 'PUT',
              path: '/api/newsletter-content-os/campaigns/:id',
              purpose: 'Update an existing newsletter campaign.',
              whenToUse: 'Use this endpoint to modify campaign properties like name, status, etc.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to update' },
              ],
              requestBody: { name: 'Updated Campaign Name', status: 'active' },
              successResponse: { status: 200, description: 'Updated campaign', body: { id: 'nl-1721640000000', name: 'Updated Campaign Name', status: 'active', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Failed to update campaign' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Campaign Name","status":"active"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Campaign Name', status: 'active' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID',
  { name: 'Updated Campaign Name', status: 'active' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Campaign Name', status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/campaigns/CAMPAIGN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Campaign Name', 'status': 'active'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Campaign Name', 'status' => 'active']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the campaign is merged with existing data.'],
              commonMistakes: ['Sending the entire campaign object when only updating a few fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.edit'],
              relatedApis: ['ncos-campaign-detail', 'ncos-campaign-create'],
            },
            {
              id: 'ncos-campaign-delete',
              name: 'Delete Campaign',
              method: 'DELETE',
              path: '/api/newsletter-content-os/campaigns/:id',
              purpose: 'Delete a newsletter campaign.',
              whenToUse: 'Use this endpoint to permanently remove a campaign.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to delete' },
              ],
              successResponse: { status: 200, description: 'Campaign deleted', body: { message: 'Campaign deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Failed to delete campaign' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/newsletter-content-os/campaigns/CAMPAIGN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/newsletter-content-os/campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Campaign deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the MongoDB _id instead of the campaign id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'newsletter-content-os.delete'],
              relatedApis: ['ncos-campaigns-list', 'ncos-campaign-update'],
            },
          ],
        },
        // --- Social Media OS ---
        {
          id: 'social-media-os',
          name: 'Social Media OS',
          description: 'Manage social media campaigns with a 7-phase wizard workflow — create campaigns, generate posts/videos/testimonials, manage calendars, and upload images.',
          endpoints: [
            {
              id: 'smos-campaigns-list',
              name: 'Get All Campaigns',
              method: 'GET',
              path: '/api/social-media-campaigns/:companyId',
              purpose: 'Retrieve all social media campaigns for a company, sorted by creation date (newest first).',
              whenToUse: 'Use this endpoint to list all social media campaigns for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve campaigns for' },
              ],
              successResponse: { status: 200, description: 'Array of social media campaigns', body: { data: [{ _id: '...', companyId: '...', name: 'Summer Launch Campaign', description: '...', contentTypes: ['post', 'story', 'reel'], campaignGoal: ['brand-awareness'], targetAudience: 'Young professionals 25-35', platforms: ['instagram', 'linkedin'], startDate: '2026-07-01', endDate: '2026-09-30', postingFrequency: '3x-week', postsPerWeek: 3, brandVoice: ['friendly', 'expert'], ctaStyle: ['value-first'], contentPillars: ['education', 'inspiration'], status: 'draft', currentStep: 'content-requirements', completedSteps: [], generatedPosts: [], generatedVideos: [], generatedTestimonials: [], calendarEntries: [], version: 1, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/social-media-campaigns/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaigns = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/social-media-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/social-media-campaigns/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'companyId', type: 'string', description: 'Company the campaign belongs to' },
                { field: 'name', type: 'string', description: 'Campaign name (max 200 chars)' },
                { field: 'description', type: 'string', description: 'Campaign description' },
                { field: 'contentTypes', type: 'string[]', description: 'Content types: post, story, reel, video, carousel, testimonial' },
                { field: 'campaignGoal', type: 'string[]', description: 'Campaign goals: brand-awareness, lead-generation, engagement, etc.' },
                { field: 'platforms', type: 'string[]', description: 'Target platforms: instagram, linkedin, twitter, facebook, tiktok, youtube' },
                { field: 'status', type: 'string', description: 'Campaign status: draft, planning, generating, ready, active, completed, archived' },
                { field: 'currentStep', type: 'string', description: 'Current wizard step' },
                { field: 'version', type: 'number', description: 'Campaign version (auto-incremented on updates)' },
              ],
              notes: ['Returns a flat array sorted by creation date (newest first).', 'Each campaign contains nested arrays for generatedPosts, generatedVideos, generatedTestimonials, and calendarEntries.'],
              commonMistakes: ['Using the document _id instead of companyId in the URL — the path parameter is companyId.', 'Expecting a paginated response — this endpoint returns all campaigns for the company.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'social-media-os.view'],
              relatedApis: ['smos-campaign-detail', 'smos-campaign-create'],
            },
            {
              id: 'smos-campaign-detail',
              name: 'Get Campaign Detail',
              method: 'GET',
              path: '/api/social-media-campaigns/detail/:id',
              purpose: 'Retrieve a single social media campaign by its MongoDB ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific campaign including all generated content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the campaign' },
              ],
              successResponse: { status: 200, description: 'Single campaign object with all nested content', body: { _id: '...', companyId: '...', name: 'Summer Launch Campaign', contentTypes: ['post', 'story'], platforms: ['instagram', 'linkedin'], generatedPosts: [{ id: '...', contentType: 'post', platform: 'instagram', title: '...', copy: '...', hashtags: ['...'], status: 'draft' }], generatedVideos: [], generatedTestimonials: [], calendarEntries: [], status: 'draft', version: 1 } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/social-media-campaigns/detail/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/social-media-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/detail/CAMPAIGN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/social-media-campaigns/detail/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/detail/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'contentTypes', type: 'string[]', description: 'Content types selected' },
                { field: 'platforms', type: 'string[]', description: 'Target social media platforms' },
                { field: 'generatedPosts', type: 'array', description: 'AI-generated post objects with contentType, platform, title, copy, hashtags, status' },
                { field: 'generatedVideos', type: 'array', description: 'AI-generated video objects with hook, script, sceneBreakdown, visualDirection' },
                { field: 'generatedTestimonials', type: 'array', description: 'AI-generated testimonial objects with headline, customerStory, quoteHighlight' },
                { field: 'calendarEntries', type: 'array', description: 'Calendar entries with date, time, platform, contentType, status' },
                { field: 'status', type: 'string', description: 'Campaign status: draft, planning, generating, ready, active, completed, archived' },
                { field: 'aiStatus', type: 'string', description: 'AI generation status: idle, processing, completed, completed-with-errors, failed' },
                { field: 'version', type: 'number', description: 'Campaign version number' },
              ],
              notes: ['The id parameter is the MongoDB _id (not a custom id field).', 'The response includes all nested generated content (posts, videos, testimonials) and calendar entries.'],
              commonMistakes: ['Using a custom id field instead of the MongoDB _id — this endpoint uses MongoDB findById.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'social-media-os.view'],
              relatedApis: ['smos-campaigns-list', 'smos-campaign-update'],
            },
            {
              id: 'smos-campaign-create',
              name: 'Create Campaign',
              method: 'POST',
              path: '/api/social-media-campaigns',
              purpose: 'Create a new social media campaign for a company.',
              whenToUse: 'Use this endpoint to create a new campaign, typically as the first step of the 7-phase wizard.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Summer Launch Campaign', contentTypes: ['post', 'story', 'reel'], campaignGoal: ['brand-awareness', 'engagement'], targetAudience: 'Young professionals 25-35', platforms: ['instagram', 'linkedin'], startDate: '2026-07-01', postingFrequency: '3x-week', brandVoice: ['friendly', 'expert'], ctaStyle: ['value-first'] },
              successResponse: { status: 201, description: 'Created campaign', body: { _id: '...', companyId: '...', name: 'Summer Launch Campaign', contentTypes: ['post', 'story', 'reel'], campaignGoal: ['brand-awareness', 'engagement'], platforms: ['instagram', 'linkedin'], status: 'draft', currentStep: 'content-requirements', version: 1, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — Company ID is required', body: { errors: [{ msg: 'Company ID is required' }] } },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/social-media-campaigns \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Summer Launch Campaign","contentTypes":["post","story","reel"],"campaignGoal":["brand-awareness"],"platforms":["instagram","linkedin"]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Summer Launch Campaign', contentTypes: ['post', 'story'], campaignGoal: ['brand-awareness'], platforms: ['instagram', 'linkedin'] })
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/social-media-campaigns',
  { companyId: 'YOUR_COMPANY_ID', name: 'Summer Launch Campaign', contentTypes: ['post', 'story'], campaignGoal: ['brand-awareness'], platforms: ['instagram', 'linkedin'] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Summer Launch Campaign', contentTypes: ['post', 'story'], campaignGoal: ['brand-awareness'], platforms: ['instagram', 'linkedin'] });
const options = { hostname: 'api.mengo.ai', path: '/api/social-media-campaigns', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/social-media-campaigns',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Summer Launch Campaign', 'contentTypes': ['post', 'story'], 'campaignGoal': ['brand-awareness'], 'platforms': ['instagram', 'linkedin']})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Summer Launch Campaign', 'contentTypes' => ['post', 'story'], 'campaignGoal' => ['brand-awareness'], 'platforms' => ['instagram', 'linkedin']]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the campaign for' },
                { field: 'name', type: 'string', description: 'Campaign name (max 200 chars). Defaults to "Untitled Campaign" if omitted or empty.' },
                { field: 'contentTypes', type: 'string[]', description: 'Content types: post, story, reel, video, carousel, testimonial' },
                { field: 'campaignGoal', type: 'string[]', description: 'Campaign goals: brand-awareness, lead-generation, engagement, etc.' },
                { field: 'targetAudience', type: 'string', description: 'Target audience description' },
                { field: 'platforms', type: 'string[]', description: 'Target platforms: instagram, linkedin, twitter, facebook, tiktok, youtube' },
                { field: 'status', type: 'string', description: 'Defaults to "draft"' },
                { field: 'currentStep', type: 'string', description: 'Defaults to "content-requirements"' },
                { field: 'version', type: 'number', description: 'Defaults to 1' },
              ],
              notes: ['companyId is required in the request body.', 'name defaults to "Untitled Campaign" if not provided or empty — supports early auto-save during the wizard.', 'All other fields are optional and stored as-is.', 'Protected fields (_id, __v, companyId, createdAt) are automatically managed.'],
              commonMistakes: ['Omitting the required companyId field in the request body.', 'Including _id or __v in the request body — these are auto-generated and cannot be set.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'social-media-os.create'],
              relatedApis: ['smos-campaigns-list', 'smos-campaign-update'],
            },
            {
              id: 'smos-campaign-update',
              name: 'Update Campaign',
              method: 'PUT',
              path: '/api/social-media-campaigns/:id',
              purpose: 'Update an existing social media campaign with partial or full data.',
              whenToUse: 'Use this endpoint to modify campaign properties, advance wizard steps, or update generated content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the campaign to update' },
              ],
              requestBody: { name: 'Updated Campaign Name', status: 'active', generatedPosts: [{ id: 'p1', contentType: 'post', platform: 'instagram', title: 'New Post', copy: 'Content here', status: 'approved' }], currentStep: 'review' },
              successResponse: { status: 200, description: 'Updated campaign', body: { _id: '...', name: 'Updated Campaign Name', status: 'active', currentStep: 'review', version: 2, updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Campaign Name","status":"active"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Campaign Name', status: 'active' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID',
  { name: 'Updated Campaign Name', status: 'active' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Campaign Name', status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/CAMPAIGN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Campaign Name', 'status': 'active'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Campaign Name', 'status' => 'active']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
                { field: 'version', type: 'number', description: 'Campaign version (may auto-increment)' },
              ],
              notes: ['Only include fields you want to change — partial updates are supported.', 'Protected fields (_id, __v, companyId, createdAt) are automatically stripped from the request body.', 'The updatedAt timestamp is automatically set to the current time.', 'runValidators is disabled on updates to allow flexible wizard data.'],
              commonMistakes: ['Including _id, __v, companyId, or createdAt in the request body — these are stripped automatically.', 'Using a custom id field instead of the MongoDB _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'social-media-os.edit'],
              relatedApis: ['smos-campaign-detail', 'smos-campaign-create'],
            },
            {
              id: 'smos-campaign-delete',
              name: 'Delete Campaign',
              method: 'DELETE',
              path: '/api/social-media-campaigns/:id',
              purpose: 'Delete a social media campaign permanently.',
              whenToUse: 'Use this endpoint to permanently remove a campaign and all its associated generated content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the campaign to delete' },
              ],
              successResponse: { status: 200, description: 'Campaign deleted', body: { message: 'Campaign deleted successfully' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/CAMPAIGN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Campaign deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting a campaign also removes all associated generated posts, videos, testimonials, and calendar entries.'],
              commonMistakes: ['Using a custom id field instead of the MongoDB _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'social-media-os.delete'],
              relatedApis: ['smos-campaigns-list', 'smos-campaign-update'],
            },
            {
              id: 'smos-upload-image',
              name: 'Upload Image (Base64)',
              method: 'POST',
              path: '/api/social-media-campaigns/upload-image',
              purpose: 'Upload an image for social media campaign assets using base64-encoded data.',
              whenToUse: 'Use this endpoint to upload AI-generated or processed images from base64 data for use in campaign posts and testimonials.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', base64Data: 'data:image/png;base64,iVBOR...', mimeType: 'image/png', source: 'ai-generation' },
              successResponse: { status: 200, description: 'Image uploaded successfully', body: { success: true, url: '/uploads/brand-assets/social-abc123.png', fileSize: 45000, source: 'ai-generation' } },
              errorResponses: [
                { code: 400, message: 'companyId is required' },
                { code: 400, message: 'base64Data is required' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to upload image' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/social-media-campaigns/upload-image \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","base64Data":"data:image/png;base64,iVBOR...","mimeType":"image/png","source":"ai-generation"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/upload-image', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', base64Data: 'data:image/png;base64,...', mimeType: 'image/png', source: 'ai-generation' })
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/social-media-campaigns/upload-image',
  { companyId: 'YOUR_COMPANY_ID', base64Data: 'data:image/png;base64,...', mimeType: 'image/png', source: 'ai-generation' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', base64Data: 'data:image/png;base64,...', mimeType: 'image/png', source: 'ai-generation' });
const options = { hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/upload-image', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/social-media-campaigns/upload-image',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'base64Data': 'data:image/png;base64,...', 'mimeType': 'image/png', 'source': 'ai-generation'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/upload-image');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'base64Data' => 'data:image/png;base64,...', 'mimeType' => 'image/png', 'source' => 'ai-generation']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Always true on success' },
                { field: 'url', type: 'string', description: 'URL path to the uploaded image (e.g., /uploads/brand-assets/social-abc123.png)' },
                { field: 'fileSize', type: 'number', description: 'Size of the uploaded file in bytes' },
                { field: 'source', type: 'string', description: 'Source of the image: "ai-generation" or "upload"' },
              ],
              notes: ['companyId and base64Data are required.', 'mimeType defaults to "image/png" if not provided.', 'source defaults to "ai-generation" if not provided.', 'Supported image formats: PNG, JPEG, WebP, GIF, SVG.', 'Maximum file size: 10MB.', 'The returned URL should be stored in the campaign data (e.g., localAssets on posts).'],
              commonMistakes: ['Omitting companyId or base64Data — both are required.', 'Not including the data URI prefix (data:image/png;base64,) in the base64Data field.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'social-media-os.upload'],
              relatedApis: ['smos-upload-file', 'smos-campaign-update'],
            },
            {
              id: 'smos-upload-file',
              name: 'Upload File (Multipart)',
              method: 'POST',
              path: '/api/social-media-campaigns/upload-file',
              purpose: 'Upload an image file for social media campaign assets using multipart form data.',
              whenToUse: 'Use this endpoint to upload image files directly (not base64) for use in campaign posts and testimonials.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'multipart/form-data' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', file: '(binary file — image/png, image/jpeg, image/webp, image/gif, or image/svg+xml)' },
              successResponse: { status: 200, description: 'File uploaded successfully', body: { success: true, url: '/uploads/brand-assets/abc123-uuid.png', fileName: 'campaign-image.png', fileSize: 45000, mimeType: 'image/png' } },
              errorResponses: [
                { code: 400, message: 'No file uploaded' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to upload file' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/social-media-campaigns/upload-file \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -F "companyId=YOUR_COMPANY_ID" \\
  -F "file=@/path/to/image.png"`,
              jsExample: `const formData = new FormData();
formData.append('companyId', 'YOUR_COMPANY_ID');
formData.append('file', fileInput.files[0]);
const response = await fetch('https://app.mengoengine.com/api/social-media-campaigns/upload-file', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
  body: formData
});
const result = await response.json();`,
              axiosExample: `const formData = new FormData();
formData.append('companyId', 'YOUR_COMPANY_ID');
formData.append('file', fileInput.files[0]);
const { data } = await axios.post('https://app.mengoengine.com/api/social-media-campaigns/upload-file',
  formData,
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'multipart/form-data' } });`,
              nodeExample: `const FormData = require('form-data');
const fs = require('fs');
const formData = new FormData();
formData.append('companyId', 'YOUR_COMPANY_ID');
formData.append('file', fs.createReadStream('/path/to/image.png'));
const options = { hostname: 'api.mengo.ai', path: '/api/social-media-campaigns/upload-file', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', ...formData.getHeaders() } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
formData.pipe(req);`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/social-media-campaigns/upload-file',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  data={'companyId': 'YOUR_COMPANY_ID'},
  files={'file': open('image.png', 'rb')})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/social-media-campaigns/upload-file');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['companyId' => 'YOUR_COMPANY_ID', 'file' => new CURLFile('/path/to/image.png', 'image/png', 'image.png')]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Always true on success' },
                { field: 'url', type: 'string', description: 'URL path to the uploaded file (e.g., /uploads/brand-assets/abc123-uuid.png)' },
                { field: 'fileName', type: 'string', description: 'Original filename of the uploaded file' },
                { field: 'fileSize', type: 'number', description: 'Size of the uploaded file in bytes' },
                { field: 'mimeType', type: 'string', description: 'MIME type of the uploaded file' },
              ],
              notes: ['This endpoint uses multipart/form-data, not JSON.', 'companyId is required in the form data.', 'Supported image formats: PNG, JPEG, WebP, GIF, SVG (checked by MIME type).', 'Maximum file size: 10MB.', 'If authorization fails after the file is uploaded, the file is automatically cleaned up.'],
              commonMistakes: ['Sending JSON instead of multipart/form-data — this endpoint requires form data.', 'Omitting companyId in the form data.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'social-media-os.upload'],
              relatedApis: ['smos-upload-image', 'smos-campaign-update'],
            },
          ],
        },
      ],
    },
    {
      id: 'marketing',
      name: 'Marketing',
      description: 'Marketing campaigns and assets',
      icon: 'Target',
      color: '#3B82F6',
      categories: [
        {
          id: 'ads-campaigns',
          name: 'Ads & Campaigns',
          description: 'Endpoints for managing marketing campaigns.',
          endpoints: [
            {
              id: 'campaigns-get-all',
              name: 'Get All Campaigns',
              method: 'GET',
              path: '/api/module-data/ads/:companyId',
              purpose: 'Retrieve all ad campaigns for the authenticated company.',
              whenToUse: 'Use this endpoint to list all ad campaigns and their statuses.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Campaigns retrieved successfully', body: { data: [], total: 0 } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Insufficient permissions' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/module-data/ads/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/module-data/ads/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/module-data/ads/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/module-data/ads/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
requests.get('https://app.mengoengine.com/api/module-data/ads/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/module-data/ads/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of campaign objects' },
                { field: 'total', type: 'number', description: 'Total number of campaigns' },
              ],
              notes: ['Campaigns are scoped to the authenticated company.', 'Returns an empty object {} if no ads data exists.'],
              commonMistakes: ['Using ?companyId= as a query parameter — it must be a path parameter: /ads/YOUR_COMPANY_ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read', 'campaign.read'],
              relatedApis: ['bp-get-company-stats'],
            },
          ],
        },
        
        {
          id: 'marketing-calendar',
          name: 'Marketing Calendar',
          description: 'Manage marketing calendar events and seasonal plans for campaign planning and scheduling.',
          endpoints: [
            // --- Events ---
            {
              id: 'mc-events-list',
              name: 'List Calendar Events',
              method: 'GET',
              path: '/api/marketing-calendar/events/:companyId',
              purpose: 'Retrieve all marketing calendar events for a company.',
              whenToUse: 'Use this endpoint to list all calendar events, e.g. to render a marketing calendar view or check upcoming campaigns.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve events for' },
              ],
              successResponse: { status: 200, description: 'Array of calendar events sorted by startDate', body: [{ id: '...', companyId: '...', title: 'Spring Campaign Launch', startDate: '2026-03-20', description: '...', targetAudience: '...', notes: '...', budgetAllocated: 5000, budgetActual: 4500, createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-calendar/events/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const events = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/events/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Event ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the event belongs to' },
                { field: '[].title', type: 'string', description: 'Event title (max 200 chars)' },
                { field: '[].startDate', type: 'string', description: 'Start date of the event' },
                { field: '[].description', type: 'string', description: 'Event description (max 1000 chars)' },
                { field: '[].targetAudience', type: 'string', description: 'Target audience (max 200 chars)' },
                { field: '[].notes', type: 'string', description: 'Additional notes (max 1000 chars)' },
                { field: '[].budgetAllocated', type: 'number', description: 'Allocated budget (non-negative)' },
                { field: '[].budgetActual', type: 'number', description: 'Actual spend (non-negative)' },
              ],
              notes: ['Events are scoped to the authenticated company and sorted by startDate ascending.', 'Only companies the user has access to are returned.'],
              commonMistakes: ['Using POST to list events — this is a GET endpoint with companyId as a path parameter.', 'Passing companyId as a query parameter instead of a path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mc-events-detail', 'mc-events-create'],
            },
            {
              id: 'mc-events-detail',
              name: 'Get Calendar Event',
              method: 'GET',
              path: '/api/marketing-calendar/events/detail/:id',
              purpose: 'Retrieve a single marketing calendar event by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific calendar event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar event ID' },
              ],
              successResponse: { status: 200, description: 'Single calendar event object', body: { id: '...', companyId: '...', title: 'Spring Campaign Launch', startDate: '2026-03-20', description: '...', targetAudience: '...', notes: '...', budgetAllocated: 5000, budgetActual: 4500, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-calendar/events/detail/YOUR_EVENT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/events/detail/YOUR_EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-calendar/events/detail/YOUR_EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/events/detail/YOUR_EVENT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-calendar/events/detail/YOUR_EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/events/detail/YOUR_EVENT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Event ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the event belongs to' },
                { field: 'title', type: 'string', description: 'Event title' },
                { field: 'startDate', type: 'string', description: 'Start date of the event' },
                { field: 'description', type: 'string', description: 'Event description' },
                { field: 'targetAudience', type: 'string', description: 'Target audience' },
                { field: 'notes', type: 'string', description: 'Additional notes' },
                { field: 'budgetAllocated', type: 'number', description: 'Allocated budget' },
                { field: 'budgetActual', type: 'number', description: 'Actual spend' },
              ],
              notes: ['Returns 404 if the event ID does not exist.', 'User must have access to the company the event belongs to.'],
              commonMistakes: ['Confusing the event ID with companyId — the path parameter is the event ObjectId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mc-events-list', 'mc-events-update'],
            },
            {
              id: 'mc-events-create',
              name: 'Create Calendar Event',
              method: 'POST',
              path: '/api/marketing-calendar/events',
              purpose: 'Create a new marketing calendar event.',
              whenToUse: 'Use this endpoint to add a new event to the marketing calendar, e.g. a campaign launch or promotional activity.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                companyId: 'string (required) — Company ID the event belongs to',
                title: 'string (required, max 200 chars) — Event title',
                startDate: 'string (required) — Start date of the event',
                description: 'string (optional, max 1000 chars) — Event description',
                targetAudience: 'string (optional, max 200 chars) — Target audience',
                notes: 'string (optional, max 1000 chars) — Additional notes',
                budgetAllocated: 'number (optional, non-negative) — Allocated budget',
                budgetActual: 'number (optional, non-negative) — Actual spend',
              },
              successResponse: { status: 201, description: 'Created calendar event', body: { id: '...', companyId: '...', title: 'Spring Campaign Launch', startDate: '2026-03-20', description: '...', targetAudience: '...', notes: '...', budgetAllocated: 5000, budgetActual: 0, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields or field length exceeded' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/marketing-calendar/events" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Spring Campaign Launch","startDate":"2026-03-20","description":"Launch event for spring campaign","budgetAllocated":5000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/events', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Spring Campaign Launch', startDate: '2026-03-20', budgetAllocated: 5000 }),
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/marketing-calendar/events', {
  companyId: 'YOUR_COMPANY_ID', title: 'Spring Campaign Launch', startDate: '2026-03-20', budgetAllocated: 5000,
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Spring Campaign Launch', startDate: '2026-03-20' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/events', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/marketing-calendar/events',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Spring Campaign Launch', 'startDate': '2026-03-20', 'budgetAllocated': 5000})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/events');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Spring Campaign Launch', 'startDate' => '2026-03-20']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Auto-generated event ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the event belongs to' },
                { field: 'title', type: 'string', description: 'Event title' },
                { field: 'startDate', type: 'string', description: 'Start date of the event' },
                { field: 'description', type: 'string', description: 'Event description' },
                { field: 'targetAudience', type: 'string', description: 'Target audience' },
                { field: 'notes', type: 'string', description: 'Additional notes' },
                { field: 'budgetAllocated', type: 'number', description: 'Allocated budget' },
                { field: 'budgetActual', type: 'number', description: 'Actual spend' },
              ],
              notes: ['companyId, title, and startDate are required.', 'title is limited to 200 characters, description and notes to 1000 characters, targetAudience to 200 characters.', 'budgetAllocated and budgetActual must be non-negative numbers.'],
              commonMistakes: ['Omitting companyId — it is required to associate the event with a company.', 'Passing a negative budget value — only non-negative values are accepted.', 'Exceeding character limits on title (200), description (1000), or targetAudience (200).'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-events-list', 'mc-events-update', 'mc-events-detail'],
            },
            {
              id: 'mc-events-update',
              name: 'Update Calendar Event',
              method: 'PUT',
              path: '/api/marketing-calendar/events/:id',
              purpose: 'Update an existing marketing calendar event.',
              whenToUse: 'Use this endpoint to modify a calendar event, e.g. to change the title, date, budget, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar event ID to update' },
              ],
              requestBody: {
                title: 'string (optional, max 200 chars) — Updated event title',
                startDate: 'string (optional) — Updated start date',
                description: 'string (optional, max 1000 chars) — Updated description',
                targetAudience: 'string (optional, max 200 chars) — Updated target audience',
                notes: 'string (optional, max 1000 chars) — Updated notes',
                budgetAllocated: 'number (optional, non-negative) — Updated allocated budget',
                budgetActual: 'number (optional, non-negative) — Updated actual spend',
              },
              successResponse: { status: 200, description: 'Updated calendar event', body: { id: '...', companyId: '...', title: 'Updated Campaign Launch', startDate: '2026-04-01', description: '...', targetAudience: '...', notes: '...', budgetAllocated: 6000, budgetActual: 4500, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 400, message: 'Validation error — field length exceeded or negative budget' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Campaign Launch","budgetAllocated":6000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Campaign Launch', budgetAllocated: 6000 }),
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID', {
  title: 'Updated Campaign Launch', budgetAllocated: 6000,
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Campaign Launch', budgetAllocated: 6000 });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/events/YOUR_EVENT_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'title': 'Updated Campaign Launch', 'budgetAllocated': 6000})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Campaign Launch', 'budgetAllocated' => 6000]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Event ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the event belongs to' },
                { field: 'title', type: 'string', description: 'Updated event title' },
                { field: 'startDate', type: 'string', description: 'Updated start date' },
                { field: 'updatedAt', type: 'string', description: 'ISO timestamp of last update' },
              ],
              notes: ['Only include fields you want to update — omitted fields remain unchanged.', 'Character limits apply: title (200), description (1000), targetAudience (200), notes (1000).', 'budgetAllocated and budgetActual must be non-negative.'],
              commonMistakes: ['Using POST instead of PUT for updates.', 'Passing companyId in the body to change the event owner — this is not supported via update.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-events-detail', 'mc-events-create', 'mc-events-delete'],
            },
            {
              id: 'mc-events-delete',
              name: 'Delete Calendar Event',
              method: 'DELETE',
              path: '/api/marketing-calendar/events/:id',
              purpose: 'Delete a marketing calendar event by its ID.',
              whenToUse: 'Use this endpoint to permanently remove a calendar event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Calendar event ID to delete' },
              ],
              successResponse: { status: 200, description: 'Event deleted successfully', body: { message: 'Calendar event deleted' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/events/YOUR_EVENT_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/events/YOUR_EVENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Calendar event deleted"' },
              ],
              notes: ['Deletion is permanent and cannot be undone.', 'Returns 404 if the event ID does not exist.'],
              commonMistakes: ['Using GET or POST instead of DELETE.', 'Expecting the deleted event data in the response — only a confirmation message is returned.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-events-list', 'mc-events-detail', 'mc-events-update'],
            },
            // --- Seasonal Plans ---
            {
              id: 'mc-seasonal-plans-list',
              name: 'List Seasonal Plans',
              method: 'GET',
              path: '/api/marketing-calendar/seasonal-plans/:companyId',
              purpose: 'Retrieve all seasonal plans for a company.',
              whenToUse: 'Use this endpoint to list all seasonal marketing plans, e.g. to display quarterly or seasonal campaign strategies.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve seasonal plans for' },
              ],
              successResponse: { status: 200, description: 'Array of seasonal plans sorted by year descending then season', body: [{ id: '...', companyId: '...', name: 'Q1 Marketing Push', season: 'Spring', year: 2026, createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plans = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Seasonal plan ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the plan belongs to' },
                { field: '[].name', type: 'string', description: 'Plan name' },
                { field: '[].season', type: 'string', description: 'Season (e.g. Spring, Summer, Fall, Winter)' },
                { field: '[].year', type: 'number', description: 'Year the plan applies to' },
              ],
              notes: ['Seasonal plans are scoped to the authenticated company and sorted by year descending, then season.', 'Only companies the user has access to are returned.'],
              commonMistakes: ['Using POST to list seasonal plans — this is a GET endpoint with companyId as a path parameter.', 'Passing companyId as a query parameter instead of a path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mc-seasonal-plans-detail', 'mc-seasonal-plans-create'],
            },
            {
              id: 'mc-seasonal-plans-detail',
              name: 'Get Seasonal Plan',
              method: 'GET',
              path: '/api/marketing-calendar/seasonal-plans/detail/:id',
              purpose: 'Retrieve a single seasonal plan by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific seasonal plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Seasonal plan ID' },
              ],
              successResponse: { status: 200, description: 'Single seasonal plan object', body: { id: '...', companyId: '...', name: 'Q1 Marketing Push', season: 'Spring', year: 2026, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Seasonal plan not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plan = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/detail/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Seasonal plan ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the plan belongs to' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'season', type: 'string', description: 'Season' },
                { field: 'year', type: 'number', description: 'Year' },
              ],
              notes: ['Returns 404 if the plan ID does not exist.', 'User must have access to the company the plan belongs to.'],
              commonMistakes: ['Confusing the plan ID with companyId — the path parameter is the plan ObjectId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mc-seasonal-plans-list', 'mc-seasonal-plans-update'],
            },
            {
              id: 'mc-seasonal-plans-create',
              name: 'Create Seasonal Plan',
              method: 'POST',
              path: '/api/marketing-calendar/seasonal-plans',
              purpose: 'Create a new seasonal marketing plan.',
              whenToUse: 'Use this endpoint to add a new seasonal plan for campaign planning, e.g. a quarterly or seasonal marketing strategy.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                companyId: 'string (required) — Company ID the plan belongs to',
                name: 'string (required) — Plan name',
                season: 'string (required) — Season (e.g. Spring, Summer, Fall, Winter)',
                year: 'number (required) — Year the plan applies to',
              },
              successResponse: { status: 201, description: 'Created seasonal plan', body: { id: '...', companyId: '...', name: 'Q1 Marketing Push', season: 'Spring', year: 2026, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 400, message: 'Validation error — companyId, name, season, and year are required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/marketing-calendar/seasonal-plans" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q1 Marketing Push","season":"Spring","year":2026}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q1 Marketing Push', season: 'Spring', year: 2026 }),
});
const plan = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans', {
  companyId: 'YOUR_COMPANY_ID', name: 'Q1 Marketing Push', season: 'Spring', year: 2026,
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q1 Marketing Push', season: 'Spring', year: 2026 });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/seasonal-plans', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q1 Marketing Push', 'season': 'Spring', 'year': 2026})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q1 Marketing Push', 'season' => 'Spring', 'year' => 2026]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Auto-generated plan ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the plan belongs to' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'season', type: 'string', description: 'Season' },
                { field: 'year', type: 'number', description: 'Year the plan applies to' },
              ],
              notes: ['companyId, name, season, and year are all required fields.', 'year must be a numeric value.'],
              commonMistakes: ['Omitting required fields — companyId, name, season, and year are all mandatory.', 'Passing year as a string instead of a number.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-seasonal-plans-list', 'mc-seasonal-plans-update', 'mc-seasonal-plans-detail'],
            },
            {
              id: 'mc-seasonal-plans-update',
              name: 'Update Seasonal Plan',
              method: 'PUT',
              path: '/api/marketing-calendar/seasonal-plans/:id',
              purpose: 'Update an existing seasonal plan.',
              whenToUse: 'Use this endpoint to modify a seasonal plan, e.g. to change the name, season, or year.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Seasonal plan ID to update' },
              ],
              requestBody: {
                name: 'string (optional) — Updated plan name',
                season: 'string (optional) — Updated season',
                year: 'number (optional) — Updated year',
              },
              successResponse: { status: 200, description: 'Updated seasonal plan', body: { id: '...', companyId: '...', name: 'Updated Marketing Push', season: 'Summer', year: 2026, createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 404, message: 'Seasonal plan not found' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Marketing Push","season":"Summer"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Marketing Push', season: 'Summer' }),
});
const plan = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', {
  name: 'Updated Marketing Push', season: 'Summer',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Marketing Push', season: 'Summer' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'name': 'Updated Marketing Push', 'season': 'Summer'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Marketing Push', 'season' => 'Summer']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Plan ID' },
                { field: 'companyId', type: 'string', description: 'Company ID the plan belongs to' },
                { field: 'name', type: 'string', description: 'Updated plan name' },
                { field: 'season', type: 'string', description: 'Updated season' },
                { field: 'year', type: 'number', description: 'Updated year' },
                { field: 'updatedAt', type: 'string', description: 'ISO timestamp of last update' },
              ],
              notes: ['Only include fields you want to update — omitted fields remain unchanged.', 'Mongoose validators run on update, so invalid values will be rejected.'],
              commonMistakes: ['Using POST instead of PUT for updates.', 'Passing companyId in the body to change the plan owner — this is not supported via update.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-seasonal-plans-detail', 'mc-seasonal-plans-create', 'mc-seasonal-plans-delete'],
            },
            {
              id: 'mc-seasonal-plans-delete',
              name: 'Delete Seasonal Plan',
              method: 'DELETE',
              path: '/api/marketing-calendar/seasonal-plans/:id',
              purpose: 'Delete a seasonal plan by its ID.',
              whenToUse: 'Use this endpoint to permanently remove a seasonal plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Seasonal plan ID to delete' },
              ],
              successResponse: { status: 200, description: 'Seasonal plan deleted successfully', body: { message: 'Seasonal plan deleted' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 404, message: 'Seasonal plan not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-calendar/seasonal-plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Seasonal plan deleted"' },
              ],
              notes: ['Deletion is permanent and cannot be undone.', 'Returns 404 if the plan ID does not exist.'],
              commonMistakes: ['Using GET or POST instead of DELETE.', 'Expecting the deleted plan data in the response — only a confirmation message is returned.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mc-seasonal-plans-list', 'mc-seasonal-plans-detail', 'mc-seasonal-plans-update'],
            },
          ],
        },
        {
          id: 'guerrilla-campaigns',
          name: 'Guerrilla Campaigns',
          description: 'Manage guerrilla marketing campaigns for unconventional, low-cost, high-impact marketing tactics.',
          endpoints: [
            {
              id: 'gc-campaigns-list',
              name: 'List Guerrilla Campaigns',
              method: 'GET',
              path: '/api/guerrilla-campaigns/:companyId',
              purpose: 'Retrieve all guerrilla campaigns for a company.',
              whenToUse: 'Use this endpoint to list all guerrilla marketing campaigns and their statuses.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve campaigns for' },
              ],
              successResponse: { status: 200, description: 'Campaigns retrieved successfully', body: [{ id: '...', name: 'Untitled Campaign', companyId: '...', createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/guerrilla-campaigns/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/guerrilla-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const campaigns = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/guerrilla-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/guerrilla-campaigns/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/guerrilla-campaigns/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/guerrilla-campaigns/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Unique campaign identifier' },
                { field: '[].name', type: 'string', description: 'Campaign name (defaults to "Untitled Campaign")' },
                { field: '[].companyId', type: 'string', description: 'Company the campaign belongs to' },
                { field: '[].createdAt', type: 'string', description: 'Creation timestamp' },
                { field: '[].updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Campaigns are scoped to the authenticated company.', 'Returns an empty array if no campaigns exist for the company.'],
              commonMistakes: ['Using ?companyId= as a query parameter — it must be a path parameter: /guerrilla-campaigns/YOUR_COMPANY_ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gc-campaigns-detail', 'gc-campaigns-create'],
            },
            {
              id: 'gc-campaigns-detail',
              name: 'Get Campaign Detail',
              method: 'GET',
              path: '/api/guerrilla-campaigns/detail/:id',
              purpose: 'Retrieve a single guerrilla campaign by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific guerrilla campaign.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single guerrilla campaign object', body: { id: '...', name: 'Untitled Campaign', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/guerrilla-campaigns/detail/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/guerrilla-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/guerrilla-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/guerrilla-campaigns/detail/CAMPAIGN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/guerrilla-campaigns/detail/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/guerrilla-campaigns/detail/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique campaign identifier' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'companyId', type: 'string', description: 'Company the campaign belongs to' },
                { field: 'createdAt', type: 'string', description: 'Creation timestamp' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['The id parameter is the campaign _id field.'],
              commonMistakes: ['Using the companyId instead of the campaign id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gc-campaigns-list', 'gc-campaigns-update'],
            },
            {
              id: 'gc-campaigns-create',
              name: 'Create Guerrilla Campaign',
              method: 'POST',
              path: '/api/guerrilla-campaigns',
              purpose: 'Create a new guerrilla marketing campaign for a company.',
              whenToUse: 'Use this endpoint to create a new guerrilla campaign with unconventional marketing tactics.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Flash Mob Campaign' },
              successResponse: { status: 201, description: 'Created guerrilla campaign', body: { id: '...', name: 'Flash Mob Campaign', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 400, message: 'Company ID is required' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/guerrilla-campaigns \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Flash Mob Campaign"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/guerrilla-campaigns', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Flash Mob Campaign' })
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/guerrilla-campaigns',
  { companyId: 'YOUR_COMPANY_ID', name: 'Flash Mob Campaign' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Flash Mob Campaign' });
const options = { hostname: 'api.mengo.ai', path: '/api/guerrilla-campaigns', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/guerrilla-campaigns',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Flash Mob Campaign'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/guerrilla-campaigns');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Flash Mob Campaign']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the campaign for' },
                { field: 'name', type: 'string', description: 'Campaign name. Defaults to "Untitled Campaign" if not provided.' },
                { field: 'id', type: 'string', description: 'Auto-generated MongoDB ObjectId' },
                { field: 'createdAt', type: 'string', description: 'Auto-generated creation timestamp' },
                { field: 'updatedAt', type: 'string', description: 'Auto-generated update timestamp' },
              ],
              notes: ['companyId is required in the request body.', 'name is optional — defaults to "Untitled Campaign" if not provided or if blank.', 'Requires guerrilla-marketing create permission.'],
              commonMistakes: ['Omitting the required companyId field in the request body.', 'Not setting Content-Type header to application/json.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gc-campaigns-list', 'gc-campaigns-update'],
            },
            {
              id: 'gc-campaigns-update',
              name: 'Update Guerrilla Campaign',
              method: 'PUT',
              path: '/api/guerrilla-campaigns/:id',
              purpose: 'Update an existing guerrilla marketing campaign.',
              whenToUse: 'Use this endpoint to modify campaign content, configuration, or other properties.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to update' },
              ],
              requestBody: { name: 'Updated Campaign Name' },
              successResponse: { status: 200, description: 'Updated guerrilla campaign', body: { id: '...', name: 'Updated Campaign Name', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Campaign Name"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Campaign Name' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID',
  { name: 'Updated Campaign Name' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Campaign Name' });
const options = { hostname: 'api.mengo.ai', path: '/api/guerrilla-campaigns/CAMPAIGN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Campaign Name'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Campaign Name']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Campaign identifier' },
                { field: 'name', type: 'string', description: 'Updated campaign name' },
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the campaign is merged with existing data.', 'Protected fields like _id, companyId, and createdAt are stripped from the update body.', 'The updatedAt timestamp is automatically set to the current time.'],
              commonMistakes: ['Trying to update companyId — this is a protected field and will be ignored.', 'Not setting Content-Type header to application/json.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gc-campaigns-detail', 'gc-campaigns-create'],
            },
            {
              id: 'gc-campaigns-delete',
              name: 'Delete Guerrilla Campaign',
              method: 'DELETE',
              path: '/api/guerrilla-campaigns/:id',
              purpose: 'Delete a guerrilla marketing campaign.',
              whenToUse: 'Use this endpoint to permanently remove a guerrilla campaign.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign ID to delete' },
              ],
              successResponse: { status: 200, description: 'Campaign deleted successfully', body: { message: 'Campaign deleted successfully' } },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/guerrilla-campaigns/CAMPAIGN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/guerrilla-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Campaign deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires guerrilla-marketing delete permission.'],
              commonMistakes: ['Using the companyId instead of the campaign id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gc-campaigns-list', 'gc-campaigns-detail'],
            },
          ],
        },
        {
          id: 'marketing-channels',
          name: 'Marketing Channels',
          description: 'Manage marketing channels and channel maps for multi-channel strategy planning and optimization.',
          endpoints: [
            {
              id: 'mkch-channels-list',
              name: 'List Marketing Channels',
              method: 'GET',
              path: '/api/marketing-channels/channels/:companyId',
              purpose: 'Retrieve all marketing channels for a company.',
              whenToUse: 'Use this endpoint to list all marketing channels and their types for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve channels for' },
              ],
              successResponse: { status: 200, description: 'Array of marketing channels', body: [{ _id: '...', companyId: '...', name: 'Social Media', channelType: 'social', createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-channels/channels/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/channels/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const channels = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-channels/channels/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-channels/channels/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-channels/channels/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/channels/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Unique channel identifier' },
                { field: '[].companyId', type: 'string', description: 'Company the channel belongs to' },
                { field: '[].name', type: 'string', description: 'Channel name' },
                { field: '[].channelType', type: 'string', description: 'Channel type (e.g., social, email, paid, organic)' },
              ],
              notes: ['Channels are scoped to the authenticated company.', 'Returns channels sorted by channelType and name.'],
              commonMistakes: ['Using a query parameter for companyId — it must be a path parameter: /channels/YOUR_COMPANY_ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mkch-channels-detail', 'mkch-channels-create'],
            },
            {
              id: 'mkch-channels-detail',
              name: 'Get Channel Detail',
              method: 'GET',
              path: '/api/marketing-channels/channels/detail/:id',
              purpose: 'Retrieve a single marketing channel by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific marketing channel.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single marketing channel object', body: { _id: '...', companyId: '...', name: 'Social Media', channelType: 'social', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Channel not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-channels/channels/detail/CHANNEL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/channels/detail/CHANNEL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const channel = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-channels/channels/detail/CHANNEL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-channels/channels/detail/CHANNEL_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-channels/channels/detail/CHANNEL_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/channels/detail/CHANNEL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Unique channel identifier' },
                { field: 'name', type: 'string', description: 'Channel name' },
                { field: 'channelType', type: 'string', description: 'Channel type (e.g., social, email, paid, organic)' },
                { field: 'companyId', type: 'string', description: 'Company the channel belongs to' },
              ],
              notes: ['The id parameter is the MongoDB ObjectId of the channel.'],
              commonMistakes: ['Using the companyId instead of the channel id in the URL — the path parameter is the channel id.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mkch-channels-list', 'mkch-channels-update'],
            },
            {
              id: 'mkch-channels-create',
              name: 'Create Channel',
              method: 'POST',
              path: '/api/marketing-channels/channels',
              purpose: 'Create a new marketing channel for a company.',
              whenToUse: 'Use this endpoint to add a new marketing channel to your multi-channel strategy.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Social Media', channelType: 'social' },
              successResponse: { status: 201, description: 'Created marketing channel', body: { _id: '...', companyId: '...', name: 'Social Media', channelType: 'social', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — companyId, name, and channelType are required' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/marketing-channels/channels \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Social Media","channelType":"social"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/channels', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Social Media', channelType: 'social' })
});
const channel = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/marketing-channels/channels',
  { companyId: 'YOUR_COMPANY_ID', name: 'Social Media', channelType: 'social' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Social Media', channelType: 'social' });
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/channels', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/marketing-channels/channels',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Social Media', 'channelType': 'social'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/channels');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Social Media', 'channelType' => 'social']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the channel for' },
                { field: 'name', type: 'string', description: 'Required. Channel name' },
                { field: 'channelType', type: 'string', description: 'Required. Channel type (e.g., social, email, paid, organic)' },
              ],
              notes: ['companyId, name, and channelType are required fields.', 'The channel is automatically scoped to the authenticated company.'],
              commonMistakes: ['Omitting the required companyId, name, or channelType fields in the request body.', 'Using a companyId the authenticated user does not have access to.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-channels-list', 'mkch-channels-detail'],
            },
            {
              id: 'mkch-channels-update',
              name: 'Update Channel',
              method: 'PUT',
              path: '/api/marketing-channels/channels/:id',
              purpose: 'Update an existing marketing channel.',
              whenToUse: 'Use this endpoint to modify channel properties such as name or channelType.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel ID to update' },
              ],
              requestBody: { name: 'Updated Channel Name', channelType: 'paid' },
              successResponse: { status: 200, description: 'Updated channel', body: { _id: '...', companyId: '...', name: 'Updated Channel Name', channelType: 'paid', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Channel not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Channel Name","channelType":"paid"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Channel Name', channelType: 'paid' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID',
  { name: 'Updated Channel Name', channelType: 'paid' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Channel Name', channelType: 'paid' });
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/channels/CHANNEL_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Channel Name', 'channelType': 'paid'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Channel Name', 'channelType' => 'paid']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the channel is merged with existing data.', 'The updatedAt timestamp is automatically set to the current time.'],
              commonMistakes: ['Using the companyId instead of the channel id in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-channels-detail', 'mkch-channels-delete'],
            },
            {
              id: 'mkch-channels-delete',
              name: 'Delete Channel',
              method: 'DELETE',
              path: '/api/marketing-channels/channels/:id',
              purpose: 'Delete a marketing channel.',
              whenToUse: 'Use this endpoint to permanently remove a marketing channel.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel ID to delete' },
              ],
              successResponse: { status: 200, description: 'Channel deleted', body: { message: 'Channel deleted' } },
              errorResponses: [
                { code: 404, message: 'Channel not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/channels/CHANNEL_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/channels/CHANNEL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Channel deleted"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the companyId instead of the channel id in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-channels-list', 'mkch-channels-update'],
            },
            {
              id: 'mkch-maps-list',
              name: 'List Channel Maps',
              method: 'GET',
              path: '/api/marketing-channels/maps/:companyId',
              purpose: 'Retrieve all channel maps for a company.',
              whenToUse: 'Use this endpoint to list all channel maps configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve channel maps for' },
              ],
              successResponse: { status: 200, description: 'Array of channel maps', body: [{ _id: '...', companyId: '...', name: 'Q3 Channel Strategy', createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-channels/maps/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/maps/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const maps = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-channels/maps/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-channels/maps/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-channels/maps/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/maps/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Unique channel map identifier' },
                { field: '[].companyId', type: 'string', description: 'Company the channel map belongs to' },
                { field: '[].name', type: 'string', description: 'Channel map name' },
                { field: '[].createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Channel maps are scoped to the authenticated company.', 'Returns channel maps sorted by creation date (newest first).'],
              commonMistakes: ['Using a query parameter for companyId — it must be a path parameter: /maps/YOUR_COMPANY_ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mkch-maps-detail', 'mkch-maps-create'],
            },
            {
              id: 'mkch-maps-detail',
              name: 'Get Channel Map Detail',
              method: 'GET',
              path: '/api/marketing-channels/maps/detail/:id',
              purpose: 'Retrieve a single channel map by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific channel map.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel map ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single channel map object', body: { _id: '...', companyId: '...', name: 'Q3 Channel Strategy', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Channel map not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/marketing-channels/maps/detail/MAP_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/maps/detail/MAP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const map = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/marketing-channels/maps/detail/MAP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/marketing-channels/maps/detail/MAP_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/marketing-channels/maps/detail/MAP_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/maps/detail/MAP_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Unique channel map identifier' },
                { field: 'name', type: 'string', description: 'Channel map name' },
                { field: 'companyId', type: 'string', description: 'Company the channel map belongs to' },
              ],
              notes: ['The id parameter is the MongoDB ObjectId of the channel map.'],
              commonMistakes: ['Using the companyId instead of the channel map id in the URL — the path parameter is the map id.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mkch-maps-list', 'mkch-maps-update'],
            },
            {
              id: 'mkch-maps-create',
              name: 'Create Channel Map',
              method: 'POST',
              path: '/api/marketing-channels/maps',
              purpose: 'Create a new channel map for a company.',
              whenToUse: 'Use this endpoint to add a new channel map for multi-channel strategy planning.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Channel Strategy' },
              successResponse: { status: 201, description: 'Created channel map', body: { _id: '...', companyId: '...', name: 'Q3 Channel Strategy', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — companyId and name are required' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/marketing-channels/maps \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q3 Channel Strategy"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/maps', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Channel Strategy' })
});
const map = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/marketing-channels/maps',
  { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Channel Strategy' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Channel Strategy' });
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/maps', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/marketing-channels/maps',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q3 Channel Strategy'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/maps');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q3 Channel Strategy']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the channel map for' },
                { field: 'name', type: 'string', description: 'Required. Channel map name' },
              ],
              notes: ['companyId and name are required fields.', 'The channel map is automatically scoped to the authenticated company.'],
              commonMistakes: ['Omitting the required companyId or name fields in the request body.', 'Using a companyId the authenticated user does not have access to.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-maps-list', 'mkch-maps-detail'],
            },
            {
              id: 'mkch-maps-update',
              name: 'Update Channel Map',
              method: 'PUT',
              path: '/api/marketing-channels/maps/:id',
              purpose: 'Update an existing channel map.',
              whenToUse: 'Use this endpoint to modify channel map properties such as name.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel map ID to update' },
              ],
              requestBody: { name: 'Updated Channel Map Name' },
              successResponse: { status: 200, description: 'Updated channel map', body: { _id: '...', companyId: '...', name: 'Updated Channel Map Name', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Channel map not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Channel Map Name"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Channel Map Name' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID',
  { name: 'Updated Channel Map Name' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Channel Map Name' });
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/maps/MAP_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Channel Map Name'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Channel Map Name']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the channel map is merged with existing data.', 'The updatedAt timestamp is automatically set to the current time.'],
              commonMistakes: ['Using the companyId instead of the channel map id in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-maps-detail', 'mkch-maps-delete'],
            },
            {
              id: 'mkch-maps-delete',
              name: 'Delete Channel Map',
              method: 'DELETE',
              path: '/api/marketing-channels/maps/:id',
              purpose: 'Delete a channel map.',
              whenToUse: 'Use this endpoint to permanently remove a channel map.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The channel map ID to delete' },
              ],
              successResponse: { status: 200, description: 'Channel map deleted', body: { message: 'Channel map deleted' } },
              errorResponses: [
                { code: 404, message: 'Channel map not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/marketing-channels/maps/MAP_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/marketing-channels/maps/MAP_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Channel map deleted"' },
              ],
              notes: ['This action is permanent and cannot be undone.'],
              commonMistakes: ['Using the companyId instead of the channel map id in the URL.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['mkch-maps-list', 'mkch-maps-update'],
            },
          ],
        },
        {
          id: 'gmb',
          name: 'Google Business Profile',
          description: 'Manage Google Business Profile (formerly Google My Business) locations, posts, reviews, and analytics.',
          endpoints: [
            // --- Locations ---
            {
              id: 'gmb-locations-list',
              name: 'List GMB Locations',
              method: 'GET',
              path: '/api/gmb/locations/:companyId',
              purpose: 'Retrieve all GMB locations for a company.',
              whenToUse: 'Use this endpoint to list all business locations registered under a company in Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve locations for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of GMB locations',
                body: [
                  { id: '507f1f77bcf86cd799439012', locationName: 'Acme HQ', isPrimary: true, status: 'active', verificationStatus: 'verified', companyId: '...', createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to fetch locations' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/locations/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/locations/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const locations = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/locations/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/locations/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/locations/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/locations/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Location ID' },
                { field: '[].locationName', type: 'string', description: 'Business location name' },
                { field: '[].isPrimary', type: 'boolean', description: 'Whether this is the primary location' },
                { field: '[].status', type: 'string', description: 'Location status: active, inactive' },
                { field: '[].verificationStatus', type: 'string', description: 'Verification status: verified, unverified, pending' },
                { field: '[].companyId', type: 'string', description: 'Owning company ID' },
              ],
              notes: ['Locations are sorted by isPrimary (descending) then createdAt (descending).', 'Only returns locations the authenticated user has access to.'],
              commonMistakes: ['Using a companyId the user does not have access to — returns 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-locations-detail', 'gmb-locations-create', 'gmb-locations-update'],
            },
            {
              id: 'gmb-locations-detail',
              name: 'Get GMB Location Detail',
              method: 'GET',
              path: '/api/gmb/locations/detail/:id',
              purpose: 'Retrieve a single GMB location by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific business location.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Location ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Location details',
                body: { id: '507f1f77bcf86cd799439012', locationName: 'Acme HQ', isPrimary: true, primaryPhone: '+1-555-1234', website: 'https://acme.com', description: 'Main office', category: 'Technology', streetAddress: '123 Main St', city: 'Springfield', country: 'US', status: 'active', verificationStatus: 'verified', companyId: '...' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Location not found' },
                { code: 500, message: 'Failed to fetch location' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/locations/detail/LOCATION_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/locations/detail/LOCATION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const location = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/locations/detail/LOCATION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/locations/detail/LOCATION_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/locations/detail/LOCATION_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/locations/detail/LOCATION_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Location ID' },
                { field: 'locationName', type: 'string', description: 'Business location name' },
                { field: 'isPrimary', type: 'boolean', description: 'Whether this is the primary location' },
                { field: 'primaryPhone', type: 'string', description: 'Primary phone number' },
                { field: 'website', type: 'string', description: 'Business website URL' },
                { field: 'description', type: 'string', description: 'Business description' },
                { field: 'category', type: 'string', description: 'Primary business category' },
                { field: 'streetAddress', type: 'string', description: 'Street address' },
                { field: 'city', type: 'string', description: 'City' },
                { field: 'country', type: 'string', description: 'Country code' },
                { field: 'status', type: 'string', description: 'Location status' },
                { field: 'verificationStatus', type: 'string', description: 'Verification status' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
              ],
              notes: ['Returns 404 if the location ID does not exist.', 'Returns 403 if the user does not have access to the location\'s company.'],
              commonMistakes: ['Using the companyId instead of the location id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-locations-list', 'gmb-locations-update', 'gmb-locations-delete'],
            },
            {
              id: 'gmb-locations-create',
              name: 'Create GMB Location',
              method: 'POST',
              path: '/api/gmb/locations',
              purpose: 'Create a new GMB location.',
              whenToUse: 'Use this endpoint to add a new business location to Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { locationName: 'Acme HQ (required)', companyId: 'YOUR_COMPANY_ID (required)', primaryPhone: '+1-555-1234', website: 'https://acme.com', description: 'Main office', category: 'Technology', streetAddress: '123 Main St', city: 'Springfield', country: 'US' },
              successResponse: {
                status: 201,
                description: 'Location created',
                body: { id: '...', locationName: 'Acme HQ', isPrimary: false, status: 'active', verificationStatus: 'unverified', companyId: '...', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — locationName is required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 500, message: 'Failed to create location' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/gmb/locations \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"locationName":"Acme HQ","companyId":"YOUR_COMPANY_ID","primaryPhone":"+1-555-1234","website":"https://acme.com"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/locations', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ locationName: 'Acme HQ', companyId: 'YOUR_COMPANY_ID', primaryPhone: '+1-555-1234', website: 'https://acme.com' }),
});
const location = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/gmb/locations',
  { locationName: 'Acme HQ', companyId: 'YOUR_COMPANY_ID', primaryPhone: '+1-555-1234', website: 'https://acme.com' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ locationName: 'Acme HQ', companyId: 'YOUR_COMPANY_ID', primaryPhone: '+1-555-1234' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/locations', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/gmb/locations',
    json={'locationName': 'Acme HQ', 'companyId': 'YOUR_COMPANY_ID', 'primaryPhone': '+1-555-1234'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/locations');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['locationName' => 'Acme HQ', 'companyId' => 'YOUR_COMPANY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New location ID' },
                { field: 'locationName', type: 'string', description: 'Business location name' },
                { field: 'isPrimary', type: 'boolean', description: 'Whether this is the primary location' },
                { field: 'status', type: 'string', description: 'Location status (defaults to active)' },
                { field: 'verificationStatus', type: 'string', description: 'Verification status (defaults to unverified)' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
              ],
              notes: ['locationName is required in the request body.', 'companyId is required in the request body to associate the location with a company.', 'New locations default to status "active" and verificationStatus "unverified".'],
              commonMistakes: ['Omitting the required locationName field — returns 400 validation error.', 'Forgetting to include companyId in the request body.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-locations-list', 'gmb-locations-update'],
            },
            {
              id: 'gmb-locations-update',
              name: 'Update GMB Location',
              method: 'PUT',
              path: '/api/gmb/locations/:id',
              purpose: 'Update an existing GMB location.',
              whenToUse: 'Use this endpoint to modify a business location\'s details such as name, phone, address, or website.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Location ID to update' },
              ],
              requestBody: { locationName: 'Updated Location Name', primaryPhone: '+1-555-5678', website: 'https://acme-updated.com', description: 'Updated description' },
              successResponse: {
                status: 200,
                description: 'Location updated',
                body: { id: '...', locationName: 'Updated Location Name', primaryPhone: '+1-555-5678', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Location not found' },
                { code: 500, message: 'Failed to update location' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/gmb/locations/LOCATION_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"locationName":"Updated Location Name","primaryPhone":"+1-555-5678"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ locationName: 'Updated Location Name', primaryPhone: '+1-555-5678' }),
});
const location = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID',
  { locationName: 'Updated Location Name', primaryPhone: '+1-555-5678' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ locationName: 'Updated Location Name', primaryPhone: '+1-555-5678' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/locations/LOCATION_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID',
    json={'locationName': 'Updated Location Name', 'primaryPhone': '+1-555-5678'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['locationName' => 'Updated Location Name', 'primaryPhone' => '+1-555-5678']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Location ID' },
                { field: 'locationName', type: 'string', description: 'Updated location name' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the location was last updated' },
              ],
              notes: ['Only the fields included in the request body will be updated; omitted fields remain unchanged.', 'updatedAt is automatically set to the current timestamp.'],
              commonMistakes: ['Using the companyId instead of the location id in the URL path.', 'Attempting to update a location the user does not have access to — returns 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-locations-list', 'gmb-locations-detail', 'gmb-locations-delete'],
            },
            {
              id: 'gmb-locations-delete',
              name: 'Delete GMB Location',
              method: 'DELETE',
              path: '/api/gmb/locations/:id',
              purpose: 'Delete a GMB location.',
              whenToUse: 'Use this endpoint to permanently remove a business location.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Location ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Location deleted',
                body: { message: 'Location deleted successfully' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Location not found' },
                { code: 500, message: 'Failed to delete location' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/gmb/locations/LOCATION_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/locations/LOCATION_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/locations/LOCATION_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Location deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires gmb delete permission.'],
              commonMistakes: ['Using the companyId instead of the location id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-locations-list', 'gmb-locations-detail'],
            },
            // --- Posts ---
            {
              id: 'gmb-posts-list',
              name: 'List GMB Posts',
              method: 'GET',
              path: '/api/gmb/posts/:companyId',
              purpose: 'Retrieve all GMB posts for a company.',
              whenToUse: 'Use this endpoint to list all posts (updates, events, offers) for a company\'s Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve posts for' },
              ],
              queryParams: [
                { name: 'locationId', type: 'string', required: false, description: 'Filter posts by location ID' },
                { name: 'type', type: 'string', required: false, description: 'Filter posts by type (e.g. offer, event, update)' },
                { name: 'status', type: 'string', required: false, description: 'Filter posts by status (e.g. draft, published)' },
              ],
              successResponse: {
                status: 200,
                description: 'List of GMB posts',
                body: [
                  { id: '...', description: 'Grand opening sale!', type: 'offer', status: 'published', companyId: '...', createdAt: '2026-07-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to fetch posts' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/posts/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const posts = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/posts/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/posts/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/posts/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/posts/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Post ID' },
                { field: '[].description', type: 'string', description: 'Post content/description' },
                { field: '[].type', type: 'string', description: 'Post type: offer, event, update' },
                { field: '[].status', type: 'string', description: 'Post status: draft, published, archived' },
                { field: '[].companyId', type: 'string', description: 'Owning company ID' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the post was created' },
              ],
              notes: ['Posts are sorted by createdAt in descending order.', 'Optional query parameters locationId, type, and status can be used to filter results.'],
              commonMistakes: ['Using a companyId the user does not have access to — returns 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-posts-detail', 'gmb-posts-create', 'gmb-posts-update'],
            },
            {
              id: 'gmb-posts-detail',
              name: 'Get GMB Post Detail',
              method: 'GET',
              path: '/api/gmb/posts/detail/:id',
              purpose: 'Retrieve a single GMB post by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific Google Business Profile post.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Post details',
                body: { id: '...', description: 'Grand opening sale!', type: 'offer', status: 'published', companyId: '...', createdAt: '2026-07-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to fetch post' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/posts/detail/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const post = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/posts/detail/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/posts/detail/POST_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/posts/detail/POST_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/posts/detail/POST_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Post ID' },
                { field: 'description', type: 'string', description: 'Post content' },
                { field: 'type', type: 'string', description: 'Post type: offer, event, update' },
                { field: 'status', type: 'string', description: 'Post status' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the post was created' },
              ],
              notes: ['Returns 404 if the post ID does not exist.', 'Returns 403 if the user does not have access to the post\'s company.'],
              commonMistakes: ['Using the companyId instead of the post id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-posts-list', 'gmb-posts-create', 'gmb-posts-update'],
            },
            {
              id: 'gmb-posts-create',
              name: 'Create GMB Post',
              method: 'POST',
              path: '/api/gmb/posts',
              purpose: 'Create a new GMB post.',
              whenToUse: 'Use this endpoint to create a new post (update, event, or offer) for a Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { description: 'Grand opening sale! (required)', companyId: 'YOUR_COMPANY_ID (required)', type: 'offer', status: 'draft', locationId: '...' },
              successResponse: {
                status: 201,
                description: 'Post created',
                body: { id: '...', description: 'Grand opening sale!', type: 'offer', status: 'draft', companyId: '...', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — description is required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 500, message: 'Failed to create post' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/gmb/posts \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"description":"Grand opening sale!","companyId":"YOUR_COMPANY_ID","type":"offer","status":"draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/posts', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ description: 'Grand opening sale!', companyId: 'YOUR_COMPANY_ID', type: 'offer', status: 'draft' }),
});
const post = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/gmb/posts',
  { description: 'Grand opening sale!', companyId: 'YOUR_COMPANY_ID', type: 'offer', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ description: 'Grand opening sale!', companyId: 'YOUR_COMPANY_ID', type: 'offer', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/posts', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/gmb/posts',
    json={'description': 'Grand opening sale!', 'companyId': 'YOUR_COMPANY_ID', 'type': 'offer', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/posts');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['description' => 'Grand opening sale!', 'companyId' => 'YOUR_COMPANY_ID', 'type' => 'offer', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New post ID' },
                { field: 'description', type: 'string', description: 'Post content' },
                { field: 'type', type: 'string', description: 'Post type' },
                { field: 'status', type: 'string', description: 'Post status' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the post was created' },
              ],
              notes: ['description is required in the request body.', 'companyId is required in the request body to associate the post with a company.'],
              commonMistakes: ['Omitting the required description field — returns 400 validation error.', 'Forgetting to include companyId in the request body.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-posts-list', 'gmb-posts-detail', 'gmb-posts-update'],
            },
            {
              id: 'gmb-posts-update',
              name: 'Update GMB Post',
              method: 'PUT',
              path: '/api/gmb/posts/:id',
              purpose: 'Update an existing GMB post.',
              whenToUse: 'Use this endpoint to modify a post\'s content, type, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID to update' },
              ],
              requestBody: { description: 'Updated post content', status: 'published' },
              successResponse: {
                status: 200,
                description: 'Post updated',
                body: { id: '...', description: 'Updated post content', status: 'published', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to update post' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/gmb/posts/POST_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"description":"Updated post content","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/posts/POST_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ description: 'Updated post content', status: 'published' }),
});
const post = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/gmb/posts/POST_ID',
  { description: 'Updated post content', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ description: 'Updated post content', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/posts/POST_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/gmb/posts/POST_ID',
    json={'description': 'Updated post content', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['description' => 'Updated post content', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Post ID' },
                { field: 'description', type: 'string', description: 'Updated post content' },
                { field: 'status', type: 'string', description: 'Updated post status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the post was last updated' },
              ],
              notes: ['Only the fields included in the request body will be updated.', 'updatedAt is automatically set to the current timestamp.'],
              commonMistakes: ['Using the companyId instead of the post id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-posts-list', 'gmb-posts-detail', 'gmb-posts-delete'],
            },
            {
              id: 'gmb-posts-delete',
              name: 'Delete GMB Post',
              method: 'DELETE',
              path: '/api/gmb/posts/:id',
              purpose: 'Delete a GMB post.',
              whenToUse: 'Use this endpoint to permanently remove a post.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Post ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Post deleted',
                body: { message: 'Post deleted successfully' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Post not found' },
                { code: 500, message: 'Failed to delete post' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/gmb/posts/POST_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/posts/POST_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/gmb/posts/POST_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/posts/POST_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/gmb/posts/POST_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/posts/POST_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Post deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires gmb delete permission.'],
              commonMistakes: ['Using the companyId instead of the post id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-posts-list', 'gmb-posts-detail'],
            },
            // --- Reviews ---
            {
              id: 'gmb-reviews-list',
              name: 'List GMB Reviews',
              method: 'GET',
              path: '/api/gmb/reviews/:companyId',
              purpose: 'Retrieve all GMB reviews for a company.',
              whenToUse: 'Use this endpoint to list all customer reviews for a company\'s Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to retrieve reviews for' },
              ],
              queryParams: [
                { name: 'locationId', type: 'string', required: false, description: 'Filter reviews by location ID' },
                { name: 'rating', type: 'number', required: false, description: 'Filter reviews by rating (1-5)' },
                { name: 'status', type: 'string', required: false, description: 'Filter reviews by reply status' },
              ],
              successResponse: {
                status: 200,
                description: 'List of GMB reviews',
                body: [
                  { id: '...', reviewerName: 'John Doe', rating: 5, replyStatus: 'replied', companyId: '...', reviewDate: '2026-07-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to fetch reviews' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/reviews/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/reviews/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const reviews = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/reviews/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/reviews/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/reviews/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/reviews/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Review ID' },
                { field: '[].reviewerName', type: 'string', description: 'Name of the reviewer' },
                { field: '[].rating', type: 'number', description: 'Rating from 1 to 5' },
                { field: '[].replyStatus', type: 'string', description: 'Reply status: replied, unreplied' },
                { field: '[].companyId', type: 'string', description: 'Owning company ID' },
                { field: '[].reviewDate', type: 'string', description: 'ISO date of the review' },
              ],
              notes: ['Reviews are sorted by reviewDate in descending order.', 'Optional query parameters locationId, rating, and status can be used to filter results.'],
              commonMistakes: ['Using a companyId the user does not have access to — returns 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-reviews-detail', 'gmb-reviews-create'],
            },
            {
              id: 'gmb-reviews-detail',
              name: 'Get GMB Review Detail',
              method: 'GET',
              path: '/api/gmb/reviews/detail/:id',
              purpose: 'Retrieve a single GMB review by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific review.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Review ID' },
              ],
              successResponse: {
                status: 200,
                description: 'Review details',
                body: { id: '...', reviewerName: 'John Doe', rating: 5, replyStatus: 'replied', companyId: '...', reviewDate: '2026-07-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Review not found' },
                { code: 500, message: 'Failed to fetch review' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/gmb/reviews/detail/REVIEW_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/reviews/detail/REVIEW_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const review = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/gmb/reviews/detail/REVIEW_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/gmb/reviews/detail/REVIEW_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/gmb/reviews/detail/REVIEW_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/reviews/detail/REVIEW_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Review ID' },
                { field: 'reviewerName', type: 'string', description: 'Name of the reviewer' },
                { field: 'rating', type: 'number', description: 'Rating from 1 to 5' },
                { field: 'replyStatus', type: 'string', description: 'Reply status: replied, unreplied' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
                { field: 'reviewDate', type: 'string', description: 'ISO date of the review' },
              ],
              notes: ['Returns 404 if the review ID does not exist.', 'Returns 403 if the user does not have access to the review\'s company.'],
              commonMistakes: ['Using the companyId instead of the review id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['gmb-reviews-list', 'gmb-reviews-create'],
            },
            {
              id: 'gmb-reviews-create',
              name: 'Create GMB Review',
              method: 'POST',
              path: '/api/gmb/reviews',
              purpose: 'Create a new GMB review.',
              whenToUse: 'Use this endpoint to add a new review entry to a company\'s Google Business Profile.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { reviewerName: 'John Doe (required)', rating: 5, companyId: 'YOUR_COMPANY_ID (required)', reviewDate: '2026-07-22T10:00:00Z', replyStatus: 'unreplied' },
              successResponse: {
                status: 201,
                description: 'Review created',
                body: { id: '...', reviewerName: 'John Doe', rating: 5, replyStatus: 'unreplied', companyId: '...', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — reviewerName is required, rating must be 1-5' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 500, message: 'Failed to create review' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/gmb/reviews \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"reviewerName":"John Doe","rating":5,"companyId":"YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/reviews', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ reviewerName: 'John Doe', rating: 5, companyId: 'YOUR_COMPANY_ID' }),
});
const review = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/gmb/reviews',
  { reviewerName: 'John Doe', rating: 5, companyId: 'YOUR_COMPANY_ID' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ reviewerName: 'John Doe', rating: 5, companyId: 'YOUR_COMPANY_ID' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/reviews', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/gmb/reviews',
    json={'reviewerName': 'John Doe', 'rating': 5, 'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/reviews');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['reviewerName' => 'John Doe', 'rating' => 5, 'companyId' => 'YOUR_COMPANY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'New review ID' },
                { field: 'reviewerName', type: 'string', description: 'Name of the reviewer' },
                { field: 'rating', type: 'number', description: 'Rating from 1 to 5' },
                { field: 'replyStatus', type: 'string', description: 'Reply status' },
                { field: 'companyId', type: 'string', description: 'Owning company ID' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the review was created' },
              ],
              notes: ['reviewerName is required in the request body.', 'rating must be an integer between 1 and 5.', 'companyId is required in the request body.'],
              commonMistakes: ['Omitting the required reviewerName field — returns 400 validation error.', 'Providing a rating outside the 1-5 range — returns 400 validation error.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-reviews-list', 'gmb-reviews-detail'],
            },
            {
              id: 'gmb-reviews-update',
              name: 'Update GMB Review',
              method: 'PUT',
              path: '/api/gmb/reviews/:id',
              purpose: 'Update an existing GMB review.',
              whenToUse: 'Use this endpoint to modify a review, for example to update the reply status or add a response.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Review ID to update' },
              ],
              requestBody: { replyStatus: 'replied', replyText: 'Thank you for your feedback!' },
              successResponse: {
                status: 200,
                description: 'Review updated',
                body: { id: '...', reviewerName: 'John Doe', rating: 5, replyStatus: 'replied', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Review not found' },
                { code: 500, message: 'Failed to update review' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"replyStatus":"replied","replyText":"Thank you for your feedback!"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ replyStatus: 'replied', replyText: 'Thank you for your feedback!' }),
});
const review = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID',
  { replyStatus: 'replied', replyText: 'Thank you for your feedback!' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ replyStatus: 'replied', replyText: 'Thank you for your feedback!' });
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/reviews/REVIEW_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID',
    json={'replyStatus': 'replied', 'replyText': 'Thank you for your feedback!'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['replyStatus' => 'replied', 'replyText' => 'Thank you for your feedback!']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Review ID' },
                { field: 'reviewerName', type: 'string', description: 'Name of the reviewer' },
                { field: 'rating', type: 'number', description: 'Rating from 1 to 5' },
                { field: 'replyStatus', type: 'string', description: 'Updated reply status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the review was last updated' },
              ],
              notes: ['Only the fields included in the request body will be updated.', 'updatedAt is automatically set to the current timestamp.'],
              commonMistakes: ['Using the companyId instead of the review id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-reviews-list', 'gmb-reviews-detail'],
            },
            {
              id: 'gmb-reviews-delete',
              name: 'Delete GMB Review',
              method: 'DELETE',
              path: '/api/gmb/reviews/:id',
              purpose: 'Delete a GMB review.',
              whenToUse: 'Use this endpoint to permanently remove a review.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Review ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Review deleted',
                body: { message: 'Review deleted successfully' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Review not found' },
                { code: 500, message: 'Failed to delete review' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/gmb/reviews/REVIEW_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/gmb/reviews/REVIEW_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Review deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires gmb delete permission.'],
              commonMistakes: ['Using the companyId instead of the review id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['gmb-reviews-list', 'gmb-reviews-detail'],
            },
          ],
        },
        // --- Events ---
        {
          id: 'events',
          name: 'Events',
          description: 'Manage events, categories, sessions, and resources for event planning and scheduling.',
          endpoints: [
            // === Categories ===
            {
              id: 'events-categories-list',
              name: 'List Event Categories',
              method: 'GET',
              path: '/api/events/categories/:companyId',
              purpose: 'Retrieve all event categories for a company.',
              whenToUse: 'Use this endpoint to list all categories used to organise events within a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch categories for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of event categories',
                body: [
                  { _id: '507f1f77bcf86cd799439011', name: 'Workshops', companyId: '...', order: 1, createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/categories/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const categories = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/categories/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/categories/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Category ID' },
                { field: '[].name', type: 'string', description: 'Category name' },
                { field: '[].companyId', type: 'string', description: 'Company ID the category belongs to' },
                { field: '[].order', type: 'number', description: 'Sort order of the category' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the category was created' },
              ],
              notes: ['Categories are sorted by order then creation date.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-categories-detail', 'events-categories-create', 'events-categories-update', 'events-categories-delete'],
            },
            {
              id: 'events-categories-detail',
              name: 'Get Event Category Detail',
              method: 'GET',
              path: '/api/events/categories/detail/:id',
              purpose: 'Retrieve a single event category by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific event category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Category details',
                body: { _id: '507f1f77bcf86cd799439011', name: 'Workshops', companyId: '...', order: 1, createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/categories/detail/CATEGORY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/categories/detail/CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const category = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/categories/detail/CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/categories/detail/CATEGORY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/categories/detail/CATEGORY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/categories/detail/CATEGORY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Category ID' },
                { field: 'name', type: 'string', description: 'Category name' },
                { field: 'companyId', type: 'string', description: 'Company ID the category belongs to' },
                { field: 'order', type: 'number', description: 'Sort order of the category' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the category was created' },
              ],
              notes: ['You can only access categories belonging to companies you have access to.'],
              commonMistakes: ['Using the category _id in the path instead of the id field.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-categories-list', 'events-categories-create', 'events-categories-update'],
            },
            {
              id: 'events-categories-create',
              name: 'Create Event Category',
              method: 'POST',
              path: '/api/events/categories',
              purpose: 'Create a new event category for organising events.',
              whenToUse: 'Use this endpoint to add a new category to group events under within a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Category name', companyId: 'string (required) — Company ID', order: 'number (optional) — Sort order' },
              successResponse: {
                status: 201,
                description: 'Category created',
                body: { _id: '...', name: 'Workshops', companyId: '...', order: 1, createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — name and companyId are required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/events/categories \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Workshops", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/categories', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Workshops', companyId: 'YOUR_COMPANY_ID' }),
});
const category = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/events/categories',
  { name: 'Workshops', companyId: 'YOUR_COMPANY_ID' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Workshops', companyId: 'YOUR_COMPANY_ID' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/categories', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/events/categories',
    json={'name': 'Workshops', 'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/categories');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Workshops', 'companyId' => 'YOUR_COMPANY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New category ID' },
                { field: 'name', type: 'string', description: 'Category name' },
                { field: 'companyId', type: 'string', description: 'Company ID the category belongs to' },
                { field: 'order', type: 'number', description: 'Sort order of the category' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the category was created' },
              ],
              notes: ['name and companyId are required fields.', 'Requires events.create permission.'],
              commonMistakes: ['Omitting companyId — the request will return a 400 validation error.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-categories-list', 'events-categories-detail', 'events-categories-update', 'events-categories-delete'],
            },
            {
              id: 'events-categories-update',
              name: 'Update Event Category',
              method: 'PUT',
              path: '/api/events/categories/:id',
              purpose: 'Update an existing event category.',
              whenToUse: 'Use this endpoint to modify the name, order, or other fields of a category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category ID to update' },
              ],
              requestBody: { name: 'string (optional) — Updated category name', order: 'number (optional) — Updated sort order' },
              successResponse: {
                status: 200,
                description: 'Category updated',
                body: { _id: '...', name: 'Updated Workshops', companyId: '...', order: 2, updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/events/categories/CATEGORY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name": "Updated Workshops"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/categories/CATEGORY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Workshops' }),
});
const category = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/events/categories/CATEGORY_ID',
  { name: 'Updated Workshops' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Workshops' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/categories/CATEGORY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/events/categories/CATEGORY_ID',
    json={'name': 'Updated Workshops'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Workshops']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Category ID' },
                { field: 'name', type: 'string', description: 'Updated category name' },
                { field: 'companyId', type: 'string', description: 'Company ID the category belongs to' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the category was last updated' },
              ],
              notes: ['Only send fields you want to update; omitted fields remain unchanged.', 'Requires events.edit permission.'],
              commonMistakes: ['Trying to update a category that belongs to a company you do not have access to.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-categories-list', 'events-categories-detail', 'events-categories-create', 'events-categories-delete'],
            },
            {
              id: 'events-categories-delete',
              name: 'Delete Event Category',
              method: 'DELETE',
              path: '/api/events/categories/:id',
              purpose: 'Delete an event category. Related events will have their categoryId cleared.',
              whenToUse: 'Use this endpoint to remove a category that is no longer needed. Events previously in this category will become uncategorised.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Category deleted',
                body: { message: 'Category deleted' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Category not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/events/categories/CATEGORY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/categories/CATEGORY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/events/categories/CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/events/categories/CATEGORY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/events/categories/CATEGORY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/categories/CATEGORY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Deleting a category clears categoryId on all events that were in it.', 'Requires events.delete permission.'],
              commonMistakes: ['Assuming events are deleted along with the category — only the categoryId reference is removed.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-categories-list', 'events-categories-detail', 'events-categories-update'],
            },
            // === Events ===
            {
              id: 'events-list',
              name: 'List Events',
              method: 'GET',
              path: '/api/events/events/:companyId',
              purpose: 'Retrieve events for a company with optional search and filtering.',
              whenToUse: 'Use this endpoint to list events, with support for text search, filtering by category, status, type, mode, priority, visibility, and audience type. Supports pagination.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch events for' },
              ],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Full-text search term' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived, cancelled' },
                { name: 'eventType', type: 'string', required: false, description: 'Filter by event type: meeting, workshop, conference, webinar, training, etc.' },
                { name: 'eventMode', type: 'string', required: false, description: 'Filter by mode: online, offline, hybrid' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'visibility', type: 'string', required: false, description: 'Filter by visibility: private, internal, public' },
                { name: 'audienceType', type: 'string', required: false, description: 'Filter by audience type: public, internal, team_specific, department_specific, admin_only' },
                { name: 'isFeatured', type: 'string', required: false, description: 'Filter featured events: true or false' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Results per page (default 50)' },
              ],
              successResponse: {
                status: 200,
                description: 'Paginated list of events',
                body: { data: [{ _id: '...', title: 'Q3 Strategy Workshop', companyId: '...', status: 'published', eventType: 'workshop', eventDate: '2026-08-15T00:00:00Z', createdAt: '...' }], pagination: { page: 1, limit: 50, total: 1, pages: 1 } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/events/events/YOUR_COMPANY_ID?status=published&limit=10" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/events/YOUR_COMPANY_ID?status=published&limit=10', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { data, pagination } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/events/YOUR_COMPANY_ID', {
  params: { status: 'published', limit: 10 },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/events/YOUR_COMPANY_ID?status=published&limit=10', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/events/YOUR_COMPANY_ID',
    params={'status': 'published', 'limit': 10},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/events/YOUR_COMPANY_ID?status=published&limit=10');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of event objects' },
                { field: 'data[]._id', type: 'string', description: 'Event ID' },
                { field: 'data[].title', type: 'string', description: 'Event title' },
                { field: 'data[].companyId', type: 'string', description: 'Company ID' },
                { field: 'data[].status', type: 'string', description: 'Event status (draft, review, approved, published, archived, cancelled)' },
                { field: 'data[].eventType', type: 'string', description: 'Event type (meeting, workshop, conference, etc.)' },
                { field: 'data[].eventDate', type: 'string', description: 'ISO date of the event' },
                { field: 'pagination.page', type: 'number', description: 'Current page number' },
                { field: 'pagination.limit', type: 'number', description: 'Results per page' },
                { field: 'pagination.total', type: 'number', description: 'Total number of matching events' },
                { field: 'pagination.pages', type: 'number', description: 'Total number of pages' },
              ],
              notes: ['Results are sorted by creation date, newest first.', 'Use query parameters to filter results.'],
              commonMistakes: ['Forgetting that the response is paginated — check the pagination object for total counts.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-detail', 'events-create', 'events-update', 'events-delete'],
            },
            {
              id: 'events-detail',
              name: 'Get Event Detail',
              method: 'GET',
              path: '/api/events/events/detail/:id',
              purpose: 'Retrieve a single event by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Event ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Event details',
                body: { _id: '...', title: 'Q3 Strategy Workshop', companyId: '...', eventType: 'workshop', status: 'published', eventMode: 'online', eventDate: '2026-08-15T00:00:00Z', startTime: '10:00', endTime: '12:00', location: 'Zoom', createdAt: '...' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/events/detail/EVENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/events/detail/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/events/detail/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/events/detail/EVENT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/events/detail/EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/events/detail/EVENT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Event ID' },
                { field: 'title', type: 'string', description: 'Event title' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'eventType', type: 'string', description: 'Event type (meeting, workshop, conference, etc.)' },
                { field: 'status', type: 'string', description: 'Event status' },
                { field: 'eventMode', type: 'string', description: 'Event mode (online, offline, hybrid)' },
                { field: 'eventDate', type: 'string', description: 'ISO date of the event' },
                { field: 'startTime', type: 'string', description: 'Event start time' },
                { field: 'endTime', type: 'string', description: 'Event end time' },
                { field: 'location', type: 'string', description: 'Event location or online link' },
              ],
              notes: ['You can only access events belonging to companies you have access to.'],
              commonMistakes: ['Using a companyId instead of the event _id in the path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-list', 'events-create', 'events-update', 'events-delete'],
            },
            {
              id: 'events-create',
              name: 'Create Event',
              method: 'POST',
              path: '/api/events/events',
              purpose: 'Create a new event.',
              whenToUse: 'Use this endpoint to schedule a new event with title, date, time, type, and other details.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Event title', companyId: 'string (required) — Company ID', eventType: 'string (optional) — meeting, workshop, conference, webinar, training, product_launch, campaign_event, sop_training, team_activity, onboarding, hr_activity, other', status: 'string (optional) — draft, review, approved, published, archived, cancelled (default: draft)', eventMode: 'string (optional) — online, offline, hybrid (default: online)', eventDate: 'string (optional) — ISO 8601 date', startTime: 'string (optional) — Start time', endTime: 'string (optional) — End time', location: 'string (optional) — Venue or location', shortDescription: 'string (optional) — Brief description (max 500 chars)', priority: 'string (optional) — low, medium, high, critical (default: medium)', visibility: 'string (optional) — private, internal, public (default: internal)', audienceType: 'string (optional) — public, internal, team_specific, department_specific, admin_only (default: internal)' },
              successResponse: {
                status: 201,
                description: 'Event created',
                body: { _id: '...', title: 'Q3 Strategy Workshop', companyId: '...', eventType: 'workshop', status: 'draft', eventMode: 'online', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — title and companyId are required; endTime must be after startTime; eventDate cannot be in the past' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/events/events \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title": "Q3 Strategy Workshop", "companyId": "YOUR_COMPANY_ID", "eventType": "workshop", "eventDate": "2026-08-15T00:00:00Z"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/events', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Q3 Strategy Workshop', companyId: 'YOUR_COMPANY_ID', eventType: 'workshop', eventDate: '2026-08-15T00:00:00Z' }),
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/events/events',
  { title: 'Q3 Strategy Workshop', companyId: 'YOUR_COMPANY_ID', eventType: 'workshop', eventDate: '2026-08-15T00:00:00Z' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Q3 Strategy Workshop', companyId: 'YOUR_COMPANY_ID', eventType: 'workshop', eventDate: '2026-08-15T00:00:00Z' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/events', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/events/events',
    json={'title': 'Q3 Strategy Workshop', 'companyId': 'YOUR_COMPANY_ID', 'eventType': 'workshop', 'eventDate': '2026-08-15T00:00:00Z'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/events');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Q3 Strategy Workshop', 'companyId' => 'YOUR_COMPANY_ID', 'eventType' => 'workshop', 'eventDate' => '2026-08-15T00:00:00Z']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New event ID' },
                { field: 'title', type: 'string', description: 'Event title' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'eventType', type: 'string', description: 'Event type' },
                { field: 'status', type: 'string', description: 'Event status (defaults to draft)' },
                { field: 'eventMode', type: 'string', description: 'Event mode (defaults to online)' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the event was created' },
              ],
              notes: ['title and companyId are required.', 'Invalid enum values default to their respective defaults (e.g. eventType defaults to "other", status to "draft").', 'endTime must be after startTime if both are provided.', 'eventDate cannot be in the past.', 'Requires events.create permission.'],
              commonMistakes: ['Setting eventDate to a past date — will return a 400 error.', 'Setting endTime before startTime — will return a 400 error.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-list', 'events-detail', 'events-update', 'events-delete'],
            },
            {
              id: 'events-update',
              name: 'Update Event',
              method: 'PUT',
              path: '/api/events/events/:id',
              purpose: 'Update an existing event.',
              whenToUse: 'Use this endpoint to modify event details such as title, date, status, or any other field.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Event ID to update' },
              ],
              requestBody: { title: 'string (optional) — Updated event title', status: 'string (optional) — Updated status', eventDate: 'string (optional) — Updated event date', startTime: 'string (optional) — Updated start time', endTime: 'string (optional) — Updated end time', priority: 'string (optional) — Updated priority' },
              successResponse: {
                status: 200,
                description: 'Event updated',
                body: { _id: '...', title: 'Updated Workshop', status: 'published', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'endTime must be after startTime, or eventDate cannot be in the past (when changing date)' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/events/events/EVENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status": "published", "priority": "high"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/events/EVENT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'published', priority: 'high' }),
});
const event = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/events/events/EVENT_ID',
  { status: 'published', priority: 'high' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ status: 'published', priority: 'high' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/events/EVENT_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/events/events/EVENT_ID',
    json={'status': 'published', 'priority': 'high'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/events/EVENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'published', 'priority' => 'high']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Event ID' },
                { field: 'title', type: 'string', description: 'Updated event title' },
                { field: 'status', type: 'string', description: 'Updated event status' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the event was last updated' },
              ],
              notes: ['Only send fields you want to update; omitted fields remain unchanged.', 'When updating eventDate to a new value, the new date cannot be in the past.', 'endTime must be after startTime when both are present.', 'Requires events.edit permission.'],
              commonMistakes: ['Re-sending the existing eventDate on an event that already has a past date — only triggers validation when the date value actually changes.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-list', 'events-detail', 'events-create', 'events-delete'],
            },
            {
              id: 'events-delete',
              name: 'Delete Event',
              method: 'DELETE',
              path: '/api/events/events/:id',
              purpose: 'Delete an event and all its associated sessions and resources.',
              whenToUse: 'Use this endpoint to permanently remove an event. This cascade-deletes all sessions and resources linked to the event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Event ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Event deleted',
                body: { message: 'Event deleted' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/events/events/EVENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/events/EVENT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/events/events/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/events/events/EVENT_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/events/events/EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/events/EVENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Deleting an event cascade-deletes all sessions and resources linked to it.', 'Requires events.delete permission.'],
              commonMistakes: ['Assuming sessions and resources are preserved — they are deleted along with the event.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-list', 'events-detail', 'events-update'],
            },
            // === Sessions ===
            {
              id: 'events-sessions-list',
              name: 'List Event Sessions',
              method: 'GET',
              path: '/api/events/sessions/:eventId',
              purpose: 'Retrieve all sessions for a specific event.',
              whenToUse: 'Use this endpoint to list all sessions scheduled under an event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'eventId', type: 'string', required: true, description: 'Event ID to fetch sessions for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of sessions',
                body: [
                  { _id: '...', title: 'Opening Keynote', eventId: '...', companyId: '...', order: 1, createdAt: '2026-07-22T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/sessions/EVENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/sessions/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const sessions = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/sessions/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/sessions/EVENT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/sessions/EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/sessions/EVENT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Session ID' },
                { field: '[].title', type: 'string', description: 'Session title' },
                { field: '[].eventId', type: 'string', description: 'Parent event ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].order', type: 'number', description: 'Sort order of the session' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the session was created' },
              ],
              notes: ['Sessions are sorted by order then creation date.', 'The event must exist and you must have access to its company.'],
              commonMistakes: ['Using a session ID instead of an event ID in the path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-sessions-detail', 'events-sessions-create', 'events-sessions-update', 'events-sessions-delete'],
            },
            {
              id: 'events-sessions-detail',
              name: 'Get Session Detail',
              method: 'GET',
              path: '/api/events/sessions/detail/:id',
              purpose: 'Retrieve a single session by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific session.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Session ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Session details',
                body: { _id: '...', title: 'Opening Keynote', eventId: '...', companyId: '...', order: 1, duration: '30 min', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Session not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/sessions/detail/SESSION_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/sessions/detail/SESSION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const session = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/sessions/detail/SESSION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/sessions/detail/SESSION_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/sessions/detail/SESSION_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/sessions/detail/SESSION_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Session ID' },
                { field: 'title', type: 'string', description: 'Session title' },
                { field: 'eventId', type: 'string', description: 'Parent event ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'order', type: 'number', description: 'Sort order' },
                { field: 'duration', type: 'string', description: 'Session duration' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the session was created' },
              ],
              notes: ['You can only access sessions belonging to events in companies you have access to.'],
              commonMistakes: ['Using an event ID instead of a session ID in the path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-sessions-list', 'events-sessions-create', 'events-sessions-update'],
            },
            {
              id: 'events-sessions-create',
              name: 'Create Event Session',
              method: 'POST',
              path: '/api/events/sessions',
              purpose: 'Create a new session under an event.',
              whenToUse: 'Use this endpoint to add a session (e.g. keynote, workshop, breakout) to an existing event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Session title', eventId: 'string (required) — Parent event ID', companyId: 'string (required) — Company ID', duration: 'string (optional) — Session duration (e.g. "30 min")', order: 'number (optional) — Sort order', description: 'string (optional) — Session description', speakerInfo: 'string (optional) — Speaker information' },
              successResponse: {
                status: 201,
                description: 'Session created',
                body: { _id: '...', title: 'Opening Keynote', eventId: '...', companyId: '...', order: 1, duration: '30 min', createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — title, eventId, and companyId are required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/events/sessions \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title": "Opening Keynote", "eventId": "EVENT_ID", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/sessions', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Opening Keynote', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' }),
});
const session = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/events/sessions',
  { title: 'Opening Keynote', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Opening Keynote', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/sessions', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/events/sessions',
    json={'title': 'Opening Keynote', 'eventId': 'EVENT_ID', 'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/sessions');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Opening Keynote', 'eventId' => 'EVENT_ID', 'companyId' => 'YOUR_COMPANY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New session ID' },
                { field: 'title', type: 'string', description: 'Session title' },
                { field: 'eventId', type: 'string', description: 'Parent event ID' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'order', type: 'number', description: 'Sort order' },
                { field: 'duration', type: 'string', description: 'Session duration' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the session was created' },
              ],
              notes: ['title, eventId, and companyId are required fields.', 'Requires events.create permission.'],
              commonMistakes: ['Omitting eventId — the request will return a 400 validation error.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-sessions-list', 'events-sessions-detail', 'events-sessions-update', 'events-sessions-delete'],
            },
            {
              id: 'events-sessions-update',
              name: 'Update Event Session',
              method: 'PUT',
              path: '/api/events/sessions/:id',
              purpose: 'Update an existing event session.',
              whenToUse: 'Use this endpoint to modify session details such as title, duration, speaker info, or order.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Session ID to update' },
              ],
              requestBody: { title: 'string (optional) — Updated session title', duration: 'string (optional) — Updated duration', order: 'number (optional) — Updated sort order', description: 'string (optional) — Updated description', speakerInfo: 'string (optional) — Updated speaker info' },
              successResponse: {
                status: 200,
                description: 'Session updated',
                body: { _id: '...', title: 'Updated Keynote', duration: '45 min', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Session not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/events/sessions/SESSION_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"duration": "45 min"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/sessions/SESSION_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ duration: '45 min' }),
});
const session = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/events/sessions/SESSION_ID',
  { duration: '45 min' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ duration: '45 min' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/sessions/SESSION_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/events/sessions/SESSION_ID',
    json={'duration': '45 min'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/sessions/SESSION_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['duration' => '45 min']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Session ID' },
                { field: 'title', type: 'string', description: 'Updated session title' },
                { field: 'duration', type: 'string', description: 'Updated session duration' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the session was last updated' },
              ],
              notes: ['Only send fields you want to update; omitted fields remain unchanged.', 'Requires events.edit permission.'],
              commonMistakes: ['Trying to update a session that belongs to an event in a company you do not have access to.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-sessions-list', 'events-sessions-detail', 'events-sessions-create', 'events-sessions-delete'],
            },
            {
              id: 'events-sessions-delete',
              name: 'Delete Event Session',
              method: 'DELETE',
              path: '/api/events/sessions/:id',
              purpose: 'Delete a session and its associated resources.',
              whenToUse: 'Use this endpoint to remove a session from an event. All resources linked to this session are also deleted.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Session ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Session deleted',
                body: { message: 'Session deleted' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Session not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/events/sessions/SESSION_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/sessions/SESSION_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/events/sessions/SESSION_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/events/sessions/SESSION_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/events/sessions/SESSION_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/sessions/SESSION_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Deleting a session also cascade-deletes all resources linked to it.', 'Requires events.delete permission.'],
              commonMistakes: ['Assuming session resources are preserved — they are deleted along with the session.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-sessions-list', 'events-sessions-detail', 'events-sessions-update'],
            },
            // === Resources ===
            {
              id: 'events-resources-list',
              name: 'List Event Resources',
              method: 'GET',
              path: '/api/events/resources/:eventId',
              purpose: 'Retrieve all resources for a specific event.',
              whenToUse: 'Use this endpoint to list all resources (files, links, documents) attached to an event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'eventId', type: 'string', required: true, description: 'Event ID to fetch resources for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of resources',
                body: [
                  { _id: '...', title: 'Slide Deck', eventId: '...', sessionId: '...', companyId: '...', order: 1, createdAt: '2026-07-22T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Event not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/resources/EVENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/resources/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const resources = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/resources/EVENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/resources/EVENT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/resources/EVENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/resources/EVENT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Resource ID' },
                { field: '[].title', type: 'string', description: 'Resource title' },
                { field: '[].eventId', type: 'string', description: 'Parent event ID' },
                { field: '[].sessionId', type: 'string', description: 'Parent session ID (if linked to a session)' },
                { field: '[].companyId', type: 'string', description: 'Company ID' },
                { field: '[].order', type: 'number', description: 'Sort order' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the resource was created' },
              ],
              notes: ['Resources are sorted by order then creation date.', 'The event must exist and you must have access to its company.'],
              commonMistakes: ['Using a session ID instead of an event ID in the path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-resources-detail', 'events-resources-create', 'events-resources-update', 'events-resources-delete'],
            },
            {
              id: 'events-resources-detail',
              name: 'Get Resource Detail',
              method: 'GET',
              path: '/api/events/resources/detail/:id',
              purpose: 'Retrieve a single resource by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific event resource.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Resource ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Resource details',
                body: { _id: '...', title: 'Slide Deck', eventId: '...', sessionId: '...', companyId: '...', order: 1, createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Resource not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/events/resources/detail/RESOURCE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/resources/detail/RESOURCE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const resource = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/events/resources/detail/RESOURCE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/events/resources/detail/RESOURCE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/events/resources/detail/RESOURCE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/resources/detail/RESOURCE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Resource ID' },
                { field: 'title', type: 'string', description: 'Resource title' },
                { field: 'eventId', type: 'string', description: 'Parent event ID' },
                { field: 'sessionId', type: 'string', description: 'Parent session ID (if linked)' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'order', type: 'number', description: 'Sort order' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the resource was created' },
              ],
              notes: ['You can only access resources belonging to events in companies you have access to.'],
              commonMistakes: ['Using an event ID instead of a resource ID in the path parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['events-resources-list', 'events-resources-create', 'events-resources-update'],
            },
            {
              id: 'events-resources-create',
              name: 'Create Event Resource',
              method: 'POST',
              path: '/api/events/resources',
              purpose: 'Create a new resource under an event.',
              whenToUse: 'Use this endpoint to add a resource (e.g. slide deck, link, document) to an event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Resource title', eventId: 'string (required) — Parent event ID', companyId: 'string (required) — Company ID', sessionId: 'string (optional) — Session ID to link the resource to', order: 'number (optional) — Sort order', url: 'string (optional) — Resource URL', description: 'string (optional) — Resource description' },
              successResponse: {
                status: 201,
                description: 'Resource created',
                body: { _id: '...', title: 'Slide Deck', eventId: '...', companyId: '...', order: 1, createdAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — title, eventId, and companyId are required' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/events/resources \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title": "Slide Deck", "eventId": "EVENT_ID", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/resources', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Slide Deck', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' }),
});
const resource = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/events/resources',
  { title: 'Slide Deck', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Slide Deck', eventId: 'EVENT_ID', companyId: 'YOUR_COMPANY_ID' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/resources', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/events/resources',
    json={'title': 'Slide Deck', 'eventId': 'EVENT_ID', 'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/resources');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Slide Deck', 'eventId' => 'EVENT_ID', 'companyId' => 'YOUR_COMPANY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New resource ID' },
                { field: 'title', type: 'string', description: 'Resource title' },
                { field: 'eventId', type: 'string', description: 'Parent event ID' },
                { field: 'sessionId', type: 'string', description: 'Linked session ID (if applicable)' },
                { field: 'companyId', type: 'string', description: 'Company ID' },
                { field: 'order', type: 'number', description: 'Sort order' },
                { field: 'createdAt', type: 'string', description: 'ISO date when the resource was created' },
              ],
              notes: ['title, eventId, and companyId are required fields.', 'Requires events.create permission.'],
              commonMistakes: ['Omitting eventId — the request will return a 400 validation error.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-resources-list', 'events-resources-detail', 'events-resources-update', 'events-resources-delete'],
            },
            {
              id: 'events-resources-update',
              name: 'Update Event Resource',
              method: 'PUT',
              path: '/api/events/resources/:id',
              purpose: 'Update an existing event resource.',
              whenToUse: 'Use this endpoint to modify a resource such as updating its title, URL, or linked session.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Resource ID to update' },
              ],
              requestBody: { title: 'string (optional) — Updated resource title', sessionId: 'string (optional) — Updated session ID', order: 'number (optional) — Updated sort order', url: 'string (optional) — Updated resource URL', description: 'string (optional) — Updated resource description' },
              successResponse: {
                status: 200,
                description: 'Resource updated',
                body: { _id: '...', title: 'Updated Slide Deck', updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Resource not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/events/resources/RESOURCE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title": "Updated Slide Deck"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/resources/RESOURCE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Slide Deck' }),
});
const resource = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/events/resources/RESOURCE_ID',
  { title: 'Updated Slide Deck' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Slide Deck' });
const options = { hostname: 'api.mengo.ai', path: '/api/events/resources/RESOURCE_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/events/resources/RESOURCE_ID',
    json={'title': 'Updated Slide Deck'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/resources/RESOURCE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Slide Deck']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Resource ID' },
                { field: 'title', type: 'string', description: 'Updated resource title' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the resource was last updated' },
              ],
              notes: ['Only send fields you want to update; omitted fields remain unchanged.', 'Requires events.edit permission.'],
              commonMistakes: ['Trying to update a resource belonging to a company you do not have access to.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-resources-list', 'events-resources-detail', 'events-resources-create', 'events-resources-delete'],
            },
            {
              id: 'events-resources-delete',
              name: 'Delete Event Resource',
              method: 'DELETE',
              path: '/api/events/resources/:id',
              purpose: 'Delete an event resource.',
              whenToUse: 'Use this endpoint to permanently remove a resource from an event.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Resource ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Resource deleted',
                body: { message: 'Resource deleted' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Resource not found' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/events/resources/RESOURCE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/events/resources/RESOURCE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/events/resources/RESOURCE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/events/resources/RESOURCE_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/events/resources/RESOURCE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/events/resources/RESOURCE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Deleting a resource is permanent and cannot be undone.', 'Requires events.delete permission.'],
              commonMistakes: ['Confusing resource ID with session or event ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['events-resources-list', 'events-resources-detail', 'events-resources-update'],
            },
          ],
        },
        // --- PR (Public Relations) ---
        {
          id: 'pr',
          name: 'Public Relations',
          description: 'Manage expert columns, press releases, founder bios, media kits, and media outreach for PR operations.',
          endpoints: [
            // === Expert Columns ===
            {
              id: 'pr-columns-list',
              name: 'List Expert Columns',
              method: 'GET',
              path: '/api/pr/expert-columns/:companyId',
              purpose: 'Retrieve all expert columns for a company.',
              whenToUse: 'Use this endpoint to list all expert columns published or managed by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch expert columns for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of expert columns',
                body: [
                  { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Industry Insights', weekNumber: 26, createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/expert-columns/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/expert-columns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const columns = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/expert-columns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/expert-columns/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/expert-columns/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/expert-columns/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Expert column ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the column belongs to' },
                { field: '[].title', type: 'string', description: 'Column title' },
                { field: '[].weekNumber', type: 'number', description: 'Week number (1-52) the column is scheduled for' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the column was created' },
              ],
              notes: ['Columns are sorted by weekNumber then creation date.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-columns-detail', 'pr-columns-create', 'pr-columns-update', 'pr-columns-delete'],
            },
            {
              id: 'pr-columns-detail',
              name: 'Get Expert Column Detail',
              method: 'GET',
              path: '/api/pr/expert-columns/detail/:id',
              purpose: 'Retrieve a single expert column by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific expert column.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Expert column ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Expert column details',
                body: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Industry Insights', weekNumber: 26, content: '...', createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Expert column not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/expert-columns/detail/COLUMN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/expert-columns/detail/COLUMN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const column = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/expert-columns/detail/COLUMN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/expert-columns/detail/COLUMN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/expert-columns/detail/COLUMN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/expert-columns/detail/COLUMN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Expert column ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.title', type: 'string', description: 'Column title' },
                { field: 'data.weekNumber', type: 'number', description: 'Week number (1-52)' },
                { field: 'data.content', type: 'string', description: 'Column content body' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the column was created' },
              ],
              notes: ['The id path parameter must be a valid MongoDB ObjectId.'],
              commonMistakes: ['Using companyId instead of the column _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-columns-list', 'pr-columns-create', 'pr-columns-update', 'pr-columns-delete'],
            },
            {
              id: 'pr-columns-create',
              name: 'Create Expert Column',
              method: 'POST',
              path: '/api/pr/expert-columns',
              purpose: 'Create a new expert column.',
              whenToUse: 'Use this endpoint to add a new expert column for PR content scheduling.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId', 'title', 'weekNumber'],
                properties: {
                  companyId: { type: 'string', description: 'Company ID the column belongs to' },
                  title: { type: 'string', description: 'Title of the expert column' },
                  weekNumber: { type: 'number', description: 'Week number (1-52) for scheduling' },
                  content: { type: 'string', description: 'Column content body (optional)' },
                },
              },
              successResponse: {
                status: 201,
                description: 'Expert column created successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Industry Insights', weekNumber: 26, content: '', createdAt: '2026-01-15T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Missing required fields: companyId, title, weekNumber' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pr/expert-columns \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Industry Insights","weekNumber":26}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/expert-columns', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Industry Insights', weekNumber: 26 }),
});
const column = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pr/expert-columns', {
  companyId: 'YOUR_COMPANY_ID',
  title: 'Industry Insights',
  weekNumber: 26,
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Industry Insights', weekNumber: 26 });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/expert-columns', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/pr/expert-columns',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Industry Insights', 'weekNumber': 26})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/expert-columns');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Industry Insights', 'weekNumber' => 26]));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Newly created expert column ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.title', type: 'string', description: 'Column title' },
                { field: 'data.weekNumber', type: 'number', description: 'Week number (1-52)' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the column was created' },
              ],
              notes: ['weekNumber must be between 1 and 52.', 'title is required and must be non-empty.'],
              commonMistakes: ['Forgetting to include companyId in the request body.', 'Setting weekNumber outside the 1-52 range.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-columns-list', 'pr-columns-detail', 'pr-columns-update', 'pr-columns-delete'],
            },
            {
              id: 'pr-columns-update',
              name: 'Update Expert Column',
              method: 'PUT',
              path: '/api/pr/expert-columns/:id',
              purpose: 'Update an existing expert column.',
              whenToUse: 'Use this endpoint to modify the title, weekNumber, or content of an expert column.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Expert column ID to update' },
              ],
              requestBody: {
                required: [],
                properties: {
                  title: { type: 'string', description: 'Updated column title' },
                  weekNumber: { type: 'number', description: 'Updated week number (1-52)' },
                  content: { type: 'string', description: 'Updated column content' },
                },
              },
              successResponse: {
                status: 200,
                description: 'Expert column updated successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Updated Title', weekNumber: 30, content: '...', updatedAt: '2026-07-22T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Invalid update data' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Expert column not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Title","weekNumber":30}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Title', weekNumber: 30 }),
});
const column = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID', {
  title: 'Updated Title',
  weekNumber: 30,
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Title', weekNumber: 30 });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/expert-columns/COLUMN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'title': 'Updated Title', 'weekNumber': 30})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Title', 'weekNumber' => 30]));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Expert column ID' },
                { field: 'data.title', type: 'string', description: 'Updated column title' },
                { field: 'data.weekNumber', type: 'number', description: 'Updated week number' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when the column was last updated' },
              ],
              notes: ['All fields are optional — only include the fields you want to update.', 'weekNumber must still be between 1 and 52 if provided.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Sending the entire object instead of only changed fields.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-columns-list', 'pr-columns-detail', 'pr-columns-create', 'pr-columns-delete'],
            },
            {
              id: 'pr-columns-delete',
              name: 'Delete Expert Column',
              method: 'DELETE',
              path: '/api/pr/expert-columns/:id',
              purpose: 'Delete an expert column.',
              whenToUse: 'Use this endpoint to permanently remove an expert column.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Expert column ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Expert column deleted successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', message: 'Expert column deleted successfully' } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Expert column not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/expert-columns/COLUMN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/expert-columns/COLUMN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'ID of the deleted expert column' },
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires admin.write permission.'],
              commonMistakes: ['Using companyId instead of the column _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-columns-list', 'pr-columns-detail', 'pr-columns-update'],
            },
            // === Press Releases ===
            {
              id: 'pr-releases-list',
              name: 'List Press Releases',
              method: 'GET',
              path: '/api/pr/press-releases/:companyId',
              purpose: 'Retrieve all press releases for a company.',
              whenToUse: 'Use this endpoint to list all press releases published or managed by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch press releases for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of press releases',
                body: [
                  { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Product Launch Announcement', eventType: 'product-launch', createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/press-releases/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/press-releases/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const releases = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/press-releases/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/press-releases/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/press-releases/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/press-releases/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Press release ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the press release belongs to' },
                { field: '[].title', type: 'string', description: 'Press release title' },
                { field: '[].eventType', type: 'string', description: 'Type of event (e.g., product-launch, partnership, award)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the press release was created' },
              ],
              notes: ['Press releases are sorted by creation date, newest first.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-releases-detail', 'pr-releases-create', 'pr-releases-update', 'pr-releases-delete'],
            },
            {
              id: 'pr-releases-detail',
              name: 'Get Press Release Detail',
              method: 'GET',
              path: '/api/pr/press-releases/detail/:id',
              purpose: 'Retrieve a single press release by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific press release.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Press release ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Press release details',
                body: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Product Launch Announcement', eventType: 'product-launch', content: '...', createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Press release not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/press-releases/detail/RELEASE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/press-releases/detail/RELEASE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const release = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/press-releases/detail/RELEASE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/press-releases/detail/RELEASE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/press-releases/detail/RELEASE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/press-releases/detail/RELEASE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Press release ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.title', type: 'string', description: 'Press release title' },
                { field: 'data.eventType', type: 'string', description: 'Event type (e.g., product-launch, partnership, award)' },
                { field: 'data.content', type: 'string', description: 'Press release content body' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the press release was created' },
              ],
              notes: ['The id path parameter must be a valid MongoDB ObjectId.'],
              commonMistakes: ['Using companyId instead of the press release _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-releases-list', 'pr-releases-create', 'pr-releases-update', 'pr-releases-delete'],
            },
            {
              id: 'pr-releases-create',
              name: 'Create Press Release',
              method: 'POST',
              path: '/api/pr/press-releases',
              purpose: 'Create a new press release.',
              whenToUse: 'Use this endpoint to add a new press release for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId', 'title', 'eventType'],
                properties: {
                  companyId: { type: 'string', description: 'Company ID the press release belongs to' },
                  title: { type: 'string', description: 'Title of the press release' },
                  eventType: { type: 'string', description: 'Type of event (e.g., product-launch, partnership, award, milestone, announcement)' },
                  content: { type: 'string', description: 'Press release content body (optional)' },
                },
              },
              successResponse: {
                status: 201,
                description: 'Press release created successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Product Launch Announcement', eventType: 'product-launch', content: '', createdAt: '2026-01-15T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Missing required fields: companyId, title, eventType' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pr/press-releases \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Product Launch Announcement","eventType":"product-launch"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/press-releases', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Product Launch Announcement', eventType: 'product-launch' }),
});
const release = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pr/press-releases', {
  companyId: 'YOUR_COMPANY_ID',
  title: 'Product Launch Announcement',
  eventType: 'product-launch',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Product Launch Announcement', eventType: 'product-launch' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/press-releases', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/pr/press-releases',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Product Launch Announcement', 'eventType': 'product-launch'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/press-releases');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Product Launch Announcement', 'eventType' => 'product-launch']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Newly created press release ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.title', type: 'string', description: 'Press release title' },
                { field: 'data.eventType', type: 'string', description: 'Event type' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the press release was created' },
              ],
              notes: ['eventType is required and must be a valid event type.', 'title is required and must be non-empty.'],
              commonMistakes: ['Forgetting to include companyId in the request body.', 'Omitting the required eventType field.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-releases-list', 'pr-releases-detail', 'pr-releases-update', 'pr-releases-delete'],
            },
            {
              id: 'pr-releases-update',
              name: 'Update Press Release',
              method: 'PUT',
              path: '/api/pr/press-releases/:id',
              purpose: 'Update an existing press release.',
              whenToUse: 'Use this endpoint to modify the title, eventType, or content of a press release.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Press release ID to update' },
              ],
              requestBody: {
                required: [],
                properties: {
                  title: { type: 'string', description: 'Updated press release title' },
                  eventType: { type: 'string', description: 'Updated event type' },
                  content: { type: 'string', description: 'Updated press release content' },
                },
              },
              successResponse: {
                status: 200,
                description: 'Press release updated successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', title: 'Updated Title', eventType: 'partnership', content: '...', updatedAt: '2026-07-22T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Invalid update data' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Press release not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Title","eventType":"partnership"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Title', eventType: 'partnership' }),
});
const release = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID', {
  title: 'Updated Title',
  eventType: 'partnership',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Title', eventType: 'partnership' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/press-releases/RELEASE_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'title': 'Updated Title', 'eventType': 'partnership'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Title', 'eventType' => 'partnership']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Press release ID' },
                { field: 'data.title', type: 'string', description: 'Updated press release title' },
                { field: 'data.eventType', type: 'string', description: 'Updated event type' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when the press release was last updated' },
              ],
              notes: ['All fields are optional — only include the fields you want to update.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Sending the entire object instead of only changed fields.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-releases-list', 'pr-releases-detail', 'pr-releases-create', 'pr-releases-delete'],
            },
            {
              id: 'pr-releases-delete',
              name: 'Delete Press Release',
              method: 'DELETE',
              path: '/api/pr/press-releases/:id',
              purpose: 'Delete a press release.',
              whenToUse: 'Use this endpoint to permanently remove a press release.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Press release ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Press release deleted successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', message: 'Press release deleted successfully' } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Press release not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/press-releases/RELEASE_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/press-releases/RELEASE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'ID of the deleted press release' },
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires admin.write permission.'],
              commonMistakes: ['Using companyId instead of the press release _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-releases-list', 'pr-releases-detail', 'pr-releases-update'],
            },
            // === Founder Bios ===
            {
              id: 'pr-bios-list',
              name: 'List Founder Bios',
              method: 'GET',
              path: '/api/pr/founder-bios/:companyId',
              purpose: 'Retrieve all founder bios for a company.',
              whenToUse: 'Use this endpoint to list all founder bios managed by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch founder bios for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of founder bios',
                body: [
                  { _id: '507f1f77bcf86cd799439011', companyId: '...', personName: 'Jane Doe', bioType: 'founder', createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/founder-bios/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/founder-bios/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const bios = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/founder-bios/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/founder-bios/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/founder-bios/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/founder-bios/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Founder bio ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the bio belongs to' },
                { field: '[].personName', type: 'string', description: 'Name of the person' },
                { field: '[].bioType', type: 'string', description: 'Type of bio (founder, co-founder, executive, advisor)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the bio was created' },
              ],
              notes: ['Founder bios are sorted by creation date.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-bios-detail', 'pr-bios-create', 'pr-bios-update', 'pr-bios-delete'],
            },
            {
              id: 'pr-bios-detail',
              name: 'Get Founder Bio Detail',
              method: 'GET',
              path: '/api/pr/founder-bios/detail/:id',
              purpose: 'Retrieve a single founder bio by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific founder bio.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder bio ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Founder bio details',
                body: { _id: '507f1f77bcf86cd799439011', companyId: '...', personName: 'Jane Doe', bioType: 'founder', content: '...', createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder bio not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/founder-bios/detail/BIO_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/founder-bios/detail/BIO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const bio = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/founder-bios/detail/BIO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/founder-bios/detail/BIO_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/founder-bios/detail/BIO_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/founder-bios/detail/BIO_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Founder bio ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.personName', type: 'string', description: 'Name of the person' },
                { field: 'data.bioType', type: 'string', description: 'Type of bio (founder, co-founder, executive, advisor)' },
                { field: 'data.content', type: 'string', description: 'Bio content body' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the bio was created' },
              ],
              notes: ['The id path parameter must be a valid MongoDB ObjectId.'],
              commonMistakes: ['Using companyId instead of the bio _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-bios-list', 'pr-bios-create', 'pr-bios-update', 'pr-bios-delete'],
            },
            {
              id: 'pr-bios-create',
              name: 'Create Founder Bio',
              method: 'POST',
              path: '/api/pr/founder-bios',
              purpose: 'Create a new founder bio.',
              whenToUse: 'Use this endpoint to add a new founder bio for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId', 'personName', 'bioType'],
                properties: {
                  companyId: { type: 'string', description: 'Company ID the bio belongs to' },
                  personName: { type: 'string', description: 'Name of the person' },
                  bioType: { type: 'string', description: 'Type of bio (founder, co-founder, executive, advisor)' },
                  content: { type: 'string', description: 'Bio content body (optional)' },
                },
              },
              successResponse: {
                status: 201,
                description: 'Founder bio created successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', personName: 'Jane Doe', bioType: 'founder', content: '', createdAt: '2026-01-15T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Missing required fields: companyId, personName, bioType' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pr/founder-bios \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","personName":"Jane Doe","bioType":"founder"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/founder-bios', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', personName: 'Jane Doe', bioType: 'founder' }),
});
const bio = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pr/founder-bios', {
  companyId: 'YOUR_COMPANY_ID',
  personName: 'Jane Doe',
  bioType: 'founder',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', personName: 'Jane Doe', bioType: 'founder' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/founder-bios', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/pr/founder-bios',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'personName': 'Jane Doe', 'bioType': 'founder'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/founder-bios');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'personName' => 'Jane Doe', 'bioType' => 'founder']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Newly created founder bio ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.personName', type: 'string', description: 'Name of the person' },
                { field: 'data.bioType', type: 'string', description: 'Type of bio' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the bio was created' },
              ],
              notes: ['bioType must be one of: founder, co-founder, executive, advisor.', 'personName is required and must be non-empty.'],
              commonMistakes: ['Forgetting to include companyId in the request body.', 'Using an invalid bioType value.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-bios-list', 'pr-bios-detail', 'pr-bios-update', 'pr-bios-delete'],
            },
            {
              id: 'pr-bios-update',
              name: 'Update Founder Bio',
              method: 'PUT',
              path: '/api/pr/founder-bios/:id',
              purpose: 'Update an existing founder bio.',
              whenToUse: 'Use this endpoint to modify the personName, bioType, or content of a founder bio.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder bio ID to update' },
              ],
              requestBody: {
                required: [],
                properties: {
                  personName: { type: 'string', description: 'Updated person name' },
                  bioType: { type: 'string', description: 'Updated bio type (founder, co-founder, executive, advisor)' },
                  content: { type: 'string', description: 'Updated bio content' },
                },
              },
              successResponse: {
                status: 200,
                description: 'Founder bio updated successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', personName: 'Jane Doe Updated', bioType: 'co-founder', content: '...', updatedAt: '2026-07-22T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Invalid update data' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder bio not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pr/founder-bios/BIO_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"personName":"Jane Doe Updated","bioType":"co-founder"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ personName: 'Jane Doe Updated', bioType: 'co-founder' }),
});
const bio = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID', {
  personName: 'Jane Doe Updated',
  bioType: 'co-founder',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ personName: 'Jane Doe Updated', bioType: 'co-founder' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/founder-bios/BIO_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'personName': 'Jane Doe Updated', 'bioType': 'co-founder'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['personName' => 'Jane Doe Updated', 'bioType' => 'co-founder']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Founder bio ID' },
                { field: 'data.personName', type: 'string', description: 'Updated person name' },
                { field: 'data.bioType', type: 'string', description: 'Updated bio type' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when the bio was last updated' },
              ],
              notes: ['All fields are optional — only include the fields you want to update.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Sending the entire object instead of only changed fields.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-bios-list', 'pr-bios-detail', 'pr-bios-create', 'pr-bios-delete'],
            },
            {
              id: 'pr-bios-delete',
              name: 'Delete Founder Bio',
              method: 'DELETE',
              path: '/api/pr/founder-bios/:id',
              purpose: 'Delete a founder bio.',
              whenToUse: 'Use this endpoint to permanently remove a founder bio.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Founder bio ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Founder bio deleted successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', message: 'Founder bio deleted successfully' } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Founder bio not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/pr/founder-bios/BIO_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/founder-bios/BIO_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/founder-bios/BIO_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'ID of the deleted founder bio' },
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires admin.write permission.'],
              commonMistakes: ['Using companyId instead of the bio _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-bios-list', 'pr-bios-detail', 'pr-bios-update'],
            },
            // === Media Kits ===
            {
              id: 'pr-kits-list',
              name: 'List Media Kits',
              method: 'GET',
              path: '/api/pr/media-kits/:companyId',
              purpose: 'Retrieve all media kits for a company.',
              whenToUse: 'Use this endpoint to list all media kits managed by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch media kits for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of media kits',
                body: [
                  { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Product Launch Kit', createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/media-kits/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-kits/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const kits = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/media-kits/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/media-kits/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/media-kits/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-kits/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Media kit ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the kit belongs to' },
                { field: '[].name', type: 'string', description: 'Media kit name' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the media kit was created' },
              ],
              notes: ['Media kits are sorted by creation date.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-kits-detail', 'pr-kits-create', 'pr-kits-update', 'pr-kits-delete'],
            },
            {
              id: 'pr-kits-detail',
              name: 'Get Media Kit Detail',
              method: 'GET',
              path: '/api/pr/media-kits/detail/:id',
              purpose: 'Retrieve a single media kit by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific media kit.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media kit ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Media kit details',
                body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Product Launch Kit', content: '...', createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media kit not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/media-kits/detail/KIT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-kits/detail/KIT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const kit = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/media-kits/detail/KIT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/media-kits/detail/KIT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/media-kits/detail/KIT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-kits/detail/KIT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Media kit ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.name', type: 'string', description: 'Media kit name' },
                { field: 'data.content', type: 'string', description: 'Media kit content' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the media kit was created' },
              ],
              notes: ['The id path parameter must be a valid MongoDB ObjectId.'],
              commonMistakes: ['Using companyId instead of the kit _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-kits-list', 'pr-kits-create', 'pr-kits-update', 'pr-kits-delete'],
            },
            {
              id: 'pr-kits-create',
              name: 'Create Media Kit',
              method: 'POST',
              path: '/api/pr/media-kits',
              purpose: 'Create a new media kit.',
              whenToUse: 'Use this endpoint to add a new media kit for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId', 'name'],
                properties: {
                  companyId: { type: 'string', description: 'Company ID the media kit belongs to' },
                  name: { type: 'string', description: 'Name of the media kit' },
                  content: { type: 'string', description: 'Media kit content (optional)' },
                },
              },
              successResponse: {
                status: 201,
                description: 'Media kit created successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Product Launch Kit', content: '', createdAt: '2026-01-15T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Missing required fields: companyId, name' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pr/media-kits \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Product Launch Kit"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-kits', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Kit' }),
});
const kit = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pr/media-kits', {
  companyId: 'YOUR_COMPANY_ID',
  name: 'Product Launch Kit',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Kit' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-kits', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/pr/media-kits',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Launch Kit'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-kits');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Launch Kit']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Newly created media kit ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.name', type: 'string', description: 'Media kit name' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the media kit was created' },
              ],
              notes: ['name is required and must be non-empty.'],
              commonMistakes: ['Forgetting to include companyId in the request body.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-kits-list', 'pr-kits-detail', 'pr-kits-update', 'pr-kits-delete'],
            },
            {
              id: 'pr-kits-update',
              name: 'Update Media Kit',
              method: 'PUT',
              path: '/api/pr/media-kits/:id',
              purpose: 'Update an existing media kit.',
              whenToUse: 'Use this endpoint to modify the name or content of a media kit.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media kit ID to update' },
              ],
              requestBody: {
                required: [],
                properties: {
                  name: { type: 'string', description: 'Updated media kit name' },
                  content: { type: 'string', description: 'Updated media kit content' },
                },
              },
              successResponse: {
                status: 200,
                description: 'Media kit updated successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Updated Kit Name', content: '...', updatedAt: '2026-07-22T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Invalid update data' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media kit not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pr/media-kits/KIT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Kit Name"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-kits/KIT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Kit Name' }),
});
const kit = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pr/media-kits/KIT_ID', {
  name: 'Updated Kit Name',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Kit Name' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-kits/KIT_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/pr/media-kits/KIT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'name': 'Updated Kit Name'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-kits/KIT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Kit Name']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Media kit ID' },
                { field: 'data.name', type: 'string', description: 'Updated media kit name' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when the media kit was last updated' },
              ],
              notes: ['All fields are optional — only include the fields you want to update.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Sending the entire object instead of only changed fields.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-kits-list', 'pr-kits-detail', 'pr-kits-create', 'pr-kits-delete'],
            },
            {
              id: 'pr-kits-delete',
              name: 'Delete Media Kit',
              method: 'DELETE',
              path: '/api/pr/media-kits/:id',
              purpose: 'Delete a media kit.',
              whenToUse: 'Use this endpoint to permanently remove a media kit.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media kit ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Media kit deleted successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', message: 'Media kit deleted successfully' } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media kit not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/pr/media-kits/KIT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-kits/KIT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pr/media-kits/KIT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-kits/KIT_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/pr/media-kits/KIT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-kits/KIT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'ID of the deleted media kit' },
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires admin.write permission.'],
              commonMistakes: ['Using companyId instead of the kit _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-kits-list', 'pr-kits-detail', 'pr-kits-update'],
            },
            // === Media Outreach ===
            {
              id: 'pr-outreach-list',
              name: 'List Media Outreach',
              method: 'GET',
              path: '/api/pr/media-outreach/:companyId',
              purpose: 'Retrieve all media outreach records for a company.',
              whenToUse: 'Use this endpoint to list all media outreach activities managed by a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch media outreach for' },
              ],
              successResponse: {
                status: 200,
                description: 'List of media outreach records',
                body: [
                  { _id: '507f1f77bcf86cd799439011', companyId: '...', outlet: 'TechCrunch', status: 'pitched', createdAt: '2026-01-15T10:00:00Z' },
                ],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/media-outreach/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-outreach/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const outreach = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/media-outreach/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/media-outreach/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/media-outreach/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-outreach/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Media outreach ID' },
                { field: '[].companyId', type: 'string', description: 'Company ID the outreach belongs to' },
                { field: '[].outlet', type: 'string', description: 'Media outlet name' },
                { field: '[].status', type: 'string', description: 'Outreach status (pitched, responded, scheduled, published, declined)' },
                { field: '[].createdAt', type: 'string', description: 'ISO date when the outreach was created' },
              ],
              notes: ['Media outreach records are sorted by creation date, newest first.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-outreach-detail', 'pr-outreach-create', 'pr-outreach-update', 'pr-outreach-delete'],
            },
            {
              id: 'pr-outreach-detail',
              name: 'Get Media Outreach Detail',
              method: 'GET',
              path: '/api/pr/media-outreach/detail/:id',
              purpose: 'Retrieve a single media outreach record by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific media outreach record.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media outreach ID to retrieve' },
              ],
              successResponse: {
                status: 200,
                description: 'Media outreach details',
                body: { _id: '507f1f77bcf86cd799439011', companyId: '...', outlet: 'TechCrunch', status: 'pitched', content: '...', createdAt: '2026-01-15T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media outreach not found' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pr/media-outreach/detail/OUTREACH_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-outreach/detail/OUTREACH_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const outreach = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pr/media-outreach/detail/OUTREACH_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/pr/media-outreach/detail/OUTREACH_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let body = '';
  res.on('data', c => body += c);
  res.on('end', () => console.log(JSON.parse(body)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/pr/media-outreach/detail/OUTREACH_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-outreach/detail/OUTREACH_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Media outreach ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.outlet', type: 'string', description: 'Media outlet name' },
                { field: 'data.status', type: 'string', description: 'Outreach status' },
                { field: 'data.content', type: 'string', description: 'Outreach content/pitch' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the outreach was created' },
              ],
              notes: ['The id path parameter must be a valid MongoDB ObjectId.'],
              commonMistakes: ['Using companyId instead of the outreach _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pr-outreach-list', 'pr-outreach-create', 'pr-outreach-update', 'pr-outreach-delete'],
            },
            {
              id: 'pr-outreach-create',
              name: 'Create Media Outreach',
              method: 'POST',
              path: '/api/pr/media-outreach',
              purpose: 'Create a new media outreach record.',
              whenToUse: 'Use this endpoint to add a new media outreach activity for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId'],
                properties: {
                  companyId: { type: 'string', description: 'Company ID the outreach belongs to' },
                  outlet: { type: 'string', description: 'Media outlet name (optional)' },
                  status: { type: 'string', description: 'Outreach status: pitched, responded, scheduled, published, declined (optional)' },
                  content: { type: 'string', description: 'Outreach content/pitch (optional)' },
                },
              },
              successResponse: {
                status: 201,
                description: 'Media outreach created successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', outlet: 'TechCrunch', status: 'pitched', content: '', createdAt: '2026-01-15T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Missing required field: companyId' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pr/media-outreach \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","outlet":"TechCrunch","status":"pitched"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-outreach', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', outlet: 'TechCrunch', status: 'pitched' }),
});
const outreach = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pr/media-outreach', {
  companyId: 'YOUR_COMPANY_ID',
  outlet: 'TechCrunch',
  status: 'pitched',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', outlet: 'TechCrunch', status: 'pitched' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-outreach', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/pr/media-outreach',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'companyId': 'YOUR_COMPANY_ID', 'outlet': 'TechCrunch', 'status': 'pitched'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-outreach');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'outlet' => 'TechCrunch', 'status' => 'pitched']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Newly created media outreach ID' },
                { field: 'data.companyId', type: 'string', description: 'Company ID' },
                { field: 'data.outlet', type: 'string', description: 'Media outlet name' },
                { field: 'data.status', type: 'string', description: 'Outreach status' },
                { field: 'data.createdAt', type: 'string', description: 'ISO date when the outreach was created' },
              ],
              notes: ['companyId is required. All other fields are optional.'],
              commonMistakes: ['Forgetting to include companyId in the request body.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-outreach-list', 'pr-outreach-detail', 'pr-outreach-update', 'pr-outreach-delete'],
            },
            {
              id: 'pr-outreach-update',
              name: 'Update Media Outreach',
              method: 'PUT',
              path: '/api/pr/media-outreach/:id',
              purpose: 'Update an existing media outreach record.',
              whenToUse: 'Use this endpoint to modify the outlet, status, or content of a media outreach record.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media outreach ID to update' },
              ],
              requestBody: {
                required: [],
                properties: {
                  outlet: { type: 'string', description: 'Updated media outlet name' },
                  status: { type: 'string', description: 'Updated outreach status (pitched, responded, scheduled, published, declined)' },
                  content: { type: 'string', description: 'Updated outreach content/pitch' },
                },
              },
              successResponse: {
                status: 200,
                description: 'Media outreach updated successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', companyId: '...', outlet: 'Updated Outlet', status: 'responded', content: '...', updatedAt: '2026-07-22T10:00:00Z' } },
              },
              errorResponses: [
                { code: 400, message: 'Invalid update data' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media outreach not found' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status":"responded","outlet":"Updated Outlet"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'responded', outlet: 'Updated Outlet' }),
});
const outreach = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID', {
  status: 'responded',
  outlet: 'Updated Outlet',
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ status: 'responded', outlet: 'Updated Outlet' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-outreach/OUTREACH_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={'status': 'responded', 'outlet': 'Updated Outlet'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'responded', 'outlet' => 'Updated Outlet']));
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Media outreach ID' },
                { field: 'data.outlet', type: 'string', description: 'Updated media outlet name' },
                { field: 'data.status', type: 'string', description: 'Updated outreach status' },
                { field: 'data.updatedAt', type: 'string', description: 'ISO date when the outreach was last updated' },
              ],
              notes: ['All fields are optional — only include the fields you want to update.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Sending the entire object instead of only changed fields.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-outreach-list', 'pr-outreach-detail', 'pr-outreach-create', 'pr-outreach-delete'],
            },
            {
              id: 'pr-outreach-delete',
              name: 'Delete Media Outreach',
              method: 'DELETE',
              path: '/api/pr/media-outreach/:id',
              purpose: 'Delete a media outreach record.',
              whenToUse: 'Use this endpoint to permanently remove a media outreach record.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Media outreach ID to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Media outreach deleted successfully',
                body: { data: { _id: '507f1f77bcf86cd799439011', message: 'Media outreach deleted successfully' } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Media outreach not found' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/pr/media-outreach/OUTREACH_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php
$ch = curl_init('https://app.mengoengine.com/api/pr/media-outreach/OUTREACH_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'ID of the deleted media outreach record' },
                { field: 'data.message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Requires admin.write permission.'],
              commonMistakes: ['Using companyId instead of the outreach _id in the URL path.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pr-outreach-list', 'pr-outreach-detail', 'pr-outreach-update'],
            },
          ],
        },
        {
          id: 'interview-media-prep',
          name: 'Interview & Media Prep',
          description: 'Interview coaching sessions, media preparation, and AI-generated Q&A with coaching tips.',
          endpoints: [
            {
              id: 'imp-sessions-list',
              name: 'List Sessions',
              method: 'GET',
              path: '/api/interview-media-prep/sessions',
              purpose: 'Retrieve all interview/media prep sessions for a company with optional filtering by type and status.',
              whenToUse: 'Use this endpoint to list all preparation sessions, optionally filtered by type (podcast, rapid-fire, interview, panel-discussion, etc.) or status (draft, generating, completed, archived, failed).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              queryParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch sessions for' },
                { name: 'type', type: 'string', required: false, description: 'Filter by prep type: podcast, rapid-fire, interview, panel-discussion, founder-interview, employee-interview, media-interview, tv-interview, press-conference, journalist, investor-interview, startup-interview, crisis-management, product-launch, custom' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, generating, completed, archived, failed' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Results per page (default 50, max 100)' },
              ],
              successResponse: { status: 200, description: 'Paginated list of sessions', body: { sessions: [{ id: 'imp_1721640000000_abc123', name: 'Product Launch Interview', type: 'product-launch', status: 'completed', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10, aiGenerated: true, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:15:00Z' }], total: 5, page: 1, limit: 50, totalPages: 1 } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing companyId' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/interview-media-prep/sessions?companyId=YOUR_COMPANY_ID&type=interview&status=completed" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions?companyId=YOUR_COMPANY_ID&type=interview', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const data = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/interview-media-prep/sessions', {
  params: { companyId: 'YOUR_COMPANY_ID', type: 'interview' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions?companyId=YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/interview-media-prep/sessions',
    params={'companyId': 'YOUR_COMPANY_ID', 'type': 'interview'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions?companyId=YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'sessions', type: 'array', description: 'Array of session objects' },
                { field: 'sessions[].id', type: 'string', description: 'Unique session ID (imp_ prefix)' },
                { field: 'sessions[].name', type: 'string', description: 'Session name' },
                { field: 'sessions[].type', type: 'string', description: 'Prep type (podcast, interview, media-interview, etc.)' },
                { field: 'sessions[].status', type: 'string', description: 'Session status (draft, generating, completed, archived, failed)' },
                { field: 'sessions[].speakerName', type: 'string', description: 'Name of the speaker' },
                { field: 'sessions[].questionCount', type: 'number', description: 'Number of interview questions' },
                { field: 'sessions[].aiGenerated', type: 'boolean', description: 'Whether AI content has been generated' },
                { field: 'total', type: 'number', description: 'Total number of sessions' },
                { field: 'page', type: 'number', description: 'Current page number' },
                { field: 'limit', type: 'number', description: 'Results per page' },
                { field: 'totalPages', type: 'number', description: 'Total number of pages' },
              ],
              notes: ['Sessions are stored as sub-documents within a company document. If no document exists, returns empty array.', 'The createdAt field is derived from the session ID for legacy entries.'],
              commonMistakes: ['Omitting the required companyId query parameter.', 'Using an invalid type value — must be one of the 15 allowed enum values.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['imp-session-detail', 'imp-session-create', 'imp-session-generate'],
            },
            {
              id: 'imp-session-detail',
              name: 'Get Session Detail',
              method: 'GET',
              path: '/api/interview-media-prep/sessions/:sessionId',
              purpose: 'Retrieve a single interview/media prep session by its ID.',
              whenToUse: 'Use this endpoint to get full details of a specific session including questions, coaching tips, and AI-generated content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              queryParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID the session belongs to' },
              ],
              pathParams: [
                { name: 'sessionId', type: 'string', required: true, description: 'Session ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Session details', body: { session: { id: 'imp_1721640000000_abc123', name: 'Product Launch Interview', type: 'product-launch', status: 'completed', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10, questions: [], coachingTips: [], aiGenerated: true, aiModel: 'claude-3-5-sonnet', aiProvider: 'claude', aiTokensUsed: 5000, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:15:00Z' } } },
              errorResponses: [
                { code: 404, message: 'Session not found' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const { session } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123', {
  params: { companyId: 'YOUR_COMPANY_ID' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123',
    params={'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'session.id', type: 'string', description: 'Unique session ID' },
                { field: 'session.name', type: 'string', description: 'Session name' },
                { field: 'session.type', type: 'string', description: 'Preparation type' },
                { field: 'session.status', type: 'string', description: 'Session status' },
                { field: 'session.questions', type: 'array', description: 'Array of interview question objects with suggested answers' },
                { field: 'session.coachingTips', type: 'array', description: 'Array of coaching tip objects' },
                { field: 'session.aiGenerated', type: 'boolean', description: 'Whether AI content was generated' },
                { field: 'session.aiModel', type: 'string', description: 'AI model used for generation' },
              ],
              notes: ['The session includes full question objects with suggestedAnswer, expertAnswer, shortAnswer, longAnswer, and more.'],
              commonMistakes: ['Omitting the companyId query parameter.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['imp-sessions-list', 'imp-session-create', 'imp-session-generate'],
            },
            {
              id: 'imp-session-create',
              name: 'Create Session',
              method: 'POST',
              path: '/api/interview-media-prep/sessions',
              purpose: 'Create a new interview/media prep session.',
              whenToUse: 'Use this endpoint to create a new preparation session for interview coaching.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Interview', type: 'product-launch', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10 },
              successResponse: { status: 201, description: 'Session created', body: { session: { id: 'imp_1721640000000_abc123', name: 'Product Launch Interview', type: 'product-launch', status: 'draft', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10, includeExpertAnswers: true, includeFollowUps: true, includeCoachingTips: true, questions: [], coachingTips: [], aiGenerated: false, createdAt: '2026-07-22T10:00:00Z' }, documentId: '507f1f77bcf86cd799439011' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields' },
                { code: 401, message: 'Invalid or expired token' },
                { code: 11000, message: 'Duplicate entry' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/interview-media-prep/sessions \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Product Launch Interview","type":"product-launch","speakerType":"founder","speakerName":"Jane Doe","difficulty":"intermediate","language":"english","questionCount":10}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Interview', type: 'product-launch', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/interview-media-prep/sessions',
  { companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Interview', type: 'product-launch', speakerType: 'founder', speakerName: 'Jane Doe', difficulty: 'intermediate', language: 'english', questionCount: 10 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Interview', type: 'product-launch', speakerType: 'founder', speakerName: 'Jane Doe' });
const options = { hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/interview-media-prep/sessions',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Launch Interview', 'type': 'product-launch', 'speakerType': 'founder', 'speakerName': 'Jane Doe'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Launch Interview', 'type' => 'product-launch', 'speakerType' => 'founder', 'speakerName' => 'Jane Doe']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'session.id', type: 'string', description: 'Auto-generated session ID (imp_timestamp_random)' },
                { field: 'session.name', type: 'string', description: 'Session name' },
                { field: 'session.type', type: 'string', description: 'Preparation type' },
                { field: 'session.status', type: 'string', description: 'Always "draft" on creation' },
                { field: 'session.speakerName', type: 'string', description: 'Name of the speaker' },
                { field: 'documentId', type: 'string', description: 'MongoDB document ID containing the sessions array' },
              ],
              notes: ['Required fields: companyId, name, type, speakerType, speakerName.', 'Valid type values: podcast, rapid-fire, interview, panel-discussion, founder-interview, employee-interview, media-interview, tv-interview, press-conference, journalist, investor-interview, startup-interview, crisis-management, product-launch, custom.', 'Valid speakerType values: founder, employee, ceo, manager, entrepreneur, student, other.'],
              commonMistakes: ['Omitting required fields (name, type, speakerType, speakerName).', 'Using an invalid type or speakerType enum value.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['imp-sessions-list', 'imp-session-detail', 'imp-session-generate'],
            },
            {
              id: 'imp-session-update',
              name: 'Update Session',
              method: 'PUT',
              path: '/api/interview-media-prep/sessions/:sessionId',
              purpose: 'Update an existing interview/media prep session.',
              whenToUse: 'Use this endpoint to modify session fields such as name, type, speaker details, questions, or coaching tips.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              queryParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID the session belongs to' },
              ],
              pathParams: [
                { name: 'sessionId', type: 'string', required: true, description: 'Session ID to update' },
              ],
              requestBody: { name: 'Updated Interview Session', status: 'completed' },
              successResponse: { status: 200, description: 'Session updated', body: { session: { id: 'imp_1721640000000_abc123', name: 'Updated Interview Session', status: 'completed', updatedAt: '2026-07-22T11:00:00Z' } } },
              errorResponses: [
                { code: 400, message: 'Validation error' },
                { code: 404, message: 'Session not found' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Session","status":"completed"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Session', status: 'completed' }),
});
const { session } = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123',
  { name: 'Updated Session', status: 'completed' },
  { params: { companyId: 'YOUR_COMPANY_ID' }, headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Session', status: 'completed' });
const options = { hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123',
    params={'companyId': 'YOUR_COMPANY_ID'},
    json={'name': 'Updated Session', 'status': 'completed'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Session', 'status' => 'completed']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'session.id', type: 'string', description: 'Session ID' },
                { field: 'session.name', type: 'string', description: 'Updated session name' },
                { field: 'session.updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Allowed update fields: name, type, speakerType, speakerName, speakerPosition, speakerCompany, speakerIndustry, speakerDepartment, speakerBio, difficulty, language, audienceType, questionCount, includeExpertAnswers, includeFollowUps, includeCoachingTips, contextTopic, contextIndustry, contextAudience, contextInterviewType, questions, coachingTips, status, notes, tags.'],
              commonMistakes: ['Omitting the companyId query parameter.', 'Attempting to update immutable fields like id or createdAt.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['imp-session-create', 'imp-session-detail', 'imp-session-generate'],
            },
            {
              id: 'imp-session-delete',
              name: 'Delete Session',
              method: 'DELETE',
              path: '/api/interview-media-prep/sessions/:sessionId',
              purpose: 'Delete an interview/media prep session.',
              whenToUse: 'Use this endpoint to permanently remove a session and all its questions and coaching tips.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              queryParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID the session belongs to' },
              ],
              pathParams: [
                { name: 'sessionId', type: 'string', required: true, description: 'Session ID to delete' },
              ],
              successResponse: { status: 200, description: 'Session deleted', body: { success: true, message: 'Session deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Session not found' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123', {
  params: { companyId: 'YOUR_COMPANY_ID' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123',
    params={'companyId': 'YOUR_COMPANY_ID'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123?companyId=YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Whether the deletion was successful' },
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Omitting the companyId query parameter.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['imp-sessions-list', 'imp-session-detail'],
            },
            {
              id: 'imp-session-generate',
              name: 'Generate Interview Content (AI)',
              method: 'POST',
              path: '/api/interview-media-prep/sessions/:sessionId/generate',
              purpose: 'AI-generate interview questions and coaching tips for a session.',
              whenToUse: 'Use this endpoint to trigger AI generation of interview questions and coaching tips based on the session configuration and company context.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              queryParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              pathParams: [
                { name: 'sessionId', type: 'string', required: true, description: 'Session ID to generate content for' },
              ],
              requestBody: { regenerateQuestions: true, regenerateCoachingTips: true },
              successResponse: { status: 200, description: 'AI content generated', body: { success: true, session: { id: 'imp_1721640000000_abc123', status: 'completed', aiGenerated: true, aiModel: 'claude-3-5-sonnet', aiProvider: 'claude', aiTokensUsed: 5000, questions: [], coachingTips: [] }, tokensUsed: 5000 } },
              errorResponses: [
                { code: 404, message: 'Session not found' },
                { code: 408, message: 'Request timeout — AI generation took too long' },
                { code: 503, message: 'AI service not configured properly' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate?companyId=YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"regenerateQuestions":true,"regenerateCoachingTips":true}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate?companyId=YOUR_COMPANY_ID', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ regenerateQuestions: true, regenerateCoachingTips: true }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate',
  { regenerateQuestions: true, regenerateCoachingTips: true },
  { params: { companyId: 'YOUR_COMPANY_ID' }, headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ regenerateQuestions: true, regenerateCoachingTips: true });
const options = { hostname: 'api.mengo.ai', path: '/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate?companyId=YOUR_COMPANY_ID', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate',
    params={'companyId': 'YOUR_COMPANY_ID'},
    json={'regenerateQuestions': True, 'regenerateCoachingTips': True},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/interview-media-prep/sessions/imp_1721640000000_abc123/generate?companyId=YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['regenerateQuestions' => true, 'regenerateCoachingTips' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Whether generation was successful' },
                { field: 'session.status', type: 'string', description: 'Session status (completed on success)' },
                { field: 'session.aiGenerated', type: 'boolean', description: 'True after successful generation' },
                { field: 'session.aiModel', type: 'string', description: 'AI model used for generation' },
                { field: 'session.aiProvider', type: 'string', description: 'AI provider used' },
                { field: 'tokensUsed', type: 'number', description: 'Total tokens consumed by AI generation' },
              ],
              notes: ['This endpoint uses the AI service to generate questions and coaching tips based on the session configuration.', 'The session status changes to "generating" during generation and "completed" on success.', 'If AI generation fails, the status reverts to "draft".', 'Company context (business profile, brand, ICP, etc.) is automatically included in the AI prompt.'],
              commonMistakes: ['Not waiting for generation to complete before polling for results.', 'Omitting the companyId query parameter.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['imp-session-create', 'imp-session-detail'],
            },
          ],
        },
        {
          id: 'intro-scripts',
          name: 'Intro Scripts',
          description: 'Introduction script management for events, networking, and presentations.',
          endpoints: [
            {
              id: 'intro-list',
              name: 'List Intro Scripts',
              method: 'GET',
              path: '/api/intro-scripts/:companyId',
              purpose: 'Retrieve all intro scripts for a company with optional filtering.',
              whenToUse: 'Use this endpoint to list all introduction scripts, optionally filtered by type, status, language, tone, event type, context, or source.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch intro scripts for' },
              ],
              queryParams: [
                { name: 'introductionType', type: 'string', required: false, description: 'Filter by type: company, founder, employee, team, speaker, guest, event-host' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published' },
                { name: 'language', type: 'string', required: false, description: 'Filter by language: en, hi, mr, bilingual, multilingual' },
                { name: 'tone', type: 'string', required: false, description: 'Filter by tone: professional, corporate, inspirational, friendly, motivational, formal, luxury, premium, startup, humorous' },
                { name: 'search', type: 'string', required: false, description: 'Search in name, content, and personalizationNotes' },
              ],
              successResponse: { status: 200, description: 'List of intro scripts', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: '...', language: 'en', duration: '1min', tone: 'professional', status: 'approved', source: 'manual', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/intro-scripts/YOUR_COMPANY_ID?introductionType=company&status=approved" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts/YOUR_COMPANY_ID?introductionType=company', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const scripts = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/intro-scripts/YOUR_COMPANY_ID', {
  params: { introductionType: 'company' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/intro-scripts/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/intro-scripts/YOUR_COMPANY_ID',
    params={'introductionType': 'company'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Script ID' },
                { field: '[].name', type: 'string', description: 'Script name' },
                { field: '[].introductionType', type: 'string', description: 'Introduction type (company, founder, employee, etc.)' },
                { field: '[].eventType', type: 'string', description: 'Event type (corporate-meeting, conference, etc.)' },
                { field: '[].content', type: 'string', description: 'Script content text' },
                { field: '[].language', type: 'string', description: 'Language (en, hi, mr, bilingual, multilingual)' },
                { field: '[].duration', type: 'string', description: 'Duration (30s, 1min, 2min, 3min, 5min)' },
                { field: '[].tone', type: 'string', description: 'Tone (professional, corporate, inspirational, etc.)' },
                { field: '[].status', type: 'string', description: 'Status (draft, review, approved, published)' },
              ],
              notes: ['Results are sorted by createdAt descending.', 'Search is case-insensitive and matches name, content, and personalizationNotes.'],
              commonMistakes: ['Using an invalid introductionType or eventType enum value.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['intro-detail', 'intro-create'],
            },
            {
              id: 'intro-detail',
              name: 'Get Intro Script Detail',
              method: 'GET',
              path: '/api/intro-scripts/detail/:id',
              purpose: 'Retrieve a single intro script by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific intro script.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Intro script ID' },
              ],
              successResponse: { status: 200, description: 'Intro script details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: '...', language: 'en', duration: '1min', tone: 'professional', status: 'approved', source: 'manual', context: 'stage', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Intro script not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/intro-scripts/detail/YOUR_SCRIPT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts/detail/YOUR_SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const script = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/intro-scripts/detail/YOUR_SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/intro-scripts/detail/YOUR_SCRIPT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/intro-scripts/detail/YOUR_SCRIPT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts/detail/YOUR_SCRIPT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Script ID' },
                { field: 'name', type: 'string', description: 'Script name' },
                { field: 'introductionType', type: 'string', description: 'Introduction type' },
                { field: 'eventType', type: 'string', description: 'Event type' },
                { field: 'content', type: 'string', description: 'Full script content' },
                { field: 'context', type: 'string', description: 'Context (stage, self, video, networking, investor, conference-speaker, award-ceremony)' },
              ],
              notes: ['Returns the complete script object with all fields.'],
              commonMistakes: ['Using an invalid script ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['intro-list', 'intro-create', 'intro-update'],
            },
            {
              id: 'intro-create',
              name: 'Create Intro Script',
              method: 'POST',
              path: '/api/intro-scripts',
              purpose: 'Create a new intro script.',
              whenToUse: 'Use this endpoint to create a new introduction script for events, networking, or presentations.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: 'Ladies and gentlemen, welcome to...' },
              successResponse: { status: 201, description: 'Intro script created', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: '...', status: 'draft', source: 'manual', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/intro-scripts \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Company Introduction","introductionType":"company","eventType":"corporate-meeting","content":"Ladies and gentlemen..."}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: 'Ladies and gentlemen...' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/intro-scripts',
  { companyId: 'YOUR_COMPANY_ID', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: 'Ladies and gentlemen...' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Company Introduction', introductionType: 'company', eventType: 'corporate-meeting', content: '...' });
const options = { hostname: 'api.mengo.ai', path: '/api/intro-scripts', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/intro-scripts',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Company Introduction', 'introductionType': 'company', 'eventType': 'corporate-meeting', 'content': '...'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Company Introduction', 'introductionType' => 'company', 'eventType' => 'corporate-meeting', 'content' => '...']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Script name' },
                { field: 'introductionType', type: 'string', description: 'Introduction type' },
                { field: 'eventType', type: 'string', description: 'Event type' },
                { field: 'status', type: 'string', description: 'Always "draft" on creation' },
                { field: 'source', type: 'string', description: 'Defaults to "manual"' },
              ],
              notes: ['Required fields: companyId, name, introductionType, eventType, content.', 'Valid introductionType: company, founder, employee, team, speaker, guest, event-host.', 'Valid eventType: corporate-meeting, conference, webinar, workshop, product-launch, investor-pitch, networking-event, award-ceremony, employee-onboarding, annual-function, training-session, social-media-video, youtube-video, podcast, college-seminar, public-event.', 'Status defaults to "draft" and source defaults to "manual".'],
              commonMistakes: ['Omitting required fields (name, introductionType, eventType, content).', 'Using invalid enum values for introductionType or eventType.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'intro-scripts.create'],
              relatedApis: ['intro-list', 'intro-detail', 'intro-update'],
            },
            {
              id: 'intro-update',
              name: 'Update Intro Script',
              method: 'PUT',
              path: '/api/intro-scripts/:id',
              purpose: 'Update an existing intro script.',
              whenToUse: 'Use this endpoint to modify a script\'s content, status, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Intro script ID to update' },
              ],
              requestBody: { name: 'Updated Introduction', content: 'Updated script content...', status: 'approved' },
              successResponse: { status: 200, description: 'Intro script updated', body: { _id: '507f1f77bcf86cd799439011', name: 'Updated Introduction', content: '...', status: 'approved', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Intro script not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Introduction","content":"Updated script content...","status":"approved"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Introduction', content: '...', status: 'approved' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID',
  { name: 'Updated Introduction', content: '...', status: 'approved' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Introduction', content: '...', status: 'approved' });
const options = { hostname: 'api.mengo.ai', path: '/api/intro-scripts/YOUR_SCRIPT_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID',
    json={'name': 'Updated Introduction', 'content': '...', 'status': 'approved'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Introduction', 'content' => '...', 'status' => 'approved']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Script ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['updatedAt is automatically set to current timestamp on update.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'intro-scripts.edit'],
              relatedApis: ['intro-list', 'intro-detail', 'intro-create'],
            },
            {
              id: 'intro-delete',
              name: 'Delete Intro Script',
              method: 'DELETE',
              path: '/api/intro-scripts/:id',
              purpose: 'Delete an intro script permanently.',
              whenToUse: 'Use this endpoint to permanently remove an intro script.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Intro script ID to delete' },
              ],
              successResponse: { status: 200, description: 'Intro script deleted', body: { message: 'Intro script deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Intro script not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/intro-scripts/YOUR_SCRIPT_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts/YOUR_SCRIPT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Using an invalid script ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'intro-scripts.delete'],
              relatedApis: ['intro-list', 'intro-detail'],
            },
            {
              id: 'intro-clear',
              name: 'Clear All Intro Scripts',
              method: 'DELETE',
              path: '/api/intro-scripts/clear/:companyId',
              purpose: 'Delete all intro scripts for a company.',
              whenToUse: 'Use this endpoint to remove all intro scripts for a company at once.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to clear scripts for' },
              ],
              successResponse: { status: 200, description: 'All intro scripts cleared', body: { message: 'Deleted 5 intro scripts', deletedCount: 5 } },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/intro-scripts/clear/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/intro-scripts/clear/YOUR_COMPANY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/intro-scripts/clear/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/intro-scripts/clear/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/intro-scripts/clear/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/intro-scripts/clear/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message with count' },
                { field: 'deletedCount', type: 'number', description: 'Number of scripts deleted' },
              ],
              notes: ['This operation is permanent and cannot be undone.'],
              commonMistakes: ['Using an incorrect companyId that the user does not have access to.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'intro-scripts.delete'],
              relatedApis: ['intro-list', 'intro-delete'],
            },
          ],
        },
        {
          id: 'moat-analysis',
          name: 'MOAT Analysis',
          description: 'Competitive moat analysis — identify and evaluate sustainable competitive advantages.',
          endpoints: [
            {
              id: 'moat-list',
              name: 'List MOAT Analyses',
              method: 'GET',
              path: '/api/moat-analysis/:companyId',
              purpose: 'Retrieve all MOAT analyses for a company with optional filtering.',
              whenToUse: 'Use this endpoint to list all competitive moat analyses, optionally filtered by status or source.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch analyses for' },
              ],
              queryParams: [
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, archived' },
                { name: 'source', type: 'string', required: false, description: 'Filter by source: ai-generation, manual' },
                { name: 'search', type: 'string', required: false, description: 'Search in name, businessName, industry, content' },
              ],
              successResponse: { status: 200, description: 'List of MOAT analyses', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Acme Corp Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', status: 'approved', source: 'manual', version: 1, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/moat-analysis/YOUR_COMPANY_ID?status=approved" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis/YOUR_COMPANY_ID?status=approved', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const analyses = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/moat-analysis/YOUR_COMPANY_ID', {
  params: { status: 'approved' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/moat-analysis/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/moat-analysis/YOUR_COMPANY_ID',
    params={'status': 'approved'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Analysis ID' },
                { field: '[].name', type: 'string', description: 'Analysis name' },
                { field: '[].businessName', type: 'string', description: 'Business name analyzed' },
                { field: '[].industry', type: 'string', description: 'Industry' },
                { field: '[].status', type: 'string', description: 'Status (draft, review, approved, archived)' },
                { field: '[].source', type: 'string', description: 'Source (ai-generation, manual)' },
                { field: '[].version', type: 'number', description: 'Version number' },
              ],
              notes: ['Results are sorted by createdAt descending.', 'Search is case-insensitive.'],
              commonMistakes: ['Using an invalid status value.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['moat-detail', 'moat-create'],
            },
            {
              id: 'moat-detail',
              name: 'Get MOAT Analysis Detail',
              method: 'GET',
              path: '/api/moat-analysis/detail/:id',
              purpose: 'Retrieve a single MOAT analysis by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific competitive moat analysis.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'MOAT analysis ID' },
              ],
              successResponse: { status: 200, description: 'MOAT analysis details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Acme Corp Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', businessDescription: '...', targetMarket: '...', productsServices: '...', status: 'approved', version: 1, content: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'MOAT analysis not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/moat-analysis/detail/YOUR_ANALYSIS_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis/detail/YOUR_ANALYSIS_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const analysis = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/moat-analysis/detail/YOUR_ANALYSIS_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/moat-analysis/detail/YOUR_ANALYSIS_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/moat-analysis/detail/YOUR_ANALYSIS_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis/detail/YOUR_ANALYSIS_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Analysis ID' },
                { field: 'name', type: 'string', description: 'Analysis name' },
                { field: 'businessName', type: 'string', description: 'Business name' },
                { field: 'industry', type: 'string', description: 'Industry' },
                { field: 'businessDescription', type: 'string', description: 'Business description' },
                { field: 'targetMarket', type: 'string', description: 'Target market' },
                { field: 'productsServices', type: 'string', description: 'Products/services' },
                { field: 'content', type: 'string', description: 'Full analysis content' },
              ],
              notes: ['Returns the complete analysis with all fields.'],
              commonMistakes: ['Using an invalid analysis ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['moat-list', 'moat-create'],
            },
            {
              id: 'moat-create',
              name: 'Create MOAT Analysis',
              method: 'POST',
              path: '/api/moat-analysis',
              purpose: 'Create a new MOAT analysis.',
              whenToUse: 'Use this endpoint to create a new competitive moat analysis.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Acme Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', businessDescription: 'A technology company...', targetMarket: 'Enterprise SaaS', productsServices: 'Cloud Platform, Analytics Suite', status: 'draft' },
              successResponse: { status: 201, description: 'MOAT analysis created', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Acme Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', status: 'draft', source: 'manual', version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/moat-analysis \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Acme Moat Analysis","businessName":"Acme Corp","industry":"Technology","businessDescription":"A tech company","targetMarket":"Enterprise","productsServices":"SaaS"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', businessDescription: '...', targetMarket: 'Enterprise', productsServices: 'SaaS' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/moat-analysis',
  { companyId: 'YOUR_COMPANY_ID', name: 'Acme Moat Analysis', businessName: 'Acme Corp', industry: 'Technology', businessDescription: '...', targetMarket: 'Enterprise', productsServices: 'SaaS' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Acme Moat Analysis', businessName: 'Acme Corp', industry: 'Technology' });
const options = { hostname: 'api.mengo.ai', path: '/api/moat-analysis', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/moat-analysis',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Acme Moat Analysis', 'businessName': 'Acme Corp', 'industry': 'Technology'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Acme Moat Analysis', 'businessName' => 'Acme Corp', 'industry' => 'Technology']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Analysis name' },
                { field: 'businessName', type: 'string', description: 'Business name' },
                { field: 'status', type: 'string', description: 'Defaults to "draft" on creation' },
                { field: 'source', type: 'string', description: 'Defaults to "manual"' },
                { field: 'version', type: 'number', description: 'Defaults to 1' },
              ],
              notes: ['Required fields: companyId, name, businessName, industry, businessDescription, targetMarket, productsServices.', 'Valid status values: draft, review, approved, archived.', 'Valid source values: ai-generation, manual.'],
              commonMistakes: ['Omitting required fields.', 'Using invalid status or source enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'moat-analysis.create'],
              relatedApis: ['moat-list', 'moat-detail', 'moat-update'],
            },
            {
              id: 'moat-update',
              name: 'Update MOAT Analysis',
              method: 'PUT',
              path: '/api/moat-analysis/:id',
              purpose: 'Update an existing MOAT analysis.',
              whenToUse: 'Use this endpoint to modify a competitive moat analysis.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'MOAT analysis ID to update' },
              ],
              requestBody: { name: 'Updated Analysis', content: 'Updated moat analysis content...', status: 'approved' },
              successResponse: { status: 200, description: 'MOAT analysis updated', body: { _id: '507f1f77bcf86cd799439011', name: 'Updated Analysis', status: 'approved', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'MOAT analysis not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Analysis","content":"Updated content...","status":"approved"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Analysis', content: '...', status: 'approved' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID',
  { name: 'Updated Analysis', content: '...', status: 'approved' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Analysis', content: '...', status: 'approved' });
const options = { hostname: 'api.mengo.ai', path: '/api/moat-analysis/YOUR_ANALYSIS_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID',
    json={'name': 'Updated Analysis', 'content': '...', 'status': 'approved'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Analysis', 'content' => '...', 'status' => 'approved']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Analysis ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['updatedAt is automatically set to current timestamp.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'moat-analysis.edit'],
              relatedApis: ['moat-list', 'moat-detail', 'moat-create'],
            },
            {
              id: 'moat-delete',
              name: 'Delete MOAT Analysis',
              method: 'DELETE',
              path: '/api/moat-analysis/:id',
              purpose: 'Delete a MOAT analysis permanently.',
              whenToUse: 'Use this endpoint to permanently remove a competitive moat analysis.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'MOAT analysis ID to delete' },
              ],
              successResponse: { status: 200, description: 'MOAT analysis deleted', body: { message: 'MOAT analysis deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'MOAT analysis not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/moat-analysis/YOUR_ANALYSIS_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis/YOUR_ANALYSIS_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Using an invalid analysis ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'moat-analysis.delete'],
              relatedApis: ['moat-list', 'moat-detail'],
            },
            {
              id: 'moat-clear',
              name: 'Clear All MOAT Analyses',
              method: 'DELETE',
              path: '/api/moat-analysis/clear/:companyId',
              purpose: 'Delete all MOAT analyses for a company, optionally filtered by status.',
              whenToUse: 'Use this endpoint to remove all moat analyses for a company at once.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to clear analyses for' },
              ],
              queryParams: [
                { name: 'status', type: 'string', required: false, description: 'Optional: Only delete analyses with this status (draft, review, approved, archived)' },
              ],
              successResponse: { status: 200, description: 'MOAT analyses cleared', body: { message: 'Deleted 3 MOAT analyses', deletedCount: 3 } },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/moat-analysis/clear/YOUR_COMPANY_ID?status=draft" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/moat-analysis/clear/YOUR_COMPANY_ID?status=draft', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/moat-analysis/clear/YOUR_COMPANY_ID', {
  params: { status: 'draft' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/moat-analysis/clear/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/moat-analysis/clear/YOUR_COMPANY_ID',
    params={'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/moat-analysis/clear/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message with count' },
                { field: 'deletedCount', type: 'number', description: 'Number of analyses deleted' },
              ],
              notes: ['If status filter is provided, only analyses with that status are deleted.', 'This operation is permanent and cannot be undone.'],
              commonMistakes: ['Using an incorrect companyId that the user does not have access to.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'moat-analysis.delete'],
              relatedApis: ['moat-list', 'moat-delete'],
            },
          ],
        },
        {
          id: 'referrals',
          name: 'Referrals',
          description: 'Referral programme management with rewards, rules, and product referrals.',
          endpoints: [
            {
              id: 'ref-list',
              name: 'List Referral Offers',
              method: 'GET',
              path: '/api/referrals/:companyId',
              purpose: 'Retrieve all referral offers for a company.',
              whenToUse: 'Use this endpoint to list all referral programmes/offers for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch referral offers for' },
              ],
              successResponse: { status: 200, description: 'List of referral offers', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Friend Get Friend', type: 'double-sided', status: 'active', referralCodePrefix: 'FGF', startDate: '2026-01-01', endDate: '2026-12-31', maxReferralsPerUser: 10, maxTotalReferrals: 1000, rewards: [], rules: [], productReferrals: [], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/referrals/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/referrals/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const offers = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/referrals/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/referrals/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/referrals/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/referrals/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Offer ID' },
                { field: '[].name', type: 'string', description: 'Referral offer name' },
                { field: '[].type', type: 'string', description: 'Type: single-sided, double-sided, tiered, affiliate, ambassador, custom' },
                { field: '[].status', type: 'string', description: 'Status: draft, active, paused, archived' },
                { field: '[].referralCodePrefix', type: 'string', description: 'Prefix for generated referral codes' },
                { field: '[].payoutTiming', type: 'string', description: 'Payout timing: immediate, on-qualification, monthly, quarterly, annual' },
                { field: '[].rewards', type: 'array', description: 'Array of reward objects' },
                { field: '[].rules', type: 'array', description: 'Array of rule objects' },
                { field: '[].productReferrals', type: 'array', description: 'Array of product referral objects' },
              ],
              notes: ['Each offer contains nested rewards, rules, and productReferrals arrays.', 'Valid type values: single-sided, double-sided, tiered, affiliate, ambassador, custom.', 'Valid status values: draft, active, paused, archived.'],
              commonMistakes: ['Using an invalid referral type value.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ref-detail', 'ref-create'],
            },
            {
              id: 'ref-detail',
              name: 'Get Referral Offer Detail',
              method: 'GET',
              path: '/api/referrals/detail/:id',
              purpose: 'Retrieve a single referral offer by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific referral offer including all rewards, rules, and product referrals.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Referral offer ID' },
              ],
              successResponse: { status: 200, description: 'Referral offer details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Friend Get Friend', type: 'double-sided', status: 'active', description: '...', referralCodePrefix: 'FGF', referralCodeFormat: 'PREFIX-XXXXXX', maxReferralsPerUser: 10, maxTotalReferrals: 1000, rewards: [], rules: [], productReferrals: [], strategies: {}, settings: {}, payoutTiming: 'immediate', aiGenerated: false, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Referral offer not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/referrals/detail/YOUR_OFFER_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/referrals/detail/YOUR_OFFER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const offer = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/referrals/detail/YOUR_OFFER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/referrals/detail/YOUR_OFFER_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/referrals/detail/YOUR_OFFER_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/referrals/detail/YOUR_OFFER_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Offer ID' },
                { field: 'name', type: 'string', description: 'Offer name' },
                { field: 'type', type: 'string', description: 'Referral type' },
                { field: 'status', type: 'string', description: 'Offer status' },
                { field: 'rewards', type: 'array', description: 'Array of reward objects with referrer/referree rewards' },
                { field: 'rules', type: 'array', description: 'Array of rule objects defining referral conditions' },
                { field: 'productReferrals', type: 'array', description: 'Array of product referral objects' },
                { field: 'payoutTiming', type: 'string', description: 'Payout timing for rewards' },
              ],
              notes: ['Returns the complete offer object with all nested rewards, rules, and product referrals.'],
              commonMistakes: ['Using an invalid offer ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ref-list', 'ref-create'],
            },
            {
              id: 'ref-create',
              name: 'Create Referral Offer',
              method: 'POST',
              path: '/api/referrals',
              purpose: 'Create a new referral offer.',
              whenToUse: 'Use this endpoint to create a new referral programme/offer.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Friend Get Friend', type: 'double-sided', description: 'Refer friends and both get rewards', referralCodePrefix: 'FGF', maxReferralsPerUser: 10, maxTotalReferrals: 1000, payoutTiming: 'immediate' },
              successResponse: { status: 201, description: 'Referral offer created', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Friend Get Friend', type: 'double-sided', status: 'draft', referralCodePrefix: 'FGF', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/referrals \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Friend Get Friend","type":"double-sided","description":"Refer friends and both get rewards","referralCodePrefix":"FGF","maxReferralsPerUser":10,"maxTotalReferrals":1000,"payoutTiming":"immediate"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/referrals', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Friend Get Friend', type: 'double-sided', description: 'Refer friends and both get rewards', referralCodePrefix: 'FGF', maxReferralsPerUser: 10, maxTotalReferrals: 1000, payoutTiming: 'immediate' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/referrals',
  { companyId: 'YOUR_COMPANY_ID', name: 'Friend Get Friend', type: 'double-sided', referralCodePrefix: 'FGF', maxReferralsPerUser: 10, maxTotalReferrals: 1000, payoutTiming: 'immediate' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Friend Get Friend', type: 'double-sided', referralCodePrefix: 'FGF' });
const options = { hostname: 'api.mengo.ai', path: '/api/referrals', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/referrals',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Friend Get Friend', 'type': 'double-sided', 'referralCodePrefix': 'FGF'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/referrals');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Friend Get Friend', 'type' => 'double-sided', 'referralCodePrefix' => 'FGF']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Offer name' },
                { field: 'type', type: 'string', description: 'Referral type' },
                { field: 'status', type: 'string', description: 'Defaults to "draft" on creation' },
                { field: 'referralCodePrefix', type: 'string', description: 'Prefix for generated referral codes' },
              ],
              notes: ['Required fields: companyId, name, type.', 'Valid type values: single-sided, double-sided, tiered, affiliate, ambassador, custom.', 'Valid status values: draft, active, paused, archived.', 'Valid payoutTiming values: immediate, on-qualification, monthly, quarterly, annual.', 'Name is truncated to 200 characters, description to 2000 characters.'],
              commonMistakes: ['Omitting required fields (companyId, name, type).', 'Using invalid type, status, or payoutTiming enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'referral-programme.create'],
              relatedApis: ['ref-list', 'ref-detail', 'ref-update'],
            },
            {
              id: 'ref-update',
              name: 'Update Referral Offer',
              method: 'PUT',
              path: '/api/referrals/:id',
              purpose: 'Update an existing referral offer.',
              whenToUse: 'Use this endpoint to modify a referral offer including its rewards, rules, and settings.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Referral offer ID to update' },
              ],
              requestBody: { name: 'Updated Referral Programme', status: 'active', description: 'Updated description' },
              successResponse: { status: 200, description: 'Referral offer updated', body: { _id: '507f1f77bcf86cd799439011', name: 'Updated Referral Programme', status: 'active', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Referral offer not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Referral Programme","status":"active","description":"Updated description"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Referral Programme', status: 'active', description: 'Updated description' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID',
  { name: 'Updated Referral Programme', status: 'active', description: 'Updated description' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Referral Programme', status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/referrals/YOUR_OFFER_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID',
    json={'name': 'Updated Referral Programme', 'status': 'active', 'description': 'Updated description'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Referral Programme', 'status' => 'active']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Offer ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All offer fields are updatable. updatedAt is automatically set.', 'Name is truncated to 200 characters, description to 2000 characters.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.', 'Using invalid enum values for type, status, or payoutTiming.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'referral-programme.edit'],
              relatedApis: ['ref-list', 'ref-detail', 'ref-create'],
            },
            {
              id: 'ref-delete',
              name: 'Delete Referral Offer',
              method: 'DELETE',
              path: '/api/referrals/:id',
              purpose: 'Delete a referral offer permanently.',
              whenToUse: 'Use this endpoint to permanently remove a referral offer and all its nested rewards, rules, and product referrals.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Referral offer ID to delete' },
              ],
              successResponse: { status: 200, description: 'Referral offer deleted', body: { message: 'Referral offer deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Referral offer not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/referrals/YOUR_OFFER_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/referrals/YOUR_OFFER_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and removes all nested rewards, rules, and product referrals.'],
              commonMistakes: ['Using an invalid offer ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'referral-programme.delete'],
              relatedApis: ['ref-list', 'ref-detail'],
            },
          ],
        },
        {
          id: 'speaking-engagements',
          name: 'Speaking Engagements',
          description: 'Speaking engagement management for events, conferences, and presentations.',
          endpoints: [
            {
              id: 'se-list',
              name: 'List Speaking Engagements',
              method: 'GET',
              path: '/api/speaking-engagements/:companyId',
              purpose: 'Retrieve all speaking engagements for a company with optional filtering.',
              whenToUse: 'Use this endpoint to list all speaking engagements, optionally filtered by speechType, status, language, speakerType, tone, or source.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch speaking engagements for' },
              ],
              queryParams: [
                { name: 'speechType', type: 'string', required: false, description: 'Filter by speech type' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'language', type: 'string', required: false, description: 'Filter by language' },
                { name: 'speakerType', type: 'string', required: false, description: 'Filter by speaker type' },
                { name: 'tone', type: 'string', required: false, description: 'Filter by tone' },
                { name: 'search', type: 'string', required: false, description: 'Search in name, content, and topic' },
              ],
              successResponse: { status: 200, description: 'List of speaking engagements', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Tech Conference Keynote', speechType: 'keynote', status: 'approved', language: 'en', tone: 'professional', source: 'manual', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/speaking-engagements/YOUR_COMPANY_ID?status=approved" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements/YOUR_COMPANY_ID?status=approved', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const engagements = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/speaking-engagements/YOUR_COMPANY_ID', {
  params: { status: 'approved' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/speaking-engagements/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/speaking-engagements/YOUR_COMPANY_ID',
    params={'status': 'approved'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Speaking engagement ID' },
                { field: '[].name', type: 'string', description: 'Engagement name' },
                { field: '[].speechType', type: 'string', description: 'Speech type (keynote, presentation, workshop, etc.)' },
                { field: '[].status', type: 'string', description: 'Status (draft, review, approved, published, archived)' },
                { field: '[].language', type: 'string', description: 'Language' },
                { field: '[].tone', type: 'string', description: 'Tone (professional, corporate, inspirational, etc.)' },
                { field: '[].source', type: 'string', description: 'Source (ai-generation, manual)' },
              ],
              notes: ['Results are sorted by createdAt descending.', 'Search is case-insensitive and matches name, content, and topic fields.'],
              commonMistakes: ['Using an invalid speechType or status enum value.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['se-detail', 'se-create'],
            },
            {
              id: 'se-detail',
              name: 'Get Speaking Engagement Detail',
              method: 'GET',
              path: '/api/speaking-engagements/detail/:id',
              purpose: 'Retrieve a single speaking engagement by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific speaking engagement.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Speaking engagement ID' },
              ],
              successResponse: { status: 200, description: 'Speaking engagement details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Tech Conference Keynote', speechType: 'keynote', content: '...', language: 'en', duration: '30min', tone: 'professional', status: 'approved', source: 'manual', version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Speaking engagement not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X GET https://app.mengoengine.com/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const engagement = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements/detail/YOUR_ENGAGEMENT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Engagement ID' },
                { field: 'name', type: 'string', description: 'Engagement name' },
                { field: 'speechType', type: 'string', description: 'Speech type' },
                { field: 'content', type: 'string', description: 'Full speech content' },
                { field: 'language', type: 'string', description: 'Language' },
                { field: 'duration', type: 'string', description: 'Speech duration' },
                { field: 'tone', type: 'string', description: 'Tone' },
                { field: 'version', type: 'number', description: 'Version number' },
              ],
              notes: ['Returns the complete engagement object with all fields.'],
              commonMistakes: ['Using an invalid engagement ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['se-list', 'se-create'],
            },
            {
              id: 'se-create',
              name: 'Create Speaking Engagement',
              method: 'POST',
              path: '/api/speaking-engagements',
              purpose: 'Create a new speaking engagement.',
              whenToUse: 'Use this endpoint to create a new speaking engagement for events, conferences, or presentations.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Tech Conference Keynote', speechType: 'keynote', content: 'Good morning everyone...', language: 'en', duration: '30min', tone: 'professional', status: 'draft' },
              successResponse: { status: 201, description: 'Speaking engagement created', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Tech Conference Keynote', speechType: 'keynote', content: '...', language: 'en', duration: '30min', tone: 'professional', status: 'draft', source: 'manual', version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — missing required fields' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/speaking-engagements \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Tech Conference Keynote","speechType":"keynote","content":"Good morning everyone...","language":"en","duration":"30min","tone":"professional"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Tech Conference Keynote', speechType: 'keynote', content: 'Good morning everyone...', language: 'en', duration: '30min', tone: 'professional' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/speaking-engagements',
  { companyId: 'YOUR_COMPANY_ID', name: 'Tech Conference Keynote', speechType: 'keynote', content: 'Good morning everyone...', language: 'en', duration: '30min', tone: 'professional' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Tech Conference Keynote', speechType: 'keynote', content: 'Good morning everyone...' });
const options = { hostname: 'api.mengo.ai', path: '/api/speaking-engagements', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/speaking-engagements',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Tech Conference Keynote', 'speechType': 'keynote', 'content': 'Good morning everyone...'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Tech Conference Keynote', 'speechType' => 'keynote', 'content' => 'Good morning everyone...']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Engagement name' },
                { field: 'speechType', type: 'string', description: 'Speech type' },
                { field: 'status', type: 'string', description: 'Defaults to "draft" on creation' },
                { field: 'source', type: 'string', description: 'Defaults to "manual"' },
                { field: 'version', type: 'number', description: 'Defaults to 1' },
              ],
              notes: ['Required fields: companyId, name, speechType.', 'Content is required when status is not "draft".', 'Status defaults to "draft" and source defaults to "manual".'],
              commonMistakes: ['Omitting required fields (companyId, name, speechType).', 'Using invalid speechType enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'speaking-engagements.create'],
              relatedApis: ['se-list', 'se-detail', 'se-update'],
            },
            {
              id: 'se-update',
              name: 'Update Speaking Engagement',
              method: 'PUT',
              path: '/api/speaking-engagements/:id',
              purpose: 'Update an existing speaking engagement.',
              whenToUse: 'Use this endpoint to modify a speaking engagement\'s content, status, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Speaking engagement ID to update' },
              ],
              requestBody: { name: 'Updated Keynote', content: 'Updated speech content...', status: 'approved' },
              successResponse: { status: 200, description: 'Speaking engagement updated', body: { _id: '507f1f77bcf86cd799439011', name: 'Updated Keynote', content: '...', status: 'approved', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [
                { code: 404, message: 'Speaking engagement not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Keynote","content":"Updated speech content...","status":"approved"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Keynote', content: '...', status: 'approved' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID',
  { name: 'Updated Keynote', content: '...', status: 'approved' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Keynote', content: '...', status: 'approved' });
const options = { hostname: 'api.mengo.ai', path: '/api/speaking-engagements/YOUR_ENGAGEMENT_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID',
    json={'name': 'Updated Keynote', 'content': '...', 'status': 'approved'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Keynote', 'content' => '...', 'status' => 'approved']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Engagement ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['updatedAt is automatically set to current timestamp on update.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'speaking-engagements.edit'],
              relatedApis: ['se-list', 'se-detail', 'se-create'],
            },
            {
              id: 'se-delete',
              name: 'Delete Speaking Engagement',
              method: 'DELETE',
              path: '/api/speaking-engagements/:id',
              purpose: 'Delete a speaking engagement permanently.',
              whenToUse: 'Use this endpoint to permanently remove a speaking engagement.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Speaking engagement ID to delete' },
              ],
              successResponse: { status: 200, description: 'Speaking engagement deleted', body: { message: 'Speaking engagement deleted successfully' } },
              errorResponses: [
                { code: 404, message: 'Speaking engagement not found' },
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/speaking-engagements/YOUR_ENGAGEMENT_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements/YOUR_ENGAGEMENT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Using an invalid engagement ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'speaking-engagements.delete'],
              relatedApis: ['se-list', 'se-detail'],
            },
            {
              id: 'se-clear',
              name: 'Clear All Speaking Engagements',
              method: 'DELETE',
              path: '/api/speaking-engagements/clear/:companyId',
              purpose: 'Delete all speaking engagements for a company, optionally filtered by type.',
              whenToUse: 'Use this endpoint to remove all speaking engagements for a company at once.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID to clear engagements for' },
              ],
              queryParams: [
                { name: 'speechType', type: 'string', required: false, description: 'Optional: Only delete engagements with this speech type' },
              ],
              successResponse: { status: 200, description: 'Speaking engagements cleared', body: { message: 'Deleted 3 speaking engagements', deletedCount: 3 } },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 401, message: 'Invalid or expired token' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/speaking-engagements/clear/YOUR_COMPANY_ID?speechType=keynote" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/speaking-engagements/clear/YOUR_COMPANY_ID?speechType=keynote', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/speaking-engagements/clear/YOUR_COMPANY_ID', {
  params: { speechType: 'keynote' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/speaking-engagements/clear/YOUR_COMPANY_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/speaking-engagements/clear/YOUR_COMPANY_ID',
    params={'speechType': 'keynote'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/speaking-engagements/clear/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message with count' },
                { field: 'deletedCount', type: 'number', description: 'Number of engagements deleted' },
              ],
              notes: ['If speechType filter is provided, only engagements of that type are deleted.', 'This operation is permanent and cannot be undone.'],
              commonMistakes: ['Using an incorrect companyId that the user does not have access to.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'speaking-engagements.delete'],
              relatedApis: ['se-list', 'se-delete'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // OPERATIONS GROUP
    // ==========================================
    {
      id: 'operations',
      name: 'Operations',
      description: 'Legal documents, SOPs, and background task management',
      icon: 'Settings',
      color: '#6366F1',
      categories: [
        {
          id: 'legal-documents',
          name: 'Legal Documents',
          description: 'Legal document management with file uploads, versioning, share links, and AI validation.',
          endpoints: [
            {
              id: 'ldoc-list',
              name: 'List Legal Documents',
              method: 'GET',
              path: '/api/legal-documents/:companyId',
              purpose: 'Retrieve all legal documents for a company with search, filter, and pagination.',
              whenToUse: 'Use this endpoint to list legal documents, optionally filtered by category, status, type, or search text.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch documents for' }],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Search text in document name' },
                { name: 'category', type: 'string', required: false, description: 'Filter by document category' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, active, archived' },
                { name: 'type', type: 'string', required: false, description: 'Filter by document type (e.g. contract, policy, agreement)' },
                { name: 'sort', type: 'string', required: false, description: 'Sort field (default: createdAt)' },
                { name: 'page', type: 'number', required: false, description: 'Page number for pagination' },
                { name: 'limit', type: 'number', required: false, description: 'Items per page' },
              ],
              successResponse: { status: 200, description: 'List of legal documents', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'NDA Template', category: 'contract', type: 'nda', status: 'active', versions: [], shareLink: null, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 401, message: 'Invalid or expired token' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/legal-documents/YOUR_COMPANY_ID?status=active&category=contract" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/legal-documents/YOUR_COMPANY_ID?status=active&category=contract', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const docs = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/legal-documents/YOUR_COMPANY_ID', {
  params: { status: 'active', category: 'contract' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/legal-documents/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/legal-documents/YOUR_COMPANY_ID',
    params={'status': 'active', 'category': 'contract'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Document ID' },
                { field: '[].name', type: 'string', description: 'Document name' },
                { field: '[].category', type: 'string', description: 'Document category (contract, policy, agreement, etc.)' },
                { field: '[].type', type: 'string', description: 'Document type (nda, terms, privacy, etc.)' },
                { field: '[].status', type: 'string', description: 'Status: draft, active, archived' },
                { field: '[].versions', type: 'array', description: 'Array of version objects with file metadata' },
                { field: '[].shareLink', type: 'object|null', description: 'Share link object if generated' },
              ],
              notes: ['Results are sorted by createdAt descending by default.', 'Search is case-insensitive on document name.', 'Additional endpoints available: GET /stats/:companyId (document counts by status), GET /download/:id (file download), GET /shared/:token (public share link access).'],
              commonMistakes: ['Not including the companyId parameter.', 'Using invalid status or category filter values.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ldoc-detail', 'ldoc-create'],
            },
            {
              id: 'ldoc-detail',
              name: 'Get Legal Document Detail',
              method: 'GET',
              path: '/api/legal-documents/detail/:id',
              purpose: 'Retrieve a single legal document by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific legal document including all versions and metadata.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Legal document ID' }],
              successResponse: { status: 200, description: 'Legal document details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'NDA Template', category: 'contract', type: 'nda', status: 'active', description: '...', versions: [], activityLog: [], shareLink: null, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Document not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/legal-documents/detail/YOUR_DOC_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/legal-documents/detail/YOUR_DOC_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const doc = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/legal-documents/detail/YOUR_DOC_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/legal-documents/detail/YOUR_DOC_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/legal-documents/detail/YOUR_DOC_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents/detail/YOUR_DOC_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Document ID' },
                { field: 'name', type: 'string', description: 'Document name' },
                { field: 'category', type: 'string', description: 'Document category' },
                { field: 'type', type: 'string', description: 'Document type' },
                { field: 'status', type: 'string', description: 'Status: draft, active, archived' },
                { field: 'versions', type: 'array', description: 'Array of version objects with file URLs and change notes' },
                { field: 'activityLog', type: 'array', description: 'Activity log entries for audit trail' },
                { field: 'shareLink', type: 'object|null', description: 'Share link object if generated' },
              ],
              notes: ['Returns the complete document object including all nested versions and activity log.'],
              commonMistakes: ['Using an invalid document ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ldoc-list', 'ldoc-create'],
            },
            {
              id: 'ldoc-create',
              name: 'Create Legal Document',
              method: 'POST',
              path: '/api/legal-documents',
              purpose: 'Create a new legal document with file upload.',
              whenToUse: 'Use this endpoint to create a new legal document. Requires a file upload (multipart/form-data).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'multipart/form-data' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'NDA Template', category: 'contract', type: 'nda', description: 'Standard NDA template', file: '(uploaded file)' },
              successResponse: { status: 201, description: 'Legal document created', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'NDA Template', category: 'contract', type: 'nda', status: 'draft', versions: [{ version: 1, file: '/uploads/...', changeNotes: 'Initial upload' }], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — missing required fields or file' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/legal-documents \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -F "companyId=YOUR_COMPANY_ID" \\
  -F "name=NDA Template" \\
  -F "category=contract" \\
  -F "type=nda" \\
  -F "file=@/path/to/document.pdf"`,
              jsExample: `const formData = new FormData();
formData.append('companyId', 'YOUR_COMPANY_ID');
formData.append('name', 'NDA Template');
formData.append('category', 'contract');
formData.append('type', 'nda');
formData.append('file', fileInput.files[0]);

const response = await fetch('https://app.mengoengine.com/api/legal-documents', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
  body: formData,
});`,
              axiosExample: `const formData = new FormData();
formData.append('companyId', 'YOUR_COMPANY_ID');
formData.append('name', 'NDA Template');
formData.append('category', 'contract');
formData.append('type', 'nda');
formData.append('file', fileInput.files[0]);

const { data } = await axios.post('https://app.mengoengine.com/api/legal-documents', formData, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'multipart/form-data' },
});`,
              nodeExample: `const fs = require('fs');
const https = require('https');
// Use form-data package for multipart uploads in Node.js
const FormData = require('form-data');
const form = new FormData();
form.append('companyId', 'YOUR_COMPANY_ID');
form.append('name', 'NDA Template');
form.append('category', 'contract');
form.append('type', 'nda');
form.append('file', fs.createReadStream('/path/to/document.pdf'));

const options = { hostname: 'api.mengo.ai', path: '/api/legal-documents', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', ...form.getHeaders() } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
form.pipe(req);`,
              pythonExample: `import requests
files = {'file': open('document.pdf', 'rb')}
data = {'companyId': 'YOUR_COMPANY_ID', 'name': 'NDA Template', 'category': 'contract', 'type': 'nda'}
response = requests.post('https://app.mengoengine.com/api/legal-documents',
    files=files, data=data,
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents');
$cfile = new CURLFile('/path/to/document.pdf', 'application/pdf', 'document.pdf');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, ['companyId' => 'YOUR_COMPANY_ID', 'name' => 'NDA Template', 'category' => 'contract', 'type' => 'nda', 'file' => $cfile]);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Document name' },
                { field: 'category', type: 'string', description: 'Document category' },
                { field: 'type', type: 'string', description: 'Document type' },
                { field: 'status', type: 'string', description: 'Defaults to "draft" on creation' },
                { field: 'versions', type: 'array', description: 'Contains initial file upload as version 1' },
              ],
              notes: ['Required fields: companyId, name, category, type, and a file upload.', 'Name is truncated to 200 characters.', 'File upload uses multipart/form-data with field name "file".', 'Additional endpoints: POST /:id/versions (upload new version), POST /:id/share-link (generate share link), PATCH /:id/archive (toggle archive).'],
              commonMistakes: ['Forgetting to include the file upload — this endpoint requires a file.', 'Using application/json Content-Type instead of multipart/form-data.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'legal-documents.create'],
              relatedApis: ['ldoc-list', 'ldoc-detail', 'ldoc-update'],
            },
            {
              id: 'ldoc-update',
              name: 'Update Legal Document',
              method: 'PUT',
              path: '/api/legal-documents/:id',
              purpose: 'Update an existing legal document.',
              whenToUse: 'Use this endpoint to modify a legal document\'s metadata. Auto-appends an activity log entry.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Legal document ID to update' }],
              requestBody: { name: 'Updated NDA Template', description: 'Updated description', status: 'active' },
              successResponse: { status: 200, description: 'Legal document updated', body: { _id: '507f1f77bcf86cd799439011', name: 'Updated NDA Template', status: 'active', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Document not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated NDA Template","description":"Updated description","status":"active"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated NDA Template', description: 'Updated description', status: 'active' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID',
  { name: 'Updated NDA Template', description: 'Updated description', status: 'active' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated NDA Template', status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/legal-documents/YOUR_DOC_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID',
    json={'name': 'Updated NDA Template', 'description': 'Updated description', 'status': 'active'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated NDA Template', 'status' => 'active']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Document ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
                { field: 'activityLog', type: 'array', description: 'Auto-appended activity entry' },
              ],
              notes: ['updatedAt is automatically set on update.', 'An activity log entry is automatically appended tracking the change.', 'Name is truncated to 200 characters.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'legal-documents.edit'],
              relatedApis: ['ldoc-list', 'ldoc-detail', 'ldoc-create'],
            },
            {
              id: 'ldoc-delete',
              name: 'Delete Legal Document',
              method: 'DELETE',
              path: '/api/legal-documents/:id',
              purpose: 'Delete a legal document permanently.',
              whenToUse: 'Use this endpoint to permanently remove a legal document and its associated files.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Legal document ID to delete' }],
              successResponse: { status: 200, description: 'Legal document deleted', body: { message: 'Legal document deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Document not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/legal-documents/YOUR_DOC_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents/YOUR_DOC_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and removes the document and all associated file versions.'],
              commonMistakes: ['Using an invalid document ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'legal-documents.delete'],
              relatedApis: ['ldoc-list', 'ldoc-detail'],
            },
            {
              id: 'ldoc-validate',
              name: 'Validate Document Name/Tag',
              method: 'POST',
              path: '/api/legal-documents/validate',
              purpose: 'AI-powered validation to detect gibberish or invalid document names and tags.',
              whenToUse: 'Use this endpoint to validate that a document name or tag is meaningful (not gibberish) before creating or updating a document.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { name: 'NDA Template', tag: 'legal' },
              successResponse: { status: 200, description: 'Validation result', body: { isValid: true, feedback: 'Name and tag appear valid' } },
              errorResponses: [{ code: 400, message: 'Validation error' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/legal-documents/validate \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"NDA Template","tag":"legal"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/legal-documents/validate', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'NDA Template', tag: 'legal' }),
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/legal-documents/validate',
  { name: 'NDA Template', tag: 'legal' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'NDA Template', tag: 'legal' });
const options = { hostname: 'api.mengo.ai', path: '/api/legal-documents/validate', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/legal-documents/validate',
    json={'name': 'NDA Template', 'tag': 'legal'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/legal-documents/validate');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'NDA Template', 'tag' => 'legal']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'isValid', type: 'boolean', description: 'Whether the name/tag passed AI validation' },
                { field: 'feedback', type: 'string', description: 'AI-generated feedback on the name/tag' },
              ],
              notes: ['Uses AI to detect gibberish or nonsensical document names and tags.', 'Both name and tag are optional — send either or both for validation.', 'Additional endpoints: POST /:id/share-link (generate share link), POST /:id/versions (upload new version), PATCH /:id/archive (toggle archive), GET /shared/:token (public share link access).'],
              commonMistakes: ['Sending both fields empty — at least one should have content to validate.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ldoc-list', 'ldoc-create'],
            },
          ],
        },
        {
          id: 'sops',
          name: 'SOPs',
          description: 'Standard Operating Procedures management with categories, approval workflows, and AI generation.',
          endpoints: [
            {
              id: 'sop-list',
              name: 'List SOPs',
              method: 'GET',
              path: '/api/sops/sops/:companyId',
              purpose: 'Retrieve all SOPs for a company with search, filter, and pagination.',
              whenToUse: 'Use this endpoint to list SOPs, optionally filtered by category, status, priority, department, or visibility.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch SOPs for' }],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Full-text search in title and description' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'department', type: 'string', required: false, description: 'Filter by department' },
                { name: 'visibility', type: 'string', required: false, description: 'Filter by visibility: public, internal, restricted' },
                { name: 'sort', type: 'string', required: false, description: 'Sort field' },
                { name: 'order', type: 'string', required: false, description: 'Sort order: asc or desc' },
                { name: 'page', type: 'number', required: false, description: 'Page number' },
                { name: 'limit', type: 'number', required: false, description: 'Items per page' },
              ],
              successResponse: { status: 200, description: 'List of SOPs', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', sopId: 'SOP-001', title: 'Employee Onboarding', categoryId: '...', status: 'published', priority: 'high', department: 'HR', visibility: 'internal', version: 2, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 401, message: 'Invalid or expired token' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sops/sops/YOUR_COMPANY_ID?status=published&priority=high" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/sops/YOUR_COMPANY_ID?status=published&priority=high', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const sops = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sops/sops/YOUR_COMPANY_ID', {
  params: { status: 'published', priority: 'high' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sops/sops/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sops/sops/YOUR_COMPANY_ID',
    params={'status': 'published', 'priority': 'high'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/sops/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'SOP ID' },
                { field: '[].sopId', type: 'string', description: 'Auto-generated SOP identifier (e.g. SOP-001)' },
                { field: '[].title', type: 'string', description: 'SOP title' },
                { field: '[].status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: '[].priority', type: 'string', description: 'Priority: low, medium, high, critical' },
                { field: '[].department', type: 'string', description: 'Department' },
                { field: '[].version', type: 'number', description: 'Current version number' },
              ],
              notes: ['Results use MongoDB text search for the "search" parameter.', 'viewCount is incremented on each detail view.', 'Category management endpoints also available: GET/POST/PUT/DELETE /api/sops/categories/.'],
              commonMistakes: ['Using the base path /api/sops/:companyId instead of /api/sops/sops/:companyId for listing SOPs.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['sop-detail', 'sop-create'],
            },
            {
              id: 'sop-detail',
              name: 'Get SOP Detail',
              method: 'GET',
              path: '/api/sops/sops/detail/:id',
              purpose: 'Retrieve a single SOP by ID. Increments the view count.',
              whenToUse: 'Use this endpoint to get full details of a specific SOP including steps and version history.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'SOP ID' }],
              successResponse: { status: 200, description: 'SOP details', body: { _id: '507f1f77bcf86cd799439011', sopId: 'SOP-001', title: 'Employee Onboarding', description: '...', detailedDescription: '...', steps: [], status: 'published', priority: 'high', department: 'HR', visibility: 'internal', version: 2, versionHistory: [], viewCount: 15, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'SOP not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/sops/sops/detail/YOUR_SOP_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/sops/detail/YOUR_SOP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const sop = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sops/sops/detail/YOUR_SOP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sops/sops/detail/YOUR_SOP_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sops/sops/detail/YOUR_SOP_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/sops/detail/YOUR_SOP_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'SOP ID' },
                { field: 'sopId', type: 'string', description: 'Auto-generated SOP identifier' },
                { field: 'title', type: 'string', description: 'SOP title' },
                { field: 'steps', type: 'array', description: 'Array of step objects with title, description, order' },
                { field: 'versionHistory', type: 'array', description: 'Array of version history entries' },
                { field: 'viewCount', type: 'number', description: 'Number of times this SOP has been viewed' },
              ],
              notes: ['viewCount is automatically incremented on each GET request.', 'Returns the complete SOP object including steps and version history.'],
              commonMistakes: ['Using an invalid SOP ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['sop-list', 'sop-create'],
            },
            {
              id: 'sop-create',
              name: 'Create SOP',
              method: 'POST',
              path: '/api/sops/sops',
              purpose: 'Create a new Standard Operating Procedure.',
              whenToUse: 'Use this endpoint to create a new SOP with steps, categories, and approval workflows.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Employee Onboarding', department: 'HR', description: 'Step-by-step onboarding process', steps: [{ title: 'Welcome', description: 'Welcome the new employee', order: 1 }], priority: 'high', visibility: 'internal' },
              successResponse: { status: 201, description: 'SOP created', body: { _id: '507f1f77bcf86cd799439011', sopId: 'SOP-001', title: 'Employee Onboarding', department: 'HR', status: 'draft', priority: 'high', visibility: 'internal', version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — missing required fields' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sops/sops \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Employee Onboarding","department":"HR","description":"Step-by-step onboarding process","steps":[{"title":"Welcome","description":"Welcome the new employee","order":1}],"priority":"high","visibility":"internal"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/sops', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Employee Onboarding', department: 'HR', steps: [{ title: 'Welcome', description: 'Welcome the new employee', order: 1 }], priority: 'high', visibility: 'internal' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sops/sops',
  { companyId: 'YOUR_COMPANY_ID', title: 'Employee Onboarding', department: 'HR', steps: [{ title: 'Welcome', description: 'Welcome the new employee', order: 1 }], priority: 'high', visibility: 'internal' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Employee Onboarding', department: 'HR' });
const options = { hostname: 'api.mengo.ai', path: '/api/sops/sops', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/sops/sops',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Employee Onboarding', 'department': 'HR', 'priority': 'high', 'visibility': 'internal'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/sops');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Employee Onboarding', 'department' => 'HR']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'sopId', type: 'string', description: 'Auto-generated SOP identifier (e.g. SOP-001)' },
                { field: 'title', type: 'string', description: 'SOP title' },
                { field: 'status', type: 'string', description: 'Defaults to "draft" on creation' },
                { field: 'version', type: 'number', description: 'Defaults to 1' },
              ],
              notes: ['Required fields: companyId, title, department.', 'sopId is auto-generated with incrementing numbers.', 'Status defaults to "draft". Valid values: draft, review, approved, published, archived.', 'Priority valid values: low, medium, high, critical.', 'Visibility valid values: public, internal, restricted.', 'Additional endpoints: PUT /:id/approve (approve SOP), PUT /:id/archive (archive SOP), POST /ai/generate-sop (AI generate), POST /ai/enhance-sop (AI enhance).'],
              commonMistakes: ['Omitting required fields (companyId, title, department).', 'Using /api/sops instead of /api/sops/sops for SOP creation.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sops.create'],
              relatedApis: ['sop-list', 'sop-detail', 'sop-update'],
            },
            {
              id: 'sop-update',
              name: 'Update SOP',
              method: 'PUT',
              path: '/api/sops/sops/:id',
              purpose: 'Update an existing SOP. Auto-tracks version changes if steps or description are modified.',
              whenToUse: 'Use this endpoint to modify an SOP. Version number and history are auto-updated when steps or detailedDescription change.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'SOP ID to update' }],
              requestBody: { title: 'Updated Onboarding Process', status: 'published', steps: [{ title: 'Welcome', description: 'Welcome the new employee', order: 1 }, { title: 'Setup', description: 'Set up workspace and accounts', order: 2 }] },
              successResponse: { status: 200, description: 'SOP updated', body: { _id: '507f1f77bcf86cd799439011', sopId: 'SOP-001', title: 'Updated Onboarding Process', version: 3, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'SOP not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Onboarding Process","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Onboarding Process', status: 'published' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID',
  { title: 'Updated Onboarding Process', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Onboarding Process', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/sops/sops/YOUR_SOP_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID',
    json={'title': 'Updated Onboarding Process', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Onboarding Process', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'SOP ID' },
                { field: 'version', type: 'number', description: 'Auto-incremented if steps or detailedDescription changed' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['If steps or detailedDescription are in the request body, the version number is auto-incremented and a version history entry is added.', 'updatedAt is automatically set.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or sopId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sops.edit'],
              relatedApis: ['sop-list', 'sop-detail', 'sop-create'],
            },
            {
              id: 'sop-delete',
              name: 'Delete SOP',
              method: 'DELETE',
              path: '/api/sops/sops/:id',
              purpose: 'Delete an SOP permanently.',
              whenToUse: 'Use this endpoint to permanently remove an SOP.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'SOP ID to delete' }],
              successResponse: { status: 200, description: 'SOP deleted', body: { message: 'SOP deleted successfully' } },
              errorResponses: [{ code: 404, message: 'SOP not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sops/sops/YOUR_SOP_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/sops/YOUR_SOP_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Using an invalid SOP ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sops.delete'],
              relatedApis: ['sop-list', 'sop-detail'],
            },
            {
              id: 'sop-ai-generate',
              name: 'AI Generate SOP',
              method: 'POST',
              path: '/api/sops/ai/generate-sop',
              purpose: 'Generate an SOP using AI. This is a stub endpoint that delegates generation to the frontend.',
              whenToUse: 'Use this endpoint to trigger AI-powered SOP generation. The actual generation is handled client-side.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { title: 'Employee Offboarding', companyId: 'YOUR_COMPANY_ID', department: 'HR', context: 'Process for offboarding departing employees' },
              successResponse: { status: 200, description: 'AI generation delegated to frontend', body: { message: 'SOP generation should be handled by the frontend AI service', title: 'Employee Offboarding', companyId: 'YOUR_COMPANY_ID' } },
              errorResponses: [{ code: 400, message: 'Validation error — title and companyId required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sops/ai/generate-sop \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Employee Offboarding","companyId":"YOUR_COMPANY_ID","department":"HR","context":"Process for offboarding departing employees"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sops/ai/generate-sop', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Employee Offboarding', companyId: 'YOUR_COMPANY_ID', department: 'HR', context: 'Process for offboarding departing employees' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sops/ai/generate-sop',
  { title: 'Employee Offboarding', companyId: 'YOUR_COMPANY_ID', department: 'HR', context: 'Process for offboarding' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Employee Offboarding', companyId: 'YOUR_COMPANY_ID', department: 'HR' });
const options = { hostname: 'api.mengo.ai', path: '/api/sops/ai/generate-sop', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/sops/ai/generate-sop',
    json={'title': 'Employee Offboarding', 'companyId': 'YOUR_COMPANY_ID', 'department': 'HR'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sops/ai/generate-sop');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Employee Offboarding', 'companyId' => 'YOUR_COMPANY_ID', 'department' => 'HR']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Delegation message indicating frontend-side generation' },
                { field: 'title', type: 'string', description: 'Echoed SOP title' },
                { field: 'companyId', type: 'string', description: 'Echoed company ID' },
              ],
              notes: ['This is a stub endpoint — actual AI generation happens on the frontend.', 'Required fields: title, companyId.', 'Related endpoint: POST /api/sops/ai/enhance-sop for AI enhancement.'],
              commonMistakes: ['Expecting the API to return generated SOP content — generation is handled client-side.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sops.ai-generate'],
              relatedApis: ['sop-create', 'sop-list'],
            },
          ],
        },
        {
          id: 'background-tasks',
          name: 'Background Tasks',
          description: 'Background task tracking for long-running operations like bulk imports and AI generation.',
          endpoints: [
            {
              id: 'task-list',
              name: 'List Background Tasks',
              method: 'GET',
              path: '/api/tasks/:companyId',
              purpose: 'Retrieve all background tasks for a company.',
              whenToUse: 'Use this endpoint to list all background tasks (bulk imports, AI generation jobs, etc.) for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID to fetch tasks for' }],
              successResponse: { status: 200, description: 'List of background tasks', body: [{ _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Bulk Import Contacts', moduleId: 'contacts', totalItems: 150, completedItems: 120, status: 'running', results: [], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 401, message: 'Invalid or expired token' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/tasks/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const tasks = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/tasks/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/tasks/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/tasks/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Task ID' },
                { field: '[].name', type: 'string', description: 'Task name/description' },
                { field: '[].moduleId', type: 'string', description: 'Module that created this task' },
                { field: '[].totalItems', type: 'number', description: 'Total number of items to process' },
                { field: '[].completedItems', type: 'number', description: 'Number of items completed so far' },
                { field: '[].status', type: 'string', description: 'Status: running, completed, failed, cancelled' },
                { field: '[].results', type: 'array', description: 'Array of batch result objects' },
              ],
              notes: ['Results are sorted by createdAt descending.', 'Task statuses: running, completed, failed, cancelled.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['task-detail', 'task-create'],
            },
            {
              id: 'task-detail',
              name: 'Get Task Detail',
              method: 'GET',
              path: '/api/tasks/detail/:id',
              purpose: 'Retrieve a single background task by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific task including all batch results.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Task ID' }],
              successResponse: { status: 200, description: 'Task details', body: { _id: '507f1f77bcf86cd799439011', companyId: '...', name: 'Bulk Import Contacts', moduleId: 'contacts', totalItems: 150, completedItems: 120, status: 'running', results: [{ batchIndex: 0, items: ['item1', 'item2'], status: 'completed' }], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Task not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/tasks/detail/YOUR_TASK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks/detail/YOUR_TASK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const task = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/tasks/detail/YOUR_TASK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/tasks/detail/YOUR_TASK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/tasks/detail/YOUR_TASK_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks/detail/YOUR_TASK_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Task ID' },
                { field: 'name', type: 'string', description: 'Task name' },
                { field: 'moduleId', type: 'string', description: 'Module that created this task' },
                { field: 'totalItems', type: 'number', description: 'Total items to process' },
                { field: 'completedItems', type: 'number', description: 'Items completed so far' },
                { field: 'status', type: 'string', description: 'Task status' },
                { field: 'results', type: 'array', description: 'Detailed batch results' },
              ],
              notes: ['Returns the complete task object including all nested batch results.'],
              commonMistakes: ['Using an invalid task ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['task-list', 'task-create'],
            },
            {
              id: 'task-create',
              name: 'Create Background Task',
              method: 'POST',
              path: '/api/tasks',
              purpose: 'Create a new background task for tracking long-running operations.',
              whenToUse: 'Use this endpoint to create a background task for operations like bulk imports or AI generation jobs.',
              auth: 'Bearer Token Required (API access token or session JWT, admin or editor role)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { name: 'Bulk Import Contacts', companyId: 'YOUR_COMPANY_ID', moduleId: 'contacts', totalItems: 150 },
              successResponse: { status: 201, description: 'Background task created', body: { _id: '507f1f77bcf86cd799439011', name: 'Bulk Import Contacts', companyId: '...', moduleId: 'contacts', totalItems: 150, completedItems: 0, status: 'running', results: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — missing required fields' }, { code: 403, message: 'Access denied — requires admin or editor role' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/tasks \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Bulk Import Contacts","companyId":"YOUR_COMPANY_ID","moduleId":"contacts","totalItems":150}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Bulk Import Contacts', companyId: 'YOUR_COMPANY_ID', moduleId: 'contacts', totalItems: 150 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/tasks',
  { name: 'Bulk Import Contacts', companyId: 'YOUR_COMPANY_ID', moduleId: 'contacts', totalItems: 150 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Bulk Import Contacts', companyId: 'YOUR_COMPANY_ID', moduleId: 'contacts', totalItems: 150 });
const options = { hostname: 'api.mengo.ai', path: '/api/tasks', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/tasks',
    json={'name': 'Bulk Import Contacts', 'companyId': 'YOUR_COMPANY_ID', 'moduleId': 'contacts', 'totalItems': 150},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Bulk Import Contacts', 'companyId' => 'YOUR_COMPANY_ID', 'moduleId' => 'contacts', 'totalItems' => 150]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated task ID' },
                { field: 'name', type: 'string', description: 'Task name' },
                { field: 'moduleId', type: 'string', description: 'Module that owns this task' },
                { field: 'totalItems', type: 'number', description: 'Total items to process' },
                { field: 'status', type: 'string', description: 'Defaults to "running"' },
              ],
              notes: ['Required fields: name, companyId, moduleId, totalItems.', 'Status defaults to "running" on creation.', 'Requires admin or editor role.'],
              commonMistakes: ['Omitting required fields (name, companyId, moduleId, totalItems).', 'Using a non-admin/editor token.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['task-list', 'task-detail', 'task-update'],
            },
            {
              id: 'task-update',
              name: 'Update Task Progress',
              method: 'PUT',
              path: '/api/tasks/:id',
              purpose: 'Update a background task\'s progress and status.',
              whenToUse: 'Use this endpoint to update completedItems, status, results, or error information for a running task.',
              auth: 'Bearer Token Required (API access token or session JWT, admin or editor role)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Task ID to update' }],
              requestBody: { completedItems: 120, status: 'running', results: [{ batchIndex: 0, items: ['item1'], status: 'completed' }] },
              successResponse: { status: 200, description: 'Task updated', body: { _id: '507f1f77bcf86cd799439011', completedItems: 120, status: 'running', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Task not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/tasks/YOUR_TASK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"completedItems":120,"status":"running"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ completedItems: 120, status: 'running' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID',
  { completedItems: 120, status: 'running' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ completedItems: 120, status: 'running' });
const options = { hostname: 'api.mengo.ai', path: '/api/tasks/YOUR_TASK_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID',
    json={'completedItems': 120, 'status': 'running'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['completedItems' => 120, 'status' => 'running']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Task ID' },
                { field: 'completedItems', type: 'number', description: 'Updated completed count' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are optional — only send the fields you want to update.', 'Valid status values: running, completed, failed, cancelled.', 'Requires admin or editor role.'],
              commonMistakes: ['Using an invalid task ID.', 'Using invalid status values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['task-list', 'task-detail', 'task-create'],
            },
            {
              id: 'task-cancel',
              name: 'Cancel Background Task',
              method: 'POST',
              path: '/api/tasks/:id/cancel',
              purpose: 'Cancel a running background task.',
              whenToUse: 'Use this endpoint to cancel a task that is currently running.',
              auth: 'Bearer Token Required (API access token or session JWT, admin or editor role)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Task ID to cancel' }],
              successResponse: { status: 200, description: 'Task cancelled', body: { _id: '507f1f77bcf86cd799439011', status: 'cancelled', updatedAt: '2026-07-22T11:30:00Z' } },
              errorResponses: [{ code: 404, message: 'Task not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/tasks/YOUR_TASK_ID/cancel \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID/cancel', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID/cancel', {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/tasks/YOUR_TASK_ID/cancel', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID/cancel',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID/cancel');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Task ID' },
                { field: 'status', type: 'string', description: 'Set to "cancelled"' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Sets the task status to "cancelled".', 'Requires admin or editor role.'],
              commonMistakes: ['Trying to cancel a task that is already completed or failed.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['task-list', 'task-detail'],
            },
            {
              id: 'task-delete',
              name: 'Delete Background Task',
              method: 'DELETE',
              path: '/api/tasks/:id',
              purpose: 'Delete a background task permanently.',
              whenToUse: 'Use this endpoint to permanently remove a background task record.',
              auth: 'Bearer Token Required (API access token or session JWT, admin role only)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Task ID to delete' }],
              successResponse: { status: 200, description: 'Task deleted', body: { message: 'Task deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Task not found' }, { code: 403, message: 'Access denied — requires admin role' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/tasks/YOUR_TASK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/tasks/YOUR_TASK_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/tasks/YOUR_TASK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.', 'Requires admin role only (not editor).'],
              commonMistakes: ['Using a non-admin token — only admin role can delete tasks.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['task-list', 'task-detail'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // FUNDING GROUP
    // ==========================================
    {
      id: 'funding',
      name: 'Funding',
      description: 'Investor management, pitch decks, presentations, cap tables, financial models, and funding rounds',
      icon: 'DollarSign',
      color: '#10B981',
      categories: [
        {
          id: 'investors',
          name: 'Investors',
          description: 'Investor pipeline management with stages, interactions, and statistics.',
          endpoints: [
            {
              id: 'inv-list',
              name: 'List Investors',
              method: 'GET',
              path: '/api/investors/:companyId',
              purpose: 'Retrieve all investors for a company.',
              whenToUse: 'Use this endpoint to list all investors in the pipeline.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of investors', body: [{ _id: '...', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', priority: 'high', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 401, message: 'Invalid or expired token' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/investors/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/investors/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const investors = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/investors/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/investors/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/investors/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/investors/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Investor ID' },
                { field: '[].name', type: 'string', description: 'Investor name' },
                { field: '[].type', type: 'string', description: 'Investor type: angel, seed-fund, vc, private-equity, strategic, accelerator, family-office' },
                { field: '[].stage', type: 'string', description: 'Pipeline stage' },
                { field: '[].priority', type: 'string', description: 'Priority level' },
                { field: '[].email', type: 'string', description: 'Contact email' },
              ],
              notes: ['Additional endpoints: GET /pipeline/:companyId (grouped by stage), GET /stats/:companyId (pipeline statistics).'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['inv-detail', 'inv-create'],
            },
            {
              id: 'inv-detail',
              name: 'Get Investor Detail',
              method: 'GET',
              path: '/api/investors/detail/:id',
              purpose: 'Retrieve a single investor by ID.',
              whenToUse: 'Use this endpoint to get full details of a specific investor including interactions.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Investor ID' }],
              successResponse: { status: 200, description: 'Investor details', body: { _id: '...', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', priority: 'high', interactions: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Investor not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/investors/detail/YOUR_INVESTOR_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/investors/detail/YOUR_INVESTOR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const investor = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/investors/detail/YOUR_INVESTOR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/investors/detail/YOUR_INVESTOR_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/investors/detail/YOUR_INVESTOR_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/investors/detail/YOUR_INVESTOR_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Investor ID' },
                { field: 'name', type: 'string', description: 'Investor name' },
                { field: 'type', type: 'string', description: 'Investor type' },
                { field: 'interactions', type: 'array', description: 'Array of interaction records' },
              ],
              notes: ['Returns full investor object including all interactions.'],
              commonMistakes: ['Using an invalid investor ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['inv-list', 'inv-create'],
            },
            {
              id: 'inv-create',
              name: 'Create Investor',
              method: 'POST',
              path: '/api/investors',
              purpose: 'Create a new investor in the pipeline.',
              whenToUse: 'Use this endpoint to add a new investor to the tracking pipeline.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', priority: 'high' },
              successResponse: { status: 201, description: 'Investor created', body: { _id: '...', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — missing required fields' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/investors \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Sequoia Capital","type":"vc","email":"partner@sequoia.com","stage":"contacted","priority":"high"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/investors', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', priority: 'high' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/investors',
  { companyId: 'YOUR_COMPANY_ID', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com', stage: 'contacted', priority: 'high' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Sequoia Capital', type: 'vc', email: 'partner@sequoia.com' });
const options = { hostname: 'api.mengo.ai', path: '/api/investors', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/investors',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Sequoia Capital', 'type': 'vc', 'email': 'partner@sequoia.com', 'stage': 'contacted'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/investors');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Sequoia Capital', 'type' => 'vc', 'email' => 'partner@sequoia.com']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated MongoDB ID' },
                { field: 'name', type: 'string', description: 'Investor name' },
                { field: 'type', type: 'string', description: 'Investor type' },
                { field: 'stage', type: 'string', description: 'Pipeline stage' },
              ],
              notes: ['Required fields: companyId, name, type.', 'Valid type values: angel, seed-fund, vc, private-equity, strategic, accelerator, family-office.', 'Additional endpoints: PUT /:id/stage (update stage), POST /:id/interactions (add interaction).'],
              commonMistakes: ['Omitting required fields (companyId, name, type).', 'Using invalid type enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.create'],
              relatedApis: ['inv-list', 'inv-detail', 'inv-update'],
            },
            {
              id: 'inv-update',
              name: 'Update Investor',
              method: 'PUT',
              path: '/api/investors/:id',
              purpose: 'Update an existing investor.',
              whenToUse: 'Use this endpoint to modify investor details, stage, or other fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Investor ID to update' }],
              requestBody: { name: 'Sequoia Capital India', stage: 'meeting-scheduled', priority: 'critical' },
              successResponse: { status: 200, description: 'Investor updated', body: { _id: '...', name: 'Sequoia Capital India', stage: 'meeting-scheduled', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Investor not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Sequoia Capital India","stage":"meeting-scheduled","priority":"critical"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Sequoia Capital India', stage: 'meeting-scheduled', priority: 'critical' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID',
  { name: 'Sequoia Capital India', stage: 'meeting-scheduled', priority: 'critical' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Sequoia Capital India', stage: 'meeting-scheduled' });
const options = { hostname: 'api.mengo.ai', path: '/api/investors/YOUR_INVESTOR_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID',
    json={'name': 'Sequoia Capital India', 'stage': 'meeting-scheduled', 'priority': 'critical'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Sequoia Capital India', 'stage' => 'meeting-scheduled']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Investor ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable. Empty string values are automatically filtered out.', 'Additional endpoint: PUT /:id/stage to update only the pipeline stage.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.edit'],
              relatedApis: ['inv-list', 'inv-detail', 'inv-create'],
            },
            {
              id: 'inv-delete',
              name: 'Delete Investor',
              method: 'DELETE',
              path: '/api/investors/:id',
              purpose: 'Delete an investor permanently.',
              whenToUse: 'Use this endpoint to permanently remove an investor from the pipeline.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Investor ID to delete' }],
              successResponse: { status: 200, description: 'Investor deleted', body: { message: 'Investor deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Investor not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/investors/YOUR_INVESTOR_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/investors/YOUR_INVESTOR_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Deletion confirmation message' },
              ],
              notes: ['Deletion is permanent and cannot be undone.'],
              commonMistakes: ['Using an invalid investor ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.delete'],
              relatedApis: ['inv-list', 'inv-detail'],
            },
          ],
        },
        {
          id: 'pitch-decks',
          name: 'Pitch Decks',
          description: 'Pitch deck management with templates, slide reordering, and duplication.',
          endpoints: [
            {
              id: 'pd-list',
              name: 'List Pitch Decks',
              method: 'GET',
              path: '/api/pitch-decks/:companyId',
              purpose: 'Retrieve all pitch decks for a company.',
              whenToUse: 'Use this endpoint to list all pitch decks.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of pitch decks', body: [{ _id: '...', name: 'Series A Pitch', template: 'investor', slides: 12, status: 'draft', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pitch-decks/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pitch-decks/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const decks = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pitch-decks/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/pitch-decks/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/pitch-decks/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/pitch-decks/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Pitch deck ID' },
                { field: '[].name', type: 'string', description: 'Deck name' },
                { field: '[].template', type: 'string', description: 'Template type: investor, sales, product, partner, event, internal' },
                { field: '[].slides', type: 'array', description: 'Array of slide objects' },
              ],
              notes: ['Valid template values: investor, sales, product, partner, event, internal.', 'Additional endpoints: POST /:id/duplicate (duplicate deck), PUT /:id/reorder (reorder slides).'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pd-detail', 'pd-create'],
            },
            {
              id: 'pd-create',
              name: 'Create Pitch Deck',
              method: 'POST',
              path: '/api/pitch-decks',
              purpose: 'Create a new pitch deck.',
              whenToUse: 'Use this endpoint to create a new pitch deck from a template.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Series A Pitch', template: 'investor' },
              successResponse: { status: 201, description: 'Pitch deck created', body: { _id: '...', name: 'Series A Pitch', template: 'investor', status: 'draft', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — name, companyId, and template required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/pitch-decks -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"companyId":"YOUR_COMPANY_ID","name":"Series A Pitch","template":"investor"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pitch-decks', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Series A Pitch', template: 'investor' }) });`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/pitch-decks', { companyId: 'YOUR_COMPANY_ID', name: 'Series A Pitch', template: 'investor' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Series A Pitch', template: 'investor' }); const options = { hostname: 'api.mengo.ai', path: '/api/pitch-decks', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.post('https://app.mengoengine.com/api/pitch-decks', json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Series A Pitch', 'template': 'investor'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/pitch-decks'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Series A Pitch', 'template' => 'investor'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Deck name' },
                { field: 'template', type: 'string', description: 'Template type' },
              ],
              notes: ['Required fields: companyId, name, template.', 'Valid template values: investor, sales, product, partner, event, internal.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.create'],
              relatedApis: ['pd-list', 'pd-detail'],
            },
            {
              id: 'pd-detail',
              name: 'Get Pitch Deck Detail',
              method: 'GET',
              path: '/api/pitch-decks/detail/:id',
              purpose: 'Retrieve a single pitch deck by ID.',
              whenToUse: 'Use this endpoint to get full details of a pitch deck including all slides.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Pitch deck ID' }],
              successResponse: { status: 200, description: 'Pitch deck details', body: { _id: '...', name: 'Series A Pitch', template: 'investor', slides: [], status: 'draft' } },
              errorResponses: [{ code: 404, message: 'Pitch deck not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/pitch-decks/detail/YOUR_DECK_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pitch-decks/detail/YOUR_DECK_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const deck = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/pitch-decks/detail/YOUR_DECK_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/pitch-decks/detail/YOUR_DECK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/pitch-decks/detail/YOUR_DECK_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/pitch-decks/detail/YOUR_DECK_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Pitch deck ID' },
                { field: 'slides', type: 'array', description: 'Full array of slide objects' },
              ],
              notes: ['Returns complete pitch deck with all slide content.'],
              commonMistakes: ['Using an invalid deck ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pd-list', 'pd-create'],
            },
            {
              id: 'pd-update',
              name: 'Update Pitch Deck',
              method: 'PUT',
              path: '/api/pitch-decks/:id',
              purpose: 'Update a pitch deck.',
              whenToUse: 'Use this endpoint to modify a pitch deck including slides and metadata.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Pitch deck ID' }],
              requestBody: { name: 'Updated Pitch Deck', slides: [] },
              successResponse: { status: 200, description: 'Pitch deck updated', body: { _id: '...', name: 'Updated Pitch Deck', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Pitch deck not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"name":"Updated Pitch Deck"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Updated Pitch Deck' }) });`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', { name: 'Updated Pitch Deck' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ name: 'Updated Pitch Deck' }); const options = { hostname: 'api.mengo.ai', path: '/api/pitch-decks/YOUR_DECK_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.put('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', json={'name': 'Updated Pitch Deck'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Pitch Deck'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Deck ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Empty string values are automatically filtered out before updating.'],
              commonMistakes: ['Attempting to update companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.edit'],
              relatedApis: ['pd-list', 'pd-create'],
            },
            {
              id: 'pd-delete',
              name: 'Delete Pitch Deck',
              method: 'DELETE',
              path: '/api/pitch-decks/:id',
              purpose: 'Delete a pitch deck permanently.',
              whenToUse: 'Use this endpoint to permanently remove a pitch deck.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Pitch deck ID to delete' }],
              successResponse: { status: 200, description: 'Pitch deck deleted', body: { message: 'Pitch deck deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Pitch deck not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const options = { hostname: 'api.mengo.ai', path: '/api/pitch-decks/YOUR_DECK_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests\nrequests.delete('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/pitch-decks/YOUR_DECK_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid deck ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.delete'],
              relatedApis: ['pd-list', 'pd-detail'],
            },
          ],
        },
        {
          id: 'presentations',
          name: 'Presentations',
          description: 'Presentation management with AI generation, versioning, and export.',
          endpoints: [
            {
              id: 'pres-list',
              name: 'List Presentations',
              method: 'GET',
              path: '/api/presentations/:companyId',
              purpose: 'Retrieve all presentations for a company.',
              whenToUse: 'Use this endpoint to list all presentations, optionally filtered by type or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'type', type: 'string', required: false, description: 'Filter by presentation type' }, { name: 'status', type: 'string', required: false, description: 'Filter by status' }],
              successResponse: { status: 200, description: 'List of presentations', body: [{ _id: '...', title: 'Company Profile', type: 'company-profile', status: 'published', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/presentations/YOUR_COMPANY_ID?type=company-profile" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/presentations/YOUR_COMPANY_ID?type=company-profile', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const presentations = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/presentations/YOUR_COMPANY_ID', { params: { type: 'company-profile' }, headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/presentations/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/presentations/YOUR_COMPANY_ID', params={'type': 'company-profile'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/presentations/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Presentation ID' },
                { field: '[].title', type: 'string', description: 'Presentation title' },
                { field: '[].type', type: 'string', description: 'Presentation type (company-profile, product, investor-pitch, etc.)' },
                { field: '[].status', type: 'string', description: 'Status' },
              ],
              notes: ['Valid type values include: company-profile, product, investor-pitch, sales, workshop, training, webinar, event, internal, marketing, project-proposal, quarterly-review, custom.', 'Additional endpoints: POST /generate-brief, POST /generate-slides, POST /:id/export, GET /:id/versions.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pres-detail', 'pres-create'],
            },
            {
              id: 'pres-create',
              name: 'Create Presentation',
              method: 'POST',
              path: '/api/presentations',
              purpose: 'Create a new presentation.',
              whenToUse: 'Use this endpoint to create a new presentation with slides.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Company Profile', type: 'company-profile', businessName: 'Acme Corp', industry: 'Technology', targetAudience: 'Investors', keyMessage: 'Innovation drives growth' },
              successResponse: { status: 201, description: 'Presentation created', body: { _id: '...', title: 'Company Profile', type: 'company-profile', status: 'draft', version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — missing required fields' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/presentations -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"companyId":"YOUR_COMPANY_ID","title":"Company Profile","type":"company-profile","businessName":"Acme Corp","industry":"Technology","targetAudience":"Investors","keyMessage":"Innovation drives growth"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/presentations', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Company Profile', type: 'company-profile', businessName: 'Acme Corp', industry: 'Technology', targetAudience: 'Investors', keyMessage: 'Innovation drives growth' }) });`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/presentations', { companyId: 'YOUR_COMPANY_ID', title: 'Company Profile', type: 'company-profile', businessName: 'Acme Corp' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Company Profile', type: 'company-profile' }); const options = { hostname: 'api.mengo.ai', path: '/api/presentations', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.post('https://app.mengoengine.com/api/presentations', json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Company Profile', 'type': 'company-profile', 'businessName': 'Acme Corp'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/presentations'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Company Profile', 'type' => 'company-profile'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'title', type: 'string', description: 'Presentation title' },
                { field: 'type', type: 'string', description: 'Presentation type' },
                { field: 'version', type: 'number', description: 'Defaults to 1' },
              ],
              notes: ['Required fields: companyId, title, type, businessName, industry, targetAudience, keyMessage.', 'Valid type values: company-profile, product, investor-pitch, sales, workshop, training, webinar, event, internal, marketing, project-proposal, quarterly-review, custom.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'presentations.create'],
              relatedApis: ['pres-list', 'pres-detail'],
            },
            {
              id: 'pres-detail',
              name: 'Get Presentation Detail',
              method: 'GET',
              path: '/api/presentations/detail/:id',
              purpose: 'Retrieve a single presentation by ID.',
              whenToUse: 'Use this endpoint to get full details of a presentation including all slides.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Presentation ID' }],
              successResponse: { status: 200, description: 'Presentation details', body: { _id: '...', title: 'Company Profile', type: 'company-profile', slides: [], version: 1, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Presentation not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/presentations/detail/YOUR_PRES_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/presentations/detail/YOUR_PRES_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const pres = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/presentations/detail/YOUR_PRES_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/presentations/detail/YOUR_PRES_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/presentations/detail/YOUR_PRES_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/presentations/detail/YOUR_PRES_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Presentation ID' },
                { field: 'slides', type: 'array', description: 'Full array of slide objects' },
                { field: 'version', type: 'number', description: 'Current version number' },
              ],
              notes: ['Returns complete presentation with all slide content.', 'Auto-versioning occurs on updates that modify slides.'],
              commonMistakes: ['Using an invalid presentation ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pres-list', 'pres-create'],
            },
            {
              id: 'pres-update',
              name: 'Update Presentation',
              method: 'PUT',
              path: '/api/presentations/:id',
              purpose: 'Update a presentation. Auto-versions when slides change.',
              whenToUse: 'Use this endpoint to modify a presentation. Slide changes trigger automatic version tracking.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Presentation ID' }],
              requestBody: { title: 'Updated Company Profile', slides: [] },
              successResponse: { status: 200, description: 'Presentation updated', body: { _id: '...', title: 'Updated Company Profile', version: 2, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Presentation not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/presentations/YOUR_PRES_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"title":"Updated Company Profile"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ title: 'Updated Company Profile' }) });`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', { title: 'Updated Company Profile' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ title: 'Updated Company Profile' }); const options = { hostname: 'api.mengo.ai', path: '/api/presentations/YOUR_PRES_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.put('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', json={'title': 'Updated Company Profile'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Company Profile'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Presentation ID' },
                { field: 'version', type: 'number', description: 'Auto-incremented if slides changed' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Slide changes auto-increment the version number.', 'Set skipVersioning: true in the body to skip version tracking.', 'Additional endpoints: POST /:id/duplicate, PUT /:id/reorder, POST /:id/export, GET /:id/versions.'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'presentations.edit'],
              relatedApis: ['pres-list', 'pres-detail', 'pres-create'],
            },
            {
              id: 'pres-delete',
              name: 'Delete Presentation',
              method: 'DELETE',
              path: '/api/presentations/:id',
              purpose: 'Delete a presentation permanently.',
              whenToUse: 'Use this endpoint to permanently remove a presentation.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Presentation ID to delete' }],
              successResponse: { status: 200, description: 'Presentation deleted', body: { message: 'Presentation deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Presentation not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/presentations/YOUR_PRES_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const options = { hostname: 'api.mengo.ai', path: '/api/presentations/YOUR_PRES_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests\nrequests.delete('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/presentations/YOUR_PRES_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid presentation ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'presentations.delete'],
              relatedApis: ['pres-list', 'pres-detail'],
            },
          ],
        },
        {
          id: 'cap-table',
          name: 'Cap Table',
          description: 'Cap table management with shareholders, dilution scenarios, and ownership pie data.',
          endpoints: [
            {
              id: 'cap-get',
              name: 'Get Cap Table',
              method: 'GET',
              path: '/api/cap-table/:companyId',
              purpose: 'Retrieve the cap table for a company (auto-creates if missing).',
              whenToUse: 'Use this endpoint to get the full cap table including all shareholders and dilution scenarios.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'Cap table data', body: { _id: '...', companyId: '...', shareholders: [], dilutionScenarios: [], totalShares: 1000000, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const capTable = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/cap-table/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Cap table ID' },
                { field: 'shareholders', type: 'array', description: 'Array of shareholder objects' },
                { field: 'dilutionScenarios', type: 'array', description: 'Array of dilution scenario objects' },
                { field: 'totalShares', type: 'number', description: 'Total number of shares' },
              ],
              notes: ['If no cap table exists for the company, one is automatically created.', 'Additional endpoints: POST /:companyId/shareholders, PUT /:companyId/shareholders/:id, DELETE /:companyId/shareholders/:id, POST /:companyId/dilution-scenario, DELETE /:companyId/dilution-scenario/:id, GET /:companyId/ownership-pie.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['cap-upsert'],
            },
            {
              id: 'cap-upsert',
              name: 'Upsert Cap Table',
              method: 'PUT',
              path: '/api/cap-table/:companyId',
              purpose: 'Create or update the cap table for a company.',
              whenToUse: 'Use this endpoint to create or update the overall cap table data.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              requestBody: { totalShares: 1000000, totalValuation: 5000000 },
              successResponse: { status: 200, description: 'Cap table updated', body: { _id: '...', companyId: '...', totalShares: 1000000, totalValuation: 5000000, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"totalShares":1000000,"totalValuation":5000000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ totalShares: 1000000, totalValuation: 5000000 }) });`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', { totalShares: 1000000, totalValuation: 5000000 }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ totalShares: 1000000, totalValuation: 5000000 }); const options = { hostname: 'api.mengo.ai', path: '/api/cap-table/YOUR_COMPANY_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.put('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID', json={'totalShares': 1000000, 'totalValuation': 5000000}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/cap-table/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['totalShares' => 1000000, 'totalValuation' => 5000000])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Cap table ID' },
                { field: 'totalShares', type: 'number', description: 'Total shares' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Creates a new cap table if none exists, updates if one does.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.edit'],
              relatedApis: ['cap-get'],
            },
          ],
        },
        {
          id: 'financial-models',
          name: 'Financial Models',
          description: 'Financial model management with scenarios and active scenario selection.',
          endpoints: [
            {
              id: 'fm-list',
              name: 'List Financial Models',
              method: 'GET',
              path: '/api/financial-models/:companyId',
              purpose: 'Retrieve all financial models for a company.',
              whenToUse: 'Use this endpoint to list all financial models.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of financial models', body: [{ _id: '...', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31', scenarios: [], activeScenario: null, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/financial-models/YOUR_COMPANY_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/financial-models/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const models = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/financial-models/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/financial-models/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/financial-models/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/financial-models/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Model ID' },
                { field: '[].name', type: 'string', description: 'Model name' },
                { field: '[].startDate', type: 'string', description: 'Start date' },
                { field: '[].endDate', type: 'string', description: 'End date' },
                { field: '[].scenarios', type: 'array', description: 'Array of scenario objects' },
                { field: '[].activeScenario', type: 'string|null', description: 'ID of the active scenario' },
              ],
              notes: ['Additional endpoints: POST /:id/scenarios (add scenario), PUT /:id/active-scenario (set active).'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['fm-detail', 'fm-create'],
            },
            {
              id: 'fm-create',
              name: 'Create Financial Model',
              method: 'POST',
              path: '/api/financial-models',
              purpose: 'Create a new financial model.',
              whenToUse: 'Use this endpoint to create a new financial model with date ranges and scenarios.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31' },
              successResponse: { status: 201, description: 'Financial model created', body: { _id: '...', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31', scenarios: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — name, companyId, startDate, endDate required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/financial-models -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"companyId":"YOUR_COMPANY_ID","name":"Revenue Model 2026","startDate":"2026-01-01","endDate":"2026-12-31"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/financial-models', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31' }) });`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/financial-models', { companyId: 'YOUR_COMPANY_ID', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31' }); const options = { hostname: 'api.mengo.ai', path: '/api/financial-models', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.post('https://app.mengoengine.com/api/financial-models', json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Revenue Model 2026', 'startDate': '2026-01-01', 'endDate': '2026-12-31'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/financial-models'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Revenue Model 2026', 'startDate' => '2026-01-01', 'endDate' => '2026-12-31'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Model name' },
                { field: 'startDate', type: 'string', description: 'Model start date' },
                { field: 'endDate', type: 'string', description: 'Model end date' },
              ],
              notes: ['Required fields: companyId, name, startDate, endDate.'],
              commonMistakes: ['Omitting required fields (companyId, name, startDate, endDate).'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.create'],
              relatedApis: ['fm-list', 'fm-detail'],
            },
            {
              id: 'fm-detail',
              name: 'Get Financial Model Detail',
              method: 'GET',
              path: '/api/financial-models/detail/:id',
              purpose: 'Retrieve a single financial model by ID.',
              whenToUse: 'Use this endpoint to get full details of a financial model including scenarios.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Financial model ID' }],
              successResponse: { status: 200, description: 'Financial model details', body: { _id: '...', name: 'Revenue Model 2026', startDate: '2026-01-01', endDate: '2026-12-31', scenarios: [], activeScenario: null } },
              errorResponses: [{ code: 404, message: 'Financial model not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/financial-models/detail/YOUR_MODEL_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/financial-models/detail/YOUR_MODEL_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const model = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/financial-models/detail/YOUR_MODEL_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/financial-models/detail/YOUR_MODEL_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/financial-models/detail/YOUR_MODEL_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/financial-models/detail/YOUR_MODEL_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Model ID' },
                { field: 'scenarios', type: 'array', description: 'Array of scenario objects' },
                { field: 'activeScenario', type: 'string|null', description: 'ID of the active scenario' },
              ],
              notes: ['Returns complete model with all scenarios.'],
              commonMistakes: ['Using an invalid model ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['fm-list', 'fm-create'],
            },
            {
              id: 'fm-update',
              name: 'Update Financial Model',
              method: 'PUT',
              path: '/api/financial-models/:id',
              purpose: 'Update a financial model.',
              whenToUse: 'Use this endpoint to modify a financial model.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Financial model ID' }],
              requestBody: { name: 'Updated Revenue Model', endDate: '2027-12-31' },
              successResponse: { status: 200, description: 'Financial model updated', body: { _id: '...', name: 'Updated Revenue Model', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Financial model not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"name":"Updated Revenue Model"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Updated Revenue Model' }) });`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', { name: 'Updated Revenue Model' }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ name: 'Updated Revenue Model' }); const options = { hostname: 'api.mengo.ai', path: '/api/financial-models/YOUR_MODEL_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.put('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', json={'name': 'Updated Revenue Model'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Revenue Model'])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Model ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.', 'Additional endpoints: POST /:id/scenarios (add scenario), PUT /:id/active-scenario (set active).'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.edit'],
              relatedApis: ['fm-list', 'fm-detail', 'fm-create'],
            },
            {
              id: 'fm-delete',
              name: 'Delete Financial Model',
              method: 'DELETE',
              path: '/api/financial-models/:id',
              purpose: 'Delete a financial model permanently.',
              whenToUse: 'Use this endpoint to permanently remove a financial model.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Financial model ID to delete' }],
              successResponse: { status: 200, description: 'Financial model deleted', body: { message: 'Financial model deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Financial model not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const options = { hostname: 'api.mengo.ai', path: '/api/financial-models/YOUR_MODEL_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests\nrequests.delete('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/financial-models/YOUR_MODEL_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid model ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.delete'],
              relatedApis: ['fm-list', 'fm-detail'],
            },
          ],
        },
        {
          id: 'funding-rounds',
          name: 'Funding Rounds',
          description: 'Funding round management with commitments tracking.',
          endpoints: [
            {
              id: 'fr-list',
              name: 'List Funding Rounds',
              method: 'GET',
              path: '/api/funding-rounds/:companyId',
              purpose: 'Retrieve all funding rounds for a company.',
              whenToUse: 'Use this endpoint to list all funding rounds.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of funding rounds', body: [{ _id: '...', name: 'Series A', type: 'series-a', targetAmount: 5000000, raisedAmount: 3000000, commitments: [], status: 'open', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/funding-rounds/YOUR_COMPANY_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/funding-rounds/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const rounds = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/funding-rounds/YOUR_COMPANY_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/funding-rounds/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/funding-rounds/YOUR_COMPANY_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/funding-rounds/YOUR_COMPANY_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Round ID' },
                { field: '[].name', type: 'string', description: 'Round name' },
                { field: '[].type', type: 'string', description: 'Round type: pre-seed, seed, series-a, series-b, series-c, series-d, extension, bridge, debt' },
                { field: '[].targetAmount', type: 'number', description: 'Target funding amount' },
                { field: '[].raisedAmount', type: 'number', description: 'Amount raised so far' },
                { field: '[].commitments', type: 'array', description: 'Array of commitment objects' },
                { field: '[].status', type: 'string', description: 'Round status' },
              ],
              notes: ['Valid type values: pre-seed, seed, series-a, series-b, series-c, series-d, extension, bridge, debt.', 'Additional endpoints: POST /:id/commitments, PUT /:id/commitments/:commitmentId, DELETE /:id/commitments/:commitmentId.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['fr-detail', 'fr-create'],
            },
            {
              id: 'fr-create',
              name: 'Create Funding Round',
              method: 'POST',
              path: '/api/funding-rounds',
              purpose: 'Create a new funding round.',
              whenToUse: 'Use this endpoint to create a new funding round with target amount and type.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Series A', type: 'series-a', targetAmount: 5000000 },
              successResponse: { status: 201, description: 'Funding round created', body: { _id: '...', name: 'Series A', type: 'series-a', targetAmount: 5000000, commitments: [], status: 'open', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — name, companyId, type, targetAmount required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/funding-rounds -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"companyId":"YOUR_COMPANY_ID","name":"Series A","type":"series-a","targetAmount":5000000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/funding-rounds', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Series A', type: 'series-a', targetAmount: 5000000 }) });`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/funding-rounds', { companyId: 'YOUR_COMPANY_ID', name: 'Series A', type: 'series-a', targetAmount: 5000000 }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Series A', type: 'series-a', targetAmount: 5000000 }); const options = { hostname: 'api.mengo.ai', path: '/api/funding-rounds', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.post('https://app.mengoengine.com/api/funding-rounds', json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Series A', 'type': 'series-a', 'targetAmount': 5000000}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/funding-rounds'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Series A', 'type' => 'series-a', 'targetAmount' => 5000000])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Round name' },
                { field: 'type', type: 'string', description: 'Round type' },
                { field: 'targetAmount', type: 'number', description: 'Target amount' },
              ],
              notes: ['Required fields: companyId, name, type, targetAmount.', 'Valid type values: pre-seed, seed, series-a, series-b, series-c, series-d, extension, bridge, debt.'],
              commonMistakes: ['Omitting required fields.', 'Using invalid type enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.create'],
              relatedApis: ['fr-list', 'fr-detail'],
            },
            {
              id: 'fr-detail',
              name: 'Get Funding Round Detail',
              method: 'GET',
              path: '/api/funding-rounds/detail/:id',
              purpose: 'Retrieve a single funding round by ID.',
              whenToUse: 'Use this endpoint to get full details of a funding round including all commitments.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Funding round ID' }],
              successResponse: { status: 200, description: 'Funding round details', body: { _id: '...', name: 'Series A', type: 'series-a', targetAmount: 5000000, commitments: [], status: 'open' } },
              errorResponses: [{ code: 404, message: 'Funding round not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/funding-rounds/detail/YOUR_ROUND_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/funding-rounds/detail/YOUR_ROUND_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const round = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/funding-rounds/detail/YOUR_ROUND_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); https.get({ hostname: 'api.mengo.ai', path: '/api/funding-rounds/detail/YOUR_ROUND_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests\nresponse = requests.get('https://app.mengoengine.com/api/funding-rounds/detail/YOUR_ROUND_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/funding-rounds/detail/YOUR_ROUND_ID'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Round ID' },
                { field: 'commitments', type: 'array', description: 'Array of commitment objects' },
                { field: 'targetAmount', type: 'number', description: 'Target amount' },
                { field: 'raisedAmount', type: 'number', description: 'Amount raised' },
              ],
              notes: ['Returns complete funding round with all commitments.'],
              commonMistakes: ['Using an invalid round ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['fr-list', 'fr-create'],
            },
            {
              id: 'fr-update',
              name: 'Update Funding Round',
              method: 'PUT',
              path: '/api/funding-rounds/:id',
              purpose: 'Update a funding round.',
              whenToUse: 'Use this endpoint to modify a funding round including target amount and status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Funding round ID' }],
              requestBody: { name: 'Series A Extended', targetAmount: 8000000, status: 'closing' },
              successResponse: { status: 200, description: 'Funding round updated', body: { _id: '...', name: 'Series A Extended', targetAmount: 8000000, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Funding round not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"name":"Series A Extended","targetAmount":8000000,"status":"closing"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Series A Extended', targetAmount: 8000000, status: 'closing' }) });`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', { name: 'Series A Extended', targetAmount: 8000000 }, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const data = JSON.stringify({ name: 'Series A Extended', targetAmount: 8000000 }); const options = { hostname: 'api.mengo.ai', path: '/api/funding-rounds/YOUR_ROUND_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(data); req.end();`,
              pythonExample: `import requests\nrequests.put('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', json={'name': 'Series A Extended', 'targetAmount': 8000000}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Series A Extended', 'targetAmount' => 8000000])); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Round ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.', 'Additional endpoints: POST /:id/commitments, PUT /:id/commitments/:commitmentId, DELETE /:id/commitments/:commitmentId.'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.edit'],
              relatedApis: ['fr-list', 'fr-detail', 'fr-create'],
            },
            {
              id: 'fr-delete',
              name: 'Delete Funding Round',
              method: 'DELETE',
              path: '/api/funding-rounds/:id',
              purpose: 'Delete a funding round permanently.',
              whenToUse: 'Use this endpoint to permanently remove a funding round.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Funding round ID to delete' }],
              successResponse: { status: 200, description: 'Funding round deleted', body: { message: 'Funding round deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Funding round not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https'); const options = { hostname: 'api.mengo.ai', path: '/api/funding-rounds/YOUR_ROUND_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }; const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests\nrequests.delete('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/funding-rounds/YOUR_ROUND_ID'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent and removes all associated commitments.'],
              commonMistakes: ['Using an invalid round ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'funding.delete'],
              relatedApis: ['fr-list', 'fr-detail'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // PROGRAMS GROUP
    // ==========================================
    {
      id: 'programs',
      name: 'Programs',
      description: 'Courses, loyalty programmes, and membership plans',
      icon: 'GraduationCap',
      color: '#8B5CF6',
      categories: [
        // --- Courses ---
        {
          id: 'courses',
          name: 'Courses',
          description: 'Course management with categories, chapters, lessons, and AI-powered content generation.',
          endpoints: [
            {
              id: 'course-list',
              name: 'List Courses',
              method: 'GET',
              path: '/api/courses/courses/:companyId',
              purpose: 'Retrieve all courses for a company with optional search and filtering.',
              whenToUse: 'Use this endpoint to list courses, optionally filtered by categoryId, status, or search query.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Search term for course title/description' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, published, archived' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Results per page (default 50)' },
              ],
              successResponse: { status: 200, description: 'List of courses with pagination', body: { data: [{ _id: '...', title: 'Marketing 101', description: '...', categoryId: '...', status: 'published', chapters: [], createdAt: '2026-07-22T10:00:00Z' }], pagination: { page: 1, limit: 50, total: 10, pages: 1 } } },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/courses/courses/YOUR_COMPANY_ID?status=published" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/courses/YOUR_COMPANY_ID?status=published', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const courses = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/courses/courses/YOUR_COMPANY_ID', {
  params: { status: 'published' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/courses/courses/YOUR_COMPANY_ID?status=published', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/courses/courses/YOUR_COMPANY_ID',
    params={'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/courses/YOUR_COMPANY_ID?status=published');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of course objects' },
                { field: 'data[].title', type: 'string', description: 'Course title' },
                { field: 'data[].categoryId', type: 'string', description: 'Category ID' },
                { field: 'data[].status', type: 'string', description: 'Course status: draft, published, archived' },
                { field: 'pagination', type: 'object', description: 'Pagination metadata' },
              ],
              notes: ['Supports search, categoryId, and status query parameters.', 'Additional endpoints: GET /categories/:companyId, GET /categories/detail/:id, POST /categories, PUT /categories/:id, DELETE /categories/:id, GET /chapters/:courseId, GET /chapters/detail/:id, POST /chapters, PUT /chapters/:id, DELETE /chapters/:id, PUT /chapters/reorder/:courseId, GET /lessons/:chapterId, GET /lessons/detail/:id, POST /lessons, PUT /lessons/:id, DELETE /lessons/:id, PUT /lessons/reorder/:chapterId, DELETE /courses/clear/:companyId, POST /ai/generate-description, POST /ai/generate-structure, POST /ai/generate-quiz, POST /ai/enhance-content.'],
              commonMistakes: ['Using an invalid companyId.', 'Confusing course categories with product categories.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['course-detail', 'course-create'],
            },
            {
              id: 'course-detail',
              name: 'Get Course Detail',
              method: 'GET',
              path: '/api/courses/courses/detail/:id',
              purpose: 'Retrieve a single course by ID.',
              whenToUse: 'Use this endpoint to get full details of a course.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Course ID' }],
              successResponse: { status: 200, description: 'Course details', body: { data: { _id: '...', title: 'Marketing 101', description: '...', categoryId: '...', status: 'published', chapters: [], duration: 120, level: 'beginner' } } },
              errorResponses: [{ code: 404, message: 'Course not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/courses/courses/detail/YOUR_COURSE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/courses/detail/YOUR_COURSE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const course = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/courses/courses/detail/YOUR_COURSE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/courses/courses/detail/YOUR_COURSE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/courses/courses/detail/YOUR_COURSE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/courses/detail/YOUR_COURSE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Course ID' },
                { field: 'data.title', type: 'string', description: 'Course title' },
                { field: 'data.chapters', type: 'array', description: 'Array of chapter objects' },
                { field: 'data.duration', type: 'number', description: 'Estimated duration in minutes' },
              ],
              notes: ['Returns complete course with all chapters and lessons.'],
              commonMistakes: ['Using an invalid course ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['course-list', 'course-create'],
            },
            {
              id: 'course-create',
              name: 'Create Course',
              method: 'POST',
              path: '/api/courses/courses',
              purpose: 'Create a new course.',
              whenToUse: 'Use this endpoint to create a new course with title, description, and metadata.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', description: 'Introduction to marketing fundamentals', categoryId: 'CATEGORY_ID', status: 'draft', level: 'beginner', duration: 120 },
              successResponse: { status: 201, description: 'Course created', body: { data: { _id: '...', title: 'Marketing 101', status: 'draft', createdAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [{ code: 400, message: 'Validation error — title and companyId required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/courses/courses \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Marketing 101","description":"Introduction to marketing fundamentals","categoryId":"CATEGORY_ID","status":"draft","level":"beginner","duration":120}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/courses', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', description: 'Introduction to marketing fundamentals', categoryId: 'CATEGORY_ID', status: 'draft', level: 'beginner', duration: 120 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/courses/courses',
  { companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', description: 'Introduction to marketing fundamentals', categoryId: 'CATEGORY_ID', status: 'draft', level: 'beginner', duration: 120 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', categoryId: 'CATEGORY_ID' });
const options = { hostname: 'api.mengo.ai', path: '/api/courses/courses', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/courses/courses',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Marketing 101', 'categoryId': 'CATEGORY_ID', 'status': 'draft'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/courses');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Marketing 101', 'categoryId' => 'CATEGORY_ID']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Auto-generated course ID' },
                { field: 'data.title', type: 'string', description: 'Course title' },
                { field: 'data.status', type: 'string', description: 'Course status' },
              ],
              notes: ['Required fields: companyId, title.', 'Valid status values: draft, published, archived.', 'Valid level values: beginner, intermediate, advanced.'],
              commonMistakes: ['Omitting required fields (companyId, title).'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'courses.create'],
              relatedApis: ['course-list', 'course-detail'],
            },
            {
              id: 'course-update',
              name: 'Update Course',
              method: 'PUT',
              path: '/api/courses/courses/:id',
              purpose: 'Update an existing course.',
              whenToUse: 'Use this endpoint to modify course details, content, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Course ID to update' }],
              requestBody: { title: 'Updated Marketing 101', status: 'published' },
              successResponse: { status: 200, description: 'Course updated', body: { data: { _id: '...', title: 'Updated Marketing 101', status: 'published', updatedAt: '2026-07-22T11:00:00Z' } } },
              errorResponses: [{ code: 404, message: 'Course not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Marketing 101","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Marketing 101', status: 'published' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID',
  { title: 'Updated Marketing 101', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Marketing 101', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/courses/courses/YOUR_COURSE_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID',
    json={'title': 'Updated Marketing 101', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Marketing 101', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'Course ID' },
                { field: 'data.updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.'],
              commonMistakes: ['Attempting to update immutable fields like companyId or _id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'courses.edit'],
              relatedApis: ['course-list', 'course-detail', 'course-create'],
            },
            {
              id: 'course-delete',
              name: 'Delete Course',
              method: 'DELETE',
              path: '/api/courses/courses/:id',
              purpose: 'Delete a course permanently.',
              whenToUse: 'Use this endpoint to permanently remove a course.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Course ID to delete' }],
              successResponse: { status: 200, description: 'Course deleted', body: { data: { message: 'Course deleted' } } },
              errorResponses: [{ code: 404, message: 'Course not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/courses/courses/YOUR_COURSE_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/courses/YOUR_COURSE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'data.message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.', 'Additional endpoint: DELETE /courses/clear/:companyId to delete all courses for a company.'],
              commonMistakes: ['Using an invalid course ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'courses.delete'],
              relatedApis: ['course-list', 'course-detail'],
            },
            {
              id: 'course-ai-generate',
              name: 'AI Generate Course Content',
              method: 'POST',
              path: '/api/courses/ai/generate-description',
              purpose: 'Generate course content using AI.',
              whenToUse: 'Use this endpoint to generate course descriptions, structures, quizzes, or enhanced content via AI.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', type: 'description' },
              successResponse: { status: 200, description: 'AI-generated content', body: { data: { content: 'Generated course description...', metadata: { model: 'claude', tokensUsed: 150 } } } },
              errorResponses: [{ code: 400, message: 'Validation error — title and companyId required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/courses/ai/generate-description \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Marketing 101","type":"description"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/courses/ai/generate-description', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', type: 'description' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/courses/ai/generate-description',
  { companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', type: 'description' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Marketing 101', type: 'description' });
const options = { hostname: 'api.mengo.ai', path: '/api/courses/ai/generate-description', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/courses/ai/generate-description',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Marketing 101', 'type': 'description'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/courses/ai/generate-description');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Marketing 101', 'type' => 'description']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data.content', type: 'string', description: 'AI-generated content' },
                { field: 'data.metadata', type: 'object', description: 'AI model metadata' },
              ],
              notes: ['Additional AI endpoints: POST /ai/generate-structure, POST /ai/generate-quiz, POST /ai/enhance-content.', 'Required fields: companyId, title.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'courses.ai-generate'],
              relatedApis: ['course-list', 'course-create'],
            },
          ],
        },
        // --- Loyalty Programme ---
        {
          id: 'loyalty-programme',
          name: 'Loyalty Programme',
          description: 'Loyalty programme management with tiers, earn rules, redeem rules, and rewards.',
          endpoints: [
            {
              id: 'lp-list',
              name: 'List Loyalty Programmes',
              method: 'GET',
              path: '/api/loyalty-programme/:companyId',
              purpose: 'Retrieve all loyalty programmes for a company.',
              whenToUse: 'Use this endpoint to list all loyalty programmes.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of loyalty programmes', body: [{ _id: '...', name: 'VIP Rewards', type: 'points', status: 'active', tiers: [], earnRules: [], redeemRules: [], rewards: [], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/loyalty-programme/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/loyalty-programme/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const programmes = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/loyalty-programme/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/loyalty-programme/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/loyalty-programme/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/loyalty-programme/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Programme ID' },
                { field: '[].name', type: 'string', description: 'Programme name' },
                { field: '[].type', type: 'string', description: 'Programme type: points, tier-based, hybrid' },
                { field: '[].status', type: 'string', description: 'Programme status' },
                { field: '[].tiers', type: 'array', description: 'Array of tier objects' },
              ],
              notes: ['Additional sub-resource endpoints: POST /loyalty-programmes/:programmeId/tiers, PUT /loyalty-programmes/:programmeId/tiers/:tierId, DELETE /loyalty-programmes/:programmeId/tiers/:tierId, POST /loyalty-programmes/:programmeId/earn-rules, PUT /loyalty-programmes/:programmeId/earn-rules/:ruleId, DELETE /loyalty-programmes/:programmeId/earn-rules/:ruleId, POST /loyalty-programmes/:programmeId/redeem-rules, PUT /loyalty-programmes/:programmeId/redeem-rules/:ruleId, DELETE /loyalty-programmes/:programmeId/redeem-rules/:ruleId, POST /loyalty-programmes/:programmeId/rewards, PUT /loyalty-programmes/:programmeId/rewards/:rewardId, DELETE /loyalty-programmes/:programmeId/rewards/:rewardId.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['lp-detail', 'lp-create'],
            },
            {
              id: 'lp-detail',
              name: 'Get Loyalty Programme Detail',
              method: 'GET',
              path: '/api/loyalty-programme/detail/:id',
              purpose: 'Retrieve a single loyalty programme by ID.',
              whenToUse: 'Use this endpoint to get full details of a loyalty programme.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Programme ID' }],
              successResponse: { status: 200, description: 'Loyalty programme details', body: { _id: '...', name: 'VIP Rewards', type: 'points', tiers: [], earnRules: [], redeemRules: [], rewards: [] } },
              errorResponses: [{ code: 404, message: 'Loyalty programme not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/loyalty-programme/detail/YOUR_PROGRAMME_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/loyalty-programme/detail/YOUR_PROGRAMME_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const programme = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/loyalty-programme/detail/YOUR_PROGRAMME_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/loyalty-programme/detail/YOUR_PROGRAMME_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/loyalty-programme/detail/YOUR_PROGRAMME_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/loyalty-programme/detail/YOUR_PROGRAMME_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Programme ID' },
                { field: 'tiers', type: 'array', description: 'Array of tier objects' },
                { field: 'earnRules', type: 'array', description: 'Array of earn rule objects' },
                { field: 'redeemRules', type: 'array', description: 'Array of redeem rule objects' },
                { field: 'rewards', type: 'array', description: 'Array of reward objects' },
              ],
              notes: ['Returns complete programme with all tiers, rules, and rewards.'],
              commonMistakes: ['Using an invalid programme ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['lp-list', 'lp-create'],
            },
            {
              id: 'lp-create',
              name: 'Create Loyalty Programme',
              method: 'POST',
              path: '/api/loyalty-programme',
              purpose: 'Create a new loyalty programme.',
              whenToUse: 'Use this endpoint to create a new loyalty programme with tiers and rules.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'VIP Rewards', type: 'points', description: 'Points-based loyalty programme' },
              successResponse: { status: 201, description: 'Loyalty programme created', body: { _id: '...', name: 'VIP Rewards', type: 'points', status: 'active', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — name and companyId required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/loyalty-programme \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"VIP Rewards","type":"points","description":"Points-based loyalty programme"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/loyalty-programme', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'VIP Rewards', type: 'points', description: 'Points-based loyalty programme' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/loyalty-programme',
  { companyId: 'YOUR_COMPANY_ID', name: 'VIP Rewards', type: 'points', description: 'Points-based loyalty programme' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'VIP Rewards', type: 'points' });
const options = { hostname: 'api.mengo.ai', path: '/api/loyalty-programme', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/loyalty-programme',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'VIP Rewards', 'type': 'points'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/loyalty-programme');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'VIP Rewards', 'type' => 'points']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated programme ID' },
                { field: 'name', type: 'string', description: 'Programme name' },
                { field: 'type', type: 'string', description: 'Programme type' },
              ],
              notes: ['Required fields: companyId, name.', 'Valid type values: points, tier-based, hybrid.'],
              commonMistakes: ['Omitting required fields (companyId, name).'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'loyalty-programme.create'],
              relatedApis: ['lp-list', 'lp-detail'],
            },
            {
              id: 'lp-update',
              name: 'Update Loyalty Programme',
              method: 'PUT',
              path: '/api/loyalty-programme/:id',
              purpose: 'Update an existing loyalty programme.',
              whenToUse: 'Use this endpoint to modify programme details, tiers, or rules.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Programme ID to update' }],
              requestBody: { name: 'Updated VIP Rewards', description: 'Enhanced points programme' },
              successResponse: { status: 200, description: 'Loyalty programme updated', body: { _id: '...', name: 'Updated VIP Rewards', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Loyalty programme not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated VIP Rewards","description":"Enhanced points programme"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated VIP Rewards', description: 'Enhanced points programme' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID',
  { name: 'Updated VIP Rewards', description: 'Enhanced points programme' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated VIP Rewards', description: 'Enhanced points programme' });
const options = { hostname: 'api.mengo.ai', path: '/api/loyalty-programme/YOUR_PROGRAMME_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID',
    json={'name': 'Updated VIP Rewards', 'description': 'Enhanced points programme'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated VIP Rewards', 'description' => 'Enhanced points programme']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Programme ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'loyalty-programme.edit'],
              relatedApis: ['lp-list', 'lp-detail', 'lp-create'],
            },
            {
              id: 'lp-delete',
              name: 'Delete Loyalty Programme',
              method: 'DELETE',
              path: '/api/loyalty-programme/:id',
              purpose: 'Delete a loyalty programme permanently.',
              whenToUse: 'Use this endpoint to permanently remove a loyalty programme.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Programme ID to delete' }],
              successResponse: { status: 200, description: 'Loyalty programme deleted', body: { message: 'Loyalty programme deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Loyalty programme not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/loyalty-programme/YOUR_PROGRAMME_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/loyalty-programme/YOUR_PROGRAMME_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid programme ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'loyalty-programme.delete'],
              relatedApis: ['lp-list', 'lp-detail'],
            },
          ],
        },
        // --- Membership Plans ---
        {
          id: 'membership-plans',
          name: 'Membership Plans',
          description: 'Membership plan management with status toggling.',
          endpoints: [
            {
              id: 'mp-list',
              name: 'List Membership Plans',
              method: 'GET',
              path: '/api/membership-plans/:companyId',
              purpose: 'Retrieve all membership plans for a company.',
              whenToUse: 'Use this endpoint to list all membership plans.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              successResponse: { status: 200, description: 'List of membership plans', body: [{ _id: '...', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', status: 'active', features: [], createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/membership-plans/YOUR_COMPANY_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/membership-plans/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plans = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/membership-plans/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/membership-plans/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/membership-plans/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/membership-plans/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Plan ID' },
                { field: '[].name', type: 'string', description: 'Plan name' },
                { field: '[].price', type: 'number', description: 'Plan price' },
                { field: '[].billingCycle', type: 'string', description: 'Billing cycle: monthly, yearly, one-time' },
                { field: '[].status', type: 'string', description: 'Plan status: active, inactive, archived' },
              ],
              notes: ['Valid billingCycle values: monthly, yearly, one-time.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mp-detail', 'mp-create'],
            },
            {
              id: 'mp-detail',
              name: 'Get Membership Plan Detail',
              method: 'GET',
              path: '/api/membership-plans/detail/:id',
              purpose: 'Retrieve a single membership plan by ID.',
              whenToUse: 'Use this endpoint to get full details of a membership plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID' }],
              successResponse: { status: 200, description: 'Membership plan details', body: { _id: '...', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', status: 'active', features: [] } },
              errorResponses: [{ code: 404, message: 'Membership plan not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/membership-plans/detail/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/membership-plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plan = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/membership-plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/membership-plans/detail/YOUR_PLAN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/membership-plans/detail/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/membership-plans/detail/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Plan ID' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'features', type: 'array', description: 'Array of feature objects' },
              ],
              notes: ['Returns complete plan with all features.'],
              commonMistakes: ['Using an invalid plan ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['mp-list', 'mp-create'],
            },
            {
              id: 'mp-create',
              name: 'Create Membership Plan',
              method: 'POST',
              path: '/api/membership-plans',
              purpose: 'Create a new membership plan.',
              whenToUse: 'Use this endpoint to create a new membership plan with pricing and features.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', features: [{ name: 'Dashboard Access', description: 'Access to basic dashboard' }] },
              successResponse: { status: 201, description: 'Membership plan created', body: { _id: '...', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', status: 'active', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — name, companyId, price required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/membership-plans \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Basic Plan","price":9.99,"billingCycle":"monthly","features":[{"name":"Dashboard Access","description":"Access to basic dashboard"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/membership-plans', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', features: [{ name: 'Dashboard Access', description: 'Access to basic dashboard' }] }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/membership-plans',
  { companyId: 'YOUR_COMPANY_ID', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly', features: [{ name: 'Dashboard Access', description: 'Access to basic dashboard' }] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Basic Plan', price: 9.99, billingCycle: 'monthly' });
const options = { hostname: 'api.mengo.ai', path: '/api/membership-plans', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/membership-plans',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Basic Plan', 'price': 9.99, 'billingCycle': 'monthly'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/membership-plans');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Basic Plan', 'price' => 9.99, 'billingCycle' => 'monthly']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated plan ID' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'price', type: 'number', description: 'Plan price' },
              ],
              notes: ['Required fields: companyId, name, price.', 'Valid billingCycle values: monthly, yearly, one-time.', 'Default status is active.'],
              commonMistakes: ['Omitting required fields (companyId, name, price).'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'membership-plans.create'],
              relatedApis: ['mp-list', 'mp-detail'],
            },
            {
              id: 'mp-update',
              name: 'Update Membership Plan',
              method: 'PUT',
              path: '/api/membership-plans/:id',
              purpose: 'Update an existing membership plan.',
              whenToUse: 'Use this endpoint to modify plan details, pricing, or features.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID to update' }],
              requestBody: { name: 'Pro Plan', price: 29.99 },
              successResponse: { status: 200, description: 'Membership plan updated', body: { _id: '...', name: 'Pro Plan', price: 29.99, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Membership plan not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Pro Plan","price":29.99}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Pro Plan', price: 29.99 }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID',
  { name: 'Pro Plan', price: 29.99 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Pro Plan', price: 29.99 });
const options = { hostname: 'api.mengo.ai', path: '/api/membership-plans/YOUR_PLAN_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID',
    json={'name': 'Pro Plan', 'price': 29.99},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Pro Plan', 'price' => 29.99]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Plan ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'membership-plans.edit'],
              relatedApis: ['mp-list', 'mp-detail', 'mp-create'],
            },
            {
              id: 'mp-delete',
              name: 'Delete Membership Plan',
              method: 'DELETE',
              path: '/api/membership-plans/:id',
              purpose: 'Delete a membership plan permanently.',
              whenToUse: 'Use this endpoint to permanently remove a membership plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID to delete' }],
              successResponse: { status: 200, description: 'Membership plan deleted', body: { message: 'Membership plan deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Membership plan not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/membership-plans/YOUR_PLAN_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/membership-plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.', 'Additional endpoint: PATCH /:id/status to toggle plan status (active/inactive/archived).'],
              commonMistakes: ['Using an invalid plan ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'membership-plans.delete'],
              relatedApis: ['mp-list', 'mp-detail'],
            },
          ],
        },
      ],
    },
    // ==========================================
    // SALES GROUP
    // ==========================================
    {
      id: 'sales',
      name: 'Sales',
      description: 'Landing pages, lead capture, and deployment management',
      icon: 'ShoppingCart',
      color: '#F59E0B',
      categories: [
        // --- Landing Pages ---
        {
          id: 'landing-pages',
          name: 'Landing Pages',
          description: 'Manage landing page content (pages, templates, exports), deployments to hosting providers, and public lead capture from published pages.',
          endpoints: [
            // --- Pages ---
            {
              id: 'lp-pages-list',
              name: 'Get All Pages',
              method: 'GET',
              path: '/api/landing-page-content-os/pages/:companyId',
              purpose: 'Retrieve all landing pages for a company.',
              whenToUse: 'Use this endpoint to list all landing pages configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve pages for' },
              ],
              successResponse: { status: 200, description: 'Array of landing pages', body: [{ id: 'lp-1', name: 'Product Launch Page', status: 'draft', companyId: '...', createdAt: '...', updatedAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get pages' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/landing-page-content-os/pages/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const pages = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/landing-page-content-os/pages/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/landing-page-content-os/pages/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[].id', type: 'string', description: 'Unique page identifier (auto-generated MongoDB ObjectId if not provided)' },
                { field: '[].name', type: 'string', description: 'Landing page name' },
                { field: '[].status', type: 'string', description: 'Page status: draft, review, approved, published, archived' },
                { field: '[].companyId', type: 'string', description: 'Company the page belongs to' },
              ],
              notes: ['Returns an empty array if no pages exist for the company.', 'Pages use the LandingPageContentOS model (sub-document array pattern).'],
              commonMistakes: ['Using the page _id instead of companyId in the URL — the path parameter is companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'landing-pages.view'],
              relatedApis: ['lp-page-detail', 'lp-page-create'],
            },
            {
              id: 'lp-page-detail',
              name: 'Get Page Detail',
              method: 'GET',
              path: '/api/landing-page-content-os/pages/detail/:id',
              purpose: 'Retrieve a single landing page by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific landing page.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The page ID to retrieve' },
              ],
              successResponse: { status: 200, description: 'Single landing page object', body: { id: 'lp-1', name: 'Product Launch Page', status: 'published', companyId: '...', createdAt: '...', updatedAt: '...' } },
              errorResponses: [
                { code: 404, message: 'Page not found' },
                { code: 500, message: 'Failed to get page' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/landing-page-content-os/pages/detail/PAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages/detail/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const page = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/landing-page-content-os/pages/detail/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages/detail/PAGE_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/landing-page-content-os/pages/detail/PAGE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages/detail/PAGE_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'id', type: 'string', description: 'Unique page identifier' },
                { field: 'name', type: 'string', description: 'Landing page name' },
                { field: 'status', type: 'string', description: 'Page status: draft, review, approved, published, archived' },
              ],
              notes: ['The id parameter is the page id field (not the MongoDB _id).'],
              commonMistakes: ['Using the MongoDB _id instead of the page id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'landing-pages.view'],
              relatedApis: ['lp-pages-list', 'lp-page-update'],
            },
            {
              id: 'lp-page-create',
              name: 'Create Page',
              method: 'POST',
              path: '/api/landing-page-content-os/pages',
              purpose: 'Create a new landing page for a company.',
              whenToUse: 'Use this endpoint to create a new landing page with content and configuration.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Page', status: 'draft' },
              successResponse: { status: 201, description: 'Created landing page', body: { id: '...', name: 'Product Launch Page', status: 'draft', companyId: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Invalid status value — must be one of: draft, review, approved, published, archived' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to create page' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/landing-page-content-os/pages \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Product Launch Page","status":"draft"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Page', status: 'draft' })
});
const page = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/landing-page-content-os/pages',
  { companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Page', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Launch Page', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/landing-page-content-os/pages',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Launch Page', 'status': 'draft'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Launch Page', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the page for' },
                { field: 'name', type: 'string', description: 'Landing page name' },
                { field: 'status', type: 'string', description: 'Page status. Must be one of: draft, review, approved, published, archived. Defaults to "draft".' },
                { field: 'id', type: 'string', description: 'Auto-generated MongoDB ObjectId if not provided' },
              ],
              notes: ['companyId is required in the request body.', 'status must be one of: draft, review, approved, published, archived. Defaults to "draft" if not provided.', 'If id is not provided, a MongoDB ObjectId is auto-generated.'],
              commonMistakes: ['Omitting the required companyId field in the request body.', 'Using an invalid status value — must be one of: draft, review, approved, published, archived.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'landing-pages.create'],
              relatedApis: ['lp-pages-list', 'lp-page-update'],
            },
            {
              id: 'lp-page-update',
              name: 'Update Page',
              method: 'PUT',
              path: '/api/landing-page-content-os/pages/:id',
              purpose: 'Update an existing landing page.',
              whenToUse: 'Use this endpoint to modify page content, configuration, or other properties.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The page ID to update' },
              ],
              requestBody: { name: 'Updated Page Name', status: 'published' },
              successResponse: { status: 200, description: 'Updated page', body: { id: 'lp-1', name: 'Updated Page Name', status: 'published', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Invalid status value — must be one of: draft, review, approved, published, archived' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Page not found' },
                { code: 500, message: 'Failed to update page' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Page Name","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Page Name', status: 'published' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID',
  { name: 'Updated Page Name', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Page Name', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages/PAGE_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Page Name', 'status': 'published'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Page Name', 'status' => 'published']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the page is merged with existing data.', 'If status is provided, it must be one of: draft, review, approved, published, archived.', 'The updatedAt timestamp is automatically set to the current time.'],
              commonMistakes: ['Using an invalid status value — must be one of: draft, review, approved, published, archived.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'landing-pages.edit'],
              relatedApis: ['lp-page-detail', 'lp-page-create'],
            },
            {
              id: 'lp-page-status',
              name: 'Update Page Status',
              method: 'PATCH',
              path: '/api/landing-page-content-os/pages/:id/status',
              purpose: 'Update only the status of a landing page (admin-only workflow transition).',
              whenToUse: 'Use this endpoint to change the status of a page through its lifecycle (draft → review → approved → published, or to archived).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The page ID to update status for' },
              ],
              requestBody: { status: 'published' },
              successResponse: { status: 200, description: 'Updated page status', body: { id: 'lp-1', status: 'published', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Invalid status value — must be one of: draft, review, approved, published, archived', body: { errors: [{ msg: 'Invalid status value' }] } },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Page not found' },
                { code: 500, message: 'Failed to update status' },
              ],
              curlExample: `curl -X PATCH "https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID/status" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID/status', {
  method: 'PATCH',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'published' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.patch('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID/status',
  { status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages/PAGE_ID/status', method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.patch('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID/status',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'status': 'published'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID/status');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'published']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'status', type: 'string', description: 'Updated status: draft, review, approved, published, or archived' },
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp' },
              ],
              notes: ['This is a dedicated status-only endpoint — use PATCH method.', 'status is required and must be one of: draft, review, approved, published, archived.', 'This is the recommended way to change page status in the approval workflow.'],
              commonMistakes: ['Using POST instead of PATCH — this endpoint requires the PATCH method.', 'Omitting the required status field in the request body.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'landing-pages.edit'],
              relatedApis: ['lp-page-update', 'lp-page-detail'],
            },
            {
              id: 'lp-page-delete',
              name: 'Delete Page',
              method: 'DELETE',
              path: '/api/landing-page-content-os/pages/:id',
              purpose: 'Delete a landing page.',
              whenToUse: 'Use this endpoint to permanently remove a landing page.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The page ID to delete' },
              ],
              successResponse: { status: 200, description: 'Page deleted', body: { success: true } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Page not found' },
                { code: 500, message: 'Failed to delete page' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-content-os/pages/PAGE_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-content-os/pages/PAGE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Always true on successful deletion' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Unlike other modules, the delete response returns { success: true } instead of { message: "..." }.'],
              commonMistakes: ['Using the MongoDB _id instead of the page id field.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'landing-pages.delete'],
              relatedApis: ['lp-pages-list', 'lp-page-update'],
            },
            // --- Deployments ---
            {
              id: 'lp-deployment-create',
              name: 'Create Deployment',
              method: 'POST',
              path: '/api/landing-page-deployments',
              purpose: 'Enqueue a landing page deployment to a hosting connection.',
              whenToUse: 'Use this endpoint to deploy a landing page to a connected hosting provider (e.g., Netlify, Vercel). The deployment is processed asynchronously.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', landingPageId: 'lp-1', connectionId: '660f...', customDomain: 'promo.example.com' },
              successResponse: { status: 201, description: 'Deployment enqueued', body: { _id: '...', companyId: '...', landingPageId: 'lp-1', landingPageName: 'Product Launch Page', provider: 'netlify', status: 'queued', attemptCount: 0, customDomain: 'promo.example.com', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'landingPageId and connectionId are required' },
                { code: 403, message: 'Access denied' },
                { code: 404, message: 'Hosting connection not found' },
                { code: 404, message: 'Landing page not found' },
                { code: 500, message: 'Failed to enqueue deployment' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/landing-page-deployments \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","landingPageId":"lp-1","connectionId":"660f..."}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-deployments', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', landingPageId: 'lp-1', connectionId: '660f...' })
});
const deployment = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/landing-page-deployments',
  { companyId: 'YOUR_COMPANY_ID', landingPageId: 'lp-1', connectionId: '660f...' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', landingPageId: 'lp-1', connectionId: '660f...' });
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-deployments', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/landing-page-deployments',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'landingPageId': 'lp-1', 'connectionId': '660f...'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-deployments');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'landingPageId' => 'lp-1', 'connectionId' => '660f...']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID' },
                { field: 'landingPageId', type: 'string', description: 'Required. The landing page ID to deploy' },
                { field: 'connectionId', type: 'string', description: 'Required. The hosting connection MongoDB _id' },
                { field: 'provider', type: 'string', description: 'Hosting provider (e.g., netlify, vercel)' },
                { field: 'status', type: 'string', description: 'Initial status: "queued"' },
                { field: 'customDomain', type: 'string', description: 'Optional custom domain for the deployment' },
              ],
              notes: ['companyId, landingPageId, and connectionId are required.', 'The hosting connection must exist and belong to the authenticated user.', 'Deployment is processed asynchronously — use the List Deployments endpoint to check status.', 'The landing page status is automatically updated to "queued" when a deployment is created.'],
              commonMistakes: ['Omitting landingPageId or connectionId — both are required.', 'Using a connectionId that does not belong to the authenticated user.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'landing-pages.edit'],
              relatedApis: ['lp-deployments-list', 'lp-deployment-cancel'],
            },
            {
              id: 'lp-deployments-list',
              name: 'List Deployments',
              method: 'GET',
              path: '/api/landing-page-deployments/:companyId',
              purpose: 'List deployments for a company, optionally filtered by landing page.',
              whenToUse: 'Use this endpoint to check deployment status and history for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID' },
              ],
              queryParams: [
                { name: 'landingPageId', type: 'string', required: false, description: 'Optional. Filter deployments by landing page ID' },
              ],
              successResponse: { status: 200, description: 'Array of deployments', body: [{ _id: '...', companyId: '...', landingPageId: 'lp-1', landingPageName: 'Product Launch Page', provider: 'netlify', status: 'live', attemptCount: 1, customDomain: 'promo.example.com', createdAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied' },
                { code: 500, message: 'Failed to list deployments' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/landing-page-deployments/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-deployments/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const deployments = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/landing-page-deployments/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/landing-page-deployments/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/landing-page-deployments/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-deployments/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'MongoDB deployment ID' },
                { field: '[].landingPageId', type: 'string', description: 'The landing page ID that was deployed' },
                { field: '[].landingPageName', type: 'string', description: 'Name of the landing page at deployment time' },
                { field: '[].provider', type: 'string', description: 'Hosting provider: netlify, vercel, etc.' },
                { field: '[].status', type: 'string', description: 'Deployment status: queued, processing, live, failed, cancelled' },
                { field: '[].customDomain', type: 'string', description: 'Custom domain for the deployment (if set)' },
              ],
              notes: ['Returns deployments sorted by creation date (newest first), limited to 100.', 'Use the landingPageId query parameter to filter by a specific page.'],
              commonMistakes: ['Using the landing page id instead of companyId in the URL — the path parameter is companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'landing-pages.view'],
              relatedApis: ['lp-deployment-create', 'lp-deployment-detail'],
            },
            {
              id: 'lp-leads-list',
              name: 'List Leads',
              method: 'GET',
              path: '/api/landing-page-leads/:companyId/list',
              purpose: 'List leads captured from published landing pages for a company.',
              whenToUse: 'Use this endpoint to view all leads captured from your published landing pages.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID' },
              ],
              queryParams: [
                { name: 'landingPageId', type: 'string', required: false, description: 'Optional. Filter leads by landing page ID' },
              ],
              successResponse: { status: 200, description: 'Array of captured leads', body: [{ _id: '...', companyId: '...', landingPageId: 'lp-1', name: 'John Doe', email: 'john@example.com', phone: '+1234567890', data: { message: 'Interested in product' }, sourceUrl: 'https://promo.example.com', createdAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to list leads' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/landing-page-leads/YOUR_COMPANY_ID/list" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-leads/YOUR_COMPANY_ID/list', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const leads = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/landing-page-leads/YOUR_COMPANY_ID/list', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/landing-page-leads/YOUR_COMPANY_ID/list', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/landing-page-leads/YOUR_COMPANY_ID/list',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-leads/YOUR_COMPANY_ID/list');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'MongoDB lead ID' },
                { field: '[].landingPageId', type: 'string', description: 'The landing page ID that captured this lead' },
                { field: '[].name', type: 'string', description: 'Lead name (extracted from form submission)' },
                { field: '[].email', type: 'string', description: 'Lead email address' },
                { field: '[].phone', type: 'string', description: 'Lead phone number (if provided)' },
                { field: '[].data', type: 'object', description: 'All form submission data as key-value pairs' },
                { field: '[].sourceUrl', type: 'string', description: 'URL of the landing page that submitted the lead' },
              ],
              notes: ['Returns leads sorted by creation date (newest first), limited to 500.', 'Use the landingPageId query parameter to filter by a specific page.', 'This is an authenticated endpoint — for the public lead capture endpoint, see the Capture Lead documentation.'],
              commonMistakes: ['Using the landing page id instead of companyId in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'landing-pages.view'],
              relatedApis: ['lp-lead-capture'],
            },
            {
              id: 'lp-lead-capture',
              name: 'Capture Lead (Public)',
              method: 'POST',
              path: '/api/landing-page-leads/:pageId',
              purpose: 'Public endpoint to capture lead form submissions from published landing pages. No authentication required.',
              whenToUse: 'Use this endpoint from published landing pages to submit lead information. This is a public endpoint with CORS support and anti-spam protections.',
              auth: 'None (public endpoint — no authentication required)',
              headers: [
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json or application/x-www-form-urlencoded' },
              ],
              pathParams: [
                { name: 'pageId', type: 'string', required: true, description: 'The landing page ID to capture the lead for' },
              ],
              requestBody: { name: 'John Doe', email: 'john@example.com', phone: '+1234567890', message: 'Interested in your product' },
              successResponse: { status: 200, description: 'Lead captured successfully', body: { success: true } },
              errorResponses: [
                { code: 400, message: 'Invalid email — email format validation failed' },
                { code: 400, message: 'Too many fields — maximum 40 fields allowed' },
                { code: 404, message: 'Unknown page — landing page ID not found' },
                { code: 500, message: 'Failed to capture lead' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/landing-page-leads/PAGE_ID" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"John Doe","email":"john@example.com","phone":"+1234567890","message":"Interested in your product"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/landing-page-leads/PAGE_ID', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'John Doe', email: 'john@example.com', phone: '+1234567890', message: 'Interested in your product' })
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/landing-page-leads/PAGE_ID',
  { name: 'John Doe', email: 'john@example.com', phone: '+1234567890', message: 'Interested in your product' });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'John Doe', email: 'john@example.com', phone: '+1234567890' });
const options = { hostname: 'api.mengo.ai', path: '/api/landing-page-leads/PAGE_ID', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/landing-page-leads/PAGE_ID',
  json={'name': 'John Doe', 'email': 'john@example.com', 'phone': '+1234567890'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/landing-page-leads/PAGE_ID');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'John Doe', 'email' => 'john@example.com']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'success', type: 'boolean', description: 'Always true on successful lead capture' },
              ],
              notes: ['This is a PUBLIC endpoint — no authentication token is needed.', 'CORS is enabled for all origins on this endpoint, allowing cross-origin form submissions from published landing pages.', 'Anti-spam protections: honeypot fields (_gotcha, bot-field, honeypot, hp_field) are silently accepted and dropped.', 'Maximum 40 fields per submission. String values are truncated to 5000 characters.', 'Email validation: if an email field is provided, it must be a valid format.', 'If the client accepts text/html, a friendly "Thank you" page is returned instead of JSON.'],
              commonMistakes: ['Sending an Authorization header — this endpoint is public and requires no authentication.', 'Submitting more than 40 fields — the request will be rejected.', 'Including honeypot field values (_gotcha, bot-field) — these are silently dropped.'],
              rateLimits: '60 requests per minute',
              requiredPermissions: [],
              relatedApis: ['lp-leads-list'],
            },
          ],
        },
        // --- WhatsApp Nurturing ---
        {
          id: 'whatsapp-nurturing',
          name: 'WhatsApp Nurturing',
          description: 'WhatsApp lead nurturing automation campaigns with AI-powered message generation, sequence management, analytics, and multi-channel asset support.',
          endpoints: [
            {
              id: 'wa-campaigns-list',
              name: 'Get All Campaigns',
              method: 'GET',
              path: '/api/whatsapp-campaigns/:companyId',
              purpose: 'Retrieve all WhatsApp nurturing campaigns for a company.',
              whenToUse: 'Use this endpoint to list all WhatsApp nurturing campaigns configured for a company.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve campaigns for' },
              ],
              successResponse: { status: 200, description: 'Array of WhatsApp campaigns', body: [{ _id: '...', companyId: '...', name: 'Lead Nurture Sequence', goals: ['lead-nurturing'], status: 'draft', messageFrequency: 'daily', tone: 'friendly', createdAt: '...' }] },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/whatsapp-campaigns/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaigns = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/whatsapp-campaigns/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/whatsapp-campaigns/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'MongoDB document ID' },
                { field: '[].companyId', type: 'string', description: 'Company the campaign belongs to' },
                { field: '[].name', type: 'string', description: 'Campaign name' },
                { field: '[].goals', type: 'string[]', description: 'Campaign goals: lead-nurturing, lead-qualification, appointment-booking, product-sales, webinar-registration, course-enrollment, community-building, customer-onboarding, upsell-campaign, retention-campaign' },
                { field: '[].status', type: 'string', description: 'Campaign status: draft, planning, generating, ready, active, paused, completed, archived' },
                { field: '[].messageFrequency', type: 'string', description: 'Message frequency: daily, alternate-day, every-3-days, weekly' },
                { field: '[].tone', type: 'string', description: 'Message tone: professional, friendly, conversational, educational, motivational, persuasive, luxury, corporate' },
                { field: '[].frameworks', type: 'string[]', description: 'Nurturing frameworks: educational, problem-solution, storytelling, founder-authority, product-demonstration, case-study' },
                { field: '[].createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Returns campaigns sorted by creation date (newest first).', 'Each campaign includes full message sequences, automation config, analytics, and multi-channel assets.'],
              commonMistakes: ['Using the campaign _id instead of companyId in the URL — the path parameter is companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'whatsapp-nurturing.view'],
              relatedApis: ['wa-campaign-detail', 'wa-campaign-create'],
            },
            {
              id: 'wa-campaign-detail',
              name: 'Get Campaign Detail',
              method: 'GET',
              path: '/api/whatsapp-campaigns/detail/:id',
              purpose: 'Retrieve a single WhatsApp nurturing campaign by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific campaign including messages, analytics, and automation config.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id' },
              ],
              successResponse: { status: 200, description: 'Single WhatsApp campaign object', body: { _id: '...', companyId: '...', name: 'Lead Nurture Sequence', goals: ['lead-nurturing'], status: 'draft', messages: [], sequencePlan: [], automation: { triggerEvent: 'new-lead' }, analytics: { totalSent: 0, totalDelivered: 0, totalRead: 0, totalReplied: 0 } } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/whatsapp-campaigns/detail/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/whatsapp-campaigns/detail/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/detail/CAMPAIGN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/whatsapp-campaigns/detail/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/detail/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'MongoDB document ID' },
                { field: 'name', type: 'string', description: 'Campaign name' },
                { field: 'goals', type: 'string[]', description: 'Campaign goals (e.g., lead-nurturing, appointment-booking)' },
                { field: 'status', type: 'string', description: 'Campaign status: draft, planning, generating, ready, active, paused, completed, archived' },
                { field: 'messages', type: 'array', description: 'Array of nurturing messages in the sequence' },
                { field: 'sequencePlan', type: 'array', description: 'Day-by-day plan with theme, objective, messageAngle, contentApproach' },
                { field: 'automation', type: 'object', description: 'Automation config: triggerEvent, exitConditions, delivery times, timezone' },
                { field: 'analytics', type: 'object', description: 'Campaign analytics: totalSent, totalDelivered, totalRead, totalReplied, openRate, responseRate, conversionRate' },
                { field: 'multiChannelAssets', type: 'array', description: 'Cross-channel assets (email, landing-page, social-post, ad-copy)' },
                { field: 'optimization', type: 'object', description: 'AI optimization results: openRateScore, responseRateScore, engagementScore, conversionScore, suggestions' },
              ],
              notes: ['Returns the complete campaign object including all messages, sequence plan, analytics, and multi-channel assets.', 'The id parameter is the MongoDB _id of the campaign document.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'whatsapp-nurturing.view'],
              relatedApis: ['wa-campaigns-list', 'wa-campaign-update'],
            },
            {
              id: 'wa-campaign-create',
              name: 'Create Campaign',
              method: 'POST',
              path: '/api/whatsapp-campaigns',
              purpose: 'Create a new WhatsApp nurturing campaign.',
              whenToUse: 'Use this endpoint to create a new campaign with goals, frameworks, tone, and other configuration.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Lead Nurture Sequence', goals: ['lead-nurturing', 'appointment-booking'], frameworks: ['educational', 'storytelling'], tone: 'friendly', messageFrequency: 'daily', sequenceDuration: 7, personalizationLevel: 'medium' },
              successResponse: { status: 201, description: 'Created campaign', body: { _id: '...', companyId: '...', name: 'Lead Nurture Sequence', goals: ['lead-nurturing', 'appointment-booking'], frameworks: ['educational', 'storytelling'], tone: 'friendly', messageFrequency: 'daily', sequenceDuration: 7, status: 'draft', version: 1, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [
                { code: 400, message: 'Validation error — Company ID is required, Campaign name is required', body: { errors: [{ msg: 'Company ID is required' }] } },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/whatsapp-campaigns \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Lead Nurture Sequence","goals":["lead-nurturing","appointment-booking"],"frameworks":["educational","storytelling"],"tone":"friendly","messageFrequency":"daily","sequenceDuration":7}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Lead Nurture Sequence', goals: ['lead-nurturing', 'appointment-booking'], frameworks: ['educational', 'storytelling'], tone: 'friendly', messageFrequency: 'daily', sequenceDuration: 7 })
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/whatsapp-campaigns',
  { companyId: 'YOUR_COMPANY_ID', name: 'Lead Nurture Sequence', goals: ['lead-nurturing', 'appointment-booking'], frameworks: ['educational', 'storytelling'], tone: 'friendly', messageFrequency: 'daily', sequenceDuration: 7 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Lead Nurture Sequence', goals: ['lead-nurturing'], frameworks: ['educational'], tone: 'friendly', messageFrequency: 'daily', sequenceDuration: 7 });
const options = { hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/whatsapp-campaigns',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Lead Nurture Sequence', 'goals': ['lead-nurturing'], 'frameworks': ['educational'], 'tone': 'friendly', 'messageFrequency': 'daily', 'sequenceDuration': 7})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Lead Nurture Sequence', 'goals' => ['lead-nurturing'], 'frameworks' => ['educational'], 'tone' => 'friendly', 'messageFrequency' => 'daily', 'sequenceDuration' => 7]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the campaign for' },
                { field: 'name', type: 'string', description: 'Required. Campaign name (max 200 characters)' },
                { field: 'goals', type: 'string[]', description: 'Campaign goals: lead-nurturing, lead-qualification, appointment-booking, product-sales, webinar-registration, course-enrollment, community-building, customer-onboarding, upsell-campaign, retention-campaign' },
                { field: 'frameworks', type: 'string[]', description: 'Nurturing frameworks: educational, problem-solution, storytelling, founder-authority, product-demonstration, case-study' },
                { field: 'tone', type: 'string', description: 'Message tone: professional, friendly, conversational, educational, motivational, persuasive, luxury, corporate. Defaults to "friendly"' },
                { field: 'messageFrequency', type: 'string', description: 'Frequency: daily, alternate-day, every-3-days, weekly. Defaults to "daily"' },
                { field: 'sequenceDuration', type: 'number', description: 'Duration in days (1-90). Defaults to 7' },
                { field: 'personalizationLevel', type: 'string', description: 'Personalization: basic, medium, advanced. Defaults to "medium"' },
                { field: 'messageLength', type: 'string', description: 'Length: short, medium, long. Defaults to "medium"' },
                { field: 'status', type: 'string', description: 'Initial status: "draft"' },
              ],
              notes: ['companyId and name are required fields.', 'goals and frameworks must be arrays of the allowed enum values if provided.', 'status defaults to "draft" on creation.', 'The full campaign object is returned including all nested schemas.'],
              commonMistakes: ['Omitting the required companyId or name field.', 'Using invalid goal values — must be one of: lead-nurturing, lead-qualification, appointment-booking, product-sales, webinar-registration, course-enrollment, community-building, customer-onboarding, upsell-campaign, retention-campaign.', 'Using invalid framework values — must be one of: educational, problem-solution, storytelling, founder-authority, product-demonstration, case-study.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'whatsapp-nurturing.create'],
              relatedApis: ['wa-campaigns-list', 'wa-campaign-update'],
            },
            {
              id: 'wa-campaign-update',
              name: 'Update Campaign',
              method: 'PUT',
              path: '/api/whatsapp-campaigns/:id',
              purpose: 'Update an existing WhatsApp nurturing campaign.',
              whenToUse: 'Use this endpoint to modify campaign configuration, messages, sequence plan, automation settings, or any other field.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id to update' },
              ],
              requestBody: { name: 'Updated Campaign Name', status: 'active', tone: 'conversational', messageFrequency: 'alternate-day' },
              successResponse: { status: 200, description: 'Updated campaign', body: { _id: '...', name: 'Updated Campaign Name', status: 'active', tone: 'conversational', updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Campaign Name","status":"active","tone":"conversational"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Campaign Name', status: 'active', tone: 'conversational' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID',
  { name: 'Updated Campaign Name', status: 'active', tone: 'conversational' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Campaign Name', status: 'active', tone: 'conversational' });
const options = { hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/CAMPAIGN_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Campaign Name', 'status': 'active', 'tone': 'conversational'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Campaign Name', 'status' => 'active', 'tone' => 'conversational']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — the campaign is merged with existing data using Object.assign.', 'The updatedAt timestamp is automatically set to the current time.', 'You can update nested objects like messages, sequencePlan, automation, analytics, and multiChannelAssets.', 'Status transitions follow the lifecycle: draft → planning → generating → ready → active → paused/completed → archived.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Using invalid status values — must be one of: draft, planning, generating, ready, active, paused, completed, archived.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'whatsapp-nurturing.edit'],
              relatedApis: ['wa-campaign-detail', 'wa-campaign-create'],
            },
            {
              id: 'wa-campaign-delete',
              name: 'Delete Campaign',
              method: 'DELETE',
              path: '/api/whatsapp-campaigns/:id',
              purpose: 'Delete a WhatsApp nurturing campaign.',
              whenToUse: 'Use this endpoint to permanently remove a campaign.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id to delete' },
              ],
              successResponse: { status: 200, description: 'Campaign deleted', body: { message: 'WhatsApp campaign deleted successfully' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/CAMPAIGN_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "WhatsApp campaign deleted successfully"' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Consider changing status to "archived" instead of deleting if you want to preserve the campaign data.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'whatsapp-nurturing.delete'],
              relatedApis: ['wa-campaigns-list', 'wa-campaign-update'],
            },
            {
              id: 'wa-message-update',
              name: 'Update Single Message',
              method: 'PUT',
              path: '/api/whatsapp-campaigns/:id/messages/:messageId',
              purpose: 'Update a single message within a WhatsApp nurturing campaign sequence.',
              whenToUse: 'Use this endpoint to modify a specific message in a campaign sequence (e.g., change the copy, CTA, or status of day 3 message).',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id' },
                { name: 'messageId', type: 'string', required: true, description: 'The message id within the campaign messages array' },
              ],
              requestBody: { copy: 'Updated message text', cta: 'Book a Call', ctaUrl: 'https://example.com/book', status: 'pending' },
              successResponse: { status: 200, description: 'Updated campaign with modified message', body: { _id: '...', messages: [{ id: 'msg-1', day: 1, copy: 'Updated message text', cta: 'Book a Call', status: 'pending' }], updatedAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 404, message: 'Message not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"copy":"Updated message text","cta":"Book a Call","status":"pending"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ copy: 'Updated message text', cta: 'Book a Call', status: 'pending' })
});
const campaign = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID',
  { copy: 'Updated message text', cta: 'Book a Call', status: 'pending' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ copy: 'Updated message text', cta: 'Book a Call', status: 'pending' });
const options = { hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'copy': 'Updated message text', 'cta': 'Book a Call', 'status': 'pending'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/messages/MESSAGE_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['copy' => 'Updated message text', 'cta' => 'Book a Call', 'status' => 'pending']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'messages', type: 'array', description: 'Full messages array with the updated message' },
                { field: 'updatedAt', type: 'string', description: 'Auto-updated timestamp' },
              ],
              notes: ['Returns the full campaign object with the updated message merged in.', 'Only the fields you provide are updated — other message fields remain unchanged.', 'The messageId path parameter refers to the message id field within the messages array (not the array index).'],
              commonMistakes: ['Using the array index instead of the message id field for messageId.', 'Using companyId instead of the MongoDB _id for the campaign id path parameter.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'whatsapp-nurturing.edit'],
              relatedApis: ['wa-campaign-detail', 'wa-message-regenerate'],
            },
            {
              id: 'wa-message-regenerate',
              name: 'Regenerate Message (AI)',
              method: 'POST',
              path: '/api/whatsapp-campaigns/:id/regenerate/:messageId',
              purpose: 'Trigger AI regeneration of a single message within a campaign.',
              whenToUse: 'Use this endpoint to request AI-powered regeneration of a specific message in the sequence. Returns a 202 Accepted status indicating the job has been queued.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id' },
                { name: 'messageId', type: 'string', required: true, description: 'The message id within the campaign messages array' },
              ],
              successResponse: { status: 202, description: 'Message regeneration queued', body: { message: 'Message regeneration queued', messageId: 'msg-1', campaignId: '...' } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 404, message: 'Message not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID',
  {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/regenerate/MESSAGE_ID');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message: "Message regeneration queued"' },
                { field: 'messageId', type: 'string', description: 'The message id that was queued for regeneration' },
                { field: 'campaignId', type: 'string', description: 'The campaign id the message belongs to' },
              ],
              notes: ['This is an asynchronous operation — it returns 202 Accepted, not 200 OK.', 'The AI pipeline processes the regeneration in the background.', 'Requires the "whatsapp-nurturing" "ai-generate" permission.', 'The regenerated message will replace the existing message content once complete.'],
              commonMistakes: ['Expecting a synchronous response with the regenerated content — this endpoint only queues the job.', 'Using the array index instead of the message id field for messageId.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'whatsapp-nurturing.ai-generate'],
              relatedApis: ['wa-message-update', 'wa-campaign-detail'],
            },
            {
              id: 'wa-campaign-analytics',
              name: 'Get Campaign Analytics',
              method: 'GET',
              path: '/api/whatsapp-campaigns/:id/analytics',
              purpose: 'Retrieve analytics for a WhatsApp nurturing campaign.',
              whenToUse: 'Use this endpoint to get delivery and engagement metrics for a campaign including open rates, response rates, and conversion rates.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The campaign MongoDB _id' },
              ],
              successResponse: { status: 200, description: 'Campaign analytics', body: { totalSent: 150, totalDelivered: 142, totalRead: 98, totalReplied: 34, totalOptedOut: 5, openRate: 69.01, responseRate: 23.94, conversionRate: 12.5 } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Campaign not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/analytics" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/analytics', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const analytics = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/analytics', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/whatsapp-campaigns/CAMPAIGN_ID/analytics', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/analytics',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/whatsapp-campaigns/CAMPAIGN_ID/analytics');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'totalSent', type: 'number', description: 'Total messages sent' },
                { field: 'totalDelivered', type: 'number', description: 'Total messages delivered' },
                { field: 'totalRead', type: 'number', description: 'Total messages read' },
                { field: 'totalReplied', type: 'number', description: 'Total messages replied to' },
                { field: 'totalOptedOut', type: 'number', description: 'Total contacts that opted out' },
                { field: 'openRate', type: 'number', description: 'Open rate percentage (0-100)' },
                { field: 'responseRate', type: 'number', description: 'Response rate percentage (0-100)' },
                { field: 'conversionRate', type: 'number', description: 'Conversion rate percentage (0-100)' },
              ],
              notes: ['If no analytics data exists yet, returns zeros for all metrics.', 'Analytics are calculated from individual message statuses (sent, delivered, read, replied).', 'This is a separate endpoint from the campaign detail — it focuses only on analytics metrics.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'whatsapp-nurturing.view'],
              relatedApis: ['wa-campaign-detail', 'wa-campaigns-list'],
            },
          ],
        },
        // --- Sales Collateral ---
        {
          id: 'sales-collateral',
          name: 'Sales Collateral',
          description: 'Centralized sales asset library with collateral management, categories, funnel-stage tagging, access control, and bulk import capabilities.',
          endpoints: [
            {
              id: 'sales-collateral-list',
              name: 'List Sales Collateral',
              method: 'GET',
              path: '/api/sales-collateral/collateral/:companyId',
              purpose: 'Retrieve all sales collateral for a company with optional filters.',
              whenToUse: 'Use this endpoint to list and filter sales collateral assets for a company by type, status, category, funnel stage, or access level.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve collateral for' },
              ],
              queryParams: [
                { name: 'type', type: 'string', required: false, description: 'Filter by collateral type: pitch-deck, proposal, one-pager, brochure, case-study, white-paper, ebook, presentation, sales-letter, comparison-sheet, pricing-sheet, faq-sheet, roi-calculator, demo-script, battle-card, objection-handler, testimonial-sheet, product-spec-sheet, contract-template, nda, follow-up-email, proposal-template, presentation-deck, leave-behind, executive-summary, product-demo, competitive-analysis, customer-story, infographic, video-script, podcast-script, webinar-script, social-proof, other' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'category', type: 'string', required: false, description: 'Filter by category name' },
                { name: 'funnelStage', type: 'string', required: false, description: 'Filter by funnel stage: awareness, interest, consideration, decision, retention, advocacy' },
                { name: 'accessLevel', type: 'string', required: false, description: 'Filter by access level: public, internal, confidential, restricted' },
                { name: 'search', type: 'string', required: false, description: 'Search across name, description, and valueProposition fields' },
              ],
              successResponse: { status: 200, description: 'Array of sales collateral documents', body: { data: [{ _id: '...', companyId: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'approved', funnelStage: 'decision', accessLevel: 'internal', createdAt: '...' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COMPANY_ID?type=pitch-deck&status=approved" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COMPANY_ID?type=pitch-deck&status=approved', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COMPANY_ID', {
  params: { type: 'pitch-deck', status: 'approved' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const params = new URLSearchParams({ type: 'pitch-deck', status: 'approved' });
https.get({ hostname: 'api.mengo.ai', path: \`/api/sales-collateral/collateral/YOUR_COMPANY_ID?\${params}\`, headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COMPANY_ID',
  params={'type': 'pitch-deck', 'status': 'approved'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COMPANY_ID?type=pitch-deck&status=approved');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of collateral documents' },
                { field: 'data[]._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data[].companyId', type: 'string', description: 'Company the collateral belongs to' },
                { field: 'data[].name', type: 'string', description: 'Collateral name' },
                { field: 'data[].type', type: 'string', description: 'Collateral type enum: pitch-deck, proposal, one-pager, brochure, case-study, white-paper, ebook, presentation, sales-letter, comparison-sheet, pricing-sheet, faq-sheet, roi-calculator, demo-script, battle-card, objection-handler, testimonial-sheet, product-spec-sheet, contract-template, nda, follow-up-email, proposal-template, presentation-deck, leave-behind, executive-summary, product-demo, competitive-analysis, customer-story, infographic, video-script, podcast-script, webinar-script, social-proof, other' },
                { field: 'data[].status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'data[].funnelStage', type: 'string', description: 'Funnel stage: awareness, interest, consideration, decision, retention, advocacy' },
                { field: 'data[].accessLevel', type: 'string', description: 'Access level: public, internal, confidential, restricted' },
                { field: 'data[].category', type: 'string', description: 'Category name' },
                { field: 'data[].createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Returns collateral sorted by creation date (newest first).', 'Search query searches across name, description, and valueProposition fields.', 'All filter parameters are optional — omit them to return all collateral.'],
              commonMistakes: ['Using the collateral _id instead of companyId in the URL — the path parameter is companyId.', 'Using invalid type values — must be one of the allowed enum values.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-collateral.view'],
              relatedApis: ['sales-collateral-detail', 'sales-collateral-create'],
            },
            {
              id: 'sales-collateral-detail',
              name: 'Get Collateral Detail',
              method: 'GET',
              path: '/api/sales-collateral/collateral/detail/:id',
              purpose: 'Retrieve a single sales collateral document by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific collateral asset including all fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the collateral document' },
              ],
              successResponse: { status: 200, description: 'Full collateral document', body: { data: { _id: '...', companyId: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck', description: '...', status: 'approved', funnelStage: 'decision', accessLevel: 'internal', valueProposition: '...', keyMessages: ['...'], callToAction: '...', targetPersona: '...', createdAt: '...' } } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Collateral not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral/detail/YOUR_COLLATERAL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the collateral belongs to' },
                { field: 'data.name', type: 'string', description: 'Collateral name' },
                { field: 'data.type', type: 'string', description: 'Collateral type enum value' },
                { field: 'data.description', type: 'string', description: 'Detailed description of the collateral' },
                { field: 'data.status', type: 'string', description: 'Status: draft, review, approved, published, archived' },
                { field: 'data.funnelStage', type: 'string', description: 'Funnel stage: awareness, interest, consideration, decision, retention, advocacy' },
                { field: 'data.accessLevel', type: 'string', description: 'Access level: public, internal, confidential, restricted' },
                { field: 'data.valueProposition', type: 'string', description: 'Value proposition text' },
                { field: 'data.keyMessages', type: 'string[]', description: 'Array of key messaging points' },
                { field: 'data.callToAction', type: 'string', description: 'Primary call to action' },
                { field: 'data.targetPersona', type: 'string', description: 'Target persona description' },
                { field: 'data.createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Returns the complete collateral object including all nested fields.', 'The id parameter is the MongoDB _id of the collateral document.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Confusing the collateral id with a category id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-collateral.view'],
              relatedApis: ['sales-collateral-list', 'sales-collateral-update'],
            },
            {
              id: 'sales-collateral-create',
              name: 'Create Sales Collateral',
              method: 'POST',
              path: '/api/sales-collateral/collateral',
              purpose: 'Create a new sales collateral document.',
              whenToUse: 'Use this endpoint to add a new collateral asset to the sales asset library.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId', 'name', 'type'],
                fields: [
                  { name: 'companyId', type: 'string', required: true, description: 'Company ID the collateral belongs to' },
                  { name: 'name', type: 'string', required: true, description: 'Name of the collateral' },
                  { name: 'type', type: 'string', required: true, description: 'Collateral type: pitch-deck, proposal, one-pager, brochure, case-study, white-paper, ebook, presentation, sales-letter, comparison-sheet, pricing-sheet, faq-sheet, roi-calculator, demo-script, battle-card, objection-handler, testimonial-sheet, product-spec-sheet, contract-template, nda, follow-up-email, proposal-template, presentation-deck, leave-behind, executive-summary, product-demo, competitive-analysis, customer-story, infographic, video-script, podcast-script, webinar-script, social-proof, other' },
                  { name: 'description', type: 'string', required: false, description: 'Detailed description of the collateral' },
                  { name: 'category', type: 'string', required: false, description: 'Category name' },
                  { name: 'subcategory', type: 'string', required: false, description: 'Subcategory name' },
                  { name: 'tags', type: 'string[]', required: false, description: 'Array of tag strings' },
                  { name: 'industryTags', type: 'string[]', required: false, description: 'Array of industry tag strings' },
                  { name: 'status', type: 'string', required: false, description: 'Status: draft (default), review, approved, published, archived' },
                  { name: 'funnelStage', type: 'string', required: false, description: 'Funnel stage: awareness, interest, consideration, decision, retention, advocacy' },
                  { name: 'accessLevel', type: 'string', required: false, description: 'Access level: public, internal, confidential, restricted' },
                  { name: 'valueProposition', type: 'string', required: false, description: 'Value proposition text' },
                  { name: 'keyMessages', type: 'string[]', required: false, description: 'Array of key messaging points' },
                  { name: 'callToAction', type: 'string', required: false, description: 'Primary call to action' },
                  { name: 'secondaryCTA', type: 'string', required: false, description: 'Secondary call to action' },
                  { name: 'targetPersona', type: 'string', required: false, description: 'Target persona description' },
                  { name: 'designBrief', type: 'string', required: false, description: 'Design brief or instructions' },
                  { name: 'talkingPoints', type: 'string[]', required: false, description: 'Array of talking points' },
                  { name: 'sections', type: 'array', required: false, description: 'Array of section objects' },
                  { name: 'objectionResponses', type: 'array', required: false, description: 'Array of objection response objects' },
                  { name: 'suggestedDistributionChannels', type: 'string[]', required: false, description: 'Array of distribution channel strings' },
                  { name: 'bestPractices', type: 'string[]', required: false, description: 'Array of best practice strings' },
                  { name: 'effectivenessTips', type: 'string[]', required: false, description: 'Array of effectiveness tip strings' },
                  { name: 'successMetrics', type: 'string[]', required: false, description: 'Array of success metric strings' },
                  { name: 'usageNotes', type: 'string', required: false, description: 'Usage notes' },
                  { name: 'followUpStrategy', type: 'string', required: false, description: 'Follow-up strategy description' },
                  { name: 'idealTiming', type: 'string', required: false, description: 'Ideal timing or seasonality info' },
                  { name: 'fileUrl', type: 'string', required: false, description: 'URL to the collateral file' },
                  { name: 'fileType', type: 'string', required: false, description: 'MIME type of the file' },
                  { name: 'fileName', type: 'string', required: false, description: 'Original file name' },
                  { name: 'thumbnailUrl', type: 'string', required: false, description: 'URL to thumbnail image' },
                  { name: 'driveUrl', type: 'string', required: false, description: 'Google Drive URL' },
                  { name: 'youtubeUrl', type: 'string', required: false, description: 'YouTube video URL' },
                  { name: 'figmaUrl', type: 'string', required: false, description: 'Figma design URL' },
                  { name: 'canvaUrl', type: 'string', required: false, description: 'Canva design URL' },
                  { name: 'dropboxUrl', type: 'string', required: false, description: 'Dropbox file URL' },
                  { name: 'websiteUrl', type: 'string', required: false, description: 'Website URL' },
                  { name: 'repoUrl', type: 'string', required: false, description: 'Repository URL' },
                  { name: 'productIds', type: 'string[]', required: false, description: 'Array of product IDs' },
                  { name: 'serviceIds', type: 'string[]', required: false, description: 'Array of service IDs' },
                  { name: 'packageIds', type: 'string[]', required: false, description: 'Array of package IDs' },
                  { name: 'planIds', type: 'string[]', required: false, description: 'Array of plan IDs' },
                  { name: 'featureIds', type: 'string[]', required: false, description: 'Array of feature IDs' },
                  { name: 'icpIds', type: 'string[]', required: false, description: 'Array of ICP IDs' },
                  { name: 'version', type: 'string', required: false, description: 'Version label' },
                  { name: 'versionNumber', type: 'number', required: false, description: 'Numeric version number' },
                  { name: 'isPrimary', type: 'boolean', required: false, description: 'Whether this is the primary version' },
                  { name: 'isFeatured', type: 'boolean', required: false, description: 'Whether this collateral is featured' },
                  { name: 'isTemplate', type: 'boolean', required: false, description: 'Whether this collateral is a template' },
                ],
              },
              successResponse: { status: 201, description: 'Created collateral document', body: { data: { _id: '...', companyId: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'draft', createdAt: '...' } } },
              errorResponses: [
                { code: 400, message: 'Validation failed — companyId, name, and type are required' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/sales-collateral/collateral" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q4 Pitch Deck","type":"pitch-deck","status":"draft","funnelStage":"decision"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'draft', funnelStage: 'decision' })
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-collateral/collateral', {
  companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'draft', funnelStage: 'decision'
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'draft', funnelStage: 'decision' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/collateral', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-collateral/collateral',
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q4 Pitch Deck', 'type': 'pitch-deck', 'status': 'draft', 'funnelStage': 'decision'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q4 Pitch Deck', 'type' => 'pitch-deck', 'status' => 'draft', 'funnelStage' => 'decision']));
echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the collateral belongs to' },
                { field: 'data.name', type: 'string', description: 'Collateral name' },
                { field: 'data.type', type: 'string', description: 'Collateral type enum value' },
                { field: 'data.status', type: 'string', description: 'Status (defaults to draft)' },
                { field: 'data.funnelStage', type: 'string', description: 'Funnel stage' },
                { field: 'data.createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['companyId, name, and type are required fields.', 'status defaults to "draft" on creation.', 'The full collateral object is returned including all nested fields.'],
              commonMistakes: ['Omitting the required companyId, name, or type field.', 'Using invalid type values — must be one of the allowed enum values.', 'Using invalid status values — must be one of: draft, review, approved, published, archived.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.create'],
              relatedApis: ['sales-collateral-list', 'sales-collateral-update'],
            },
            {
              id: 'sales-collateral-update',
              name: 'Update Sales Collateral',
              method: 'PUT',
              path: '/api/sales-collateral/collateral/:id',
              purpose: 'Update an existing sales collateral document.',
              whenToUse: 'Use this endpoint to modify fields on an existing collateral asset.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the collateral document' },
              ],
              requestBody: {
                required: [],
                fields: [
                  { name: 'name', type: 'string', required: false, description: 'Updated collateral name' },
                  { name: 'type', type: 'string', required: false, description: 'Updated collateral type enum value' },
                  { name: 'description', type: 'string', required: false, description: 'Updated description' },
                  { name: 'category', type: 'string', required: false, description: 'Updated category name' },
                  { name: 'subcategory', type: 'string', required: false, description: 'Updated subcategory' },
                  { name: 'tags', type: 'string[]', required: false, description: 'Updated tags' },
                  { name: 'industryTags', type: 'string[]', required: false, description: 'Updated industry tags' },
                  { name: 'status', type: 'string', required: false, description: 'Updated status: draft, review, approved, published, archived' },
                  { name: 'funnelStage', type: 'string', required: false, description: 'Updated funnel stage' },
                  { name: 'accessLevel', type: 'string', required: false, description: 'Updated access level' },
                  { name: 'valueProposition', type: 'string', required: false, description: 'Updated value proposition' },
                  { name: 'keyMessages', type: 'string[]', required: false, description: 'Updated key messages' },
                  { name: 'callToAction', type: 'string', required: false, description: 'Updated call to action' },
                  { name: 'secondaryCTA', type: 'string', required: false, description: 'Updated secondary CTA' },
                  { name: 'targetPersona', type: 'string', required: false, description: 'Updated target persona' },
                  { name: 'designBrief', type: 'string', required: false, description: 'Updated design brief' },
                  { name: 'talkingPoints', type: 'string[]', required: false, description: 'Updated talking points' },
                  { name: 'sections', type: 'array', required: false, description: 'Updated sections' },
                  { name: 'objectionResponses', type: 'array', required: false, description: 'Updated objection responses' },
                  { name: 'suggestedDistributionChannels', type: 'string[]', required: false, description: 'Updated distribution channels' },
                  { name: 'bestPractices', type: 'string[]', required: false, description: 'Updated best practices' },
                  { name: 'effectivenessTips', type: 'string[]', required: false, description: 'Updated effectiveness tips' },
                  { name: 'successMetrics', type: 'string[]', required: false, description: 'Updated success metrics' },
                  { name: 'usageNotes', type: 'string', required: false, description: 'Updated usage notes' },
                  { name: 'followUpStrategy', type: 'string', required: false, description: 'Updated follow-up strategy' },
                  { name: 'idealTiming', type: 'string', required: false, description: 'Updated ideal timing' },
                  { name: 'fileUrl', type: 'string', required: false, description: 'Updated file URL' },
                  { name: 'thumbnailUrl', type: 'string', required: false, description: 'Updated thumbnail URL' },
                  { name: 'isPrimary', type: 'boolean', required: false, description: 'Updated primary flag' },
                  { name: 'isFeatured', type: 'boolean', required: false, description: 'Updated featured flag' },
                  { name: 'isTemplate', type: 'boolean', required: false, description: 'Updated template flag' },
                ],
              },
              successResponse: { status: 200, description: 'Updated collateral document', body: { data: { _id: '...', companyId: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'approved', updatedAt: '...' } } },
              errorResponses: [
                { code: 404, message: 'Collateral not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"status":"approved","funnelStage":"decision"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'approved', funnelStage: 'decision' })
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', {
  status: 'approved', funnelStage: 'decision'
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ status: 'approved', funnelStage: 'decision' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID',
  json={'status': 'approved', 'funnelStage': 'decision'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['status' => 'approved', 'funnelStage' => 'decision']));
echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the collateral belongs to' },
                { field: 'data.name', type: 'string', description: 'Collateral name' },
                { field: 'data.type', type: 'string', description: 'Collateral type' },
                { field: 'data.status', type: 'string', description: 'Updated status' },
                { field: 'data.funnelStage', type: 'string', description: 'Updated funnel stage' },
                { field: 'data.updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['Only include fields you want to change — the document is merged with existing data using findByIdAndUpdate.', 'The updatedAt timestamp is automatically set.', 'Status transitions: draft → review → approved → published → archived.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Using invalid status values — must be one of: draft, review, approved, published, archived.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.edit'],
              relatedApis: ['sales-collateral-detail', 'sales-collateral-create'],
            },
            {
              id: 'sales-collateral-delete',
              name: 'Delete Sales Collateral',
              method: 'DELETE',
              path: '/api/sales-collateral/collateral/:id',
              purpose: 'Delete a sales collateral document permanently.',
              whenToUse: 'Use this endpoint to permanently remove a collateral asset from the library.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the collateral document to delete' },
              ],
              successResponse: { status: 200, description: 'Deleted collateral document', body: { data: { _id: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck' } } },
              errorResponses: [
                { code: 404, message: 'Collateral not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/collateral/YOUR_COLLATERAL_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral/YOUR_COLLATERAL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID of the deleted collateral' },
                { field: 'data.name', type: 'string', description: 'Name of the deleted collateral' },
                { field: 'data.type', type: 'string', description: 'Type of the deleted collateral' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Consider changing status to "archived" instead of deleting if you want to preserve the collateral data.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.delete'],
              relatedApis: ['sales-collateral-list', 'sales-collateral-update'],
            },
            {
              id: 'sales-collateral-bulk-import',
              name: 'Bulk Import Collateral',
              method: 'POST',
              path: '/api/sales-collateral/collateral/bulk-import',
              purpose: 'Bulk import multiple sales collateral documents at once.',
              whenToUse: 'Use this endpoint to create multiple collateral assets in a single request.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['items'],
                fields: [
                  { name: 'items', type: 'array', required: true, description: 'Array of collateral objects to create. Each item must include companyId, name, and type at minimum.' },
                ],
              },
              successResponse: { status: 201, description: 'Array of created collateral documents', body: { data: [{ _id: '...', companyId: '...', name: 'Q4 Pitch Deck', type: 'pitch-deck', status: 'draft', createdAt: '...' }] } },
              errorResponses: [
                { code: 400, message: 'Items array is required and must not be empty' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/sales-collateral/collateral/bulk-import" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"items":[{"companyId":"YOUR_COMPANY_ID","name":"Q4 Pitch Deck","type":"pitch-deck"},{"companyId":"YOUR_COMPANY_ID","name":"Product Brochure","type":"brochure"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/collateral/bulk-import', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ items: [
    { companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck' },
    { companyId: 'YOUR_COMPANY_ID', name: 'Product Brochure', type: 'brochure' }
  ] })
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-collateral/collateral/bulk-import', {
  items: [
    { companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck' },
    { companyId: 'YOUR_COMPANY_ID', name: 'Product Brochure', type: 'brochure' }
  ]
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ items: [
  { companyId: 'YOUR_COMPANY_ID', name: 'Q4 Pitch Deck', type: 'pitch-deck' },
  { companyId: 'YOUR_COMPANY_ID', name: 'Product Brochure', type: 'brochure' }
] });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/collateral/bulk-import', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-collateral/collateral/bulk-import',
  json={'items': [
    {'companyId': 'YOUR_COMPANY_ID', 'name': 'Q4 Pitch Deck', 'type': 'pitch-deck'},
    {'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Brochure', 'type': 'brochure'}
  ]},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/collateral/bulk-import');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['items' => [
  ['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q4 Pitch Deck', 'type' => 'pitch-deck'],
  ['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Brochure', 'type' => 'brochure']
]]));
echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of created collateral documents' },
                { field: 'data[]._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data[].companyId', type: 'string', description: 'Company the collateral belongs to' },
                { field: 'data[].name', type: 'string', description: 'Collateral name' },
                { field: 'data[].type', type: 'string', description: 'Collateral type' },
                { field: 'data[].createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Each item in the items array must include companyId, name, and type.', 'The items array must not be empty.', 'All items are created with a single database insertMany operation.'],
              commonMistakes: ['Sending an empty items array — it must contain at least one item.', 'Omitting required fields (companyId, name, type) in individual items.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.create'],
              relatedApis: ['sales-collateral-list', 'sales-collateral-create'],
            },
            {
              id: 'sales-collateral-categories-list',
              name: 'List Collateral Categories',
              method: 'GET',
              path: '/api/sales-collateral/categories/:companyId',
              purpose: 'Retrieve all collateral categories for a company.',
              whenToUse: 'Use this endpoint to list all categories used to organize sales collateral.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve categories for' },
              ],
              successResponse: { status: 200, description: 'Array of collateral categories', body: { data: [{ _id: '...', companyId: '...', name: 'Sales Enablement', description: '...', createdAt: '...' }] } },
              errorResponses: [
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-collateral/categories/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of category objects' },
                { field: 'data[]._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data[].companyId', type: 'string', description: 'Company the category belongs to' },
                { field: 'data[].name', type: 'string', description: 'Category name' },
                { field: 'data[].description', type: 'string', description: 'Category description' },
                { field: 'data[].createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Returns an empty array if no categories exist for the company.', 'Categories are stored as ModuleData documents with moduleId "collateral-categories".'],
              commonMistakes: ['Using a category _id instead of companyId in the URL — the path parameter is companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-collateral.view'],
              relatedApis: ['sales-collateral-categories-detail', 'sales-collateral-categories-create'],
            },
            {
              id: 'sales-collateral-categories-detail',
              name: 'Get Category Detail',
              method: 'GET',
              path: '/api/sales-collateral/categories/detail/:id',
              purpose: 'Retrieve a single collateral category by its ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific collateral category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the category document' },
              ],
              successResponse: { status: 200, description: 'Category object', body: { data: { _id: '...', companyId: '...', name: 'Sales Enablement', description: '...', createdAt: '...' } } },
              errorResponses: [
                { code: 404, message: 'Category not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/categories/detail/YOUR_CATEGORY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the category belongs to' },
                { field: 'data.name', type: 'string', description: 'Category name' },
                { field: 'data.description', type: 'string', description: 'Category description' },
                { field: 'data.createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['Returns the full category object.', 'The id parameter is the MongoDB _id of the category document.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Confusing category id with collateral id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-collateral.view'],
              relatedApis: ['sales-collateral-categories-list', 'sales-collateral-categories-update'],
            },
            {
              id: 'sales-collateral-categories-create',
              name: 'Create Collateral Category',
              method: 'POST',
              path: '/api/sales-collateral/categories',
              purpose: 'Create a new collateral category.',
              whenToUse: 'Use this endpoint to add a new category for organizing sales collateral.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: {
                required: ['companyId'],
                fields: [
                  { name: 'companyId', type: 'string', required: true, description: 'Company ID the category belongs to' },
                  { name: 'name', type: 'string', required: false, description: 'Category name' },
                  { name: 'description', type: 'string', required: false, description: 'Category description' },
                ],
              },
              successResponse: { status: 201, description: 'Created category document', body: { data: { _id: '...', companyId: '...', name: 'Sales Enablement', description: '...', createdAt: '...' } } },
              errorResponses: [
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/sales-collateral/categories" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Sales Enablement","description":"Materials for sales team enablement"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/categories', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Sales Enablement', description: 'Materials for sales team enablement' })
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-collateral/categories', {
  companyId: 'YOUR_COMPANY_ID', name: 'Sales Enablement', description: 'Materials for sales team enablement'
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Sales Enablement', description: 'Materials for sales team enablement' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/categories', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-collateral/categories',
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Sales Enablement', 'description': 'Materials for sales team enablement'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/categories');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Sales Enablement', 'description' => 'Materials for sales team enablement']));
echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the category belongs to' },
                { field: 'data.name', type: 'string', description: 'Category name' },
                { field: 'data.description', type: 'string', description: 'Category description' },
                { field: 'data.createdAt', type: 'string', description: 'Creation timestamp' },
              ],
              notes: ['companyId is required.', 'Categories are stored as ModuleData documents with moduleId "collateral-categories".'],
              commonMistakes: ['Omitting the required companyId field.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.create'],
              relatedApis: ['sales-collateral-categories-list', 'sales-collateral-categories-update'],
            },
            {
              id: 'sales-collateral-categories-update',
              name: 'Update Collateral Category',
              method: 'PUT',
              path: '/api/sales-collateral/categories/:id',
              purpose: 'Update an existing collateral category.',
              whenToUse: 'Use this endpoint to modify fields on an existing collateral category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the category document' },
              ],
              requestBody: {
                required: [],
                fields: [
                  { name: 'name', type: 'string', required: false, description: 'Updated category name' },
                  { name: 'description', type: 'string', required: false, description: 'Updated category description' },
                ],
              },
              successResponse: { status: 200, description: 'Updated category document', body: { data: { _id: '...', companyId: '...', name: 'Sales Enablement', description: '...', createdAt: '...' } } },
              errorResponses: [
                { code: 404, message: 'Category not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Category Name","description":"Updated description"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Category Name', description: 'Updated description' })
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID', {
  name: 'Updated Category Name', description: 'Updated description'
}, {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Category Name', description: 'Updated description' });
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/categories/YOUR_CATEGORY_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID',
  json={'name': 'Updated Category Name', 'description': 'Updated description'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Category Name', 'description' => 'Updated description']));
echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.companyId', type: 'string', description: 'Company the category belongs to' },
                { field: 'data.name', type: 'string', description: 'Updated category name' },
                { field: 'data.description', type: 'string', description: 'Updated category description' },
              ],
              notes: ['Only include fields you want to change.', 'The category data is stored within a ModuleData document.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Confusing category id with collateral id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.edit'],
              relatedApis: ['sales-collateral-categories-detail', 'sales-collateral-categories-create'],
            },
            {
              id: 'sales-collateral-categories-delete',
              name: 'Delete Collateral Category',
              method: 'DELETE',
              path: '/api/sales-collateral/categories/:id',
              purpose: 'Delete a collateral category permanently.',
              whenToUse: 'Use this endpoint to permanently remove a collateral category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the category document to delete' },
              ],
              successResponse: { status: 200, description: 'Deleted category document', body: { data: { _id: '...', name: 'Sales Enablement' } } },
              errorResponses: [
                { code: 404, message: 'Category not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data } = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const req = https.request({ hostname: 'api.mengo.ai', path: '/api/sales-collateral/categories/YOUR_CATEGORY_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }); req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-collateral/categories/YOUR_CATEGORY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data._id', type: 'string', description: 'MongoDB document ID of the deleted category' },
                { field: 'data.name', type: 'string', description: 'Name of the deleted category' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Deleting a category does not delete collateral documents that reference it.'],
              commonMistakes: ['Using companyId instead of the MongoDB _id in the URL path.', 'Confusing category id with collateral id.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sales-collateral.delete'],
              relatedApis: ['sales-collateral-categories-list', 'sales-collateral-categories-create'],
            },
          ],
        },
        // --- Sales Scripts ---
        {
          id: 'sales-scripts',
          name: 'Sales Scripts',
          description: 'Manage sales scripts with CRUD operations, advanced search, bulk operations, cloning, performance tracking, and dashboard statistics.',
          endpoints: [
            {
              id: 'ss-list',
              name: 'Get All Sales Scripts',
              method: 'GET',
              path: '/api/sales-scripts/:companyId',
              purpose: 'Retrieve all sales scripts for a company with optional filtering.',
              whenToUse: 'Use this endpoint to list sales scripts for a company, optionally filtering by scriptType, status, funnelStage, audienceType, or priority.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve scripts for' },
              ],
              queryParams: [
                { name: 'scriptType', type: 'string', required: false, description: 'Filter by type: cold-call, warm-call, qualification, discovery, demo, sales-pitch, follow-up, negotiation, closing, whatsapp, email, linkedin, voice-note, appointment, reactivation, referral, upselling, cross-selling, retention, renewal, customer-success, objection-handling' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'funnelStage', type: 'string', required: false, description: 'Filter by funnel stage: awareness, interest, consideration, decision, purchase, retention, advocacy' },
                { name: 'audienceType', type: 'string', required: false, description: 'Filter by audience: prospect, lead, opportunity, customer, partner, investor' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'search', type: 'string', required: false, description: 'Text search across title, description, openingLine, hook, and valueProposition' },
                { name: 'sort', type: 'string', required: false, description: 'Sort field (defaults to createdAt)', default: 'createdAt' },
                { name: 'order', type: 'string', required: false, description: 'Sort order: asc or desc (defaults to desc)', default: 'desc' },
                { name: 'page', type: 'number', required: false, description: 'Page number for pagination', default: '1' },
                { name: 'limit', type: 'number', required: false, description: 'Number of results per page', default: '20' },
              ],
              successResponse: {
                status: 200,
                description: 'Array of sales scripts',
                body: [{ _id: '...', title: 'Cold Call Outreach Script', scriptType: 'cold-call', status: 'published', funnelStage: 'awareness', audienceType: 'prospect', priority: 'high', companyId: '...', createdAt: '...', updatedAt: '...' }],
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get sales scripts' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-scripts/YOUR_COMPANY_ID?status=published&scriptType=cold-call" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/YOUR_COMPANY_ID?status=published&scriptType=cold-call', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const scripts = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-scripts/YOUR_COMPANY_ID', {
  params: { status: 'published', scriptType: 'cold-call' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-scripts/YOUR_COMPANY_ID?status=published&scriptType=cold-call', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-scripts/YOUR_COMPANY_ID',
  params={'status': 'published', 'scriptType': 'cold-call'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/YOUR_COMPANY_ID?status=published&scriptType=cold-call');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Script ID' },
                { field: '[].title', type: 'string', description: 'Script title' },
                { field: '[].scriptType', type: 'string', description: 'Script type (cold-call, warm-call, qualification, etc.)' },
                { field: '[].status', type: 'string', description: 'Script status (draft, review, approved, published, archived)' },
                { field: '[].funnelStage', type: 'string', description: 'Funnel stage (awareness, interest, consideration, etc.)' },
                { field: '[].audienceType', type: 'string', description: 'Target audience (prospect, lead, opportunity, etc.)' },
                { field: '[].priority', type: 'string', description: 'Priority level (low, medium, high, critical)' },
                { field: '[].companyId', type: 'string', description: 'Company ID the script belongs to' },
              ],
              notes: ['Returns all scripts for the company the authenticated user has access to.', 'Supports text search across title, description, openingLine, hook, and valueProposition fields.'],
              commonMistakes: ['Using a companyId you do not have access to — will return 403.', 'Not URL-encoding special characters in search queries.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-scripts.view'],
              relatedApis: ['ss-detail', 'ss-create', 'ss-search'],
            },
            {
              id: 'ss-detail',
              name: 'Get Sales Script Detail',
              method: 'GET',
              path: '/api/sales-scripts/detail/:id',
              purpose: 'Retrieve a single sales script by its ID.',
              whenToUse: 'Use this endpoint when you need full details of a specific sales script including sections, objection responses, and performance metrics.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The sales script MongoDB _id' },
              ],
              successResponse: {
                status: 200,
                description: 'Single sales script object',
                body: { _id: '...', title: 'Cold Call Outreach Script', scriptType: 'cold-call', status: 'published', funnelStage: 'awareness', audienceType: 'prospect', priority: 'high', openingLine: 'Hi, this is...', hook: 'I noticed your company...', valueProposition: 'Our solution helps...', closingCTA: 'Would you like to...', sections: [], qualificationQuestions: [], objectionResponses: [], performanceMetrics: { usageCount: 45, successRate: 32, avgConversionTime: 5 }, companyId: '...', createdAt: '...', updatedAt: '...' },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Sales script not found' },
                { code: 500, message: 'Failed to get sales script' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-scripts/detail/SCRIPT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/detail/SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const script = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-scripts/detail/SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-scripts/detail/SCRIPT_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-scripts/detail/SCRIPT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/detail/SCRIPT_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Script ID' },
                { field: 'title', type: 'string', description: 'Script title' },
                { field: 'scriptType', type: 'string', description: 'Script type (cold-call, warm-call, etc.)' },
                { field: 'status', type: 'string', description: 'Script status (draft, review, approved, published, archived)' },
                { field: 'funnelStage', type: 'string', description: 'Funnel stage' },
                { field: 'audienceType', type: 'string', description: 'Target audience type' },
                { field: 'priority', type: 'string', description: 'Priority level' },
                { field: 'openingLine', type: 'string', description: 'Opening line of the script' },
                { field: 'hook', type: 'string', description: 'Hook statement' },
                { field: 'valueProposition', type: 'string', description: 'Value proposition' },
                { field: 'closingCTA', type: 'string', description: 'Closing call-to-action' },
                { field: 'sections', type: 'array', description: 'Array of script sections (id, type, title, content, order, isRequired, tips)' },
                { field: 'qualificationQuestions', type: 'array', description: 'Array of qualification questions' },
                { field: 'objectionResponses', type: 'array', description: 'Array of objection responses (id, objection, response, counterQuestions, etc.)' },
                { field: 'performanceMetrics', type: 'object', description: 'Performance data (usageCount, successRate, avgConversionTime, feedbackScore, lastUsedAt)' },
                { field: 'version', type: 'number', description: 'Script version number' },
                { field: 'companyId', type: 'string', description: 'Company ID the script belongs to' },
              ],
              notes: ['Returns the complete script object including all sections, qualification questions, and objection responses.'],
              commonMistakes: ['Using companyId instead of the script _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-scripts.view'],
              relatedApis: ['ss-list', 'ss-update', 'ss-clone'],
            },
            {
              id: 'ss-create',
              name: 'Create Sales Script',
              method: 'POST',
              path: '/api/sales-scripts',
              purpose: 'Create a new sales script.',
              whenToUse: 'Use this endpoint to create a new sales script with script type, status, and other configuration.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'Cold Call Outreach Script', companyId: 'YOUR_COMPANY_ID', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'medium', description: 'A cold call script for initial outreach to prospects', openingLine: 'Hi, this is...', hook: 'I noticed your company...', valueProposition: 'Our solution helps...', closingCTA: 'Would you like to...', followUpCTA: 'Can I send you...', exitResponse: 'Thank you for your time...' },
              successResponse: {
                status: 201,
                description: 'Sales script created',
                body: { _id: '...', title: 'Cold Call Outreach Script', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'medium', version: 1, companyId: '...', createdBy: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 400, message: 'Validation error — title and companyId are required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks create permission' },
                { code: 500, message: 'Failed to create sales script' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sales-scripts \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Cold Call Outreach Script","companyId":"YOUR_COMPANY_ID","scriptType":"cold-call","status":"draft","funnelStage":"awareness","audienceType":"prospect","priority":"medium"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Cold Call Outreach Script', companyId: 'YOUR_COMPANY_ID', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'medium' })
});
const script = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-scripts',
  { title: 'Cold Call Outreach Script', companyId: 'YOUR_COMPANY_ID', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'medium' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ title: 'Cold Call Outreach Script', companyId: 'YOUR_COMPANY_ID', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'medium' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-scripts',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'title': 'Cold Call Outreach Script', 'companyId': 'YOUR_COMPANY_ID', 'scriptType': 'cold-call', 'status': 'draft', 'funnelStage': 'awareness', 'audienceType': 'prospect', 'priority': 'medium'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Cold Call Outreach Script', 'companyId' => 'YOUR_COMPANY_ID', 'scriptType' => 'cold-call', 'status' => 'draft', 'funnelStage' => 'awareness', 'audienceType' => 'prospect', 'priority' => 'medium']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated script ID' },
                { field: 'title', type: 'string', description: 'Script title' },
                { field: 'scriptType', type: 'string', description: 'Script type (defaults to cold-call if not provided)' },
                { field: 'status', type: 'string', description: 'Script status (defaults to draft if not provided)' },
                { field: 'funnelStage', type: 'string', description: 'Funnel stage (defaults to awareness if not provided)' },
                { field: 'audienceType', type: 'string', description: 'Target audience (defaults to prospect if not provided)' },
                { field: 'priority', type: 'string', description: 'Priority level (defaults to medium if not provided)' },
                { field: 'version', type: 'number', description: 'Script version (always starts at 1)' },
                { field: 'createdBy', type: 'string', description: 'User ID who created the script' },
                { field: 'companyId', type: 'string', description: 'Company ID the script belongs to' },
              ],
              notes: ['title and companyId are required fields.', 'scriptType must be one of: cold-call, warm-call, qualification, discovery, demo, sales-pitch, follow-up, negotiation, closing, whatsapp, email, linkedin, voice-note, appointment, reactivation, referral, upselling, cross-selling, retention, renewal, customer-success, objection-handling.', 'status defaults to "draft" if not provided.', 'Requires sales-scripts.create permission.'],
              commonMistakes: ['Omitting the required title or companyId field.', 'Using an invalid scriptType value.', 'Setting status to "approved" without having approval permissions.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.create'],
              relatedApis: ['ss-list', 'ss-update', 'ss-clone'],
            },
            {
              id: 'ss-update',
              name: 'Update Sales Script',
              method: 'PUT',
              path: '/api/sales-scripts/:id',
              purpose: 'Update an existing sales script.',
              whenToUse: 'Use this endpoint to modify script content, status, sections, or any other property.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The sales script MongoDB _id' },
              ],
              requestBody: { title: 'Updated Cold Call Script', status: 'published', sections: [{ id: 'sec-1', type: 'introduction', title: 'Introduction', content: 'Hello...', order: 1, isRequired: true, tips: ['Be enthusiastic'] }], objectionResponses: [{ id: 'obj-1', objection: 'Too expensive', response: 'Let me show you the ROI...', order: 1 }] },
              successResponse: {
                status: 200,
                description: 'Updated sales script',
                body: { _id: '...', title: 'Updated Cold Call Script', status: 'published', version: 2, updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks edit permission' },
                { code: 404, message: 'Sales script not found' },
                { code: 500, message: 'Failed to update sales script' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Cold Call Script","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Cold Call Script', status: 'published' })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID',
  { title: 'Updated Cold Call Script', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ title: 'Updated Cold Call Script', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/SCRIPT_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'title': 'Updated Cold Call Script', 'status': 'published'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Cold Call Script', 'status' => 'published']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Script ID' },
                { field: 'title', type: 'string', description: 'Updated script title' },
                { field: 'status', type: 'string', description: 'Updated status' },
                { field: 'version', type: 'number', description: 'Version number (auto-incremented if sections/objectionResponses/qualificationQuestions change)' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the script was last updated' },
              ],
              notes: ['When updating sections, objectionResponses, or qualificationQuestions, the version is auto-incremented and a revision note is added.', 'Setting status to "approved" automatically records approvedBy and approvedAt.', 'Setting status to "review" automatically records reviewedBy and reviewedAt.', 'Requires sales-scripts.edit permission.'],
              commonMistakes: ['Using companyId instead of the script _id in the URL path.', 'Expecting version to stay the same after modifying sections — it auto-increments.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.edit'],
              relatedApis: ['ss-detail', 'ss-create', 'ss-delete'],
            },
            {
              id: 'ss-delete',
              name: 'Delete Sales Script',
              method: 'DELETE',
              path: '/api/sales-scripts/:id',
              purpose: 'Delete a sales script permanently.',
              whenToUse: 'Use this endpoint to permanently remove a sales script that is no longer needed.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The sales script MongoDB _id to delete' },
              ],
              successResponse: {
                status: 200,
                description: 'Sales script deleted',
                body: { message: 'Sales script deleted successfully' },
              },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks delete permission' },
                { code: 404, message: 'Sales script not found' },
                { code: 500, message: 'Failed to delete sales script' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/SCRIPT_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message "Sales script deleted successfully"' },
              ],
              notes: ['Deletion is permanent — there is no soft delete or archive option.', 'Requires sales-scripts.delete permission.'],
              commonMistakes: ['Using companyId instead of the script _id in the URL path.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.delete'],
              relatedApis: ['ss-detail', 'ss-update'],
            },
            {
              id: 'ss-bulk-import',
              name: 'Bulk Import Sales Scripts',
              method: 'POST',
              path: '/api/sales-scripts/bulk-import',
              purpose: 'Import multiple sales scripts at once.',
              whenToUse: 'Use this endpoint to create several sales scripts in a single request, e.g. when migrating scripts from another system.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', scripts: [{ title: 'Cold Call Script', scriptType: 'cold-call', status: 'draft', funnelStage: 'awareness', audienceType: 'prospect', priority: 'high' }, { title: 'Follow-Up Email Script', scriptType: 'email', status: 'draft', funnelStage: 'interest', audienceType: 'lead', priority: 'medium' }] },
              successResponse: {
                status: 201,
                description: 'Scripts imported successfully',
                body: { count: 2, scripts: [{ _id: '...', title: 'Cold Call Script', scriptType: 'cold-call', status: 'draft' }, { _id: '...', title: 'Follow-Up Email Script', scriptType: 'email', status: 'draft' }] },
              },
              errorResponses: [
                { code: 400, message: 'companyId and scripts array are required' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks import permission' },
                { code: 500, message: 'Failed to import sales scripts' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sales-scripts/bulk-import \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","scripts":[{"title":"Cold Call Script","scriptType":"cold-call"},{"title":"Follow-Up Email Script","scriptType":"email"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/bulk-import', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', scripts: [{ title: 'Cold Call Script', scriptType: 'cold-call' }, { title: 'Follow-Up Email Script', scriptType: 'email' }] })
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-scripts/bulk-import',
  { companyId: 'YOUR_COMPANY_ID', scripts: [{ title: 'Cold Call Script', scriptType: 'cold-call' }, { title: 'Follow-Up Email Script', scriptType: 'email' }] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', scripts: [{ title: 'Cold Call Script', scriptType: 'cold-call' }, { title: 'Follow-Up Email Script', scriptType: 'email' }] });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/bulk-import', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-scripts/bulk-import',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'scripts': [{'title': 'Cold Call Script', 'scriptType': 'cold-call'}, {'title': 'Follow-Up Email Script', 'scriptType': 'email'}]})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/bulk-import');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'scripts' => [['title' => 'Cold Call Script', 'scriptType' => 'cold-call'], ['title' => 'Follow-Up Email Script', 'scriptType' => 'email']]]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'count', type: 'number', description: 'Number of scripts created' },
                { field: 'scripts', type: 'array', description: 'Array of created script objects' },
              ],
              notes: ['companyId and scripts array are required.', 'Each script defaults to status: "draft", scriptType: "cold-call", and version: 1 if not specified.', 'Requires sales-scripts.import permission.'],
              commonMistakes: ['Sending scripts as an object instead of an array — must be an array.', 'Forgetting to include companyId in the request body.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.import'],
              relatedApis: ['ss-create', 'ss-bulk-update'],
            },
            {
              id: 'ss-bulk-update',
              name: 'Bulk Update Sales Scripts',
              method: 'PUT',
              path: '/api/sales-scripts/bulk-update',
              purpose: 'Update multiple sales scripts at once.',
              whenToUse: 'Use this endpoint to apply the same changes to multiple scripts, e.g. changing status from draft to review for several scripts.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { ids: ['SCRIPT_ID_1', 'SCRIPT_ID_2'], updates: { status: 'review', priority: 'high' } },
              successResponse: {
                status: 200,
                description: 'Scripts updated',
                body: { modified: 2 },
              },
              errorResponses: [
                { code: 400, message: 'ids array is required and must not be empty' },
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — no authorized scripts found or user lacks edit permission' },
                { code: 500, message: 'Failed to update sales scripts' },
              ],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/sales-scripts/bulk-update \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"ids":["SCRIPT_ID_1","SCRIPT_ID_2"],"updates":{"status":"review","priority":"high"}}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/bulk-update', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ ids: ['SCRIPT_ID_1', 'SCRIPT_ID_2'], updates: { status: 'review', priority: 'high' } })
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-scripts/bulk-update',
  { ids: ['SCRIPT_ID_1', 'SCRIPT_ID_2'], updates: { status: 'review', priority: 'high' } },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ ids: ['SCRIPT_ID_1', 'SCRIPT_ID_2'], updates: { status: 'review', priority: 'high' } });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/bulk-update', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/sales-scripts/bulk-update',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'ids': ['SCRIPT_ID_1', 'SCRIPT_ID_2'], 'updates': {'status': 'review', 'priority': 'high'}})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/bulk-update');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['ids' => ['SCRIPT_ID_1', 'SCRIPT_ID_2'], 'updates' => ['status' => 'review', 'priority' => 'high']]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'modified', type: 'number', description: 'Number of scripts that were modified' },
              ],
              notes: ['ids must be a non-empty array of script MongoDB _id values.', 'Only scripts belonging to companies the user has access to will be updated.', 'Setting status to "approved" automatically records approvedBy and approvedAt.', 'Setting status to "review" automatically records reviewedBy and reviewedAt.', 'Requires sales-scripts.edit permission.'],
              commonMistakes: ['Sending an empty ids array — will return 400.', 'Expecting detailed per-script responses — only modifiedCount is returned.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.edit'],
              relatedApis: ['ss-update', 'ss-bulk-import'],
            },
            {
              id: 'ss-clone',
              name: 'Clone Sales Script',
              method: 'POST',
              path: '/api/sales-scripts/clone/:id',
              purpose: 'Create a copy of an existing sales script.',
              whenToUse: 'Use this endpoint to duplicate a sales script, e.g. to create a variant for a different audience or channel.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The sales script MongoDB _id to clone' },
              ],
              successResponse: {
                status: 201,
                description: 'Sales script cloned',
                body: { _id: '...', title: 'Cold Call Outreach Script (Copy)', scriptType: 'cold-call', status: 'draft', version: 1, parentScriptId: 'ORIGINAL_SCRIPT_ID', companyId: '...', createdBy: '...', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks create permission' },
                { code: 404, message: 'Sales script not found' },
                { code: 500, message: 'Failed to clone sales script' },
              ],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/sales-scripts/clone/SCRIPT_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/clone/SCRIPT_ID', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }
});
const cloned = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-scripts/clone/SCRIPT_ID',
  {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/clone/SCRIPT_ID', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/sales-scripts/clone/SCRIPT_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/clone/SCRIPT_ID');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New cloned script ID' },
                { field: 'title', type: 'string', description: 'Title with "(Copy)" suffix' },
                { field: 'status', type: 'string', description: 'Always "draft" for cloned scripts' },
                { field: 'version', type: 'number', description: 'Always starts at 1 for cloned scripts' },
                { field: 'parentScriptId', type: 'string', description: 'ID of the original script that was cloned' },
                { field: 'createdBy', type: 'string', description: 'User ID who created the clone' },
              ],
              notes: ['The cloned script has "(Copy)" appended to the title.', 'Status is always reset to "draft" and version to 1.', 'Performance metrics are reset to zero.', 'Approval and review fields are cleared.', 'parentScriptId links back to the original script.', 'Requires sales-scripts.create permission.'],
              commonMistakes: ['Expecting the cloned script to retain the original status — it always starts as "draft".', 'Not using the original script _id in the URL path.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.create'],
              relatedApis: ['ss-detail', 'ss-create'],
            },
            {
              id: 'ss-search',
              name: 'Search Sales Scripts',
              method: 'GET',
              path: '/api/sales-scripts/search/:companyId',
              purpose: 'Advanced search for sales scripts with filtering, sorting, and pagination.',
              whenToUse: 'Use this endpoint when you need more advanced filtering than the basic list endpoint provides, including text search, performance filters, and tag-based filtering with pagination.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to search scripts for' },
              ],
              queryParams: [
                { name: 'query', type: 'string', required: false, description: 'Text search across title, description, openingLine, hook, valueProposition, and sections' },
                { name: 'scriptType', type: 'string', required: false, description: 'Filter by type: cold-call, warm-call, qualification, discovery, demo, etc.' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'funnelStage', type: 'string', required: false, description: 'Filter by funnel stage: awareness, interest, consideration, decision, purchase, retention, advocacy' },
                { name: 'audienceType', type: 'string', required: false, description: 'Filter by audience: prospect, lead, opportunity, customer, partner, investor' },
                { name: 'priority', type: 'string', required: false, description: 'Filter by priority: low, medium, high, critical' },
                { name: 'productId', type: 'string', required: false, description: 'Filter by product ID' },
                { name: 'serviceId', type: 'string', required: false, description: 'Filter by service ID' },
                { name: 'playbookId', type: 'string', required: false, description: 'Filter by playbook ID' },
                { name: 'channel', type: 'string', required: false, description: 'Filter by channel (matches any in the channels array)' },
                { name: 'tag', type: 'string', required: false, description: 'Filter by tag (matches any in the tags array)' },
                { name: 'minSuccessRate', type: 'number', required: false, description: 'Minimum success rate threshold (0-100)' },
                { name: 'isPublic', type: 'boolean', required: false, description: 'Filter by public visibility (true/false)' },
                { name: 'aiGenerated', type: 'boolean', required: false, description: 'Filter by AI-generated flag (true/false)' },
                { name: 'sortBy', type: 'string', required: false, description: 'Field to sort by (defaults to createdAt)', default: 'createdAt' },
                { name: 'sortOrder', type: 'string', required: false, description: 'Sort direction: asc or desc (defaults to desc)', default: 'desc' },
                { name: 'page', type: 'number', required: false, description: 'Page number for pagination', default: '1' },
                { name: 'limit', type: 'number', required: false, description: 'Number of results per page', default: '20' },
              ],
              successResponse: {
                status: 200,
                description: 'Search results with pagination',
                body: { scripts: [{ _id: '...', title: 'Cold Call Outreach Script', scriptType: 'cold-call', status: 'published', funnelStage: 'awareness', performanceMetrics: { successRate: 32 } }], pagination: { total: 45, page: 1, limit: 20, pages: 3 } },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to search sales scripts' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-scripts/search/YOUR_COMPANY_ID?query=outreach&status=published&sortBy=createdAt&sortOrder=desc&page=1&limit=20" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/search/YOUR_COMPANY_ID?query=outreach&status=published&sortBy=createdAt&sortOrder=desc&page=1&limit=20', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-scripts/search/YOUR_COMPANY_ID', {
  params: { query: 'outreach', status: 'published', sortBy: 'createdAt', sortOrder: 'desc', page: 1, limit: 20 },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-scripts/search/YOUR_COMPANY_ID?query=outreach&status=published&sortBy=createdAt&sortOrder=desc&page=1&limit=20', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-scripts/search/YOUR_COMPANY_ID',
  params={'query': 'outreach', 'status': 'published', 'sortBy': 'createdAt', 'sortOrder': 'desc', 'page': 1, 'limit': 20},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/search/YOUR_COMPANY_ID?query=outreach&status=published&sortBy=createdAt&sortOrder=desc&page=1&limit=20');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'scripts', type: 'array', description: 'Array of matching sales script objects' },
                { field: 'scripts[]._id', type: 'string', description: 'Script ID' },
                { field: 'scripts[].title', type: 'string', description: 'Script title' },
                { field: 'scripts[].scriptType', type: 'string', description: 'Script type' },
                { field: 'scripts[].status', type: 'string', description: 'Script status' },
                { field: 'scripts[].funnelStage', type: 'string', description: 'Funnel stage' },
                { field: 'scripts[].performanceMetrics', type: 'object', description: 'Performance metrics object' },
                { field: 'pagination.total', type: 'number', description: 'Total number of matching scripts' },
                { field: 'pagination.page', type: 'number', description: 'Current page number' },
                { field: 'pagination.limit', type: 'number', description: 'Results per page' },
                { field: 'pagination.pages', type: 'number', description: 'Total number of pages' },
              ],
              notes: ['This endpoint supports full-text search across title, description, openingLine, hook, valueProposition, and section content.', 'Pagination is built in — always returns a pagination object with total, page, limit, and pages.', 'Supports filtering by minSuccessRate for finding high-performing scripts.', 'Boolean query params (isPublic, aiGenerated) should be passed as "true" or "false" strings.'],
              commonMistakes: ['Using the list endpoint when you need pagination — use search instead.', 'Passing boolean values instead of strings for isPublic and aiGenerated query params.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-scripts.view'],
              relatedApis: ['ss-list', 'ss-detail', 'ss-stats'],
            },
            {
              id: 'ss-stats',
              name: 'Get Sales Scripts Statistics',
              method: 'GET',
              path: '/api/sales-scripts/stats/:companyId',
              purpose: 'Retrieve dashboard statistics for sales scripts.',
              whenToUse: 'Use this endpoint to get an overview of script distribution by status, type, funnel stage, priority, and channel, plus average performance metrics.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to get statistics for' },
              ],
              successResponse: {
                status: 200,
                description: 'Sales scripts statistics',
                body: { total: 45, byStatus: { draft: 10, review: 5, approved: 8, published: 15, archived: 7 }, byType: { 'cold-call': 12, 'warm-call': 5, 'email': 8, 'demo': 6, 'follow-up': 4 }, byFunnelStage: { awareness: 10, interest: 8, consideration: 7, decision: 12, purchase: 5, retention: 3 }, byPriority: { low: 8, medium: 15, high: 18, critical: 4 }, byChannel: { phone: 15, email: 12, whatsapp: 8, linkedin: 10 }, avgPerformance: { avgUsageCount: 23, avgSuccessRate: 28, avgConversionTime: 4.5, avgFeedbackScore: 3.8 }, topPerforming: [{ title: 'Top Cold Call Script', scriptType: 'cold-call', performanceMetrics: { successRate: 65 } }], aiGenerated: 12, published: 15 },
              },
              errorResponses: [
                { code: 401, message: 'Invalid or expired token' },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Failed to get statistics' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-scripts/stats/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/stats/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const stats = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-scripts/stats/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-scripts/stats/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-scripts/stats/YOUR_COMPANY_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/stats/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'total', type: 'number', description: 'Total number of scripts for the company' },
                { field: 'byStatus', type: 'object', description: 'Script count grouped by status (draft, review, approved, published, archived)' },
                { field: 'byType', type: 'object', description: 'Script count grouped by scriptType' },
                { field: 'byFunnelStage', type: 'object', description: 'Script count grouped by funnelStage' },
                { field: 'byPriority', type: 'object', description: 'Script count grouped by priority' },
                { field: 'byChannel', type: 'object', description: 'Script count grouped by channel' },
                { field: 'avgPerformance', type: 'object', description: 'Average performance metrics (avgUsageCount, avgSuccessRate, avgConversionTime, avgFeedbackScore)' },
                { field: 'topPerforming', type: 'array', description: 'Top 5 scripts by successRate (title, scriptType, performanceMetrics.successRate)' },
                { field: 'aiGenerated', type: 'number', description: 'Number of AI-generated scripts' },
                { field: 'published', type: 'number', description: 'Number of published scripts' },
              ],
              notes: ['Aggregates data across all scripts for the company.', 'avgPerformance only includes scripts with usageCount > 0.', 'topPerforming returns up to 5 scripts with the highest successRate.'],
              commonMistakes: ['Using companyId instead of the stats path — this is a dedicated stats endpoint, not the list endpoint.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'sales-scripts.view'],
              relatedApis: ['ss-list', 'ss-search'],
            },
            {
              id: 'ss-update-performance',
              name: 'Update Sales Script Performance',
              method: 'PATCH',
              path: '/api/sales-scripts/:id/performance',
              purpose: 'Update performance metrics for a sales script.',
              whenToUse: 'Use this endpoint to track script usage and effectiveness by updating usageCount, successRate, avgConversionTime, or feedbackScore.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The sales script MongoDB _id' },
              ],
              requestBody: { usageCount: 50, successRate: 35, avgConversionTime: 3, feedbackScore: 4.2 },
              successResponse: {
                status: 200,
                description: 'Performance metrics updated',
                body: { _id: '...', title: 'Cold Call Outreach Script', performanceMetrics: { usageCount: 50, successRate: 35, avgConversionTime: 3, feedbackScore: 4.2, lastUsedAt: '2026-07-22T12:00:00Z' }, updatedAt: '2026-07-22T12:00:00Z' },
              },
              errorResponses: [
                { code: 401, message: 'Not authenticated' },
                { code: 403, message: 'Access denied — user does not have access to this company or lacks edit permission' },
                { code: 404, message: 'Sales script not found' },
                { code: 500, message: 'Failed to update performance metrics' },
              ],
              curlExample: `curl -X PATCH "https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID/performance" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"usageCount":50,"successRate":35,"avgConversionTime":3,"feedbackScore":4.2}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID/performance', {
  method: 'PATCH',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ usageCount: 50, successRate: 35, avgConversionTime: 3, feedbackScore: 4.2 })
});
const updated = await response.json();`,
              axiosExample: `const { data } = await axios.patch('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID/performance',
  { usageCount: 50, successRate: 35, avgConversionTime: 3, feedbackScore: 4.2 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ usageCount: 50, successRate: 35, avgConversionTime: 3, feedbackScore: 4.2 });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-scripts/SCRIPT_ID/performance', method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.patch('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID/performance',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'usageCount': 50, 'successRate': 35, 'avgConversionTime': 3, 'feedbackScore': 4.2})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-scripts/SCRIPT_ID/performance');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['usageCount' => 50, 'successRate' => 35, 'avgConversionTime' => 3, 'feedbackScore' => 4.2]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Script ID' },
                { field: 'title', type: 'string', description: 'Script title' },
                { field: 'performanceMetrics.usageCount', type: 'number', description: 'Number of times the script has been used' },
                { field: 'performanceMetrics.successRate', type: 'number', description: 'Success rate percentage (0-100)' },
                { field: 'performanceMetrics.avgConversionTime', type: 'number', description: 'Average conversion time in days' },
                { field: 'performanceMetrics.feedbackScore', type: 'number', description: 'Average feedback score (1-5)' },
                { field: 'performanceMetrics.lastUsedAt', type: 'string', description: 'ISO date when the script was last used (auto-updated)' },
                { field: 'updatedAt', type: 'string', description: 'ISO date when the script was last updated' },
              ],
              notes: ['All performance fields are optional — only include the fields you want to update.', 'lastUsedAt is automatically set to the current timestamp whenever performance metrics are updated.', 'If performanceMetrics does not exist on the script, it is initialized with default values.', 'Requires sales-scripts.edit permission.'],
              commonMistakes: ['Using PUT instead of PATCH — this endpoint only accepts PATCH requests.', 'Sending the full script body — only send the performance metrics fields you want to update.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'sales-scripts.edit'],
              relatedApis: ['ss-detail', 'ss-stats', 'ss-update'],
            },
          ],
        },
        // --- Sales Playbooks ---
        {
          id: 'sales-playbooks',
          name: 'Sales Playbooks',
          description: 'Sales playbook management with funnel stages and tracking.',
          endpoints: [
            {
              id: 'spb-list',
              name: 'List Sales Playbooks',
              method: 'GET',
              path: '/api/sales-playbooks/playbooks/:companyId',
              purpose: 'Retrieve all sales playbooks for a company.',
              whenToUse: 'Use this endpoint to list sales playbooks, optionally filtered by type, status, or funnel stage.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'type', type: 'string', required: false, description: 'Filter by playbook type' }, { name: 'status', type: 'string', required: false, description: 'Filter by status' }, { name: 'funnelStage', type: 'string', required: false, description: 'Filter by funnel stage' }, { name: 'search', type: 'string', required: false, description: 'Search term' }],
              successResponse: { status: 200, description: 'List of sales playbooks', body: [{ _id: '...', title: 'Enterprise Sales Playbook', type: 'enterprise', status: 'published', funnelStage: 'consideration', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_COMPANY_ID?status=published" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_COMPANY_ID?status=published', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const playbooks = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_COMPANY_ID', {
  params: { status: 'published' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-playbooks/playbooks/YOUR_COMPANY_ID?status=published', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_COMPANY_ID',
    params={'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_COMPANY_ID?status=published');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Playbook ID' },
                { field: '[].title', type: 'string', description: 'Playbook title' },
                { field: '[].type', type: 'string', description: 'Playbook type' },
                { field: '[].status', type: 'string', description: 'Status: draft, published, archived' },
                { field: '[].funnelStage', type: 'string', description: 'Funnel stage' },
              ],
              notes: ['Supports type, status, funnelStage, and search query parameters.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['spb-detail', 'spb-create'],
            },
            {
              id: 'spb-detail',
              name: 'Get Sales Playbook Detail',
              method: 'GET',
              path: '/api/sales-playbooks/playbooks/detail/:id',
              purpose: 'Retrieve a single sales playbook by ID.',
              whenToUse: 'Use this endpoint to get full details of a sales playbook.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Playbook ID' }],
              successResponse: { status: 200, description: 'Sales playbook details', body: { _id: '...', title: 'Enterprise Sales Playbook', type: 'enterprise', status: 'published', sections: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Playbook not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const playbook = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-playbooks/playbooks/detail/YOUR_PLAYBOOK_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Playbook ID' },
                { field: 'title', type: 'string', description: 'Playbook title' },
                { field: 'sections', type: 'array', description: 'Array of section objects' },
              ],
              notes: ['Returns complete playbook with all sections.'],
              commonMistakes: ['Using an invalid playbook ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['spb-list', 'spb-create'],
            },
            {
              id: 'spb-create',
              name: 'Create Sales Playbook',
              method: 'POST',
              path: '/api/sales-playbooks/playbooks',
              purpose: 'Create a new sales playbook.',
              whenToUse: 'Use this endpoint to create a new sales playbook.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Enterprise Sales Playbook', type: 'enterprise', funnelStage: 'consideration' },
              successResponse: { status: 201, description: 'Sales playbook created', body: { _id: '...', title: 'Enterprise Sales Playbook', type: 'enterprise', status: 'draft', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — companyId, title, type required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sales-playbooks/playbooks \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Enterprise Sales Playbook","type":"enterprise","funnelStage":"consideration"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-playbooks/playbooks', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Enterprise Sales Playbook', type: 'enterprise', funnelStage: 'consideration' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-playbooks/playbooks',
  { companyId: 'YOUR_COMPANY_ID', title: 'Enterprise Sales Playbook', type: 'enterprise', funnelStage: 'consideration' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Enterprise Sales Playbook', type: 'enterprise' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-playbooks/playbooks', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/sales-playbooks/playbooks',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Enterprise Sales Playbook', 'type': 'enterprise'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-playbooks/playbooks');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Enterprise Sales Playbook', 'type' => 'enterprise']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'title', type: 'string', description: 'Playbook title' },
                { field: 'type', type: 'string', description: 'Playbook type' },
              ],
              notes: ['Required fields: companyId, title, type.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['spb-list', 'spb-detail'],
            },
            {
              id: 'spb-update',
              name: 'Update Sales Playbook',
              method: 'PUT',
              path: '/api/sales-playbooks/playbooks/:id',
              purpose: 'Update an existing sales playbook.',
              whenToUse: 'Use this endpoint to modify playbook details, sections, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Playbook ID' }],
              requestBody: { title: 'Updated Playbook', status: 'published' },
              successResponse: { status: 200, description: 'Playbook updated', body: { _id: '...', title: 'Updated Playbook', status: 'published', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Playbook not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Playbook","status":"published"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Playbook', status: 'published' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID',
  { title: 'Updated Playbook', status: 'published' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Playbook', status: 'published' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID',
    json={'title': 'Updated Playbook', 'status': 'published'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Playbook', 'status' => 'published']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Playbook ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are updatable.'],
              commonMistakes: ['Attempting to update immutable fields like companyId.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['spb-list', 'spb-detail', 'spb-create'],
            },
            {
              id: 'spb-delete',
              name: 'Delete Sales Playbook',
              method: 'DELETE',
              path: '/api/sales-playbooks/playbooks/:id',
              purpose: 'Delete a sales playbook permanently.',
              whenToUse: 'Use this endpoint to permanently remove a sales playbook.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Playbook ID to delete' }],
              successResponse: { status: 200, description: 'Playbook deleted', body: { message: 'Sales playbook deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Playbook not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-playbooks/playbooks/YOUR_PLAYBOOK_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid playbook ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['spb-list', 'spb-detail'],
            },
          ],
        },
        // --- Sales Targets ---
        {
          id: 'sales-targets',
          name: 'Sales Targets',
          description: 'Sales quota and target management with team quotas and dashboard aggregation.',
          endpoints: [
            {
              id: 'st-quotas-list',
              name: 'List Sales Quotas',
              method: 'GET',
              path: '/api/sales-targets/quotas/:companyId',
              purpose: 'Retrieve all sales quotas for a company.',
              whenToUse: 'Use this endpoint to list quotas, optionally filtered by assignedTo, period, quotaType, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'assignedTo', type: 'string', required: false, description: 'Filter by assigned user' }, { name: 'period', type: 'string', required: false, description: 'Filter by period' }, { name: 'quotaType', type: 'string', required: false, description: 'Filter by quota type' }, { name: 'status', type: 'string', required: false, description: 'Filter by status' }],
              successResponse: { status: 200, description: 'List of sales quotas', body: [{ _id: '...', name: 'Q3 Revenue Target', period: 'Q3-2026', quotaType: 'revenue', targetAmount: 50000, status: 'active', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-targets/quotas/YOUR_COMPANY_ID?status=active" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_COMPANY_ID?status=active', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const quotas = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_COMPANY_ID', {
  params: { status: 'active' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-targets/quotas/YOUR_COMPANY_ID?status=active', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_COMPANY_ID',
    params={'status': 'active'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_COMPANY_ID?status=active');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Quota ID' },
                { field: '[].name', type: 'string', description: 'Quota name' },
                { field: '[].period', type: 'string', description: 'Target period' },
                { field: '[].quotaType', type: 'string', description: 'Quota type: revenue, units, activity' },
                { field: '[].targetAmount', type: 'number', description: 'Target amount' },
                { field: '[].status', type: 'string', description: 'Status: active, completed, missed' },
              ],
              notes: ['Supports assignedTo, period, quotaType, and status query parameters. Also see team-quotas (GET/POST/PUT/DELETE) and dashboard aggregation (GET) endpoints.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['st-quotas-detail', 'st-quotas-create'],
            },
            {
              id: 'st-quotas-detail',
              name: 'Get Sales Quota Detail',
              method: 'GET',
              path: '/api/sales-targets/quotas/detail/:id',
              purpose: 'Retrieve a single sales quota by ID.',
              whenToUse: 'Use this endpoint to get full details of a sales quota.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Quota ID' }],
              successResponse: { status: 200, description: 'Sales quota details', body: { _id: '...', name: 'Q3 Revenue Target', period: 'Q3-2026', quotaType: 'revenue', targetAmount: 50000, assignedTo: 'user123', status: 'active', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Quota not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/sales-targets/quotas/detail/YOUR_QUOTA_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-targets/quotas/detail/YOUR_QUOTA_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const quota = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-targets/quotas/detail/YOUR_QUOTA_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-targets/quotas/detail/YOUR_QUOTA_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-targets/quotas/detail/YOUR_QUOTA_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-targets/quotas/detail/YOUR_QUOTA_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Quota ID' },
                { field: 'name', type: 'string', description: 'Quota name' },
                { field: 'period', type: 'string', description: 'Target period' },
                { field: 'quotaType', type: 'string', description: 'Quota type' },
                { field: 'targetAmount', type: 'number', description: 'Target amount' },
              ],
              notes: ['Returns the full quota object with all fields.'],
              commonMistakes: ['Using an invalid quota ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['st-quotas-list', 'st-quotas-update'],
            },
            {
              id: 'st-quotas-create',
              name: 'Create Sales Quota',
              method: 'POST',
              path: '/api/sales-targets/quotas',
              purpose: 'Create a new sales quota.',
              whenToUse: 'Use this endpoint to create a new sales quota target.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Target', period: 'Q3-2026', assignedTo: 'user123', targetAmount: 50000 },
              successResponse: { status: 201, description: 'Sales quota created', body: { _id: '...', name: 'Q3 Revenue Target', period: 'Q3-2026', quotaType: 'revenue', targetAmount: 50000, status: 'active', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — companyId, name, period, assignedTo, targetAmount required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sales-targets/quotas \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q3 Revenue Target","period":"Q3-2026","assignedTo":"user123","targetAmount":50000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-targets/quotas', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Target', period: 'Q3-2026', assignedTo: 'user123', targetAmount: 50000 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-targets/quotas',
  { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Target', period: 'Q3-2026', assignedTo: 'user123', targetAmount: 50000 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Target', period: 'Q3-2026', assignedTo: 'user123', targetAmount: 50000 });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-targets/quotas', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/sales-targets/quotas',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q3 Revenue Target', 'period': 'Q3-2026', 'assignedTo': 'user123', 'targetAmount': 50000},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-targets/quotas');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q3 Revenue Target', 'period' => 'Q3-2026', 'assignedTo' => 'user123', 'targetAmount' => 50000]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Quota name' },
                { field: 'period', type: 'string', description: 'Target period' },
              ],
              notes: ['Required fields: companyId, name, period, assignedTo, targetAmount.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['st-quotas-list', 'st-quotas-detail'],
            },
            {
              id: 'st-quotas-update',
              name: 'Update Sales Quota',
              method: 'PUT',
              path: '/api/sales-targets/quotas/:id',
              purpose: 'Update an existing sales quota.',
              whenToUse: 'Use this endpoint to modify quota details, target amount, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Quota ID' }],
              requestBody: { name: 'Updated Q3 Target', targetAmount: 75000, status: 'active' },
              successResponse: { status: 200, description: 'Quota updated', body: { _id: '...', name: 'Updated Q3 Target', targetAmount: 75000, status: 'active', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Quota not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Q3 Target","targetAmount":75000,"status":"active"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Q3 Target', targetAmount: 75000, status: 'active' }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID',
  { name: 'Updated Q3 Target', targetAmount: 75000, status: 'active' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Q3 Target', targetAmount: 75000, status: 'active' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-targets/quotas/YOUR_QUOTA_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID',
    json={'name': 'Updated Q3 Target', 'targetAmount': 75000, 'status': 'active'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Q3 Target', 'targetAmount' => 75000, 'status' => 'active']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Quota ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are optional — only send the fields you want to update.'],
              commonMistakes: ['Using an invalid quota ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['st-quotas-list', 'st-quotas-detail'],
            },
            {
              id: 'st-quotas-delete',
              name: 'Delete Sales Quota',
              method: 'DELETE',
              path: '/api/sales-targets/quotas/:id',
              purpose: 'Delete a sales quota.',
              whenToUse: 'Use this endpoint to permanently remove a sales quota.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Quota ID to delete' }],
              successResponse: { status: 200, description: 'Quota deleted', body: { message: 'Sales quota deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Quota not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sales-targets/quotas/YOUR_QUOTA_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-targets/quotas/YOUR_QUOTA_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent. Also available: team-quotas (GET/POST/PUT/DELETE) and dashboard aggregation (GET).'],
              commonMistakes: ['Using an invalid quota ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['st-quotas-list', 'st-quotas-detail'],
            },
          ],
        },
        // --- Proposals & Quotes ---
        {
          id: 'proposals-quotes',
          name: 'Proposals & Quotes',
          description: 'Proposal and quote management with duplication and tracking.',
          endpoints: [
            {
              id: 'pq-list',
              name: 'List Proposals & Quotes',
              method: 'GET',
              path: '/api/proposals/:companyId',
              purpose: 'Retrieve all proposals and quotes for a company.',
              whenToUse: 'Use this endpoint to list proposals, optionally filtered by type, status, assignedTo, or search.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'type', type: 'string', required: false, description: 'Filter by type: proposal, quote' }, { name: 'status', type: 'string', required: false, description: 'Filter by status' }, { name: 'assignedTo', type: 'string', required: false, description: 'Filter by assigned user' }, { name: 'search', type: 'string', required: false, description: 'Search term' }],
              successResponse: { status: 200, description: 'List of proposals and quotes', body: [{ _id: '...', title: 'Enterprise License Proposal', type: 'proposal', status: 'sent', clientName: 'Acme Corp', totalAmount: 25000, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/proposals/YOUR_COMPANY_ID?status=sent" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals/YOUR_COMPANY_ID?status=sent', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const proposals = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/proposals/YOUR_COMPANY_ID', {
  params: { status: 'sent' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/proposals/YOUR_COMPANY_ID?status=sent', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/proposals/YOUR_COMPANY_ID',
    params={'status': 'sent'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals/YOUR_COMPANY_ID?status=sent');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Proposal ID' },
                { field: '[].title', type: 'string', description: 'Proposal title' },
                { field: '[].type', type: 'string', description: 'Type: proposal or quote' },
                { field: '[].status', type: 'string', description: 'Status: draft, sent, accepted, rejected' },
                { field: '[].clientName', type: 'string', description: 'Client name' },
                { field: '[].totalAmount', type: 'number', description: 'Total amount' },
              ],
              notes: ['Supports type, status, assignedTo, and search query parameters.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pq-detail', 'pq-create'],
            },
            {
              id: 'pq-detail',
              name: 'Get Proposal Detail',
              method: 'GET',
              path: '/api/proposals/detail/:id',
              purpose: 'Retrieve a single proposal or quote by ID.',
              whenToUse: 'Use this endpoint to get full details of a proposal or quote.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Proposal ID' }],
              successResponse: { status: 200, description: 'Proposal details', body: { _id: '...', title: 'Enterprise License Proposal', type: 'proposal', status: 'sent', clientName: 'Acme Corp', totalAmount: 25000, assignedTo: 'user123', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Proposal not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/proposals/detail/YOUR_PROPOSAL_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals/detail/YOUR_PROPOSAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const proposal = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/proposals/detail/YOUR_PROPOSAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/proposals/detail/YOUR_PROPOSAL_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/proposals/detail/YOUR_PROPOSAL_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals/detail/YOUR_PROPOSAL_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Proposal ID' },
                { field: 'title', type: 'string', description: 'Proposal title' },
                { field: 'type', type: 'string', description: 'Type: proposal or quote' },
                { field: 'clientName', type: 'string', description: 'Client name' },
                { field: 'totalAmount', type: 'number', description: 'Total amount' },
              ],
              notes: ['Returns the full proposal object with all fields.'],
              commonMistakes: ['Using an invalid proposal ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['pq-list', 'pq-update'],
            },
            {
              id: 'pq-create',
              name: 'Create Proposal',
              method: 'POST',
              path: '/api/proposals',
              purpose: 'Create a new proposal or quote.',
              whenToUse: 'Use this endpoint to create a new proposal or quote.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', title: 'Enterprise License Proposal', type: 'proposal', clientName: 'Acme Corp', assignedTo: 'user123', totalAmount: 25000 },
              successResponse: { status: 201, description: 'Proposal created', body: { _id: '...', title: 'Enterprise License Proposal', type: 'proposal', status: 'draft', clientName: 'Acme Corp', totalAmount: 25000, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — companyId, title, type, clientName, assignedTo, totalAmount required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/proposals \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","title":"Enterprise License Proposal","type":"proposal","clientName":"Acme Corp","assignedTo":"user123","totalAmount":25000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Enterprise License Proposal', type: 'proposal', clientName: 'Acme Corp', assignedTo: 'user123', totalAmount: 25000 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/proposals',
  { companyId: 'YOUR_COMPANY_ID', title: 'Enterprise License Proposal', type: 'proposal', clientName: 'Acme Corp', assignedTo: 'user123', totalAmount: 25000 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', title: 'Enterprise License Proposal', type: 'proposal', clientName: 'Acme Corp', assignedTo: 'user123', totalAmount: 25000 });
const options = { hostname: 'api.mengo.ai', path: '/api/proposals', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/proposals',
    json={'companyId': 'YOUR_COMPANY_ID', 'title': 'Enterprise License Proposal', 'type': 'proposal', 'clientName': 'Acme Corp', 'assignedTo': 'user123', 'totalAmount': 25000},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'title' => 'Enterprise License Proposal', 'type' => 'proposal', 'clientName' => 'Acme Corp', 'assignedTo' => 'user123', 'totalAmount' => 25000]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'title', type: 'string', description: 'Proposal title' },
                { field: 'type', type: 'string', description: 'Type: proposal or quote' },
              ],
              notes: ['Required fields: companyId, title, type, clientName, assignedTo, totalAmount.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pq-list', 'pq-detail'],
            },
            {
              id: 'pq-update',
              name: 'Update Proposal',
              method: 'PUT',
              path: '/api/proposals/:id',
              purpose: 'Update an existing proposal or quote.',
              whenToUse: 'Use this endpoint to modify proposal details, status, or amounts.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Proposal ID' }],
              requestBody: { title: 'Updated Proposal', status: 'accepted', totalAmount: 30000 },
              successResponse: { status: 200, description: 'Proposal updated', body: { _id: '...', title: 'Updated Proposal', status: 'accepted', totalAmount: 30000, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Proposal not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Updated Proposal","status":"accepted","totalAmount":30000}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Updated Proposal', status: 'accepted', totalAmount: 30000 }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID',
  { title: 'Updated Proposal', status: 'accepted', totalAmount: 30000 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ title: 'Updated Proposal', status: 'accepted', totalAmount: 30000 });
const options = { hostname: 'api.mengo.ai', path: '/api/proposals/YOUR_PROPOSAL_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID',
    json={'title': 'Updated Proposal', 'status': 'accepted', 'totalAmount': 30000},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['title' => 'Updated Proposal', 'status' => 'accepted', 'totalAmount' => 30000]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Proposal ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are optional — only send the fields you want to update.'],
              commonMistakes: ['Using an invalid proposal ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pq-list', 'pq-detail'],
            },
            {
              id: 'pq-delete',
              name: 'Delete Proposal',
              method: 'DELETE',
              path: '/api/proposals/:id',
              purpose: 'Delete a proposal or quote.',
              whenToUse: 'Use this endpoint to permanently remove a proposal or quote.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Proposal ID to delete' }],
              successResponse: { status: 200, description: 'Proposal deleted', body: { message: 'Proposal deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Proposal not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/proposals/YOUR_PROPOSAL_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent.'],
              commonMistakes: ['Using an invalid proposal ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pq-list', 'pq-detail'],
            },
            {
              id: 'pq-duplicate',
              name: 'Duplicate Proposal',
              method: 'POST',
              path: '/api/proposals/:id/duplicate',
              purpose: 'Duplicate an existing proposal or quote.',
              whenToUse: 'Use this endpoint to create a copy of a proposal with a new ID.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Proposal ID to duplicate' }],
              successResponse: { status: 201, description: 'Proposal duplicated', body: { _id: '...', title: 'Enterprise License Proposal (Copy)', type: 'proposal', status: 'draft', createdAt: '2026-07-22T12:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Proposal not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID/duplicate \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID/duplicate', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID/duplicate',
  {},
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/proposals/YOUR_PROPOSAL_ID/duplicate', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID/duplicate',
    json={},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/proposals/YOUR_PROPOSAL_ID/duplicate');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'New proposal ID' },
                { field: 'title', type: 'string', description: 'Copied title with (Copy) suffix' },
              ],
              notes: ['Creates a copy of the proposal with a new ID and draft status.'],
              commonMistakes: ['Using an invalid proposal ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['pq-list', 'pq-detail'],
            },
          ],
        },
        // --- Sales Reports ---
        {
          id: 'sales-reports',
          name: 'Sales Reports',
          description: 'Sales dashboard and aggregation reporting with pipeline, performance, and forecast analytics.',
          endpoints: [
            {
              id: 'sr-dashboards-list',
              name: 'List Sales Dashboards',
              method: 'GET',
              path: '/api/sales-reports/dashboards/:companyId',
              purpose: 'Retrieve all sales dashboards for a company.',
              whenToUse: 'Use this endpoint to list sales dashboards.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'type', type: 'string', required: false, description: 'Filter by dashboard type' }],
              successResponse: { status: 200, description: 'List of sales dashboards', body: [{ _id: '...', name: 'Q3 Revenue Dashboard', type: 'revenue', createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_COMPANY_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const dashboards = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_COMPANY_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-reports/dashboards/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_COMPANY_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_COMPANY_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Dashboard ID' },
                { field: '[].name', type: 'string', description: 'Dashboard name' },
                { field: '[].type', type: 'string', description: 'Dashboard type' },
              ],
              notes: ['Supports type query parameter. Also see read-only aggregation endpoints: pipeline, performance, forecast.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['sr-dashboards-detail', 'sr-dashboards-create'],
            },
            {
              id: 'sr-dashboards-detail',
              name: 'Get Sales Dashboard Detail',
              method: 'GET',
              path: '/api/sales-reports/dashboards/detail/:id',
              purpose: 'Retrieve a single sales dashboard by ID.',
              whenToUse: 'Use this endpoint to get full details of a sales dashboard.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Dashboard ID' }],
              successResponse: { status: 200, description: 'Dashboard details', body: { _id: '...', name: 'Q3 Revenue Dashboard', type: 'revenue', widgets: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Dashboard not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const dashboard = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-reports/dashboards/detail/YOUR_DASHBOARD_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Dashboard ID' },
                { field: 'name', type: 'string', description: 'Dashboard name' },
                { field: 'type', type: 'string', description: 'Dashboard type' },
                { field: 'widgets', type: 'array', description: 'Dashboard widgets configuration' },
              ],
              notes: ['Returns the full dashboard object with widgets configuration.'],
              commonMistakes: ['Using an invalid dashboard ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['sr-dashboards-list', 'sr-dashboards-update'],
            },
            {
              id: 'sr-dashboards-create',
              name: 'Create Sales Dashboard',
              method: 'POST',
              path: '/api/sales-reports/dashboards',
              purpose: 'Create a new sales dashboard.',
              whenToUse: 'Use this endpoint to create a new sales report dashboard.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Dashboard', type: 'revenue' },
              successResponse: { status: 201, description: 'Dashboard created', body: { _id: '...', name: 'Q3 Revenue Dashboard', type: 'revenue', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — companyId, name, type required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/sales-reports/dashboards \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Q3 Revenue Dashboard","type":"revenue"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-reports/dashboards', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Dashboard', type: 'revenue' }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/sales-reports/dashboards',
  { companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Dashboard', type: 'revenue' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Q3 Revenue Dashboard', type: 'revenue' });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-reports/dashboards', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/sales-reports/dashboards',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Q3 Revenue Dashboard', 'type': 'revenue'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-reports/dashboards');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Q3 Revenue Dashboard', 'type' => 'revenue']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Dashboard name' },
                { field: 'type', type: 'string', description: 'Dashboard type' },
              ],
              notes: ['Required fields: companyId, name, type.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['sr-dashboards-list', 'sr-dashboards-detail'],
            },
            {
              id: 'sr-dashboards-update',
              name: 'Update Sales Dashboard',
              method: 'PUT',
              path: '/api/sales-reports/dashboards/:id',
              purpose: 'Update an existing sales dashboard.',
              whenToUse: 'Use this endpoint to modify dashboard configuration or widgets.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Dashboard ID' }],
              requestBody: { name: 'Updated Dashboard', widgets: [] },
              successResponse: { status: 200, description: 'Dashboard updated', body: { _id: '...', name: 'Updated Dashboard', updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Dashboard not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Dashboard","widgets":[]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Dashboard', widgets: [] }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID',
  { name: 'Updated Dashboard', widgets: [] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Dashboard', widgets: [] });
const options = { hostname: 'api.mengo.ai', path: '/api/sales-reports/dashboards/YOUR_DASHBOARD_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID',
    json={'name': 'Updated Dashboard', 'widgets': []},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Dashboard', 'widgets' => []]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Dashboard ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are optional — only send the fields you want to update.'],
              commonMistakes: ['Using an invalid dashboard ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['sr-dashboards-list', 'sr-dashboards-detail'],
            },
            {
              id: 'sr-dashboards-delete',
              name: 'Delete Sales Dashboard',
              method: 'DELETE',
              path: '/api/sales-reports/dashboards/:id',
              purpose: 'Delete a sales dashboard.',
              whenToUse: 'Use this endpoint to permanently remove a sales dashboard.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Dashboard ID to delete' }],
              successResponse: { status: 200, description: 'Dashboard deleted', body: { message: 'Sales dashboard deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Dashboard not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/sales-reports/dashboards/YOUR_DASHBOARD_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/sales-reports/dashboards/YOUR_DASHBOARD_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent. Also see read-only aggregation endpoints: /aggregations/pipeline, /aggregations/performance, /aggregations/forecast.'],
              commonMistakes: ['Using an invalid dashboard ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['sr-dashboards-list', 'sr-dashboards-detail'],
            },
          ],
        },
        // --- Commission Tracker ---
        {
          id: 'commission-tracker',
          name: 'Commission Tracker',
          description: 'Commission plan and payout management with bulk approval and tracking.',
          endpoints: [
            {
              id: 'ct-plans-list',
              name: 'List Commission Plans',
              method: 'GET',
              path: '/api/commission-tracker/plans/:companyId',
              purpose: 'Retrieve all commission plans for a company.',
              whenToUse: 'Use this endpoint to list commission plans, optionally filtered by isActive or planType.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'companyId', type: 'string', required: true, description: 'Company ID' }],
              queryParams: [{ name: 'isActive', type: 'string', required: false, description: 'Filter by active status' }, { name: 'planType', type: 'string', required: false, description: 'Filter by plan type' }],
              successResponse: { status: 200, description: 'List of commission plans', body: [{ _id: '...', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10, isActive: true, createdAt: '2026-07-22T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/commission-tracker/plans/YOUR_COMPANY_ID?isActive=true" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_COMPANY_ID?isActive=true', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plans = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_COMPANY_ID', {
  params: { isActive: 'true' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/commission-tracker/plans/YOUR_COMPANY_ID?isActive=true', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_COMPANY_ID',
    params={'isActive': 'true'},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_COMPANY_ID?isActive=true');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Plan ID' },
                { field: '[].name', type: 'string', description: 'Plan name' },
                { field: '[].planType', type: 'string', description: 'Plan type: percentage, fixed, tiered' },
                { field: '[].baseRate', type: 'number', description: 'Base commission rate' },
                { field: '[].isActive', type: 'boolean', description: 'Whether the plan is active' },
              ],
              notes: ['Supports isActive and planType query parameters. Also see commissions (with bulk-approve) and payouts sub-resources.'],
              commonMistakes: ['Using an invalid companyId.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ct-plans-detail', 'ct-plans-create'],
            },
            {
              id: 'ct-plans-detail',
              name: 'Get Commission Plan Detail',
              method: 'GET',
              path: '/api/commission-tracker/plans/detail/:id',
              purpose: 'Retrieve a single commission plan by ID.',
              whenToUse: 'Use this endpoint to get full details of a commission plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID' }],
              successResponse: { status: 200, description: 'Commission plan details', body: { _id: '...', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10, isActive: true, tiers: [], createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Plan not found' }],
              curlExample: `curl -X GET https://app.mengoengine.com/api/commission-tracker/plans/detail/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/commission-tracker/plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});
const plan = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/commission-tracker/plans/detail/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/commission-tracker/plans/detail/YOUR_PLAN_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => {
  let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b)));
});`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/commission-tracker/plans/detail/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/commission-tracker/plans/detail/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Plan ID' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'planType', type: 'string', description: 'Plan type' },
                { field: 'baseRate', type: 'number', description: 'Base commission rate' },
              ],
              notes: ['Returns the full plan object including tier configurations.'],
              commonMistakes: ['Using an invalid plan ID.'],
              rateLimits: '100 requests per minute',
              requiredPermissions: ['admin.read'],
              relatedApis: ['ct-plans-list', 'ct-plans-update'],
            },
            {
              id: 'ct-plans-create',
              name: 'Create Commission Plan',
              method: 'POST',
              path: '/api/commission-tracker/plans',
              purpose: 'Create a new commission plan.',
              whenToUse: 'Use this endpoint to create a new commission plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10 },
              successResponse: { status: 201, description: 'Commission plan created', body: { _id: '...', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10, isActive: true, createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation error — companyId, name, planType, baseRate required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST https://app.mengoengine.com/api/commission-tracker/plans \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Standard Commission Plan","planType":"percentage","baseRate":10}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/commission-tracker/plans', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10 }),
});`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/commission-tracker/plans',
  { companyId: 'YOUR_COMPANY_ID', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10 },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Standard Commission Plan', planType: 'percentage', baseRate: 10 });
const options = { hostname: 'api.mengo.ai', path: '/api/commission-tracker/plans', method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.post('https://app.mengoengine.com/api/commission-tracker/plans',
    json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Standard Commission Plan', 'planType': 'percentage', 'baseRate': 10},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/commission-tracker/plans');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Standard Commission Plan', 'planType' => 'percentage', 'baseRate' => 10]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Auto-generated ID' },
                { field: 'name', type: 'string', description: 'Plan name' },
                { field: 'planType', type: 'string', description: 'Plan type' },
              ],
              notes: ['Required fields: companyId, name, planType, baseRate.'],
              commonMistakes: ['Omitting required fields.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['ct-plans-list', 'ct-plans-detail'],
            },
            {
              id: 'ct-plans-update',
              name: 'Update Commission Plan',
              method: 'PUT',
              path: '/api/commission-tracker/plans/:id',
              purpose: 'Update an existing commission plan.',
              whenToUse: 'Use this endpoint to modify plan details, rates, or active status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }, { name: 'Content-Type', type: 'string', required: true, description: 'application/json' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID' }],
              requestBody: { name: 'Updated Commission Plan', baseRate: 12, isActive: true },
              successResponse: { status: 200, description: 'Plan updated', body: { _id: '...', name: 'Updated Commission Plan', baseRate: 12, isActive: true, updatedAt: '2026-07-22T11:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Plan not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Commission Plan","baseRate":12,"isActive":true}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Commission Plan', baseRate: 12, isActive: true }),
});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID',
  { name: 'Updated Commission Plan', baseRate: 12, isActive: true },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }
);`,
              nodeExample: `const https = require('https');
const data = JSON.stringify({ name: 'Updated Commission Plan', baseRate: 12, isActive: true });
const options = { hostname: 'api.mengo.ai', path: '/api/commission-tracker/plans/YOUR_PLAN_ID', method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(data); req.end();`,
              pythonExample: `import requests
requests.put('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID',
    json={'name': 'Updated Commission Plan', 'baseRate': 12, 'isActive': True},
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Commission Plan', 'baseRate' => 12, 'isActive' => true]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Plan ID' },
                { field: 'updatedAt', type: 'string', description: 'Last update timestamp' },
              ],
              notes: ['All fields are optional — only send the fields you want to update.'],
              commonMistakes: ['Using an invalid plan ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['ct-plans-list', 'ct-plans-detail'],
            },
            {
              id: 'ct-plans-delete',
              name: 'Delete Commission Plan',
              method: 'DELETE',
              path: '/api/commission-tracker/plans/:id',
              purpose: 'Delete a commission plan.',
              whenToUse: 'Use this endpoint to permanently remove a commission plan.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [{ name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' }],
              pathParams: [{ name: 'id', type: 'string', required: true, description: 'Plan ID to delete' }],
              successResponse: { status: 200, description: 'Plan deleted', body: { message: 'Commission plan deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Plan not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/commission-tracker/plans/YOUR_PLAN_ID', method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.end();`,
              pythonExample: `import requests
requests.delete('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/commission-tracker/plans/YOUR_PLAN_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [{ field: 'message', type: 'string', description: 'Deletion confirmation' }],
              notes: ['Deletion is permanent. Also see commissions (with bulk-approve) and payouts sub-resources.'],
              commonMistakes: ['Using an invalid plan ID.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write'],
              relatedApis: ['ct-plans-list', 'ct-plans-detail'],
            },
          ],
        },
        // --- Video Content ---
        {
          id: 'video-content',
          name: 'Video Content',
          description: 'Manage video content library — CRUD operations for tutorial videos, product demos, testimonials, explainers, onboarding videos, training content, webinar recordings, social shorts/longs, ad videos, pitch videos, case study videos, and more. Supports 30+ video types, multiple sources (YouTube, Vimeo, Loom, Wistia, Vidyard), sections, timestamp notes, AI-generated metadata, and bulk import.',
          endpoints: [
            {
              id: 'videos-list',
              name: 'Get All Videos',
              method: 'GET',
              path: '/api/video-content/videos/:companyId',
              purpose: 'Retrieve all video content for a company, sorted by creation date (newest first). Supports filtering by type, status, category, source, accessLevel, and search.',
              whenToUse: 'Use this endpoint to list all videos for a company or to filter videos by type, status, source, or other criteria.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'The company ID to retrieve videos for' },
              ],
              queryParams: [
                { name: 'type', type: 'string', required: false, description: 'Filter by video type (e.g., tutorial, product-demo, testimonial, explainer, onboarding, training, webinar-recording, social-short, social-long, ad-video, pitch-video, pitch-deck, case-study-video, how-to, thought-leadership, behind-the-scenes, event-highlight, announcement, faq, comparison, feature-highlight, customer-story, interview, vlog, documentary, animation, screen-recording, live-stream-recording, podcast-video, other)' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status: draft, review, approved, published, archived' },
                { name: 'category', type: 'string', required: false, description: 'Filter by category' },
                { name: 'source', type: 'string', required: false, description: 'Filter by source: youtube, vimeo, loom, wistia, viddyard, custom, uploaded' },
                { name: 'accessLevel', type: 'string', required: false, description: 'Filter by access level: public, internal, confidential, restricted' },
                { name: 'search', type: 'string', required: false, description: 'Search across name, description, and summary fields (case-insensitive regex)' },
              ],
              successResponse: { status: 200, description: 'Array of video content objects', body: { data: [{ _id: '...', companyId: '...', name: 'Product Demo Q3 2026', description: 'Quarterly product demonstration video', type: 'product-demo', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', thumbnailUrl: 'https://img.youtube.com/vi/abc123/hqdefault.jpg', duration: 320, status: 'published', category: 'Marketing', accessLevel: 'public', tags: ['product', 'demo'], language: 'en', department: 'Marketing', transcript: '...', summary: '...', keyNotes: ['...'], script: '...', shotList: ['...'], sections: [{ id: 'sec1', title: 'Introduction', content: '...', order: 1 }], timestampNotes: [{ time: '00:30', note: 'Key feature highlight' }], targetAudience: 'Prospective customers', usageNotes: '...', bestPractices: '...', effectivenessTips: '...', pdfReferences: ['...'], downloadableResources: ['...'], isFavorite: false, isPinned: false, viewCount: 1250, downloadCount: 45, aiGenerated: { isAIGenerated: true, pipelineVersion: '1.0', provider: 'claude', model: 'claude-sonnet-4-20250514', confidence: 0.92, generatedAt: '2026-07-22T10:00:00Z' }, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' }] } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/video-content/videos/YOUR_COMPANY_ID?type=product-demo&status=published" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos/YOUR_COMPANY_ID?type=product-demo&status=published', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data: videos } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/video-content/videos/YOUR_COMPANY_ID', {
  params: { type: 'product-demo', status: 'published' },
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/video-content/videos/YOUR_COMPANY_ID?type=product-demo&status=published', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/video-content/videos/YOUR_COMPANY_ID',
  params={'type': 'product-demo', 'status': 'published'},
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos/YOUR_COMPANY_ID?type=product-demo&status=published');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of video content objects' },
                { field: 'data[]._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data[].companyId', type: 'string', description: 'Company the video belongs to' },
                { field: 'data[].name', type: 'string', description: 'Video name/title' },
                { field: 'data[].description', type: 'string', description: 'Video description' },
                { field: 'data[].type', type: 'string', description: 'Video type (30+ types: tutorial, product-demo, testimonial, explainer, etc.)' },
                { field: 'data[].source', type: 'string', description: 'Video source: youtube, vimeo, loom, wistia, viddyard, custom, uploaded' },
                { field: 'data[].status', type: 'string', description: 'Video status: draft, review, approved, published, archived' },
                { field: 'data[].accessLevel', type: 'string', description: 'Access level: public, internal, confidential, restricted' },
                { field: 'data[].videoUrl', type: 'string', description: 'URL to the video' },
                { field: 'data[].thumbnailUrl', type: 'string', description: 'URL to the video thumbnail' },
                { field: 'data[].duration', type: 'number', description: 'Video duration in seconds' },
                { field: 'data[].sections', type: 'array', description: 'Array of VideoSection objects with id, title, content, order' },
                { field: 'data[].timestampNotes', type: 'array', description: 'Array of timestamp notes with time and note' },
                { field: 'data[].tags', type: 'string[]', description: 'Tags for categorization' },
                { field: 'data[].aiGenerated', type: 'object', description: 'AI generation metadata (isAIGenerated, pipelineVersion, provider, model, confidence, generatedAt)' },
              ],
              notes: ['Returns videos sorted by creation date (newest first).', 'Query parameters type, status, category, source, and accessLevel are optional filters — omit them to get all videos.', 'The search parameter performs a case-insensitive regex match on name, description, and summary fields.'],
              commonMistakes: ['Using the document _id instead of companyId in the URL — the path parameter is companyId.', 'Expecting a paginated response — this endpoint returns all matching videos for the company.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'video-content.view'],
              relatedApis: ['videos-detail', 'videos-create'],
            },
            {
              id: 'videos-detail',
              name: 'Get Video Detail',
              method: 'GET',
              path: '/api/video-content/videos/detail/:id',
              purpose: 'Retrieve a single video content record by its MongoDB ID.',
              whenToUse: 'Use this endpoint when you need the full details of a specific video including transcript, sections, timestamp notes, and AI metadata.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the video content record' },
              ],
              successResponse: { status: 200, description: 'Single video content object with all fields', body: { data: { _id: '...', companyId: '...', name: 'Product Demo Q3 2026', description: 'Quarterly product demonstration video', type: 'product-demo', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', thumbnailUrl: 'https://img.youtube.com/vi/abc123/hqdefault.jpg', duration: 320, status: 'published', category: 'Marketing', accessLevel: 'public', transcript: 'Full transcript text...', summary: 'Executive summary of the video content', keyNotes: ['Key point 1', 'Key point 2'], script: 'Video script content...', shotList: ['Intro shot', 'Feature demo shot'], sections: [{ id: 'sec1', title: 'Introduction', content: '...', order: 1 }], timestampNotes: [{ time: '00:30', note: 'Key feature highlight' }], tags: ['product', 'demo'], language: 'en', department: 'Marketing', targetAudience: 'Prospective customers', usageNotes: 'Use in sales presentations', bestPractices: 'Play intro first', effectivenessTips: 'Pair with case study', pdfReferences: [], downloadableResources: [], isFavorite: false, isPinned: false, viewCount: 1250, downloadCount: 45, aiGenerated: { isAIGenerated: true, pipelineVersion: '1.0', provider: 'claude', model: 'claude-sonnet-4-20250514', confidence: 0.92, generatedAt: '2026-07-22T10:00:00Z' }, createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Video not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/video-content/videos/detail/VIDEO_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos/detail/VIDEO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const { data: video } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/video-content/videos/detail/VIDEO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
https.get({ hostname: 'api.mengo.ai', path: '/api/video-content/videos/detail/VIDEO_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get('https://app.mengoengine.com/api/video-content/videos/detail/VIDEO_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos/detail/VIDEO_ID');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'object', description: 'The video content object' },
                { field: 'data._id', type: 'string', description: 'MongoDB document ID' },
                { field: 'data.name', type: 'string', description: 'Video name/title' },
                { field: 'data.description', type: 'string', description: 'Video description' },
                { field: 'data.type', type: 'string', description: 'Video type (30+ types)' },
                { field: 'data.source', type: 'string', description: 'Video source: youtube, vimeo, loom, wistia, viddyard, custom, uploaded' },
                { field: 'data.videoUrl', type: 'string', description: 'URL to the video' },
                { field: 'data.thumbnailUrl', type: 'string', description: 'URL to the video thumbnail' },
                { field: 'data.duration', type: 'number', description: 'Video duration in seconds' },
                { field: 'data.transcript', type: 'string', description: 'Full transcript of the video content' },
                { field: 'data.summary', type: 'string', description: 'Executive summary of the video' },
                { field: 'data.keyNotes', type: 'string[]', description: 'Key notes/highlights from the video' },
                { field: 'data.script', type: 'string', description: 'Video script content' },
                { field: 'data.shotList', type: 'string[]', description: 'List of shots/scenes for the video' },
                { field: 'data.sections', type: 'array', description: 'Array of VideoSection objects with id, title, content, order' },
                { field: 'data.timestampNotes', type: 'array', description: 'Array of timestamp notes with time and note' },
                { field: 'data.aiGenerated', type: 'object', description: 'AI generation metadata (isAIGenerated, pipelineVersion, provider, model, confidence, generatedAt)' },
              ],
              notes: ['The id parameter is the MongoDB _id (not a custom id field).', 'The response includes the full video object with all nested sections, timestamp notes, and AI metadata.'],
              commonMistakes: ['Using a custom id field instead of the MongoDB _id — this endpoint uses MongoDB findById.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'video-content.view'],
              relatedApis: ['videos-list', 'videos-update'],
            },
            {
              id: 'videos-create',
              name: 'Create Video',
              method: 'POST',
              path: '/api/video-content/videos',
              purpose: 'Create a new video content record for a company.',
              whenToUse: 'Use this endpoint to add a new video to the video content library.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo Q3 2026', type: 'product-demo', description: 'Quarterly product demonstration video', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', status: 'draft', category: 'Marketing', accessLevel: 'public' },
              successResponse: { status: 201, description: 'Created video content record', body: { data: { _id: '...', companyId: '...', name: 'Product Demo Q3 2026', type: 'product-demo', description: 'Quarterly product demonstration video', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', status: 'draft', category: 'Marketing', accessLevel: 'public', createdAt: '2026-07-22T10:00:00Z', updatedAt: '2026-07-22T10:00:00Z' } } },
              errorResponses: [
                { code: 400, message: 'Validation failed — Company ID is required', body: { error: 'Validation failed', details: [{ msg: 'Company ID is required' }] } },
                { code: 400, message: 'Validation failed — Name is required', body: { error: 'Validation failed', details: [{ msg: 'Name is required' }] } },
                { code: 400, message: 'Validation failed — Type is required', body: { error: 'Validation failed', details: [{ msg: 'Type is required' }] } },
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/video-content/videos \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"companyId":"YOUR_COMPANY_ID","name":"Product Demo Q3 2026","type":"product-demo","description":"Quarterly product demonstration video","source":"youtube","videoUrl":"https://youtube.com/watch?v=abc123","status":"draft","category":"Marketing","accessLevel":"public"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Demo Q3 2026', type: 'product-demo', description: 'Quarterly product demonstration video', source: 'youtube', status: 'draft' })
});
const { data: video } = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/video-content/videos',
  { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo Q3 2026', type: 'product-demo', description: 'Quarterly product demonstration video', source: 'youtube', status: 'draft' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', name: 'Product Demo Q3 2026', type: 'product-demo', source: 'youtube', status: 'draft' });
const options = { hostname: 'api.mengo.ai', path: '/api/video-content/videos', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/video-content/videos',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Demo Q3 2026', 'type': 'product-demo', 'description': 'Quarterly product demonstration video', 'source': 'youtube', 'status': 'draft'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Demo Q3 2026', 'type' => 'product-demo', 'description' => 'Quarterly product demonstration video', 'source' => 'youtube', 'status' => 'draft']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'companyId', type: 'string', description: 'Required. The company ID to create the video for' },
                { field: 'name', type: 'string', description: 'Required. Video name/title' },
                { field: 'type', type: 'string', description: 'Required. Video type (30+ types: tutorial, product-demo, testimonial, explainer, onboarding, training, webinar-recording, social-short, social-long, ad-video, pitch-video, pitch-deck, case-study-video, how-to, thought-leadership, behind-the-scenes, event-highlight, announcement, faq, comparison, feature-highlight, customer-story, interview, vlog, documentary, animation, screen-recording, live-stream-recording, podcast-video, other)' },
                { field: 'description', type: 'string', description: 'Video description (optional)' },
                { field: 'source', type: 'string', description: 'Video source: youtube, vimeo, loom, wistia, viddyard, custom, uploaded' },
                { field: 'videoUrl', type: 'string', description: 'URL to the video (optional)' },
                { field: 'status', type: 'string', description: 'Video status: draft, review, approved, published, archived (defaults to draft)' },
                { field: 'category', type: 'string', description: 'Category for grouping videos (optional)' },
                { field: 'accessLevel', type: 'string', description: 'Access level: public, internal, confidential, restricted (defaults to public)' },
              ],
              notes: ['companyId, name, and type are required fields.', 'All other fields are optional and stored as-is.', 'Protected fields (_id, __v, createdAt, updatedAt) are automatically managed.'],
              commonMistakes: ['Omitting the required companyId, name, or type fields in the request body.', 'Including _id or __v in the request body — these are auto-generated and cannot be set.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'video-content.create'],
              relatedApis: ['videos-list', 'videos-detail'],
            },
            {
              id: 'videos-update',
              name: 'Update Video',
              method: 'PUT',
              path: '/api/video-content/videos/:id',
              purpose: 'Update an existing video content record with partial or full data.',
              whenToUse: 'Use this endpoint to modify video properties such as name, description, status, transcript, sections, timestamp notes, or any other field.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the video content record to update' },
              ],
              requestBody: { name: 'Updated Product Demo', status: 'published', summary: 'Updated executive summary', keyNotes: ['Key point 1', 'Key point 2', 'Key point 3'] },
              successResponse: { status: 200, description: 'Updated video content record', body: { data: { _id: '...', name: 'Updated Product Demo', status: 'published', summary: 'Updated executive summary', updatedAt: '2026-07-22T12:00:00Z' } } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Video not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/video-content/videos/VIDEO_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Updated Product Demo","status":"published","summary":"Updated executive summary"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Product Demo', status: 'published', summary: 'Updated executive summary' })
});
const { data: updated } = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID',
  { name: 'Updated Product Demo', status: 'published', summary: 'Updated executive summary' },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ name: 'Updated Product Demo', status: 'published', summary: 'Updated executive summary' });
const options = { hostname: 'api.mengo.ai', path: '/api/video-content/videos/VIDEO_ID', method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.put('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'name': 'Updated Product Demo', 'status': 'published', 'summary': 'Updated executive summary'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Updated Product Demo', 'status' => 'published', 'summary' => 'Updated executive summary']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'object', description: 'The updated video content object' },
                { field: 'data.updatedAt', type: 'string', description: 'Auto-updated timestamp of the modification' },
              ],
              notes: ['Only include fields you want to change — partial updates are supported.', 'The updatedAt timestamp is automatically set to the current time.', 'Mongoose validators are run on updates (runValidators: true).'],
              commonMistakes: ['Including _id, __v, or createdAt in the request body — these are auto-generated and cannot be changed.', 'Using a custom id field instead of the MongoDB _id in the URL.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'video-content.edit'],
              relatedApis: ['videos-detail', 'videos-create'],
            },
            {
              id: 'videos-delete',
              name: 'Delete Video',
              method: 'DELETE',
              path: '/api/video-content/videos/:id',
              purpose: 'Delete a video content record permanently.',
              whenToUse: 'Use this endpoint to permanently remove a video content record from the library.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'The MongoDB _id of the video content record to delete' },
              ],
              successResponse: { status: 200, description: 'Video content record deleted', body: { data: { _id: '...', name: 'Deleted Video', status: 'archived' } } },
              errorResponses: [
                { code: 403, message: 'Access denied — user does not have access to this company' },
                { code: 404, message: 'Video not found' },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/video-content/videos/VIDEO_ID" \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID', {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const result = await response.json();`,
              axiosExample: `const { data } = await axios.delete('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID', {
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});`,
              nodeExample: `const https = require('https');
const options = { hostname: 'api.mengo.ai', path: '/api/video-content/videos/VIDEO_ID', method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };
https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
response = requests.delete('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos/VIDEO_ID');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'object', description: 'The deleted video content object' },
                { field: 'data._id', type: 'string', description: 'MongoDB document ID of the deleted video' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'The deleted video data is returned in the response for confirmation.'],
              commonMistakes: ['Using a custom id field instead of the MongoDB _id in the URL.', 'Expecting a soft delete — this endpoint permanently removes the record.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.write', 'video-content.delete'],
              relatedApis: ['videos-list', 'videos-update'],
            },
            {
              id: 'videos-bulk-import',
              name: 'Bulk Import Videos',
              method: 'POST',
              path: '/api/video-content/videos/bulk-import',
              purpose: 'Import multiple video content records at once.',
              whenToUse: 'Use this endpoint to batch-create multiple video content records in a single request.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { items: [{ companyId: 'YOUR_COMPANY_ID', name: 'Tutorial Video 1', type: 'tutorial', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', status: 'draft' }, { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo 2', type: 'product-demo', source: 'vimeo', videoUrl: 'https://vimeo.com/123456', status: 'draft' }] },
              successResponse: { status: 201, description: 'Videos created successfully', body: { data: [{ _id: '...', companyId: '...', name: 'Tutorial Video 1', type: 'tutorial', status: 'draft' }, { _id: '...', companyId: '...', name: 'Product Demo 2', type: 'product-demo', status: 'draft' }] } },
              errorResponses: [
                { code: 400, message: 'Items array is required', body: { error: 'Items array is required' } },
                { code: 400, message: 'Items must be a non-empty array', body: { error: 'Items array is required' } },
                { code: 500, message: 'Internal server error' },
              ],
              curlExample: `curl -X POST https://app.mengoengine.com/api/video-content/videos/bulk-import \\
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{"items":[{"companyId":"YOUR_COMPANY_ID","name":"Tutorial Video 1","type":"tutorial","source":"youtube","videoUrl":"https://youtube.com/watch?v=abc123","status":"draft"},{"companyId":"YOUR_COMPANY_ID","name":"Product Demo 2","type":"product-demo","source":"vimeo","videoUrl":"https://vimeo.com/123456","status":"draft"}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/video-content/videos/bulk-import', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({ items: [
    { companyId: 'YOUR_COMPANY_ID', name: 'Tutorial Video 1', type: 'tutorial', source: 'youtube', videoUrl: 'https://youtube.com/watch?v=abc123', status: 'draft' },
    { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo 2', type: 'product-demo', source: 'vimeo', videoUrl: 'https://vimeo.com/123456', status: 'draft' }
  ] })
});
const { data: videos } = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/video-content/videos/bulk-import',
  { items: [
    { companyId: 'YOUR_COMPANY_ID', name: 'Tutorial Video 1', type: 'tutorial', source: 'youtube', status: 'draft' },
    { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo 2', type: 'product-demo', source: 'vimeo', status: 'draft' }
  ] },
  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } });`,
              nodeExample: `const https = require('https');
const payload = JSON.stringify({ items: [
  { companyId: 'YOUR_COMPANY_ID', name: 'Tutorial Video 1', type: 'tutorial', source: 'youtube', status: 'draft' },
  { companyId: 'YOUR_COMPANY_ID', name: 'Product Demo 2', type: 'product-demo', source: 'vimeo', status: 'draft' }
] });
const options = { hostname: 'api.mengo.ai', path: '/api/video-content/videos/bulk-import', method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } };
const req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });
req.write(payload); req.end();`,
              pythonExample: `import requests
response = requests.post('https://app.mengoengine.com/api/video-content/videos/bulk-import',
  headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
  json={'items': [
    {'companyId': 'YOUR_COMPANY_ID', 'name': 'Tutorial Video 1', 'type': 'tutorial', 'source': 'youtube', 'status': 'draft'},
    {'companyId': 'YOUR_COMPANY_ID', 'name': 'Product Demo 2', 'type': 'product-demo', 'source': 'vimeo', 'status': 'draft'}
  ]})`,
              phpExample: `<?php $ch = curl_init('https://app.mengoengine.com/api/video-content/videos/bulk-import');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_ACCESS_TOKEN', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['items' => [
  ['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Tutorial Video 1', 'type' => 'tutorial', 'source' => 'youtube', 'status' => 'draft'],
  ['companyId' => 'YOUR_COMPANY_ID', 'name' => 'Product Demo 2', 'type' => 'product-demo', 'source' => 'vimeo', 'status' => 'draft']
]]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of created video content objects' },
                { field: 'data[]._id', type: 'string', description: 'MongoDB document ID of the created video' },
                { field: 'data[].companyId', type: 'string', description: 'Company ID the video belongs to' },
                { field: 'data[].name', type: 'string', description: 'Video name/title' },
                { field: 'data[].type', type: 'string', description: 'Video type' },
                { field: 'data[].status', type: 'string', description: 'Video status' },
              ],
              notes: ['The items array must be non-empty — an empty array will return a 400 error.', 'Each item in the items array follows the same schema as the create endpoint.', 'All items are created in a single database transaction using insertMany.'],
              commonMistakes: ['Sending an empty items array — this will result in a 400 error.', 'Not wrapping the items in an items property — the request body must be { items: [...] }.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'video-content.create'],
              relatedApis: ['videos-list', 'videos-create'],
            },
          ],
        },
        // --- Books ---
        {
          id: 'books',
          name: 'Books',
          description: 'Manage books, categories, chapters, sections, content blocks, and AI-powered content generation for book publishing.',
          endpoints: [
            // --- Categories ---
            {
              id: 'books-cat-list',
              name: 'Get All Categories',
              method: 'GET',
              path: '/api/books/categories/:companyId',
              purpose: 'Retrieve all book categories for a company.',
              whenToUse: 'Use this endpoint to list the hierarchical categories used to organize books.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'List of book categories', body: [{ _id: '...', name: 'Marketing Books', companyId: '...', parentId: null, slug: 'marketing-books', description: '...', order: 1, status: 'active', bookCount: 5, createdAt: '2026-01-15T10:00:00Z' }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 500, message: 'Failed to get categories' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/books/categories/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/categories/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst categories = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/books/categories/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/books/categories/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get("https://app.mengoengine.com/api/books/categories/YOUR_COMPANY_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/categories/YOUR_COMPANY_ID");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Category ID' },
                { field: '[].name', type: 'string', description: 'Category name' },
                { field: '[].parentId', type: 'string|null', description: 'Parent category ID for hierarchy' },
                { field: '[].slug', type: 'string', description: 'URL-friendly slug' },
                { field: '[].bookCount', type: 'number', description: 'Number of books in this category' },
              ],
              notes: ['Categories are sorted by order, then createdAt.', 'Only active categories are returned unless you filter by status.'],
              commonMistakes: ['Confusing parentId with the category _id — parentId references a parent category for hierarchy.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'books.view'],
              relatedApis: ['books-cat-tree', 'books-cat-create'],
            },
            {
              id: 'books-cat-tree',
              name: 'Get Category Tree',
              method: 'GET',
              path: '/api/books/categories/tree/:companyId',
              purpose: 'Retrieve categories as a hierarchical tree structure.',
              whenToUse: 'Use this endpoint when you need categories organized as a parent-child tree for navigation or selection UIs.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              successResponse: { status: 200, description: 'Hierarchical category tree', body: [{ _id: '...', name: 'Marketing Books', children: [{ _id: '...', name: 'Digital Marketing', children: [] }] }] },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 500, message: 'Failed to get category tree' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/books/categories/tree/YOUR_COMPANY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/categories/tree/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst tree = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/books/categories/tree/YOUR_COMPANY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/books/categories/tree/YOUR_COMPANY_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get("https://app.mengoengine.com/api/books/categories/tree/YOUR_COMPANY_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/categories/tree/YOUR_COMPANY_ID");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Category ID' },
                { field: '[].name', type: 'string', description: 'Category name' },
                { field: '[].children', type: 'array', description: 'Child categories (recursive)' },
              ],
              notes: ['Only active categories are included in the tree.', 'Each node includes a children array for nested subcategories.'],
              commonMistakes: ['Expecting a flat list — this endpoint returns a tree with nested children arrays.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'books.view'],
              relatedApis: ['books-cat-list', 'books-cat-create'],
            },
            {
              id: 'books-cat-create',
              name: 'Create Category',
              method: 'POST',
              path: '/api/books/categories',
              purpose: 'Create a new book category.',
              whenToUse: 'Use this endpoint to create a category for organizing books.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { name: 'string (required) — Category name', companyId: 'string (required) — Company ID', parentId: 'string (optional) — Parent category ID for hierarchy', description: 'string (optional) — Category description', order: 'number (optional) — Sort order' },
              successResponse: { status: 201, description: 'Category created', body: { _id: '...', name: 'New Category', companyId: '...', parentId: null, slug: 'new-category', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation failed — name and companyId are required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/categories" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"name": "Marketing Books", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/categories', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ name: 'Marketing Books', companyId: 'YOUR_COMPANY_ID' }),\n});\nconst category = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/categories',\n  { name: 'Marketing Books', companyId: 'YOUR_COMPANY_ID' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ name: 'Marketing Books', companyId: 'YOUR_COMPANY_ID' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/categories', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/categories",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ name: "Marketing Books", companyId: "YOUR_COMPANY_ID" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/categories");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ name: "Marketing Books", companyId: "YOUR_COMPANY_ID" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Created category ID' },
                { field: 'name', type: 'string', description: 'Category name' },
                { field: 'slug', type: 'string', description: 'Auto-generated URL slug' },
              ],
              notes: ['name and companyId are required fields.', 'The slug is auto-generated from the name.'],
              commonMistakes: ['Omitting companyId — it is required for every category.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.create'],
              relatedApis: ['books-cat-list', 'books-cat-update'],
            },
            {
              id: 'books-cat-update',
              name: 'Update Category',
              method: 'PUT',
              path: '/api/books/categories/:id',
              purpose: 'Update an existing book category.',
              whenToUse: 'Use this endpoint to rename or modify a category.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category ID' },
              ],
              requestBody: { name: 'string (optional) — Updated name', description: 'string (optional) — Updated description', parentId: 'string (optional) — Updated parent category ID', order: 'number (optional) — Updated sort order' },
              successResponse: { status: 200, description: 'Category updated', body: { _id: '...', name: 'Updated Category', updatedAt: '2026-07-22T10:30:00Z' } },
              errorResponses: [{ code: 404, message: 'Category not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/books/categories/CATEGORY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"name": "Updated Category"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/categories/CATEGORY_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ name: 'Updated Category' }),\n});\nconst category = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/books/categories/CATEGORY_ID',\n  { name: 'Updated Category' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ name: 'Updated Category' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/categories/CATEGORY_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put("https://app.mengoengine.com/api/books/categories/CATEGORY_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ name: "Updated Category" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/categories/CATEGORY_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ name: "Updated Category" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Category ID' },
                { field: 'name', type: 'string', description: 'Updated name' },
                { field: 'updatedAt', type: 'string', description: 'Last updated timestamp' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.'],
              commonMistakes: ['Using companyId instead of category _id in the URL path.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.edit'],
              relatedApis: ['books-cat-list', 'books-cat-delete'],
            },
            {
              id: 'books-cat-delete',
              name: 'Delete Category',
              method: 'DELETE',
              path: '/api/books/categories/:id',
              purpose: 'Delete a book category. Books in this category will have their categoryId unset.',
              whenToUse: 'Use this endpoint to remove a category. Books previously in this category will not be deleted.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Category ID to delete' },
              ],
              successResponse: { status: 200, description: 'Category deleted', body: { message: 'Category deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Category not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/books/categories/CATEGORY_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `await fetch('https://app.mengoengine.com/api/books/categories/CATEGORY_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              axiosExample: `await axios.delete('https://app.mengoengine.com/api/books/categories/CATEGORY_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/categories/CATEGORY_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
requests.delete("https://app.mengoengine.com/api/books/categories/CATEGORY_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/categories/CATEGORY_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This action is permanent and cannot be undone.', 'Books that were in this category will have their categoryId field unset (not deleted).'],
              commonMistakes: ['Expecting books to be deleted along with the category — they are not.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.delete'],
              relatedApis: ['books-cat-list', 'books-cat-update'],
            },
            // --- Books ---
            {
              id: 'books-list',
              name: 'Get All Books',
              method: 'GET',
              path: '/api/books/books/:companyId',
              purpose: 'Retrieve all books for a company with search, filtering, and pagination.',
              whenToUse: 'Use this endpoint to list books with optional filters for category, status, type, or text search.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'companyId', type: 'string', required: true, description: 'Company ID' },
              ],
              queryParams: [
                { name: 'search', type: 'string', required: false, description: 'Full-text search query' },
                { name: 'categoryId', type: 'string', required: false, description: 'Filter by category ID' },
                { name: 'status', type: 'string', required: false, description: 'Filter by status (draft, review, final, published, archived)' },
                { name: 'type', type: 'string', required: false, description: 'Filter by publication type' },
                { name: 'authorId', type: 'string', required: false, description: 'Filter by author ID' },
                { name: 'isFeatured', type: 'string', required: false, description: 'Filter featured books (true/false)' },
                { name: 'page', type: 'number', required: false, description: 'Page number (default: 1)' },
                { name: 'limit', type: 'number', required: false, description: 'Results per page (default: 50)' },
              ],
              successResponse: { status: 200, description: 'Paginated list of books', body: { data: [{ _id: '...', title: 'Marketing Mastery', type: 'book', status: 'draft', categoryId: '...', isFeatured: false, chapterCount: 5, companyId: '...', createdAt: '2026-01-15T10:00:00Z' }], pagination: { page: 1, limit: 50, total: 12, pages: 1 } } },
              errorResponses: [{ code: 403, message: 'Access denied' }, { code: 500, message: 'Failed to get books' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/books/books/YOUR_COMPANY_ID?status=draft&limit=10" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books/YOUR_COMPANY_ID?status=draft&limit=10', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst { data, pagination } = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/books/books/YOUR_COMPANY_ID', {\n  params: { status: 'draft', limit: 10 },\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/books/books/YOUR_COMPANY_ID?status=draft&limit=10', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get("https://app.mengoengine.com/api/books/books/YOUR_COMPANY_ID?status=draft&limit=10",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/YOUR_COMPANY_ID?status=draft&limit=10");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'data', type: 'array', description: 'Array of book objects' },
                { field: 'data[].title', type: 'string', description: 'Book title' },
                { field: 'data[].type', type: 'string', description: 'Publication type' },
                { field: 'data[].status', type: 'string', description: 'Status (draft, review, final, published, archived)' },
                { field: 'data[].chapterCount', type: 'number', description: 'Number of chapters' },
                { field: 'pagination.total', type: 'number', description: 'Total books matching filter' },
              ],
              notes: ['Publication types: book, ebook, whitepaper, research-paper, report, magazine, journal-article, case-study, guide, handbook, manual, sop-book, training-manual, marketing-guide, product-guide, onboarding-book, other.', 'search parameter uses MongoDB text index.'],
              commonMistakes: ['Using companyId as a query parameter — it is a path parameter.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'books.view'],
              relatedApis: ['books-detail', 'books-create'],
            },
            {
              id: 'books-detail',
              name: 'Get Book Detail',
              method: 'GET',
              path: '/api/books/books/detail/:id',
              purpose: 'Retrieve full details of a single book.',
              whenToUse: 'Use this endpoint when you need complete book information including all fields.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Book ID' },
              ],
              successResponse: { status: 200, description: 'Book details', body: { _id: '...', title: 'Marketing Mastery', type: 'book', status: 'draft', authors: [{ id: '...', name: 'John Doe', role: 'author' }], chapterCount: 5, companyId: '...', createdAt: '2026-01-15T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/books/books/detail/BOOK_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books/detail/BOOK_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst book = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/books/books/detail/BOOK_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/books/books/detail/BOOK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get("https://app.mengoengine.com/api/books/books/detail/BOOK_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/detail/BOOK_ID");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Book ID' },
                { field: 'title', type: 'string', description: 'Book title' },
                { field: 'type', type: 'string', description: 'Publication type' },
                { field: 'status', type: 'string', description: 'Status (draft, review, final, published, archived)' },
                { field: 'authors', type: 'array', description: 'Array of author objects' },
                { field: 'chapterCount', type: 'number', description: 'Number of chapters' },
              ],
              notes: ['Returns the full book document with all fields.'],
              commonMistakes: ['Using companyId instead of the book _id in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'books.view'],
              relatedApis: ['books-list', 'books-create'],
            },
            {
              id: 'books-create',
              name: 'Create Book',
              method: 'POST',
              path: '/api/books/books',
              purpose: 'Create a new book.',
              whenToUse: 'Use this endpoint to create a new book entry in the library.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Book title', companyId: 'string (required) — Company ID', type: 'string (required) — Publication type (book, ebook, whitepaper, etc.)', subtitle: 'string (optional) — Book subtitle', description: 'string (optional) — Short description', categoryId: 'string (optional) — Category ID', status: 'string (optional) — Status (default: draft)' },
              successResponse: { status: 201, description: 'Book created', body: { _id: '...', title: 'New Book', type: 'book', status: 'draft', chapterCount: 0, companyId: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation failed — title, companyId, and type are required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/books" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Marketing Mastery", "companyId": "YOUR_COMPANY_ID", "type": "book"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Marketing Mastery', companyId: 'YOUR_COMPANY_ID', type: 'book' }),\n});\nconst book = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/books',\n  { title: 'Marketing Mastery', companyId: 'YOUR_COMPANY_ID', type: 'book' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Marketing Mastery', companyId: 'YOUR_COMPANY_ID', type: 'book' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/books', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/books",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Marketing Mastery", companyId: "YOUR_COMPANY_ID", type: "book" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Marketing Mastery", companyId: "YOUR_COMPANY_ID", type: "book" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Created book ID' },
                { field: 'title', type: 'string', description: 'Book title' },
                { field: 'type', type: 'string', description: 'Publication type' },
                { field: 'status', type: 'string', description: 'Status (default: draft)' },
              ],
              notes: ['Valid publication types: book, ebook, whitepaper, research-paper, report, magazine, journal-article, case-study, guide, handbook, manual, sop-book, training-manual, marketing-guide, product-guide, onboarding-book, other.'],
              commonMistakes: ['Using an invalid type value — must be one of the 17 allowed types.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.create'],
              relatedApis: ['books-list', 'books-update'],
            },
            {
              id: 'books-update',
              name: 'Update Book',
              method: 'PUT',
              path: '/api/books/books/:id',
              purpose: 'Update an existing book.',
              whenToUse: 'Use this endpoint to modify book metadata, content, or status.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Book ID' },
              ],
              requestBody: { title: 'string (optional) — Updated title', description: 'string (optional) — Updated description', categoryId: 'string (optional) — Updated category', status: 'string (optional) — Updated status', isFeatured: 'boolean (optional) — Updated featured flag' },
              successResponse: { status: 200, description: 'Book updated', body: { _id: '...', title: 'Updated Book', updatedAt: '2026-07-22T10:30:00Z' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/books/books/BOOK_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Updated Book Title"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books/BOOK_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Updated Book Title' }),\n});\nconst book = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/books/books/BOOK_ID',\n  { title: 'Updated Book Title' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Updated Book Title' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/books/BOOK_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put("https://app.mengoengine.com/api/books/books/BOOK_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Updated Book Title" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/BOOK_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Updated Book Title" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Book ID' },
                { field: 'title', type: 'string', description: 'Updated title' },
                { field: 'updatedAt', type: 'string', description: 'Last updated timestamp' },
              ],
              notes: ['Only include fields you want to change — omitted fields are not modified.'],
              commonMistakes: ['Trying to change type to an invalid value.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.edit'],
              relatedApis: ['books-detail', 'books-delete'],
            },
            {
              id: 'books-delete',
              name: 'Delete Book',
              method: 'DELETE',
              path: '/api/books/books/:id',
              purpose: 'Delete a book and all associated chapters, sections, and content blocks.',
              whenToUse: 'Use this endpoint to permanently remove a book and its entire content hierarchy.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Book ID to delete' },
              ],
              successResponse: { status: 200, description: 'Book and all associated content deleted', body: { message: 'Book and all associated content deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/books/books/BOOK_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `await fetch('https://app.mengoengine.com/api/books/books/BOOK_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              axiosExample: `await axios.delete('https://app.mengoengine.com/api/books/books/BOOK_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/books/BOOK_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
requests.delete("https://app.mengoengine.com/api/books/books/BOOK_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/BOOK_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This is a cascade delete — all chapters, sections, and content blocks are also deleted.', 'This action is permanent and cannot be undone.'],
              commonMistakes: ['Not realizing this deletes all child content as well.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.delete'],
              relatedApis: ['books-list', 'books-update'],
            },
            {
              id: 'books-submit-review',
              name: 'Submit Book for Review',
              method: 'POST',
              path: '/api/books/books/:id/submit-review',
              purpose: 'Submit a book for review.',
              whenToUse: 'Use this endpoint when a book draft is ready for editorial review.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Book ID' },
              ],
              requestBody: { notes: 'string (optional) — Review notes' },
              successResponse: { status: 200, description: 'Book submitted for review', body: { _id: '...', status: 'review', approvalStatus: 'pending' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/books/BOOK_ID/submit-review" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"notes": "Ready for review"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books/BOOK_ID/submit-review', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ notes: 'Ready for review' }),\n});\nconst book = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/books/BOOK_ID/submit-review',\n  { notes: 'Ready for review' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ notes: 'Ready for review' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/books/BOOK_ID/submit-review', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/books/BOOK_ID/submit-review",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ notes: "Ready for review" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/BOOK_ID/submit-review");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ notes: "Ready for review" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'status', type: 'string', description: 'Set to "review"' },
                { field: 'approvalStatus', type: 'string', description: 'Set to "pending"' },
              ],
              notes: ['Changes book status to "review" and approvalStatus to "pending".'],
              commonMistakes: ['Submitting a book that is already in review status.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.manage'],
              relatedApis: ['books-approve', 'books-update'],
            },
            {
              id: 'books-approve',
              name: 'Approve Book',
              method: 'POST',
              path: '/api/books/books/:id/approve',
              purpose: 'Approve a book by changing its status to final.',
              whenToUse: 'Use this endpoint when a book has passed review and is ready for publishing.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Book ID' },
              ],
              requestBody: { notes: 'string (optional) — Approval notes' },
              successResponse: { status: 200, description: 'Book approved', body: { _id: '...', status: 'final', approvalStatus: 'approved', approvedBy: '...', approvedAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/books/BOOK_ID/approve" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"notes": "Approved"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/books/BOOK_ID/approve', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ notes: 'Approved' }),\n});\nconst book = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/books/BOOK_ID/approve',\n  { notes: 'Approved' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ notes: 'Approved' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/books/BOOK_ID/approve', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/books/BOOK_ID/approve",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ notes: "Approved" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/books/BOOK_ID/approve");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ notes: "Approved" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'status', type: 'string', description: 'Set to "final"' },
                { field: 'approvalStatus', type: 'string', description: 'Set to "approved"' },
                { field: 'approvedBy', type: 'string', description: 'User ID who approved' },
                { field: 'approvedAt', type: 'string', description: 'Timestamp of approval' },
              ],
              notes: ['Changes book status to "final" and approvalStatus to "approved".'],
              commonMistakes: ['Approving a book that is not in review status.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.manage'],
              relatedApis: ['books-submit-review', 'books-update'],
            },
            // --- Chapters ---
            {
              id: 'books-chapters-list',
              name: 'Get All Chapters',
              method: 'GET',
              path: '/api/books/chapters/:bookId',
              purpose: 'Retrieve all chapters for a book.',
              whenToUse: 'Use this endpoint to list chapters within a specific book.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'bookId', type: 'string', required: true, description: 'Book ID' },
              ],
              successResponse: { status: 200, description: 'List of chapters', body: [{ _id: '...', title: 'Chapter 1', bookId: '...', order: 1, sectionCount: 3, companyId: '...' }] },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X GET "https://app.mengoengine.com/api/books/chapters/BOOK_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/chapters/BOOK_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst chapters = await response.json();`,
              axiosExample: `const { data } = await axios.get('https://app.mengoengine.com/api/books/chapters/BOOK_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nhttps.get({ hostname: 'api.mengo.ai', path: '/api/books/chapters/BOOK_ID', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });`,
              pythonExample: `import requests
response = requests.get("https://app.mengoengine.com/api/books/chapters/BOOK_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/chapters/BOOK_ID");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '[]._id', type: 'string', description: 'Chapter ID' },
                { field: '[].title', type: 'string', description: 'Chapter title' },
                { field: '[].bookId', type: 'string', description: 'Parent book ID' },
                { field: '[].order', type: 'number', description: 'Sort order' },
                { field: '[].sectionCount', type: 'number', description: 'Number of sections' },
              ],
              notes: ['Chapters are sorted by order, then createdAt.'],
              commonMistakes: ['Using companyId instead of bookId in the URL path.'],
              rateLimits: '30 requests per minute',
              requiredPermissions: ['admin.read', 'books.view'],
              relatedApis: ['books-chapters-create', 'books-chapters-reorder'],
            },
            {
              id: 'books-chapters-create',
              name: 'Create Chapter',
              method: 'POST',
              path: '/api/books/chapters',
              purpose: 'Create a new chapter within a book.',
              whenToUse: 'Use this endpoint to add a chapter to a book.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Chapter title', bookId: 'string (required) — Book ID', companyId: 'string (required) — Company ID', description: 'string (optional) — Chapter description', order: 'number (optional) — Sort order' },
              successResponse: { status: 201, description: 'Chapter created', body: { _id: '...', title: 'New Chapter', bookId: '...', order: 1, companyId: '...', createdAt: '2026-07-22T10:00:00Z' } },
              errorResponses: [{ code: 400, message: 'Validation failed — title, bookId, and companyId are required' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/chapters" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Chapter 1", "bookId": "BOOK_ID", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/chapters', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Chapter 1', bookId: 'BOOK_ID', companyId: 'YOUR_COMPANY_ID' }),\n});\nconst chapter = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/chapters',\n  { title: 'Chapter 1', bookId: 'BOOK_ID', companyId: 'YOUR_COMPANY_ID' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Chapter 1', bookId: 'BOOK_ID', companyId: 'YOUR_COMPANY_ID' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/chapters', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/chapters",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Chapter 1", bookId: "BOOK_ID", companyId: "YOUR_COMPANY_ID" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/chapters");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Chapter 1", bookId: "BOOK_ID", companyId: "YOUR_COMPANY_ID" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Created chapter ID' },
                { field: 'title', type: 'string', description: 'Chapter title' },
                { field: 'bookId', type: 'string', description: 'Parent book ID' },
              ],
              notes: ['Creating a chapter auto-increments the chapterCount on the parent book.'],
              commonMistakes: ['Omitting bookId or companyId — both are required.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.create'],
              relatedApis: ['books-chapters-list', 'books-chapters-update'],
            },
            {
              id: 'books-chapters-update',
              name: 'Update Chapter',
              method: 'PUT',
              path: '/api/books/chapters/:id',
              purpose: 'Update an existing chapter.',
              whenToUse: 'Use this endpoint to modify a chapter title, description, or content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Chapter ID' },
              ],
              requestBody: { title: 'string (optional) — Updated title', description: 'string (optional) — Updated description', learningObjectives: 'string[] (optional) — Updated learning objectives', keyTakeaways: 'string[] (optional) — Updated key takeaways' },
              successResponse: { status: 200, description: 'Chapter updated', body: { _id: '...', title: 'Updated Chapter', updatedAt: '2026-07-22T10:30:00Z' } },
              errorResponses: [{ code: 404, message: 'Chapter not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/books/chapters/CHAPTER_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Updated Chapter Title"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/chapters/CHAPTER_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Updated Chapter Title' }),\n});\nconst chapter = await response.json();`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/books/chapters/CHAPTER_ID',\n  { title: 'Updated Chapter Title' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Updated Chapter Title' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/chapters/CHAPTER_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put("https://app.mengoengine.com/api/books/chapters/CHAPTER_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Updated Chapter Title" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/chapters/CHAPTER_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Updated Chapter Title" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: '_id', type: 'string', description: 'Chapter ID' },
                { field: 'title', type: 'string', description: 'Updated title' },
                { field: 'updatedAt', type: 'string', description: 'Last updated timestamp' },
              ],
              notes: ['Only include fields you want to change.'],
              commonMistakes: ['Using bookId instead of chapter _id in the URL path.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.edit'],
              relatedApis: ['books-chapters-list', 'books-chapters-delete'],
            },
            {
              id: 'books-chapters-delete',
              name: 'Delete Chapter',
              method: 'DELETE',
              path: '/api/books/chapters/:id',
              purpose: 'Delete a chapter and all its sections and content blocks.',
              whenToUse: 'Use this endpoint to permanently remove a chapter and its child content.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
              ],
              pathParams: [
                { name: 'id', type: 'string', required: true, description: 'Chapter ID to delete' },
              ],
              successResponse: { status: 200, description: 'Chapter and all associated content deleted', body: { message: 'Chapter and all associated content deleted successfully' } },
              errorResponses: [{ code: 404, message: 'Chapter not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X DELETE "https://app.mengoengine.com/api/books/chapters/CHAPTER_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"`,
              jsExample: `await fetch('https://app.mengoengine.com/api/books/chapters/CHAPTER_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' },\n});`,
              axiosExample: `await axios.delete('https://app.mengoengine.com/api/books/chapters/CHAPTER_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});`,
              nodeExample: `const https = require('https');\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/chapters/CHAPTER_ID', method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } };\nhttps.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); }).end();`,
              pythonExample: `import requests
requests.delete("https://app.mengoengine.com/api/books/chapters/CHAPTER_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"})`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/chapters/CHAPTER_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN"]);
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['This is a cascade delete — all sections and content blocks within the chapter are also deleted.', 'The parent book chapterCount is auto-decremented.'],
              commonMistakes: ['Not realizing this deletes all child sections and content blocks as well.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.delete'],
              relatedApis: ['books-chapters-list', 'books-chapters-update'],
            },
            {
              id: 'books-chapters-reorder',
              name: 'Reorder Chapters',
              method: 'PUT',
              path: '/api/books/chapters/reorder/:bookId',
              purpose: 'Reorder chapters within a book.',
              whenToUse: 'Use this endpoint to change the display order of chapters.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              pathParams: [
                { name: 'bookId', type: 'string', required: true, description: 'Book ID' },
              ],
              requestBody: { orders: 'array (required) — Array of { id: "chapterId", order: number } objects' },
              successResponse: { status: 200, description: 'Chapters reordered', body: { message: 'Chapters reordered successfully' } },
              errorResponses: [{ code: 404, message: 'Book not found' }, { code: 403, message: 'Access denied' }],
              curlExample: `curl -X PUT "https://app.mengoengine.com/api/books/chapters/reorder/BOOK_ID" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"orders": [{"id": "chap1", "order": 1}, {"id": "chap2", "order": 2}]}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/chapters/reorder/BOOK_ID', {\n  method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ orders: [{ id: 'chap1', order: 1 }, { id: 'chap2', order: 2 }] }),\n});`,
              axiosExample: `const { data } = await axios.put('https://app.mengoengine.com/api/books/chapters/reorder/BOOK_ID',\n  { orders: [{ id: 'chap1', order: 1 }, { id: 'chap2', order: 2 }] },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ orders: [{ id: 'chap1', order: 1 }, { id: 'chap2', order: 2 }] });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/chapters/reorder/BOOK_ID', method: 'PUT',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.put("https://app.mengoengine.com/api/books/chapters/reorder/BOOK_ID",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ orders: [{ id: "chap1", order: 1 }, { id: "chap2", order: 2 }] })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/chapters/reorder/BOOK_ID");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ orders: [{ id: "chap1", order: 1 }, { id: "chap2", order: 2 }] }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'message', type: 'string', description: 'Confirmation message' },
              ],
              notes: ['Pass an array of { id, order } objects to set the new order.'],
              commonMistakes: ['Passing chapter objects instead of { id, order } pairs.'],
              rateLimits: '10 requests per minute',
              requiredPermissions: ['admin.write', 'books.edit'],
              relatedApis: ['books-chapters-list', 'books-chapters-update'],
            },
            // --- AI Generation ---
            {
              id: 'books-ai-generate-title',
              name: 'AI: Generate Book Titles',
              method: 'POST',
              path: '/api/books/ai/generate-title',
              purpose: 'Generate AI-powered book title suggestions.',
              whenToUse: 'Use this endpoint to get AI-suggested titles for a book.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { companyId: 'string (required) — Company ID', context: 'string (optional) — Context for title generation', type: 'string (optional) — Publication type (default: book)', targetAudience: 'string (optional) — Target audience description' },
              successResponse: { status: 200, description: 'AI-generated title suggestions', body: { content: { titles: [{ title: 'Digital Marketing Mastery', subtitle: 'A Complete Guide for Modern Marketers', slug: 'digital-marketing-mastery' }] } } },
              errorResponses: [{ code: 500, message: 'AI generation failed' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/ai/generate-title" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"companyId": "YOUR_COMPANY_ID", "context": "digital marketing strategies"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/ai/generate-title', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ companyId: 'YOUR_COMPANY_ID', context: 'digital marketing strategies' }),\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/ai/generate-title',\n  { companyId: 'YOUR_COMPANY_ID', context: 'digital marketing strategies' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ companyId: 'YOUR_COMPANY_ID', context: 'digital marketing strategies' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/ai/generate-title', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/ai/generate-title",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ companyId: "YOUR_COMPANY_ID", context: "digital marketing strategies" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/ai/generate-title");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ companyId: "YOUR_COMPANY_ID", context: "digital marketing strategies" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'content.titles', type: 'array', description: 'Array of 5-8 title objects' },
                { field: 'content.titles[].title', type: 'string', description: 'Suggested book title' },
                { field: 'content.titles[].subtitle', type: 'string', description: 'Suggested subtitle' },
                { field: 'content.titles[].slug', type: 'string', description: 'URL-friendly version of the title' },
              ],
              notes: ['Requires the "books" permission with "ai-generate" action.', 'Returns 5-8 title suggestions.', 'AI generation may take a few seconds.'],
              commonMistakes: ['Omitting companyId — it is required even for AI endpoints.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'books.ai-generate'],
              relatedApis: ['books-ai-generate-description', 'books-ai-generate-outline'],
            },
            {
              id: 'books-ai-generate-description',
              name: 'AI: Generate Book Description',
              method: 'POST',
              path: '/api/books/ai/generate-description',
              purpose: 'Generate AI-powered book descriptions and keywords.',
              whenToUse: 'Use this endpoint to generate SEO-optimized descriptions for a book.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Book title', companyId: 'string (required) — Company ID', context: 'string (optional) — Additional context', type: 'string (optional) — Publication type' },
              successResponse: { status: 200, description: 'AI-generated description', body: { content: { description: 'A compelling hook...', longDescription: 'Full description...', executiveSummary: 'Concise summary...', keywords: ['marketing', 'strategy'] } } },
              errorResponses: [{ code: 400, message: 'Validation failed — title is required' }, { code: 500, message: 'AI generation failed' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/ai/generate-description" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Digital Marketing Mastery", "companyId": "YOUR_COMPANY_ID"}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/ai/generate-description', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID' }),\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/ai/generate-description',\n  { title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID' },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID' });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/ai/generate-description', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/ai/generate-description",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Digital Marketing Mastery", companyId: "YOUR_COMPANY_ID" })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/ai/generate-description");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Digital Marketing Mastery", companyId: "YOUR_COMPANY_ID" }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'content.description', type: 'string', description: 'Short description (max 200 chars)' },
                { field: 'content.longDescription', type: 'string', description: 'Full description (3-5 paragraphs)' },
                { field: 'content.executiveSummary', type: 'string', description: 'Concise summary (max 500 chars)' },
                { field: 'content.keywords', type: 'string[]', description: '8-12 SEO keywords' },
              ],
              notes: ['Requires the "books" permission with "ai-generate" action.', 'title and companyId are required.'],
              commonMistakes: ['Omitting the title field — it is required.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'books.ai-generate'],
              relatedApis: ['books-ai-generate-title', 'books-ai-generate-outline'],
            },
            {
              id: 'books-ai-generate-outline',
              name: 'AI: Generate Book Outline',
              method: 'POST',
              path: '/api/books/ai/generate-outline',
              purpose: 'Generate AI-powered book chapter outline.',
              whenToUse: 'Use this endpoint to generate a structured chapter outline with learning objectives and key takeaways.',
              auth: 'Bearer Token Required (API access token or session JWT)',
              headers: [
                { name: 'Authorization', type: 'string', required: true, description: 'Bearer YOUR_ACCESS_TOKEN or session JWT' },
                { name: 'Content-Type', type: 'string', required: true, description: 'application/json' },
              ],
              requestBody: { title: 'string (required) — Book title', companyId: 'string (required) — Company ID', description: 'string (optional) — Book description', targetChapters: 'number (optional) — Number of chapters (default: 10)', targetAudience: 'string (optional) — Target audience' },
              successResponse: { status: 200, description: 'AI-generated chapter outline', body: { content: { chapters: [{ title: 'Introduction', description: 'Overview', learningObjectives: ['Understand key concepts'], keyTakeaways: ['Marketing is essential'], estimatedWordCount: 3000 }] } } },
              errorResponses: [{ code: 400, message: 'Validation failed — title is required' }, { code: 500, message: 'AI generation failed' }],
              curlExample: `curl -X POST "https://app.mengoengine.com/api/books/ai/generate-outline" \\\n  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\\n  -H "Content-Type: application/json" \\\n  -d '{"title": "Digital Marketing Mastery", "companyId": "YOUR_COMPANY_ID", "targetChapters": 8}'`,
              jsExample: `const response = await fetch('https://app.mengoengine.com/api/books/ai/generate-outline', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID', targetChapters: 8 }),\n});\nconst result = await response.json();`,
              axiosExample: `const { data } = await axios.post('https://app.mengoengine.com/api/books/ai/generate-outline',\n  { title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID', targetChapters: 8 },\n  { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }\n);`,
              nodeExample: `const https = require('https');\nconst data = JSON.stringify({ title: 'Digital Marketing Mastery', companyId: 'YOUR_COMPANY_ID', targetChapters: 8 });\nconst options = { hostname: 'api.mengo.ai', path: '/api/books/ai/generate-outline', method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' } };\nconst req = https.request(options, (res) => { let b=''; res.on('data', c => b+=c); res.on('end', () => console.log(JSON.parse(b))); });\nreq.write(data); req.end();`,
              pythonExample: `import requests
response = requests.post("https://app.mengoengine.com/api/books/ai/generate-outline",
  headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
  json={ title: "Digital Marketing Mastery", companyId: "YOUR_COMPANY_ID", targetChapters: 8 })`,
              phpExample: `<?php  = curl_init("https://app.mengoengine.com/api/books/ai/generate-outline");
curl_setopt(, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt(, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json"]);
curl_setopt(, CURLOPT_POSTFIELDS, '{ title: "Digital Marketing Mastery", companyId: "YOUR_COMPANY_ID", targetChapters: 8 }');
curl_setopt(, CURLOPT_RETURNTRANSFER, true); echo curl_exec();`,
              responseFields: [
                { field: 'content.chapters', type: 'array', description: 'Array of chapter objects' },
                { field: 'content.chapters[].title', type: 'string', description: 'Chapter title' },
                { field: 'content.chapters[].description', type: 'string', description: 'Brief chapter description' },
                { field: 'content.chapters[].learningObjectives', type: 'string[]', description: 'Learning objectives' },
                { field: 'content.chapters[].keyTakeaways', type: 'string[]', description: 'Key takeaways' },
              ],
              notes: ['Default number of chapters is 10 if not specified.', 'This endpoint only generates an outline, not actual chapters.'],
              commonMistakes: ['Expecting chapters to be auto-created — this only generates an outline.'],
              rateLimits: '5 requests per minute',
              requiredPermissions: ['admin.write', 'books.ai-generate'],
              relatedApis: ['books-ai-generate-title', 'books-ai-generate-description'],
            },
          ],
        },
      ],
    },
  ],
};
