Content API

Manage content items that your AI can reference and deliver to users.

GET /api/sdk/content

Retrieve content items.

Query Parameters

| Parameter | Type | Description | |-----------|------|-------------| | type | string | Filter by content type (article, product, faq, etc.) | | status | string | Filter by status (draft, published, archived) | | limit | number | Max items to return (default: 20, max: 100) | | offset | number | Pagination offset |

Example Request

curl -X GET "https://app.fig1.ai/api/sdk/content?type=article&status=published&limit=10" \
  -H "X-Fig1-API-Key: fig1_sdk_abc123"

Response

{
  "success": true,
  "data": [
    {
      "_id": "content_abc123",
      "type": "article",
      "title": "Getting Started Guide",
      "excerpt": "Learn how to get started with our platform...",
      "slug": "getting-started",
      "url": "/guides/getting-started",
      "categories": ["guides", "beginner"],
      "tags": ["tutorial", "onboarding"],
      "status": "published",
      "featuredImage": "https://cdn.example.com/image.jpg",
      "publishedAt": "2024-01-15T10:00:00Z"
    }
  ],
  "pagination": {
    "total": 45,
    "limit": 10,
    "offset": 0,
    "hasMore": true
  }
}

GET /api/sdk/content/:id

Get a single content item by ID.

curl -X GET "https://app.fig1.ai/api/sdk/content/content_abc123" \
  -H "X-Fig1-API-Key: fig1_sdk_abc123"

POST /api/sdk/content

Create a new content item.

Request Body

{
  externalId: string;           // Your unique ID
  type: 'article' | 'product' | 'faq' | 'video' | 'document' | 'course';
  title: string;
  content?: string;             // Full content (HTML or markdown)
  excerpt?: string;             // Short summary
  slug?: string;                // URL-friendly identifier
  url?: string;                 // Original URL
  language?: string;            // ISO language code (default: 'en')
  categories?: string[];
  tags?: string[];
  accessLevel?: 'public' | 'authenticated' | 'premium';
  status?: 'draft' | 'published' | 'archived';
  author?: string;
  featuredImage?: string;
  metadata?: Record<string, any>;  // Custom fields
}

Example

curl -X POST https://app.fig1.ai/api/sdk/content \
  -H "Content-Type: application/json" \
  -H "X-Fig1-API-Key: fig1_sdk_abc123" \
  -d '{
    "externalId": "blog-123",
    "type": "article",
    "title": "10 Tips for Better Sleep",
    "content": "<p>Getting quality sleep is essential...</p>",
    "excerpt": "Improve your sleep with these science-backed tips.",
    "categories": ["health", "lifestyle"],
    "status": "published"
  }'

PUT /api/sdk/content/:id

Update an existing content item.

curl -X PUT https://app.fig1.ai/api/sdk/content/content_abc123 \
  -H "Content-Type: application/json" \
  -H "X-Fig1-API-Key: fig1_sdk_abc123" \
  -d '{
    "title": "Updated Title",
    "status": "published"
  }'

DELETE /api/sdk/content/:id

Delete a content item.

curl -X DELETE https://app.fig1.ai/api/sdk/content/content_abc123 \
  -H "X-Fig1-API-Key: fig1_sdk_abc123"

Content Types

| Type | Description | Common Fields | |------|-------------|---------------| | article | Blog posts, news | content, author, publishedAt | | product | E-commerce products | price, sku, inventory | | faq | Questions & answers | question, answer | | video | Video content | duration, streamUrl, thumbnailUrl | | document | PDFs, docs | pageCount, fileSize, format | | course | Educational content | lessons, duration, difficulty |

Type-Specific Metadata

Video Metadata

{
  type: 'video',
  videoMetadata: {
    duration: 3600,              // seconds
    streamUrl: 'https://...',
    thumbnailUrl: 'https://...',
    resolution: '1080p'
  }
}

Document Metadata

{
  type: 'document',
  documentMetadata: {
    pageCount: 25,
    fileSize: 2048000,           // bytes
    format: 'pdf'
  }
}

Course Metadata

{
  type: 'course',
  courseMetadata: {
    lessons: 12,
    totalDuration: 7200,         // seconds
    difficulty: 'intermediate',
    prerequisites: ['course-101']
  }
}

Syncing Content

For bulk content synchronization, we recommend:

  1. Use externalId to track your content across systems
  2. Implement upsert logic using PUT with your externalId
  3. Set up webhooks to sync on content changes
  4. Use the batch import feature in the dashboard for initial sync