API Reference
The mkt36z Workers API powers the CLI. All endpoints require authentication via Bearer token.
Base URL
https://api.mkt36z.com/api/v1
Authentication
Include your API key in the Authorization header:
Authorization: Bearer sk_live_your_key_here
Content Generation
POST /generate/:type
Generate marketing content. Returns an SSE stream.
POST /api/v1/generate/headline
Content-Type: application/json
{
"topic": "AI-powered CRM for startups",
"options": {
"count": 5,
"awarenessLevel": "3",
"channel": "linkedin",
"lang": "en"
},
"context": { ... }
}
SSE Event Types
| Event | Description |
content_chunk | Streamed content piece: {"content": "..."} |
agent_progress | Status update: {"message": "..."} |
qa_score | Quality score: {"total": 85, "pass": true} |
error | Error: {"error": "..."} |
done | Stream complete |
Analysis
POST /analyze/:type
Run market analysis. Returns an SSE stream with the same event types.
Campaigns
| Method | Endpoint | Description |
| POST | /campaigns | Create a new campaign |
| GET | /campaigns | List campaigns |
| GET | /campaigns/:id | Get campaign status |
| POST | /campaigns/:id/resume | Resume a campaign |
Agents
| Method | Endpoint | Description |
| POST | /agents/:name/run | Run a specific agent (SSE stream) |
| GET | /agents | List available agents |
| GET | /agents/runs/:id | Get run status |
Plans, Workflows, Templates
| Method | Endpoint | Description |
| POST | /plan/create | Create a marketing plan (SSE stream) |
| POST | /workflows/run | Execute a workflow (SSE stream) |
| GET | /workflows | List available workflows |
| POST | /templates/run | Run a template (SSE stream) |
| GET | /templates | List available templates |
Auth
| Method | Endpoint | Description |
| GET | /auth/status | Check auth status and plan info |
| POST | /auth/rotate | Rotate API key |
| POST | /auth/api-key | Register or validate a key |
Governance
| Method | Endpoint | Description |
| GET | /governance/audit | Hash-chain verified audit trail |
| GET | /governance/report | Compliance summary report |
Usage
| Method | Endpoint | Description |
| GET | /usage | Current usage and quota info |
| GET | /usage/history | Usage history over time |
Rate Limits
Rate limits are per API key:
| Limit | Window |
| 60 requests | Per minute |
| Monthly quota | Based on plan tier |
Rate limit headers are included in every response: X-RateLimit-Remaining, X-RateLimit-Reset.
Error Responses
{
"error": "Human-readable error message",
"status": 429,
"request_id": "req_1710000000_abc123"
}
| Status | Meaning |
| 401 | Invalid or missing API key |
| 403 | Insufficient permissions |
| 422 | PII detected in request (blocked by governance) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |