Skip to content

Cost

A Cost is an Entry against a cost account that an Action causes, posted to the Startup the Action ran in.

Properties

PropertyTypeRequiredDescription
actionActionrequiredThe Action that caused it.
startupStartuprequiredThe Startup it is posted to.
kindstringrequiredOne of model, upstream, human, platform or shared.
allocationtextFor shared Cost, the stated rule that splits it across Startups.
attemptintegerWhich outside attempt this Cost paid for when one call tried several upstreams in rank.
overrunmoneyHow far the settled amount exceeded the Action’s reservation; an overrun past a Limit opens an Approval.
Inherited from Entry: 4 properties
PropertyTypeRequiredDescription
accountstringrequiredThe code of the account in the chart of accounts, such as revenue or cash.
amountmoneyrequiredThe amount and currency.
directionstringrequiredOne of debit or credit.
counterpartyStartupThe sibling Startup on the other side of an intercompany Entry; empty for outside parties.

Object

JSON
{
  "$id": "https://api.sb/patentpad.com/costs/cost_1",
  "$type": "Cost",
  "account": "cash",
  "amount": {
    "amount": 499,
    "currency": "USD"
  },
  "direction": "debit",
  "counterparty": "startup_1",
  "action": "action_1",
  "startup": "startup_1",
  "kind": "model",
  "allocation": "Split by each Startup’s share of API calls",
  "attempt": 1,
  "overrun": {
    "amount": 499,
    "currency": "USD"
  }
}

Relationships

  • A Cost is posted by one Action: every Cost an Action causes posts to the Startup it ran in, so each Startup’s P&L is complete. postedBy, inverse posts.

Verbs

  1. getReturns one Cost by id.
    GET /{namespace}/costs/{id}readNo Event
  2. listReturns Costs, newest first, one page at a time.
    GET /{namespace}/costsreadNo Event

A Cost is kept forever and never edited: it has no update or delete.

Permissions

Which Access level may call each Verb. One-way Verbs wait their delay window.

Operationowneradminmemberviewer
Cost.getYesYesYesYes
Cost.listYesYesYesYes

Call it

Text
Show me the latest cost.

Example

A permit-status API pays $0.40 for each county records request. Each one is a Cost on the lookup Action, so the margin on a $1 lookup reads $0.60.