Run a function

SDK platic.tools.functions.run()

Run the published version with input, as an agent would. The result is recorded as a manual execution.

Example

await platic.tools.functions.run("fn_123", { input: { rfc: "XAXX010101000" } });

Path parameters

ParameterTypeDescriptionRequired
functionIdstringFunction ID✓

Request body

{
  "input": { "taxId": "XAXX010101000" }
}
FieldTypeDescriptionRequired
inputobjectInput that meets the published version's input schema. Up to 256 KB—

Do not send secrets: the execution uses the secrets bound to the function and answers 400 if the body has them.

Response

It has the same fields as Test a function. version is the published version's number. An execution that fails inside the code is also a 200, with ok: false and error.

{
  "status": "success",
  "data": {
    "ok": true,
    "output": { "found": true, "name": "EXAMPLE COMPANY INC" },
    "durationMs": 412,
    "logs": ["info response {\"status\":200}"],
    "httpCalls": [
      { "method": "POST", "host": "api.example.com", "status": 200, "durationMs": 380 }
    ],
    "runId": "run_8d1f",
    "version": 1,
    "nextStep": "It ran. The run is in the function's runs."
  }
}

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe body fails validation or has secrets. details.issues has the list of problems
403FORBIDDEN or INSUFFICIENT_SCOPEThe credential does not have write access to Integrations
404NOT_FOUNDThe function does not exist in this workspace
409NOT_PUBLISHEDThe function does not have a published version yet
409PAUSEDThe function is paused
429LIMIT_REACHEDThe call limit was exceeded: 60 per minute per function, 5,000 per day or 50,000 per month per workspace. details.resetAt says when it frees up

Notes

  • It counts against the same call quota agents use.
  • The execution stays in the executions with trigger: "manual".
  • An unbound secret answers ok: false with SECRET_MISSING. Bind it with Bind a secret.