- For: treasurers
- You get: a transfer between two of your own accounts recorded in Scoutworks, both sides at once, from a sheet row or a shortcut on your phone
- Time: about fifteen minutes
- Scopes:
accounting:readandaccounting:write
1. Create a key and find your accounts
A group admin creates a key in Settings → Integrations → API keys withaccounting:read and accounting:write. A transfer the key records shows that admin as the person who added it, and Scoutworks marks it as added by the key.
List your accounts to find their ids. Try it on the demo group first:
https://api.scoutworks.app/api/v1/bank-accounts and copy the id of each account you move money between.
2. Lay out the sheet
Make a tab called Transfers. Row 1 holds headings. From row 2, one transfer a row:
Format column A as Format → Number → Plain text before you type, so a date is always read as day, month, year.
3. Add the script
Choose Extensions → Apps Script. Delete what is there, paste the script below and choose Save. Then add a script propertySCOUTWORKS_API_KEY with your key, in Project Settings → Script Properties.
Code.gs
4. Try it on one transfer
1
Add one made-up transfer
One row: today’s date, your two account ids,
0.01, and TEST from the Scoutworks recipe.2
Run it
Choose recordTransfers and press Run. The first time, Google asks you to allow the script to reach an outside service. Column F gets an id that starts
transfer_.3
Check it in Scoutworks
Open Finance → Transactions. The test shows twice: 1p out of the first account and 1p into the second, both marked as a transfer.
4
Undo it
Delete the transfer in Scoutworks, which deletes both sides, or send
DELETE /transfers/{id} with the id from column F. Then delete the test row.5. Run it
Add a row for each transfer and choose Run. A row that already has an id is skipped, so you can keep one running list.From your phone
An iPhone Shortcut can record a transfer while you are still in the banking app. Make a shortcut with Ask for Input (a number: the amount), then Get Contents of URL:- URL:
https://api.scoutworks.app/api/v1/transfers - Method:
POST - Headers:
Authorization=Bearerand your key;Idempotency-Key= the Current Date formatted asyyyyMMddHHmmand the amount, so pressing it twice in the same minute records one transfer. - Request Body: JSON, with
fromBankAccountIdandtoBankAccountIdtyped in once,amountfrom the input (with two decimal places, for example500.00),dateas Current Date formattedyyyy-MM-dd, anddescription.
Changing or deleting one
PATCH /transfers/{id} changes the amount, dates, description or reference of both sides together, and DELETE /transfers/{id} deletes both. Each works only on a transfer the API recorded, whose sides are not yet matched to a bank statement: anything else answers 409 source_locked, so change it in Scoutworks. Send the ETag you last read as If-Match; if the transfer changed since, the answer is 412 stale_write and nothing changes.
If something goes wrong
400 invalid_request: usually an account id that is wrong, closed or not your group’s, or the same account twice. The message says which.409 period_closed: the date is in an accounting year that is closed.403 insufficient_scope: the key needsaccounting:readandaccounting:write.- The arriving side has a different date on its statement: send
destinationDatetoo, up to 7 days afterdate.