Quickstart
The sandbox runs with synthetic organizations and lets you sign in as any of their people without single sign-on, so you can try the API in minutes. Production instances accept only single sign-on.
In the examples, $SPEND is the instance’s address, such as https://app.s2p.productexec.co or http://localhost:8787 for a local copy.
1. Find a sandbox user
Section titled “1. Find a sandbox user”curl -s $SPEND/api/demo/users | jq '.tenants[] | {tenantId, name}'curl -s $SPEND/api/demo/users | jq '.users[] | select(.tenantId=="ten_demo_utility") | {id, name, roles}'2. Start a session
Section titled “2. Start a session”TOKEN=$(curl -s -X POST $SPEND/api/session \ -H 'content-type: application/json' \ -d '{"tenantId":"ten_demo_utility","userId":"<a user id from step 1>"}' | jq -r .token)The response is {"token": "...", "expiresInMinutes": 480}. Send the token as a bearer token on every call.
3. Read your work
Section titled “3. Read your work”curl -s $SPEND/api/me -H "authorization: Bearer $TOKEN" | jqcurl -s "$SPEND/api/invoices?status=exception&pageSize=5" -H "authorization: Bearer $TOKEN" | jq '.invoices[] | {number, supplierName, status, exceptions}'4. Upload a document
Section titled “4. Upload a document”curl -s -X POST $SPEND/api/documents \ -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \ -d "{\"filename\":\"invoice.pdf\",\"contentBase64\":\"$(base64 < invoice.pdf | tr -d '\n')\"}" | jqEach document comes back with what capture made of it and, for an invoice, the invoice id and status.
5. Sign out
Section titled “5. Sign out”curl -s -X POST $SPEND/api/session/logout -H "authorization: Bearer $TOKEN"Run it yourself
Section titled “Run it yourself”Agencies that run Spend in their own cloud account get the container image (or the source) and run it the same way locally, with Docker providing Postgres and S3-compatible storage:
pnpm installpnpm db:upcp .env.example .envpnpm start # http://localhost:8787, with the sandbox organizationsSee Install and configure for a hosted instance.