SalesOS

Functions

Your TypeScript/JavaScript run in the SalesOS sandbox: versions, deploys, secrets, triggers, HTTP invoke

Limits, scopes, event types and starter code for the editor

GET
/v1/functions/meta

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

curl -X GET "https://api.salesos.org/v1/functions/meta" \
  -H "Authorization: Bearer <token>"

List functions

GET
/v1/functions

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

curl -X GET "https://api.salesos.org/v1/functions" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionViewArray

[
  {
    "id": "string",
    "organizationId": "string",
    "apiName": "string",
    "name": "string",
    "description": "string",
    "activeVersionId": "string",
    "envVars": null,
    "timeoutMs": 0,
    "memoryMb": 0,
    "allowedHosts": [
      "string"
    ],
    "runAsUserId": "string",
    "runAsAdmin": true,
    "scopes": [
      "string"
    ],
    "httpEnabled": true,
    "eventTypes": [
      "string"
    ],
    "schedule": "string",
    "lastScheduledAt": "2019-08-24T14:15:22Z",
    "isActive": true,
    "createdById": "string",
    "lastInvokedAt": "2019-08-24T14:15:22Z",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "activeVersion": 0,
    "nextRunAt": "2019-08-24T14:15:22Z"
  }
]

Create a function (optionally with version 1, deployed)

POST
/v1/functions

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
apiNameRequiredstring

Stable identifier (workflow steps, HTTP path)

Pattern: "^[a-z][a-z0-9_]{1,47}$"
nameRequiredstring
Maximum length: 120
descriptionstring
Maximum length: 1000
sourcestring

Source of version 1; when given, it is compiled and deployed

Maximum length: 262144
languagestring
Default: "typescript"Value in: "javascript" | "typescript"
envVarsobject

Non-secret configuration, readable as env (UPPER_SNAKE_CASE names)

timeoutMsnumber
Default: 10000Minimum: 1000Maximum: 30000
memoryMbnumber
Default: 128Minimum: 16Maximum: 128
allowedHostsarray<string>

Hosts fetch() may reach: api.example.com or *.example.com Items: at most 20.

runAsUserIdstring

Member the salesos.* client acts as (default: you)

runAsAdminboolean

Keep the run-as user's admin visibility (off: an admin runs as a regular member)

Default: false
scopesarray<string>

READ_/WRITE_ scopes for salesos.* Items: at most 64.

httpEnabledboolean

Expose POST /functions/:id/invoke

Default: false
eventTypesarray<string>

Catalog event types that trigger the function Items: at most 20.

schedulestring

Five-field cron (UTC), at most every 5 minutes; null to clear

Maximum length: 120
isActiveboolean
Default: true

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "apiName": "score_lead",
    "name": "Score lead",
    "description": "string",
    "source": "string",
    "language": "javascript",
    "envVars": {
      "property1": "string",
      "property2": "string"
    },
    "timeoutMs": 10000,
    "memoryMb": 128,
    "allowedHosts": [
      "string"
    ],
    "runAsUserId": "string",
    "runAsAdmin": false,
    "scopes": [
      "string"
    ],
    "httpEnabled": false,
    "eventTypes": [
      "string"
    ],
    "schedule": "string",
    "isActive": true
  }'

ServerlessFunctionDetail

{
  "id": "string",
  "organizationId": "string",
  "apiName": "string",
  "name": "string",
  "description": "string",
  "activeVersionId": "string",
  "envVars": null,
  "timeoutMs": 0,
  "memoryMb": 0,
  "allowedHosts": [
    "string"
  ],
  "runAsUserId": "string",
  "runAsAdmin": true,
  "scopes": [
    "string"
  ],
  "httpEnabled": true,
  "eventTypes": [
    "string"
  ],
  "schedule": "string",
  "lastScheduledAt": "2019-08-24T14:15:22Z",
  "isActive": true,
  "createdById": "string",
  "lastInvokedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "activeVersion": 0,
  "nextRunAt": "2019-08-24T14:15:22Z",
  "secrets": [
    {
      "name": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ]
}

A function with its settings and secret names

GET
/v1/functions/{id}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
curl -X GET "https://api.salesos.org/v1/functions/<string>" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionDetail

{
  "id": "string",
  "organizationId": "string",
  "apiName": "string",
  "name": "string",
  "description": "string",
  "activeVersionId": "string",
  "envVars": null,
  "timeoutMs": 0,
  "memoryMb": 0,
  "allowedHosts": [
    "string"
  ],
  "runAsUserId": "string",
  "runAsAdmin": true,
  "scopes": [
    "string"
  ],
  "httpEnabled": true,
  "eventTypes": [
    "string"
  ],
  "schedule": "string",
  "lastScheduledAt": "2019-08-24T14:15:22Z",
  "isActive": true,
  "createdById": "string",
  "lastInvokedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "activeVersion": 0,
  "nextRunAt": "2019-08-24T14:15:22Z",
  "secrets": [
    {
      "name": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ]
}

Update settings (triggers, limits, network allow-list, scopes)

PATCH
/v1/functions/{id}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
namestring
Maximum length: 120
descriptionstring
Maximum length: 1000
envVarsobject

Non-secret configuration, readable as env (UPPER_SNAKE_CASE names)

timeoutMsnumber
Default: 10000Minimum: 1000Maximum: 30000
memoryMbnumber
Default: 128Minimum: 16Maximum: 128
allowedHostsarray<string>

Hosts fetch() may reach: api.example.com or *.example.com Items: at most 20.

runAsUserIdstring

Member the salesos.* client acts as (default: you)

runAsAdminboolean

Keep the run-as user's admin visibility (off: an admin runs as a regular member)

Default: false
scopesarray<string>

READ_/WRITE_ scopes for salesos.* Items: at most 64.

httpEnabledboolean

Expose POST /functions/:id/invoke

Default: false
eventTypesarray<string>

Catalog event types that trigger the function Items: at most 20.

schedulestring

Five-field cron (UTC), at most every 5 minutes; null to clear

Maximum length: 120
isActiveboolean
Default: true

Path Parameters

idRequiredstring

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X PATCH "https://api.salesos.org/v1/functions/<string>" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Score lead",
    "description": "string",
    "envVars": {
      "property1": "string",
      "property2": "string"
    },
    "timeoutMs": 10000,
    "memoryMb": 128,
    "allowedHosts": [
      "string"
    ],
    "runAsUserId": "string",
    "runAsAdmin": false,
    "scopes": [
      "string"
    ],
    "httpEnabled": false,
    "eventTypes": [
      "string"
    ],
    "schedule": "string",
    "isActive": true
  }'

ServerlessFunctionDetail

{
  "id": "string",
  "organizationId": "string",
  "apiName": "string",
  "name": "string",
  "description": "string",
  "activeVersionId": "string",
  "envVars": null,
  "timeoutMs": 0,
  "memoryMb": 0,
  "allowedHosts": [
    "string"
  ],
  "runAsUserId": "string",
  "runAsAdmin": true,
  "scopes": [
    "string"
  ],
  "httpEnabled": true,
  "eventTypes": [
    "string"
  ],
  "schedule": "string",
  "lastScheduledAt": "2019-08-24T14:15:22Z",
  "isActive": true,
  "createdById": "string",
  "lastInvokedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "activeVersion": 0,
  "nextRunAt": "2019-08-24T14:15:22Z",
  "secrets": [
    {
      "name": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ]
}

Delete a function, its versions, secrets and schedule

DELETE
/v1/functions/{id}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
curl -X DELETE "https://api.salesos.org/v1/functions/<string>" \
  -H "Authorization: Bearer <token>"

DeletedResponse

{
  "deleted": true
}

Versions, newest first (server-paged, without source)

GET
/v1/functions/{id}/versions

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring

Query Parameters

pagestring
Default: 1
limitstring
Default: 20
curl -X GET "https://api.salesos.org/v1/functions/<string>/versions?page=1&limit=20" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionVersionPage

{
  "data": [
    {
      "id": "string",
      "functionId": "string",
      "organizationId": "string",
      "version": 0,
      "language": "string",
      "sourceHash": "string",
      "note": "string",
      "createdById": "string",
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 0,
  "page": 0,
  "limit": 0,
  "totalPages": 0
}

Save a new immutable version (compiled now; syntax errors are a 400)

POST
/v1/functions/{id}/versions

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
sourceRequiredstring

TypeScript or JavaScript exporting a default (input, context) handler

Maximum length: 262144
languageRequiredstring
Value in: "javascript" | "typescript"
notestring
Maximum length: 500
deployboolean

Deploy the new version immediately

Default: false

Path Parameters

idRequiredstring

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions/<string>/versions" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "string",
    "language": "javascript",
    "note": "string",
    "deploy": false
  }'

ServerlessFunctionVersionSummary

{
  "id": "string",
  "functionId": "string",
  "organizationId": "string",
  "version": 0,
  "language": "string",
  "sourceHash": "string",
  "note": "string",
  "createdById": "string",
  "createdAt": "2019-08-24T14:15:22Z"
}

One version with its source

GET
/v1/functions/{id}/versions/{versionId}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
versionIdRequiredstring
curl -X GET "https://api.salesos.org/v1/functions/<string>/versions/<string>" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionVersion

{
  "id": "string",
  "functionId": "string",
  "organizationId": "string",
  "version": 0,
  "language": "string",
  "source": "string",
  "compiled": "string",
  "sourceHash": "string",
  "note": "string",
  "createdById": "string",
  "createdAt": "2019-08-24T14:15:22Z"
}

Make a version the one that runs

POST
/v1/functions/{id}/deploy

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
versionIdRequiredstring

Path Parameters

idRequiredstring

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions/<string>/deploy" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "versionId": "string"
  }'

ServerlessFunctionDetail

{
  "id": "string",
  "organizationId": "string",
  "apiName": "string",
  "name": "string",
  "description": "string",
  "activeVersionId": "string",
  "envVars": null,
  "timeoutMs": 0,
  "memoryMb": 0,
  "allowedHosts": [
    "string"
  ],
  "runAsUserId": "string",
  "runAsAdmin": true,
  "scopes": [
    "string"
  ],
  "httpEnabled": true,
  "eventTypes": [
    "string"
  ],
  "schedule": "string",
  "lastScheduledAt": "2019-08-24T14:15:22Z",
  "isActive": true,
  "createdById": "string",
  "lastInvokedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "activeVersion": 0,
  "nextRunAt": "2019-08-24T14:15:22Z",
  "secrets": [
    {
      "name": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ]
}

Deploy the version before the active one

POST
/v1/functions/{id}/rollback

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions/<string>/rollback" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionDetail

{
  "id": "string",
  "organizationId": "string",
  "apiName": "string",
  "name": "string",
  "description": "string",
  "activeVersionId": "string",
  "envVars": null,
  "timeoutMs": 0,
  "memoryMb": 0,
  "allowedHosts": [
    "string"
  ],
  "runAsUserId": "string",
  "runAsAdmin": true,
  "scopes": [
    "string"
  ],
  "httpEnabled": true,
  "eventTypes": [
    "string"
  ],
  "schedule": "string",
  "lastScheduledAt": "2019-08-24T14:15:22Z",
  "isActive": true,
  "createdById": "string",
  "lastInvokedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "activeVersion": 0,
  "nextRunAt": "2019-08-24T14:15:22Z",
  "secrets": [
    {
      "name": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ]
}

Secret names (values are never returned)

GET
/v1/functions/{id}/secrets

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
curl -X GET "https://api.salesos.org/v1/functions/<string>/secrets" \
  -H "Authorization: Bearer <token>"

FunctionSecretNameArray

[
  {
    "name": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
]

Delete a secret

DELETE
/v1/functions/{id}/secrets/{name}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
nameRequiredstring
curl -X DELETE "https://api.salesos.org/v1/functions/<string>/secrets/<string>" \
  -H "Authorization: Bearer <token>"

DeletedResponse

{
  "deleted": true
}

Set a secret (stored encrypted)

PUT
/v1/functions/{id}/secrets/{name}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
valueRequiredstring

Stored encrypted; never returned

Maximum length: 8192

Path Parameters

idRequiredstring
nameRequiredstring
curl -X PUT "https://api.salesos.org/v1/functions/<string>/secrets/<string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "string"
  }'

FunctionSecretSaved

{
  "name": "string",
  "saved": true
}

Run with sample input (saved version or unsaved source); logs are returned

POST
/v1/functions/{id}/test

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
inputobject

Sample input

sourcestring

Unsaved source to run instead of a saved version

Maximum length: 262144
languagestring
Value in: "javascript" | "typescript"
versionIdstring

Run this saved version (default: the deployed one)

Path Parameters

idRequiredstring

Header Parameters

Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions/<string>/test" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {},
    "source": "string",
    "language": "javascript",
    "versionId": "string"
  }'

FunctionRunResult

{
  "invocationId": "string",
  "ok": true,
  "status": "SUCCEEDED",
  "output": {},
  "errorCode": "string",
  "errorMessage": "string",
  "durationMs": 0,
  "cpuMs": 0,
  "memoryBytes": 0,
  "stdout": "string",
  "stderr": "string",
  "logsTruncated": true,
  "version": 0
}

Invocation log (server-paged)

GET
/v1/functions/{id}/invocations

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring

Query Parameters

pagestring
Default: 1
limitstring
Default: 20
statusstring
Value in: "SUCCEEDED" | "FAILED" | "TIMEOUT" | "MEMORY_LIMIT" | "THROTTLED" | "CRASHED"
triggerstring
Value in: "HTTP" | "WORKFLOW" | "ACTION" | "EVENT" | "SCHEDULE" | "TEST"
curl -X GET "https://api.salesos.org/v1/functions/<string>/invocations?page=1&limit=20&status=SUCCEEDED&trigger=HTTP" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionInvocationPage

{
  "data": [
    {
      "id": "string",
      "organizationId": "string",
      "functionId": "string",
      "versionId": "string",
      "version": 0,
      "trigger": "string",
      "status": "string",
      "durationMs": 0,
      "cpuMs": 0,
      "memoryBytes": 0,
      "input": null,
      "output": null,
      "stdout": "string",
      "stderr": "string",
      "logsTruncated": true,
      "errorCode": "string",
      "errorMessage": "string",
      "eventId": "string",
      "eventType": "string",
      "objectType": "string",
      "recordId": "string",
      "userId": "string",
      "depth": 0,
      "attempt": 0,
      "nextRetryAt": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 0,
  "page": 0,
  "limit": 0,
  "totalPages": 0,
  "retentionDays": 0
}

One invocation with input, output and captured logs

GET
/v1/functions/{id}/invocations/{invocationId}

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Path Parameters

idRequiredstring
invocationIdRequiredstring
curl -X GET "https://api.salesos.org/v1/functions/<string>/invocations/<string>" \
  -H "Authorization: Bearer <token>"

ServerlessFunctionInvocation

{
  "id": "string",
  "organizationId": "string",
  "functionId": "string",
  "versionId": "string",
  "version": 0,
  "trigger": "string",
  "status": "string",
  "durationMs": 0,
  "cpuMs": 0,
  "memoryBytes": 0,
  "input": null,
  "output": null,
  "stdout": "string",
  "stderr": "string",
  "logsTruncated": true,
  "errorCode": "string",
  "errorMessage": "string",
  "eventId": "string",
  "eventType": "string",
  "objectType": "string",
  "recordId": "string",
  "userId": "string",
  "depth": 0,
  "attempt": 0,
  "nextRetryAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z"
}

Invoke a function over HTTP (id or apiName); needs INVOKE_FUNCTIONS for keys and tokens

POST
/v1/functions/{id}/invoke

Authorization

AuthorizationRequiredBearer <token>

Session token from the SalesOS web app.

In: header

X-API-Key<token>

API key from Settings → API Keys. Authorization: ApiKey <key> is also accepted. Each operation lists the scope it needs under x-api-key-scopes.

In: header

Request Body

application/jsonRequired
inputobject

Passed to the handler as input

Path Parameters

idRequiredstring

Header Parameters

x-salesos-function-depthRequiredstring
Idempotency-Keystring

Unique key (a UUID is ideal) that makes this write safe to retry for 24 hours: a retry with the same body replays the original response (Idempotent-Replayed: true); the same key with a different body is a 409.

Maximum length: 255
curl -X POST "https://api.salesos.org/v1/functions/<string>/invoke" \
  -H "x-salesos-function-depth: <string>" \
  -H "Idempotency-Key: <string>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {}
  }'

FunctionInvokeResult

{
  "invocationId": "string",
  "status": "string",
  "ok": true,
  "output": {},
  "error": {
    "code": "string",
    "message": "string"
  },
  "durationMs": 0,
  "version": 0
}