ONE ads:generate
← Receivers

ads:generate

ads family

chatmcp

Write and render ad creative from a brief: copy for every format and variant, images, and (only when asked, one platform at a time) video, saved as creative-asset things on the campaign. With no campaignId a campaign group is created from the brief. Credits are checked before anything is rendered; video is capped per call and per day. Each failed asset is named, never replaced

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_integrations
The class of authority the caller must already hold, decided from the attested context with no round trip.
Authority action
manage_integrations
Also gated per node — the caller must be permitted this action over the workspace it names.
Cost
variable
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Settles
offchain
Moves real value off chain — a balance changes.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.
Version
1.0.0
Pin this to keep a contract stable; additive bumps never break callers.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/ads:generate \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": "acme", "brief": { "name": "Spring movers", "personaKey": "homeowner", "kpi": "leads", "platforms": [ "meta" ], "budgetDailyCents": 2000, "brief": "Local movers, fixed price" } }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • workspace string required Workspace (group slug) the campaign belongs to. The caller must manage its integrations
  • brief object required
  • campaignId string optional The campaign group's gid. Omit to create the campaign from the brief
  • formats string[] optional Only these format keys (one.ie/web/src/lib/ads-formats.ts); omit for every format
  • variants a | b | c[] optional Only these variants; omit for all three
  • videos boolean optional Render video formats. Default false here (a render is real money and minutes); true needs exactly one platform in brief.platforms
  • model string optional Video model id from the allowlist; default google/veo-3.1-lite

Response

What comes back from the call.

  • ok boolean
  • campaignId string
  • created boolean true when this call created the campaign group
  • generated number Creative-asset rows written, all platforms
  • failed number Formats that did not become an asset, all platforms; each is named under platforms[].failed
  • platforms object[] One answer per platform, the same shape POST /api/ads/generate returns
  • error string forbidden | unavailable | videos_need_one_platform | campaign_not_created | campaign not found in this workspace | insufficient credits (402 payload) | credit_check_unavailable | no_db
  • reason string

Traffic

Every call to ads:generate, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names ads:generate, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 1
  • one.ie/web/src/lib/receiver-index.generated.ts:22
CLI 1
  • packages/cli/src/ads.ts:286
Tests 1
  • packages/sdk/src/surfaces.test.ts:127
→

Answered by

ads:generate one.ie/web/src/lib/resolvers/ads.ts:127 Dispatched through POST /api/ask/ads:generate, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "type": "string",
      "description": "Workspace (group slug) the campaign belongs to. The caller must manage its integrations"
    },
    "brief": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Campaign name"
        },
        "personaKey": {
          "type": "string",
          "description": "Who the ads speak to (a persona key)"
        },
        "kpi": {
          "type": "string",
          "description": "What the campaign is measured on, e.g. leads"
        },
        "platforms": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "meta",
              "google",
              "linkedin",
              "tiktok"
            ]
          },
          "description": "Platforms to write for"
        },
        "budgetDailyCents": {
          "description": "Daily budget in cents, stored on a new campaign",
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "brief": {
          "description": "Free-text creative brief for the copywriter",
          "type": "string"
        },
        "visual": {
          "description": "Art direction for the image and video prompts",
          "type": "string"
        },
        "sourceMedia": {
          "description": "Run the ads on a file that already exists: no render, cost 0",
          "type": "object",
          "properties": {
            "url": {
              "type": "string"
            },
            "kind": {
              "type": "string",
              "enum": [
                "image",
                "video"
              ]
            },
            "width": {
              "type": "number"
            },
            "height": {
              "type": "number"
            },
            "durationS": {
              "type": "number"
            }
          },
          "required": [
            "url",
            "kind",
            "width",
            "height"
          ]
        }
      },
      "required": [
        "name",
        "personaKey",
        "kpi",
        "platforms"
      ],
      "additionalProperties": {}
    },
    "campaignId": {
      "description": "The campaign group's gid. Omit to create the campaign from the brief",
      "type": "string"
    },
    "formats": {
      "description": "Only these format keys (one.ie/web/src/lib/ads-formats.ts); omit for every format",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "variants": {
      "description": "Only these variants; omit for all three",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "a",
          "b",
          "c"
        ]
      }
    },
    "videos": {
      "description": "Render video formats. Default false here (a render is real money and minutes); true needs exactly one platform in brief.platforms",
      "type": "boolean"
    },
    "model": {
      "description": "Video model id from the allowlist; default google/veo-3.1-lite",
      "type": "string"
    }
  },
  "required": [
    "workspace",
    "brief"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "campaignId": {
      "type": "string"
    },
    "created": {
      "description": "true when this call created the campaign group",
      "type": "boolean"
    },
    "generated": {
      "description": "Creative-asset rows written, all platforms",
      "type": "number"
    },
    "failed": {
      "description": "Formats that did not become an asset, all platforms; each is named under platforms[].failed",
      "type": "number"
    },
    "platforms": {
      "description": "One answer per platform, the same shape POST /api/ads/generate returns",
      "type": "array",
      "items": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {}
      }
    },
    "error": {
      "description": "forbidden | unavailable | videos_need_one_platform | campaign_not_created | campaign not found in this workspace | insufficient credits (402 payload) | credit_check_unavailable | no_db",
      "type": "string"
    },
    "reason": {
      "type": "string"
    }
  },
  "required": [
    "ok"
  ],
  "additionalProperties": {}
}