Quick start
1
Copy a template
Copy the YAML from Run manually below. It works without resource IDs or input.
2
Paste it into Cloud
Open Routines → New routine, enter a Name, and choose Create routine. Open that routine’s Steps → Document → Edit, choose YAML, and replace the text with your template. For an existing routine, this replaces its configuration.
3
Check and save
Choose Check, fix any listed issues, then Save. A check does not run the steps. Use Test run before enabling recurring work. Prefer code? Save the JSON as
routine.json and use the create call.Copy a template
The first four templates need no resource IDs. Each YAML/JSON pair is identical. Document creation starts disabled; saving over an existing routine preserves its enabled state.Run manually
No placeholders or input required. Create it, then use Run now to save a short note.Schedule with cron
Runs daily at 09:00 in Amsterdam. Check a real run before enabling it.Schedule once
Runs once at the UTC time shown. Choose a future time before enabling it.Custom trigger via API
Accepts a text input. After creation, use the returned flow’striggerId in the custom fire call, with payload: { text: "My note" }.
Serverless Function
Replace11111111-1111-4111-8111-111111111111 (FUNCTION_ID) with your ready Serverless Function. This template assumes it accepts an empty input object; adapt input to its manifest.
Agent task
Replace22222222-2222-4222-8222-222222222222 (DEVICE_ID) with a device you own. A real run uses device minutes and AI credits.
View, copy, download, and edit in Cloud
1
Open the document
Open Routines, select a routine, then Steps → Document. YAML appears first; choose JSON to switch formats. Copy copies the displayed text; Download saves it as a file.
2
Edit and check
Choose Edit, select YAML or JSON, and change the text. Check validates without saving or executing. A successful check shows The document is valid. Errors identify the field and what to fix.
3
Save the whole document
Save replaces the routine’s document configuration and returns to reading. Discard changes abandons edits. If the routine changed elsewhere, use Reload and discard my edits before trying again. If the format cannot represent the routine, choose Edit in Builder.
Through the API or SDK
Use your API key. These examples use the typed HTTP methods in@mobilerun/sdk and mobilerun-sdk 6.3.0. Save a template’s JSON as routine.json; for YAML, parse it with a YAML 1.2 parser and send the resulting JSON object. All write bodies wrap it as { "document": ... }.
Export
GET /v1/flows/{flowId}/document returns the canonical document in data, including defaults, settings, and scheduled inputs.
Validate
POST /v1/flows/document/validate checks without writing or running. A 200 response can have data.valid: false: inspect errors and warnings. Errors contain code, field (a JSON Pointer), message, and repair hints. An empty pointer means the document root.
Create from a document
POST /v1/flows/document creates the trigger, steps, and disabled routine together. The 201 response contains data.flow and data.document. Reuse the same optional idempotency key and unchanged document when retrying creation. Check a real verification run before activation.
Replace
PUT /v1/flows/{flowId}/document atomically replaces the whole document, not a patch. Enabled state is preserved. Omitted description, devices, and trigger options clear those values. Omitted settings preserves stored settings; a supplied settings object replaces them, defaulting omitted fields. A successful response contains data.flow and data.document.
Editor setup
The schema URL ishttps://api.mobilerun.ai/v1/flows/document-schema. It returns raw JSON Schema 2020-12, without a data envelope. Fetching it requires an API key, including from an editor. If your editor cannot attach an authorization header, download it once:
$schema, use "$schema": "./routine-schema.json" while editing. For YAML Language Server (including the VS Code YAML extension), add:
$schema to the API URL shown in the templates, or remove the property: the backend accepts only that URL. The YAML comment is editor-only and does not enter the JSON request. Refresh the downloaded schema when available steps change.
For agent authoring, download https://api.mobilerun.ai/v1/flows/document-schema?profile=agent_routine instead. It lists only agent-eligible steps; it is guidance, and backend validation remains authoritative. Step branches specify uses, with, and x-mobilerun-output. Do not invent step names.
Field reference
Document-owned objects reject unknown fields. A step’swith follows the selected step’s parameter schema.
Read inputs with
{{event.payload.text}} and earlier results with {{steps.save.body.fileId}}. A whole template preserves its JSON type; interpolation in a longer string produces text. These are paths, not general expressions.
Common errors
Limits and gotchas
- Use YAML 1.2. A YAML 1.1 parser may read the key
onas booleantrue. JSON is the API wire format; non-finite YAML numbers cannot be sent. - Check validates configuration; it does not execute steps or prove a live result.
- Document v1 is an authoring format, not a backup of every flow setting. Unsupported behavior, including loops, child steps, and continue-on-error, cannot be exported or replaced through it.
- When replacing settings, include every setting you want to keep.
settings: {}restores defaults; omittingsettingspreserves them.