ONE invoice:create
← Receivers

invoice:create

invoice family

mcp

Make an estimate or an invoice for one of your customers: lines from your catalogue (ppid) or free text, an optional discount and tax rate, a customer, a due date. Numbered per workspace (INV-0001, EST-0001) with no gaps. It stays a draft until invoice:send. An estimate the customer accepts becomes an invoice by itself.

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.
Settles
offchain
Moves real value off chain — a balance changes.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.

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/invoice:create \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "kind": "invoice", "customerEmail": "pat@example.com", "lines": [ { "description": "Install", "quantity": 2, "unitCents": 5000 } ], "taxRateBp": 825, "dueDays": 14 }}'

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 The workspace the document belongs to; defaults to the attested caller's own. The caller must control it (refused not_your_workspace)
  • kind estimate | invoice optional Default invoice
  • lines object[] required 1 to 50 lines. A float price or quantity is refused line_not_integer, never rounded
  • discountCents number optional A flat discount in cents, off the subtotal. Not with discountBp (discount_conflict)
  • discountBp number optional A percent discount in basis points (1000 = 10%), 0 to 10000
  • taxRateBp number optional Sales tax in basis points (825 = 8.25%), 0 to 10000, charged on the subtotal after the discount
  • customerName string optional 200 characters at most
  • customerEmail string optional Where invoice:send mails the document; without one it is sent by link only
  • actorId string optional The CRM contact this is for; attributed only when the caller controls that contact's group (contact_not_found / contact_not_yours)
  • dueDays number optional Invoice: days from now until due, 0 to 90; default 14
  • validDays number optional Estimate: days it can be accepted, 1 to 365; default 30
  • notes string optional Shown on the document; 1000 characters at most

Response

What comes back from the call.

  • ok boolean
  • id string inv_ or est_ plus 32 hex: the customer's bearer link; never sequential
  • number string INV-0001 or EST-0001, per workspace and kind
  • kind string
  • status string
  • totalCents number
  • subtotalCents number
  • discountCents number
  • taxCents number
  • dueAt string | null
  • validUntil string | null
  • url string The hosted page: <origin>/u/<workspace>/shop/invoice/<id>
  • testMode boolean true when the card takes Stripe TEST money (the store is not live yet)
  • lines object[]
  • error string sign_in_required · not_your_workspace · workspace_not_found · kind_invalid · currency_unsupported · price_not_found · price_recurring_unsupported · no_lines · too_many_lines · line_description_missing · line_not_integer · line_out_of_range · discount_conflict · discount_out_of_range · discount_exceeds_subtotal · tax_rate_out_of_range · total_too_small · total_too_large · customer_email_invalid · text_too_long · contact_not_found · contact_not_yours · store_unavailable · no_db

Traffic

Every call to invoice:create, 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 invoice:create, 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:248
CLI 2
  • packages/cli/src/invoice.ts:134
  • packages/cli/src/lib/money-receivers.ts:50
→

Answered by

invoice:create one.ie/web/src/lib/resolvers/customer-invoice.ts:310 Dispatched through POST /api/ask/invoice:create, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "description": "The workspace the document belongs to; defaults to the attested caller's own. The caller must control it (refused not_your_workspace)",
      "type": "string"
    },
    "kind": {
      "description": "Default invoice",
      "type": "string",
      "enum": [
        "estimate",
        "invoice"
      ]
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ppid": {
            "description": "A catalogue price in THIS workspace (products:*); its name and unit price fill the line. Another workspace's price is refused price_not_found",
            "type": "string"
          },
          "description": {
            "description": "The line text; required without a ppid, 200 characters at most",
            "type": "string"
          },
          "quantity": {
            "description": "Whole units, 1 to 10000; default 1",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unitCents": {
            "description": "Integer US cents per unit; required without a ppid, overrides the catalogue price with one",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        }
      },
      "description": "1 to 50 lines. A float price or quantity is refused line_not_integer, never rounded"
    },
    "discountCents": {
      "description": "A flat discount in cents, off the subtotal. Not with discountBp (discount_conflict)",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "discountBp": {
      "description": "A percent discount in basis points (1000 = 10%), 0 to 10000",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "taxRateBp": {
      "description": "Sales tax in basis points (825 = 8.25%), 0 to 10000, charged on the subtotal after the discount",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "customerName": {
      "description": "200 characters at most",
      "type": "string"
    },
    "customerEmail": {
      "description": "Where invoice:send mails the document; without one it is sent by link only",
      "type": "string"
    },
    "actorId": {
      "description": "The CRM contact this is for; attributed only when the caller controls that contact's group (contact_not_found / contact_not_yours)",
      "type": "string"
    },
    "dueDays": {
      "description": "Invoice: days from now until due, 0 to 90; default 14",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "validDays": {
      "description": "Estimate: days it can be accepted, 1 to 365; default 30",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "notes": {
      "description": "Shown on the document; 1000 characters at most",
      "type": "string"
    }
  },
  "required": [
    "lines"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "id": {
      "description": "inv_ or est_ plus 32 hex: the customer's bearer link; never sequential",
      "type": "string"
    },
    "number": {
      "description": "INV-0001 or EST-0001, per workspace and kind",
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "totalCents": {
      "type": "number"
    },
    "subtotalCents": {
      "type": "number"
    },
    "discountCents": {
      "type": "number"
    },
    "taxCents": {
      "type": "number"
    },
    "dueAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "validUntil": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "description": "The hosted page: <origin>/u/<workspace>/shop/invoice/<id>",
      "type": "string"
    },
    "testMode": {
      "description": "true when the card takes Stripe TEST money (the store is not live yet)",
      "type": "boolean"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitCents": {
            "type": "number"
          },
          "ppid": {
            "type": "string"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitCents"
        ]
      }
    },
    "error": {
      "description": "sign_in_required · not_your_workspace · workspace_not_found · kind_invalid · currency_unsupported · price_not_found · price_recurring_unsupported · no_lines · too_many_lines · line_description_missing · line_not_integer · line_out_of_range · discount_conflict · discount_out_of_range · discount_exceeds_subtotal · tax_rate_out_of_range · total_too_small · total_too_large · customer_email_invalid · text_too_long · contact_not_found · contact_not_yours · store_unavailable · no_db",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}