API Overview
The YBH Pulse Content API provides programmatic access to episode management, content generation, and image creation for podcast content production workflows.Base URL
All API endpoints are accessed via:Architecture
The API is built on Cloudflare Workers (Pages Functions), providing:- Global edge network - Low latency worldwide
- Serverless execution - Auto-scaling, no infrastructure management
- Secure by default - Environment variables, JWT authentication
- CORS support - Configurable cross-origin requests
Core Services
The API integrates with multiple backend services:| Service | Purpose | Documentation |
|---|---|---|
| Sanity.io | Episode & guest data storage | Sanity Service |
| Anthropic Claude | AI content generation | AI Service |
| Pinecone | RAG knowledge base for brand context | Pinecone Service |
| Kie.ai | Image generation (Nano Banana Pro) | Kie.ai Service |
Response Format
All endpoints return JSON responses with consistent structure:Success Response
Error Response
HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource created successfully |
202 | Accepted | Async job started (returns jobId) |
400 | Bad Request | Invalid request parameters |
401 | Unauthorized | Missing or invalid authentication |
404 | Not Found | Resource does not exist |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server error occurred |
502 | Bad Gateway | Upstream service error (Sanity, Anthropic, etc.) |
Rate Limiting
Rate limits apply to authentication endpoints:- Login: 5 attempts per 15 minutes per IP
- Password reset: 3 attempts per hour per IP
429 Too Many Requests with headers:
CORS
CORS is enabled for all endpoints. The API responds toOPTIONS preflight requests with:
Pagination
Endpoints that return lists support pagination via query parameters:Maximum number of results to return (max: 500)
Number of results to skip
Async Operations
Long-running operations (content generation, image creation) use async patterns:- Initiate: POST request returns
202 AcceptedwithjobId - Poll: GET status endpoint with
jobIduntil complete - Retrieve: Fetch final result from status endpoint
Environment Variables
The API requires the following environment variables:Next Steps
- Authentication Guide - JWT token authentication
- Episode Management - Create and manage episodes
- Content Generation - Generate PRF, hooks, and posts
- Image Generation - Create infographics and thumbnails