Skip to content

multicall

Runs up to twenty of the tools above in one request, in the order given. Every tool name is validated before anything executes, so a typo in the last call cannot leave the first four already published. Calls run sequentially, which is what lets a later call use what an earlier one produced — generate an image, then attach it. Batches cannot nest.

Access
write
Category
Batching
Endpoint
POST/api/tools/multicall
On this page
  1. Parameters
  2. Example request
  3. Response

Parameters

calls
array<object>required
The calls to run, in order. Between 1 and 20.
tool
stringrequired
Name of the tool to run, e.g. create_post.
arguments
object
Arguments for that tool, exactly as if called on its own.
id
string
Label echoed back on this call’s result, for matching results to calls.
stopOnError
boolean
Stop at the first failing call and skip the rest. Set false to attempt every call — right for independent work, wrong when a later call depends on an earlier one.default: true
workspaceId
string
Workspace to act on, from list_workspaces. Omit to use the default workspace on the key.

Example request

curl -X POST "https://api.postmcpai.com/api/tools/multicall" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $POSTMCPAI_API_KEY" \
  -d '{
    "calls": [
      {
        "id": "img",
        "tool": "generate_image",
        "arguments": {
          "prompt": "Minimal product shot on a dark background"
        }
      },
      {
        "id": "post",
        "tool": "create_post",
        "arguments": {
          "content": "Shipping today. 🚀",
          "targetAccounts": [
            {
              "platform": "linkedin",
              "profileId": "lin_7741903"
            }
          ],
          "scheduleDate": "2026-09-01",
          "scheduleTime": "10:00",
          "timezone": "Asia/Kolkata"
        }
      }
    ],
    "stopOnError": true
  }'

Response

One entry per call, in order, each carrying that call’s own result or error, plus counts and any calls skipped after a failure.

200 · application/json
{
  "ok": true,
  "requested": 2,
  "executed": 2,
  "succeeded": 2,
  "failed": 0,
  "results": [
    {
      "id": "img",
      "tool": "generate_image",
      "ok": true,
      "result": {
        "mediaUrl": "https://cdn.postmcpai.com/generated/6c19f2a4.png"
      }
    },
    {
      "id": "post",
      "tool": "create_post",
      "ok": true,
      "result": {
        "message": "1 post created successfully",
        "postIds": [
          "66a50c89e4b019a2b72f"
        ]
      }
    }
  ]
}