Entry routes: post, settle
The Entry Verbs post, settle as api.sb routes, with inputs, result, refusals and an example.
Reference for Entry, one group of Entry routes.
Entry.post
Post records a manual Entry pair that no Verb caused, once a second Role approves it. Verb page.
POST /{namespace}/ entries/ postBody, as JSON: the inputs. Emits Entry.posted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
debit | string | required | The account code debited, such as expense.hosting. |
credit | string | required | The account code credited. |
amount | money | required | The amount and currency. |
memo | text | required | Why the Entry exists. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
entry | Entry | required | The debit Entry; its credit pair links to it. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ entries/ post \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"debit": "Example debit", "credit": "Example credit", "amount": {"amount": 29, "currency": "USD"}, "memo": "Example memo"}'{
"api": "https: //api.sb/ leaseline.app",
"entry": {
"$id": "https: //api.sb/ leaseline.app/ entries/ entry_syZbJCW683",
"$type": "Entry",
"account": "cash",
"amount": {
"amount": 29,
"currency": "USD"
},
"direction": "debit",
"startup": "startup_l3hr1EnUGY"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Entry.post",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Entry.settle
Settle nets a Period’s intercompany Entries between two Companies into one transfer through Stripe and reconciles both sides. Verb page.
POST /{namespace}/ entries/ settleBody, as JSON: the inputs. Emits Entry.settled.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
period | Period | required | The closed Period whose intercompany pairs settle. |
from | Company | required | The Company that owes the net amount. |
to | Company | required | The Company that receives it. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
transaction | Transaction | required | The one transfer that settles every pair. |
entry | Entry | required | The intercompany Entry, now settled. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ entries/ settle \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"period": "period_VEVuYACTsH", "from": "company_28zYNZEno0", "to": "company_28zYNZEno0"}'{
"api": "https: //api.sb/ leaseline.app",
"transaction": {
"$id": "https: //api.sb/ leaseline.app/ transactions/ txn_XoxtZe3CQI",
"$type": "Transaction",
"kind": "charge",
"amount": {
"amount": 29,
"currency": "USD"
}
},
"entry": {
"$id": "https: //api.sb/ leaseline.app/ entries/ entry_syZbJCW683",
"$type": "Entry",
"account": "cash",
"amount": {
"amount": 29,
"currency": "USD"
},
"direction": "debit",
"startup": "startup_l3hr1EnUGY"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Entry.settle",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}