ONE email:coupon-stats
← Receivers

email:coupon-stats

email family

Minted vs redeemed for the per-recipient discount codes your group's emails gave out: one campaign (campaign, or broadcastId as bc:<id>) or all of them, totals plus one row per template code with its cap (max_redemptions, null = unbounded), capUsed (clones from every campaign plus the template's own redemptions) and capReached (no further code will be minted). Exact counts, aggregated per template. Reads your own group only

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
owner
The class of authority the caller must already hold, decided from the attested context with no round trip.
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.

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/email:coupon-stats \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "broadcastId": <string>, "campaign": <string> }}'

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.

  • broadcastId string optional Read the codes one broadcast gave out (campaign bc:<broadcastId>)
  • campaign string optional A campaign tag; wins over broadcastId. Neither = every campaign

Response

What comes back from the call.

  • ok boolean
  • workspace string
  • campaign string | null
  • minted number
  • redeemed number
  • templates object[]
  • error string sign_in_required · no_db · read_failed
  • detail string

Traffic

Every call to email:coupon-stats, 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 email:coupon-stats, 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 2
  • one.ie/web/src/lib/receiver-index.generated.ts:187
  • one.ie/web/src/lib/resolvers/email-content.ts:25
CLI 2
  • packages/cli/src/lib/receivers-index.generated.ts:189
  • packages/cli/src/lib/receivers.generated.ts:189
→

Answered by

email:coupon-stats one.ie/web/src/lib/resolvers/email-content.ts:61 Dispatched through POST /api/ask/email:coupon-stats, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "broadcastId": {
      "description": "Read the codes one broadcast gave out (campaign bc:<broadcastId>)",
      "type": "string"
    },
    "campaign": {
      "description": "A campaign tag; wins over broadcastId. Neither = every campaign",
      "type": "string"
    }
  }
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "workspace": {
      "type": "string"
    },
    "campaign": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "minted": {
      "type": "number"
    },
    "redeemed": {
      "type": "number"
    },
    "templates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "template_cid": {
            "type": "string"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "minted": {
            "type": "number"
          },
          "redeemed": {
            "type": "number"
          },
          "cap": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "capUsed": {
            "type": "number"
          },
          "capReached": {
            "type": "boolean"
          }
        },
        "required": [
          "template_cid",
          "code",
          "minted",
          "redeemed",
          "cap",
          "capUsed",
          "capReached"
        ]
      }
    },
    "error": {
      "description": "sign_in_required · no_db · read_failed",
      "type": "string"
    },
    "detail": {
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}