Skip to content

Clock and jobs

See The simulated clock for how time works.

Each call answers with the clock’s state, {now, speed, frozen, real}, except advance.

CallBodyWhat it does
GET /api/clockReads the clock.
POST /api/clock/speed{"factor": 60}Runs time at that multiple of real time. 0 freezes it. Must be 0 or more.
POST /api/clock/freezeStops time.
POST /api/clock/advance{"duration": "2h"}Moves time forward and runs everything due on the way.
POST /api/clock/liveBack to real time, at 1×.

advance answers with {"clock": {…}, "jobs_run": 4}. duration is a string more than zero, such as "90m", "2h" or "3d".

Terminal window
curl -s -X POST https://c1.simmail.dev/api/clock/advance \
-H "Authorization: Bearer smk_your_key" \
-H "Content-Type: application/json" \
-d '{"duration": "3d"}'

A job is something planned for later: a reply, a follow-up, an out-of-office answer, a bounce notice, a promised email, a nudge, a new thread, or the next email from an inbound stream. In the dashboard, they are under Activity.

ParameterDefaultMeaning
stateallpending, done, skipped or failed.
personaOnly this person’s jobs: an id or an address.
kindOnly jobs of this kind (see kind below).
due_beforeOnly jobs due by then: an RFC 3339 time, or a duration from the simulated now such as 2h.
limit200How many.

An unknown kind answers 400 with the code invalid_value and the allowed kinds; an unknown persona answers 404.

{
"now": "2026-10-10T14:00:00Z",
"jobs": [
{
"id": 128,
"state": "pending",
"due": "2026-10-10T15:12:00Z",
"created": "2026-10-10T14:00:00Z",
"kind": "reply",
"persona_id": "p_3fa2b1c9d0",
"persona": "Dana Reyes",
"case_id": "deal-1701",
"to": ["[email protected]"],
"plan": "skeptical, reply reply after ~1h12m0s",
"inbound": { "subject": "Your house on Clark Street", "from": "[email protected]", "text": "…" }
}
]
}
FieldMeaning
kindreply, followup, correction, ooo (an out-of-office answer), bounce, dsn (a bounce notice), initiate (a case’s first contact), deliver (mail that was delayed), nudge (a reminder about a promise), world (mail from an inbound stream) or visit (a visit to a link or website).
planWhy it was planned, in words.
noteAfter it ran: what happened, such as “sent reply to [email protected] (ai)” or “decided not to reply (ai)”.
inboundThe email it answers, with its text cut short.
due, ranWhen it is due and when it ran, in simulated time.
CallWhat it does
POST /api/jobs/{id}/run-nowRuns it now.
POST /api/jobs/{id}/skipSkips it.
POST /api/jobs/{id}/bounceTurns a planned reply into a bounce and runs it now.
PATCH /api/jobs/{id}Reschedules it: {"due": "2026-10-11T09:00:00Z"} or {"in": "10m"} from now.

A job that is not pending answers 400 “job 128 is done”.

Runs every matching pending job now, due or not, in due order, as run-now would: the way to speed up a reply in a test instead of waiting for the simulated clock. Jobs they create, such as a follow-up to a reply, wait for their own time. Needs the member role.

Body fieldMeaning
personaOnly this person’s jobs: an id or an address.
kindOnly jobs of this kind, such as reply.
beforeOnly jobs due by then: an RFC 3339 time, or a duration from the simulated now such as 2h.
limitAt most this many (default and most 200).
Terminal window
curl -s -X POST https://c1.simmail.dev/api/jobs/run-due \
-H "Authorization: Bearer smk_your_key" -H "Content-Type: application/json" \
-d '{"persona": "[email protected]", "kind": "reply"}'
{
"ran": [
{ "id": 128, "kind": "reply", "persona": "Dana Reyes", "state": "done", "note": "sent reply to [email protected] (ai)" }
],
"count": 1,
"remaining": 0
}

remaining is how many more matched beyond limit.

JavaScript
await mail.runDue({ persona: "[email protected]", kind: JobKind.Reply });
const queue = await mail.jobs.list({ persona: "[email protected]", state: JobState.Pending });
Python
mail.run_due(persona="[email protected]", kind=JobKind.REPLY)
queue = mail.jobs.list(persona="[email protected]", state=JobState.PENDING)