← Receivers

campaign:targeting

campaign family

Size a campaign's audience BEFORE spending on reach — the tag combo plus a distinct-entity count over entity_tags

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_lifecycle
The class of authority the caller must already hold, decided from the attested context with no round trip.
Authority action
manage_lifecycle
Also gated per node — the caller must be permitted this action over the workspace it names.
Cost
free
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Idempotent
yes
Safe to retry as-is.
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/campaign:targeting \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "tags": [ "lead", "saas" ] }}'

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 optional Workspace slug; defaults to the attested caller's.
  • tags string[] required The targeting tags. MAX 8, charset-checked; more or malformed is refused by name.

Response

What comes back from the call.

  • ok boolean
  • tags string[]
  • strength number
  • audienceSize number DISTINCT entities holding ANY of the tags — an OR, so it is an UPPER BOUND on a multi-tag segment and never an intersection
  • lifecycles string[] Which stages this audience is actually in
  • workflows object[]
  • threads object[]
  • ttl number
  • cachedAt number Unix seconds. The combo half may be a KV hit; audienceSize is always counted live.
  • error string no_db | workspace required | forbidden | the tag-validation reason

Traffic

Every call to campaign:targeting, 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 campaign:targeting, 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 3
  • one.ie/web/src/lib/combo-read.ts:9
  • one.ie/web/src/lib/receiver-index.generated.ts:62
  • one.ie/web/src/pages/api/campaigns/targeting.ts:6

Answered by

campaign:targeting one.ie/web/src/lib/resolvers/campaigns.ts:364 Dispatched through POST /api/ask/campaign:targeting, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "description": "Workspace slug; defaults to the attested caller's.",
      "type": "string"
    },
    "tags": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The targeting tags. MAX 8, charset-checked; more or malformed is refused by name."
    }
  },
  "required": [
    "tags"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "strength": {
      "type": "number"
    },
    "audienceSize": {
      "description": "DISTINCT entities holding ANY of the tags — an OR, so it is an UPPER BOUND on a multi-tag segment and never an intersection",
      "type": "number"
    },
    "lifecycles": {
      "description": "Which stages this audience is actually in",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "workflows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "tags"
        ]
      }
    },
    "threads": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lastMsgAt": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "lastMsgAt"
        ]
      }
    },
    "ttl": {
      "type": "number"
    },
    "cachedAt": {
      "description": "Unix seconds. The combo half may be a KV hit; audienceSize is always counted live.",
      "type": "number"
    },
    "error": {
      "description": "no_db | workspace required | forbidden | the tag-validation reason",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}