Content Provider APIs

For content creators, websites, and service providers

Product Management

Create Product

POST /providers/products
Content-Type: application/json
Authorization: Bearer {public_key}

{
  "title": "Premium AI Tutorial Series",
  "description": "Comprehensive guide to modern AI development",
  "content_url": "https://example.com/content/ai-tutorial-series",
  "type": "course",
  "category": "education",
  "tags": ["ai", "machine-learning", "tutorial"],
  "price": "5000000000000000000",
  "currency": "ETH",
  "payment_scheme": "exact",
  "thumbnail_url": "https://example.com/thumbnails/ai-course.jpg",
  "content_type": "video/series",
  "preview_content": "Learn AI development from basics to advanced...",
  "access_duration": 86400
}

Response:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "owner_id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "Premium AI Tutorial Series",
  "status": "draft",
  "price": "5000000000000000000",
  "view_count": 0,
  "purchase_count": 0,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Products

GET /providers/products?page=1&size=20&status=active&category=education&sort_by=created_at&sort_order=desc
Authorization: Bearer {public_key}

Response:

{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "title": "Premium AI Tutorial Series",
      "status": "active",
      "price": "5000000000000000000",
      "view_count": 1250,
      "purchase_count": 89,
      "rating": 4.85,
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "size": 20,
  "pages": 1
}

Update Product

PUT /providers/products/{product_id}
Authorization: Bearer {public_key}

{
  "title": "Advanced AI Tutorial Series - Updated",
  "price": "4500000000000000000",
  "status": "active"
}

Publish Product

POST /providers/products/{product_id}/publish
Authorization: Bearer {public_key}

Analytics & Insights

Product Analytics

GET /providers/products/{product_id}/analytics?start_date=2024-01-01&end_date=2024-01-31&group_by=day
Authorization: Bearer {public_key}

Response:

{
  "total_count": 1250,
  "data": [
    {
      "date": "2024-01-15",
      "views": 45,
      "unique_visitors": 38,
      "purchases": 3,
      "revenue": "15000000000000000000",
      "conversion_rate": 0.067
    }
  ],
  "summary": {
    "total_views": 1250,
    "total_purchases": 89,
    "total_revenue": "445000000000000000000",
    "average_conversion_rate": 0.071
  }
}

Dashboard Analytics

GET /providers/analytics/dashboard?days=30
Authorization: Bearer {public_key}

Response:

{
  "summary": {
    "total_products": 15,
    "active_products": 12,
    "total_revenue": "2500000000000000000000",
    "total_views": 15750,
    "total_purchases": 342,
    "conversion_rate": 0.022
  },
  "trends": {
    "revenue_growth": 0.15,
    "view_growth": 0.08,
    "new_customers": 89
  },
  "top_products": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "title": "Premium AI Tutorial Series",
      "revenue": "445000000000000000000",
      "purchases": 89
    }
  ],
  "geographic_distribution": {
    "US": 45.2,
    "EU": 32.1,
    "ASIA": 22.7
  }
}

Revenue Analytics

GET /providers/analytics/revenue?start_date=2024-01-01&end_date=2024-01-31&group_by=week
Authorization: Bearer {public_key}

Access Logs & Unpaid Requests

Access Logs

GET /providers/access-logs?page=1&size=50&unpaid_only=true&start_date=2024-01-15T00:00:00Z
Authorization: Bearer {public_key}

Response:

{
  "items": [
    {
      "id": "log-123",
      "product_id": "550e8400-e29b-41d4-a716-446655440000",
      "ip_address": "192.168.1.100",
      "user_agent": "Mozilla/5.0 (compatible; AI-Crawler/1.0)",
      "status": "requested",
      "access_granted": false,
      "country_code": "US",
      "created_at": "2024-01-15T14:30:00Z"
    }
  ],
  "total": 156,
  "page": 1,
  "size": 50,
  "pages": 4
}

Unpaid Requests Analysis

GET /providers/unpaid-requests?hours=24&min_requests=3
Authorization: Bearer {public_key}

Response:

{
  "items": [
    {
      "ip_address": "192.168.1.100",
      "request_count": 15,
      "last_request": "2024-01-15T14:30:00Z",
      "products_requested": [
        "550e8400-e29b-41d4-a716-446655440000",
        "660e8400-e29b-41d4-a716-446655440001"
      ],
      "country_code": "US",
      "user_agent": "Mozilla/5.0 (compatible; AI-Crawler/1.0)",
      "potential_value": "75000000000000000000"
    }
  ],
  "total_potential_revenue": "1250000000000000000000",
  "unique_requesters": 23,
  "top_requested_products": [
    {
      "product_id": "550e8400-e29b-41d4-a716-446655440000", 
      "title": "Premium AI Tutorial Series",
      "unpaid_requests": 89
    }
  ]
}

Payment Management

List Received Payments

GET /providers/payments?page=1&size=50&status=confirmed&chain=ethereum&start_date=2024-01-01
Authorization: Bearer {public_key}

Response:

{
  "items": [
    {
      "id": "pay-123",
      "transaction_hash": "0xabc123...",
      "chain": "ethereum", 
      "amount": "5000000000000000000",
      "facilitator_fee": "125000000000000000",
      "status": "confirmed",
      "payer_address": "0x742d35cc6cf25a8a8c498d0b3045fc22b2b8f7f9",
      "product_id": "550e8400-e29b-41d4-a716-446655440000",
      "created_at": "2024-01-15T10:45:00Z",
      "confirmed_at": "2024-01-15T10:47:00Z"
    }
  ],
  "total": 89,
  "page": 1,
  "size": 50
}

Last updated