ONE lead:update
← Receivers

lead:update

lead family

mcp

status 'booked': records that a lead became a booked job in the caller's own workspace (or a client workspace the caller controls, named by workspace): matches the contact lead:capture filed on phone or email, or by its contact id, keeps one booking with the job value in whole cents and the booked time, and tags the contact booked, which stops the follow-up sequences. The same booking sent twice is one row. No match writes nothing and answers matched:false. The cost per booked move per campaign and variant reads these rows against ad spend. With a stage and no status it is the pipeline move: the contact's open deal moves to that stage (or one opens when there is none) and the contact's stage tag follows; stage 'won' wins the deal and books its value as above, 'lost' loses it

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_workflows
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
no
This cannot be undone. Dry-run it first where the contract allows.
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/lead:update \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "status": "booked", "phone": "+15550100", "job_value_cents": 189900, "source": "manual" }}'

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.

  • status booked optional booked = the lead became a booked job. Required unless a stage or fields is sent: no status, no stage and no fields is refused, and any other status is refused as bad_status after the caller's authority is checked
  • stage string optional A pipeline stage, a bare word (qualified, quote-sent): the contact's open deal moves to it, or one opens when there is none, and the contact's stage tag follows. 'won' wins the deal and books its value, 'lost' loses it (lost_reason names why). Sent without a status; the deal itself is deal:update
  • fields object optional Custom contact field values by declared name (people:fields), written on the contact matched by phone, email or contact. Alone it books nothing and moves no deal; with status booked it is checked before anything is written. An undeclared name is refused (unknown_field:<name>)
  • value_cents number optional With a stage: the deal's value in whole cents, when it opens or moves
  • lost_reason string optional With stage 'lost': why the deal was lost
  • phone string optional The phone the lead gave; matched as lead:capture hashed it
  • email string optional The email the lead gave; matched as lead:capture hashed it
  • contact string optional The contact's id (personId from lead:capture); used only when it is a contact of this workspace
  • job_value_cents number | null optional The job value in whole cents (189900 = $1,899.00); dollars are refused
  • booked_at number optional When it was booked, unix seconds; defaults to now; more than a year ahead is refused
  • source string optional Where the booking came from, a short slug (supermove, manual)
  • workspace string optional A client workspace to book in; only a workspace the caller controls (the agency above it). Defaults to the caller's own

Response

What comes back from the call.

  • ok boolean
  • matched boolean
  • contact string The matched contact's id
  • stage string With a stage: the deal's stage now
  • deal object With a stage: the deal that moved or opened
  • created boolean With a stage: true when the move opened a deal because the contact had none open
  • booked_at number
  • job_value_cents number | null
  • fields string[] With fields: the names of the custom contact fields written
  • error string unauthenticated | no_db | forbidden (a workspace the caller does not control) | bad_status | phone_or_email_required | job_value_cents_not_whole_cents | booked_at_too_far_ahead | bad_stage | bad_value

Traffic

Every call to lead:update, 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 lead:update, 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 4
  • one.ie/web/src/lib/deals/deals.ts:492
  • one.ie/web/src/lib/integrations/inbound-hook.ts:270
  • one.ie/web/src/lib/receiver-index.generated.ts:258
  • one.ie/web/src/lib/resolvers/lead-book.ts:221
CLI 2
  • packages/cli/src/lib/receivers-index.generated.ts:262
  • packages/cli/src/lib/receivers.generated.ts:262
→

Answered by

lead:update one.ie/web/src/lib/resolvers/lead-book.ts:156 Dispatched through POST /api/ask/lead:update, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": {
      "description": "booked = the lead became a booked job. Required unless a stage or fields is sent: no status, no stage and no fields is refused, and any other status is refused as bad_status after the caller's authority is checked",
      "type": "string",
      "enum": [
        "booked"
      ]
    },
    "stage": {
      "description": "A pipeline stage, a bare word (qualified, quote-sent): the contact's open deal moves to it, or one opens when there is none, and the contact's stage tag follows. 'won' wins the deal and books its value, 'lost' loses it (lost_reason names why). Sent without a status; the deal itself is deal:update",
      "type": "string"
    },
    "fields": {
      "description": "Custom contact field values by declared name (people:fields), written on the contact matched by phone, email or contact. Alone it books nothing and moves no deal; with status booked it is checked before anything is written. An undeclared name is refused (unknown_field:<name>)",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "value_cents": {
      "description": "With a stage: the deal's value in whole cents, when it opens or moves",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "lost_reason": {
      "description": "With stage 'lost': why the deal was lost",
      "type": "string"
    },
    "phone": {
      "description": "The phone the lead gave; matched as lead:capture hashed it",
      "type": "string"
    },
    "email": {
      "description": "The email the lead gave; matched as lead:capture hashed it",
      "type": "string"
    },
    "contact": {
      "description": "The contact's id (personId from lead:capture); used only when it is a contact of this workspace",
      "type": "string"
    },
    "job_value_cents": {
      "description": "The job value in whole cents (189900 = $1,899.00); dollars are refused",
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "booked_at": {
      "description": "When it was booked, unix seconds; defaults to now; more than a year ahead is refused",
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "source": {
      "description": "Where the booking came from, a short slug (supermove, manual)",
      "type": "string"
    },
    "workspace": {
      "description": "A client workspace to book in; only a workspace the caller controls (the agency above it). Defaults to the caller's own",
      "type": "string"
    }
  },
  "additionalProperties": {}
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "matched": {
      "type": "boolean"
    },
    "contact": {
      "description": "The matched contact's id",
      "type": "string"
    },
    "stage": {
      "description": "With a stage: the deal's stage now",
      "type": "string"
    },
    "deal": {
      "description": "With a stage: the deal that moved or opened",
      "type": "object",
      "properties": {
        "tid": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "stage": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "won",
            "lost"
          ]
        },
        "value_cents": {
          "type": "number"
        },
        "currency": {
          "type": "string"
        }
      },
      "required": [
        "tid",
        "title",
        "stage",
        "status",
        "value_cents",
        "currency"
      ],
      "additionalProperties": {}
    },
    "created": {
      "description": "With a stage: true when the move opened a deal because the contact had none open",
      "type": "boolean"
    },
    "booked_at": {
      "type": "number"
    },
    "job_value_cents": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "fields": {
      "description": "With fields: the names of the custom contact fields written",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "error": {
      "description": "unauthenticated | no_db | forbidden (a workspace the caller does not control) | bad_status | phone_or_email_required | job_value_cents_not_whole_cents | booked_at_too_far_ahead | bad_stage | bad_value",
      "type": "string"
    }
  },
  "required": [
    "ok",
    "matched"
  ]
}