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_. To work inside a sub-account with a main account key, also send the optional X-Nexor-Sub-Account-Id header.

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.

async
boolean
default:false

Return a queued run_id immediately and poll the run instead of holding this request open.

idempotency_key
string

Async tests: reuse on retries; change to intentionally rerun unchanged code and context.

Required string length: 1 - 128

Response

The test completed, or an async test was accepted with a queued run_id. Poll the same run to a terminal status; function errors/timeouts are in run.status/run.error, not HTTP errors.

success
enum<boolean>
required
Available options:
true
run
object
required
test
enum<boolean>
required
Available options:
true
run_id
string<uuid>

Stable execution id returned for async tests; poll the run endpoint.

Last modified on October 6, 2026