QuickstartPlatform API v1

Create your first finished assets

Create one Project, preview an exact USD quote, accept it under a hard maximum, and receive production artifacts through the same contract used by the Platform app.

Before you start

Create an account in the Platform, verify the account email, and create a scoped API key. Keep the key on the server or in a secret manager; never ship it in browser JavaScript.

The base URL is https://api.autocontentapi.com/v1. Requests and responses use snake_case, decimal USD amounts are strings, and list methods return one cursor page.

Install the TypeScript SDK
shell
npm install autocontentapi

1. Create and confirm a Project

A Project is the durable brand and Knowledge boundary. Creating it from one public website URL starts analysis. Wait for needs_review or ready, then confirm any inferred profile changes before generating.

TypeScript
ts
import AutoContent from 'autocontentapi'

const client = new AutoContent({
  apiKey: process.env.AUTOCONTENT_API_KEY,
})

const accepted = await client.projects.create({
  website_url: 'https://example.com',
})

const project = await client.projects.wait(accepted.id)

if (project.status === 'needs_review') {
  await client.projects.update(project.id, {
    name: project.name,
    description: project.description,
    confirmed: true,
  })
}

2. Preview, accept, and wait

A preview validates the complete request and returns the authoritative quote. Creation accepts only when max_cost_usd covers the current quote. The API reserves the accepted service value before provider work begins.

TypeScript
ts
const draft = {
  project_id: project.id,
  input: { type: 'knowledge' },
  attachment_source_ids: ['src_request_brief'],
  assets: [
    { asset_type: 'lead_magnet' },
    { asset_type: 'podcast_episode' },
  ],
}

const preview = await client.generations.preview(draft)

const generation = await client.generations.create({
  ...draft,
  max_cost_usd: preview.total_cost_usd,
})

const completed = await client.generations.wait(generation.id)
console.log(completed.assets)
REST preview
shell
curl https://api.autocontentapi.com/v1/generations/preview \
  --request POST \
  --header "Authorization: Bearer $AUTOCONTENT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "project_id": "prj_example",
    "input": { "type": "knowledge" },
    "attachment_source_ids": ["src_request_brief"],
    "assets": [{ "asset_type": "lead_magnet" }]
  }'

Mutations are idempotent

Retain one Idempotency-Key for the same logical mutation. If the connection fails after sending, recover with the same key and exact body instead of inventing a second request.

3. Turn the workflow into a Content Loop

Content Loops persist the same input and Asset contracts with an explicit schedule and per-run USD ceiling. Every Run still produces an ordinary Generation and Asset history.

Weekly Loop
ts
const loop = await client.contentLoops.create({
  project_id: project.id,
  input: {
    type: 'trend',
    lookback_days: 7,
  },
  assets: [{ asset_type: 'podcast_episode' }],
  schedule: {
    frequency: 'weekly',
    day_of_week: 'monday',
    local_time: '09:00',
    timezone: 'Europe/Madrid',
  },
  max_cost_per_run_usd: '10.00',
  max_cost_per_month_usd: '40.00',
})