Concepts
Simulations
A simulation is a hosted, stateful copy of an API's behaviour: records in collections, a plan that changes them over time, and rules that bend individual responses.
Lifecycle
When you create a simulation, Slurry parses the spec, works out the data model, generates seed data and starts serving. A model is used for the analysis and seed data (this uses your plan's AI allowance); everything after that is deterministic engine work that never uses AI.
| Status | Meaning |
|---|---|
queued | Waiting for a worker. |
analysing | Reading the spec and building the data model. |
seeding | Generating and storing records. |
running | Serving requests and running the behaviour plan. |
paused | Requests return 503 and the schedule stops. Data is kept. |
failed | Set-up could not complete. The status detail says why. |
pending_review | Waiting for content review before going live. |
suspended | Stopped by abuse monitoring or an administrator, pending review. |
Collections
The data model groups records into collections - tasks, projects, users - each with an id style, a schema, field hints for realistic values and, where the API has one, a status field with its states and allowed transitions. Operations in the spec are bound to collections as list, get, create, update, delete or action.
- A
POSTto a create operation inserts a record; later lists and gets include it. - Request bodies are read as JSON or as forms. Form keys with brackets nest as Stripe sends them:
metadata[order]=42is{ "metadata": { "order": "42" } },expand[]=aanditems[0][price]=pare arrays. Keys deeper than 5 levels, indexes over 999,__proto__,constructororprototypesegments, clashes and pairs after the first 1,000 stay flat. - Nested paths such as
/projects/{project_gid}/tasksare scoped to their parent. - References between collections point at records that exist, so joins in your code behave.
- A collection given volume 0 at creation (
{ "volume": { "Invoices": 0 } }) is empty: no generated records, no history laid out by the ledger or world, and no records added by the scheduled rules (the live chat and issue refills of Teams and Jira can still add a few). YourseedRecordsstill load, and a ledger keeps its one organisation. - Operations that do not map to data return a schema-valid static response.
Vendor behaviour
Seeded records are generated, so they vary. What a client does follows the vendor's own rules, so the same calls give the same result every run.
Stripe PaymentIntents
/v1/payment_intents behaves as Stripe test mode. Failures come from Stripe's test payment methods, or from your rules and faults, never from chance.
- A create with
confirm=trueand a payment method endssucceeded, withamount_receivedequal toamount, orrequires_capturewithcapture_method=manual. Withoutconfirmit isrequires_confirmation, orrequires_payment_methodwhen none was given. /confirm,/canceland/capturemove the intent as Stripe does. Confirming an intent that is not waiting for it answers 400payment_intent_unexpected_state.pm_card_chargeDeclinedand its variants (InsufficientFunds,ExpiredCard,IncorrectCvcand the rest) answer 402card_declinedwith the matchingdecline_code. The intent is kept asrequires_payment_method.pm_card_authenticationRequiredgivesrequires_actionon session. Withoff_session=trueit answers 402authentication_required.- Settings you leave out take Stripe's defaults (
capture_methodisautomatic_async), never a generated value. Request-only parameters such asconfirmandoff_sessionare not stored on the intent.
Xero invoices and payments
In a Xero simulation, an invoice or bill you create is what you sent, with the sums Xero works out. Nothing on it is generated.
- Each line's
LineAmountisQuantityxUnitAmount, less anyDiscountRate(Quantityis kept to 4 decimal places andDiscountRateto 2, as in Xero; a line sent with aLineAmountand noUnitAmounthas its unit price worked back from it). ItsTaxAmountcomes from itsTaxType: Xero UK's rates for the system types (OUTPUT2andINPUT220%,RROUTPUTandRRINPUT5%, zero-rated, exempt andNONE0%), the simulation'sTaxRatesfor any other type, and 0 for a type neither names. LineAmountTypesisExclusiveunless you sendInclusiveorNoTax.SubTotal,TotalTaxandTotaladd up from the lines, andAmountDueis theTotal. A bill of one line at 1,550 withINPUT2totals 1,860.00 every time.- A new invoice has
AmountPaid0, no payments, credit notes or attachments,StatusDRAFTunless you sendSUBMITTEDorAUTHORISED, and the organisation's base currency unless you send one. A sales invoice sent with no number takes the nextINV-number. PUTorPOST /Payments, with{ "Payments": [{ "Invoice": { "InvoiceID": ... }, "Account": { "Code": ... }, "Date": ..., "Amount": ... }] }or a single payment, records each payment asAUTHORISED, with its account found byAccountIDorCode. The invoice'sAmountPaidrises andAmountDuefalls; at nothing due it isPAID, withFullyPaidOnDatethe payment date.- A payment to an invoice that is not found or not
AUTHORISED, with no amount or one aboveAmountDue, answers 400ValidationExceptionwith Xero's messages inElements[].ValidationErrors. Up to 50 payments a call, all or nothing: one refused and none is recorded. Payment calls to one simulation are served one at a time; past 50 waiting, the next answers 429 withRetry-After: 1andX-Rate-Limit-Problem: concurrent, as Xero's concurrent limit does.
The behaviour plan
The behaviour plan is what makes a simulation live. It is a declarative list of rules; each rule runs every everySeconds (never faster than your plan allows) and applies its steps. It is written once, by a model, when the simulation is created, then executed by the engine with no model calls per tick. You can read and replace it at any time.
| Step | What it does |
|---|---|
transition | Moves a fraction of matching records from one state to another, optionally weighted. |
create | Creates between min and max new records, with optional field overrides. |
update | Increments, decrements, touches or regenerates a field on a fraction of records. |
delete | Deletes a fraction of records, optionally filtered. |
{
"rules": [
{
"id": "progress-tasks",
"name": "Tasks move through the board",
"everySeconds": 900,
"enabled": true,
"steps": [
{
"kind": "transition",
"collection": "tasks",
"field": "status",
"from": ["todo", "in_progress"],
"to": ["in_progress", "in_review", "done"],
"weights": [0.5, 0.3, 0.2],
"fraction": 0.1,
"maxPerTick": 25,
"event": "task.updated"
},
{
"kind": "create",
"collection": "tasks",
"count": { "min": 0, "max": 3 },
"event": "task.created"
}
]
}
]
}from list that never includes a destination, such as confirmed to cancelled - holds at most half the collection in its destination states, so a small hourly fraction cannot empty a world over a few days. New records that copy an existing one never copy a record a one-way transition has already moved.Fast-forward
POST /v1/simulations/{id}/fast-forward with { "hours": 168 } runs each enabled rule as many times as it would have fired in that window (capped at 200 ticks per rule), then persists the net changes and queues webhooks. The maximum is 720 hours - 30 days - per call. The response tells you how many records changed.
Reset
POST /v1/simulations/{id}/reset regenerates the records from the original seed. Generation is seeded deterministically from the simulation, so a reset puts back the same records every time. Rules, behaviour edits and webhooks are kept. It runs in the background: the status goes to queued and back to running. To save and restore any other state, use snapshots.
Pause and resume
Pause a simulation to stop both traffic and schedule without losing data: POST /v1/simulations/{id}/pause and /resume.
Addresses
Each simulation is served at https://<slug>.slurry.io, and also in path mode at https://api.slurry.io/s/<slug>/.... Request and response headers, including Slurry-Session and Slurry-Force, are listed under Worlds.