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

EventDescription
content_chunkStreamed content piece: {"content": "..."}
agent_progressStatus update: {"message": "..."}
qa_scoreQuality score: {"total": 85, "pass": true}
errorError: {"error": "..."}
doneStream complete

Analysis

POST /analyze/:type

Run market analysis. Returns an SSE stream with the same event types.

Campaigns

MethodEndpointDescription
POST/campaignsCreate a new campaign
GET/campaignsList campaigns
GET/campaigns/:idGet campaign status
POST/campaigns/:id/resumeResume a campaign

Agents

MethodEndpointDescription
POST/agents/:name/runRun a specific agent (SSE stream)
GET/agentsList available agents
GET/agents/runs/:idGet run status

Plans, Workflows, Templates

MethodEndpointDescription
POST/plan/createCreate a marketing plan (SSE stream)
POST/workflows/runExecute a workflow (SSE stream)
GET/workflowsList available workflows
POST/templates/runRun a template (SSE stream)
GET/templatesList available templates

Auth

MethodEndpointDescription
GET/auth/statusCheck auth status and plan info
POST/auth/rotateRotate API key
POST/auth/api-keyRegister or validate a key

Governance

MethodEndpointDescription
GET/governance/auditHash-chain verified audit trail
GET/governance/reportCompliance summary report

Usage

MethodEndpointDescription
GET/usageCurrent usage and quota info
GET/usage/historyUsage history over time

Rate Limits

Rate limits are per API key:

LimitWindow
60 requestsPer minute
Monthly quotaBased 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"
}
StatusMeaning
401Invalid or missing API key
403Insufficient permissions
422PII detected in request (blocked by governance)
429Rate limit exceeded
500Internal server error