Cost
A Cost is an Entry against a cost account that an Action causes, posted to the Startup the Action ran in.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
action | Action | required | The Action that caused it. |
startup | Startup | required | The Startup it is posted to. |
kind | string | required | One of model, upstream, human, platform or shared. |
allocation | text | For shared Cost, the stated rule that splits it across Startups. | |
attempt | integer | Which outside attempt this Cost paid for when one call tried several upstreams in rank. | |
overrun | money | How far the settled amount exceeded the Action’s reservation; an overrun past a Limit opens an Approval. |
Inherited from Entry: 4 properties
| Property | Type | Required | Description |
|---|---|---|---|
account | string | required | The code of the account in the chart of accounts, such as revenue or cash. |
amount | money | required | The amount and currency. |
direction | string | required | One of debit or credit. |
counterparty | Startup | The sibling Startup on the other side of an intercompany Entry; empty for outside parties. |
Object
{
"$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, inverseposts.
Verbs
getReturns one Cost by id.GET /{namespace}/costs/{id}listReturns Costs, newest first, one page at a time.GET /{namespace}/costs
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.
| Operation | owner | admin | member | viewer |
|---|---|---|---|---|
Cost.get | Yes | Yes | Yes | Yes |
Cost.list | Yes | Yes | Yes | Yes |
Call it
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.