SpartivoDocs
Open app
Get started
OverviewQuickstartAuthenticationRequests and errors
API reference
RecordsModules and fieldsFilesMessagingDocuments and e-signatureFunctionsWebhooks
Spartivo Script
IntroductionLanguage guideCRM and actionsBuilt-in functionsExamples
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}/execute

Runs a function and returns what it returned, plus anything it wrote with info.

Path parameters
apiNamestringrequired
The function's API name, shown in its settings. The function id also works.
Body
recordIduuid
The record to run on. It becomes the record variable.
argsobject
Values for the function's parameters. Available as input and as variables named after each parameter.
  • The HTTP status is 200 even when the code stops with an error. Check ok: when it is false, error holds the message and line the 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"
}

List functions

GET/functions

Every function with its settings and the result of its last run.

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
    }
  }
]
Previous← Documents and e-signatureNextWebhooks →
On this page
POSTRun a functionGETList functions