API reference
Functions
Run a function written in Spartivo Script from your own system. This is the simplest way to give an integration one custom action without learning the whole API.
Run a function
POST
/functions/{apiName}/executeRuns a function and returns what it returned, plus anything it wrote with info.
Path parameters
apiNamestringrequiredThe function's API name, shown in its settings. The function id also works.
Body
recordIduuidThe record to run on. It becomes the
record variable.argsobjectValues for the function's parameters. Available as
input and as variables named after each parameter.- The HTTP status is
200even when the code stops with an error. Checkok: when it isfalse,errorholds the message andlinethe line number. - A function that is switched off returns
ok: false.
Request
curl -X POST "https://api.spartivo.com/api/v1/functions/flag_key_deal/execute" \
-H "Authorization: Bearer wk_your_key" \
-H "Content-Type: application/json" \
-d '{"recordId":"a0d3bf2c-688d-42da-83e1-d5e57d3e990d","args":{"bump":true}}'Response
{
"ok": true,
"result": "checked",
"logs": [
"Deal Northwind renewal amount 180000"
],
"steps": 14,
"ms": 62,
"name": "Flag key deal"
}A run that failed
{
"ok": false,
"error": "cannot divide by zero",
"line": 7,
"logs": [],
"steps": 9,
"ms": 3,
"name": "Flag key deal"
}Request
curl "https://api.spartivo.com/api/v1/functions" \
-H "Authorization: Bearer wk_your_key"Response
[
{
"id": "ae9b3b03-30fd-4b83-a00a-8c65347a19ea",
"name": "Flag key deal",
"active": true,
"updatedAt": "2026-11-17T10:17:25.349Z",
"config": {
"apiName": "flag_key_deal",
"description": "Tags large deals and creates a review task",
"params": [
"bump"
],
"schedule": {
"every": "none",
"hour": 6,
"weekday": 1
},
"code": "…"
},
"lastRun": {
"at": "2026-11-17T10:17:25.346Z",
"ok": true
}
}
]