API Reference

Gardener Tasks API

Ask a gardener for work at a fixed price you see first. All endpoints require a valid Bearer token and realm membership.


A gardener task is work you ask a gardener for, such as regenerating a summary. Each task has a fixed price, paid in coins, that you see before anything runs.

1

List

Read the available gardener tasks and their price tiers.

2

Quote

Price the tasks you want. Show the price to the person paying before going on.

3

Run

Send each approved quote back with its quote token. The tasks start in the background.

4

Check

Look up a single task or the whole batch until it has finished.

The list of gardener tasks grows over time. Read List Gardener Tasks instead of hard-coding task types or prices.


You pay only for success

The API token's user pays the quoted price, and only when the task succeeds. A failed task charges nothing.

Quotes last 30 minutes and run once

Running a quote again returns the original task instead of starting a new one.

Send the quoted request back

A run item repeats the quoted type, target, and input along with the quote token.

Bigger input gets a new quote

If the input grew into a bigger price tier since the quote, the run is refused and you get a new quote to approve.

Up to 10 tasks per call

Quote and run requests take 1 to 10 tasks. Each task gets its own result, and one failing task never stops the others.

Permission is checked at quote time

A task you are not allowed to ask for is refused when you quote it, with a readable message.

Quote tokens stay in request bodies

Never put a quote token in a URL or query string.


GET /api/v1/realms/:realmId/gardener/types

Returns the gardener tasks you can ask for, with the input each one takes and its price tiers. A task's price is the tier its input size falls in.

Path Parameters

ParameterTypeDescription
realmId*stringThe realm ID.

Gardener Task Type

ParameterTypeDescription
type*stringThe task type to send when quoting and running.
name*stringA readable name for the task.
targetKind*stringWhat the task works on: realm, session, scene, entity, or note.
inputSchema*objectA JSON Schema describing the input the task takes.
tiers*Tier[]The price tiers, smallest first.

Tier

ParameterTypeDescription
key*stringTier identifier.
label*stringReadable tier name.
upTo*number | nullThe largest input size this tier covers, or null for no upper limit.
coins*numberThe fixed price of this tier, in coins.
curl https://realmsofshod.com/api/v1/realms/clxyz.../gardener/types \
  -H "Authorization: Bearer ros_your_token_here"
{
  "data": [
    {
      "type": "regenerate-session-summary",
      "name": "Regenerate session summary",
      "targetKind": "session",
      "inputSchema": { "type": "object", "properties": {} },
      "tiers": [
        { "key": "small", "label": "small", "upTo": 7200000, "coins": 10 },
        { "key": "large", "label": "large", "upTo": null, "coins": 15 }
      ]
    }
  ]
}

POST /api/v1/realms/:realmId/gardener/quotes

Prices 1 to 10 tasks without running them or charging anything. Results come back in request order, one per task: either ok: true with a quote, or ok: false with an error. The response is 200 even when every task is refused.

Path Parameters

ParameterTypeDescription
realmId*stringThe realm ID.

Request Body: tasks[]

ParameterTypeDescription
type*stringA task type from List Gardener Tasks.
target*{ kind, id }What the task works on. kind must match the task's targetKind.
inputobjectMatches the task's inputSchema. Defaults to an empty object.

Quote

ParameterTypeDescription
quoteToken*stringSigned token to send back when running the task.
quoteId*stringUnique quote identifier.
type*stringThe quoted task type.
target*{ kind, id }The quoted target.
tier*stringKey of the price tier the input falls in.
tierLabel*stringReadable name of that tier.
coins*numberThe price, in coins.
reason*stringWhy the task got this price, in plain words.
expiresAt*integerUnix timestamp (ms) when the quote expires.
curl -X POST https://realmsofshod.com/api/v1/realms/clxyz.../gardener/quotes \
  -H "Authorization: Bearer ros_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "tasks": [
      {
        "type": "regenerate-session-summary",
        "target": { "kind": "session", "id": "ses_abc..." },
        "input": {}
      }
    ]
  }'
{
  "quotes": [
    {
      "ok": true,
      "quote": {
        "quoteToken": "eyJxdW90ZUlkIjoi...",
        "quoteId": "qte_abc...",
        "type": "regenerate-session-summary",
        "target": { "kind": "session", "id": "ses_abc..." },
        "tier": "large",
        "tierLabel": "large",
        "coins": 15,
        "reason": "4 hours of transcript, large tier",
        "expiresAt": 1716001800000
      }
    }
  ]
}

POST /api/v1/realms/:realmId/gardener/runs

Runs 1 to 10 quoted tasks. The tasks start in the background, and the response comes back straight away with one outcome per task, in request order. batchId groups every task this request started, or is null when nothing new started.

Path Parameters

ParameterTypeDescription
realmId*stringThe realm ID.

Request Body: tasks[]

ParameterTypeDescription
type*stringA task type from List Gardener Tasks.
target*{ kind, id }What the task works on. kind must match the task's targetKind.
inputobjectMatches the task's inputSchema. Defaults to an empty object.
quoteToken*stringThe quoteToken from the quote you are running.

Run Outcomes

TypeDescription
startedA new task is queued. Check it with Get Gardener Task or Get Gardener Batch.
duplicateThis quote already ran. You get the original task back, and nothing runs or is charged twice.
requoteThe input grew into a bigger price tier since the quote. Nothing ran. Show the new quote and run it if approved.
errorThe task could not start. See error.code and error.message.
curl -X POST https://realmsofshod.com/api/v1/realms/clxyz.../gardener/runs \
  -H "Authorization: Bearer ros_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "tasks": [
      {
        "type": "regenerate-session-summary",
        "target": { "kind": "session", "id": "ses_abc..." },
        "input": {},
        "quoteToken": "eyJxdW90ZUlkIjoi..."
      }
    ]
  }'
{
  "batchId": "bat_abc...",
  "tasks": [
    {
      "outcome": "started",
      "task": {
        "id": "gtk_abc...",
        "type": "regenerate-session-summary",
        "status": "queued",
        "result": null,
        "coinsCharged": 0,
        "error": null,
        "createdAt": 1716000000000,
        "finishedAt": null
      }
    }
  ]
}

GET /api/v1/realms/:realmId/gardener/tasks/:taskId

Returns one gardener task you ran in this realm. Returns 404 for a task that belongs to someone else or to another realm.

Path Parameters

ParameterTypeDescription
realmId*stringThe realm ID.
taskId*stringThe gardener task ID returned by Run Gardener Tasks.

Gardener Task

ParameterTypeDescription
id*stringUnique gardener task identifier.
type*stringThe task type.
status*stringqueued, running, succeeded, or failed.
result*unknownWhat the task produced once it succeeds, or null. Its shape depends on the task type.
coinsCharged*numberCoins charged so far. Stays 0 unless the task succeeds.
error*string | nullA readable explanation when the task failed, or null.
createdAt*integerUnix timestamp (ms) when the task was started.
finishedAt*integer | nullUnix timestamp (ms) when the task finished, or null.
curl https://realmsofshod.com/api/v1/realms/clxyz.../gardener/tasks/gtk_abc... \
  -H "Authorization: Bearer ros_your_token_here"
{
  "id": "gtk_abc...",
  "type": "regenerate-session-summary",
  "status": "succeeded",
  "result": {},
  "coinsCharged": 15,
  "error": null,
  "createdAt": 1716000000000,
  "finishedAt": 1716000030000
}

GET /api/v1/realms/:realmId/gardener/batches/:batchId

Returns every task started by one run request. Returns 404 for a batch that belongs to someone else or to another realm.

Path Parameters

ParameterTypeDescription
realmId*stringThe realm ID.
batchId*stringThe batch ID returned by Run Gardener Tasks.

Response

ParameterTypeDescription
id*stringThe batch ID.
finished*booleanTrue once every task in the batch succeeded or failed.
coinsCharged*numberTotal coins charged across the batch so far.
tasks*GardenerTask[]Every task started by the run request.
curl https://realmsofshod.com/api/v1/realms/clxyz.../gardener/batches/bat_abc... \
  -H "Authorization: Bearer ros_your_token_here"
{
  "id": "bat_abc...",
  "finished": true,
  "coinsCharged": 15,
  "tasks": [
    {
      "id": "gtk_abc...",
      "type": "regenerate-session-summary",
      "status": "succeeded",
      "result": {},
      "coinsCharged": 15,
      "error": null,
      "createdAt": 1716000000000,
      "finishedAt": 1716000030000
    },
    {
      "id": "gtk_def...",
      "type": "regenerate-session-summary",
      "status": "failed",
      "result": null,
      "coinsCharged": 0,
      "error": "The gardener couldn't finish this task. You weren't charged.",
      "createdAt": 1716000000000,
      "finishedAt": 1716000020000
    }
  ]
}

A problem with a single task comes back in that task's slot as { code, message }. The message is written so you can show it to the person as is. Bad JSON or a malformed body returns 400 for the whole request, and every endpoint returns 404 if you are not a member of the realm.

Error Codes

TypeDescription
BAD_REQUESTUnknown task type, wrong target kind, invalid input, or a quote that is expired, invalid, or from an older price list.
ACCESS_DENIEDYou are not allowed to ask for this task, or the quote belongs to someone else.
NOT_FOUNDThe target does not exist or is not visible to you.
NO_COINSYou do not have enough coins for this task.
GONEThe target has been removed.

Join us and connect for poems, content, updates, direct questions, community discussion, and more.

© 2026 Realms of Shod. All rights reserved.