Skip to main content
POST
Test a Scheduled Function
Run the draft of a Scheduled Function on a test copy that cannot change anything. Without a draft, the test runs the published code.

What happens during a test

Without ctx, the test loads the leads, agents, and hosts that the saved lookup scope matches now. Loading them only reads data. A test has the same time and request limits as a real execution. It appears in run history with trigger_source test, but it does not change run_count, last_run_at, or last_run_status.
Accepted risks of a test
  • A GET that changes something in the other system, such as an unsubscribe link or a webhook triggered by a GET, runs for real.
  • Writes get a synthetic {} answer. Code that reads fields from that answer, such as an ID it expects back, can take a different branch than in production.
  • A write sent through globalThis.fetch instead of the provided fetch or axios is also held back, but it is not listed in run.requests.
  • A raw TCP connection opened with a socket API is not held back.

Read the result

  • run.status is success, error, or timeout. An error in your code is a successful call with run.status error.
  • run.effects lists the previewed lead changes.
  • run.requests lists every request made through fetch or axios. The ones with blocked: true were not sent.
  • run.mode is test.
A 503 DEPLOYMENT_NOT_CURRENT means the test copy could not be prepared. Nothing ran and nothing was recorded. Retry in a moment. To verify a real write, publish the code while the function is paused, then use Run now after the operator confirms.

Authorizations

X-API-Key
string
header
required

API key for authentication. Keys are prefixed with nxr_live_.

Path Parameters

id
string<uuid>
required

Scheduled Function id.

Body

application/json
ctx
object

Optional ctx to test with. Without it, the test loads the leads, agents and hosts that the saved lookup scope matches now, as a read.

Response

The test ran. A function error or timeout is reported in run.status and run.error, not as an HTTP error.

success
enum<boolean>
required
Available options:
true
run
object
required
test
enum<boolean>
required
Available options:
true
Last modified on October 6, 2026