Skip to main content

Test Endpoint (Streaming)

Run an iterate test for a single endpoint — issuing one request per supplied value (or value pair) — and stream the progress back over Server-Sent Events (SSE). Each iteration can optionally follow pagination, recurse through a tree of child resources, and respect rate limits. A companion GET lets a client reconnect to a running session.

POST /api/connectors/{id}/endpoints/{endpointId}/test/stream

Authorization

  • Authenticated user: Required. Unauthenticated requests receive a plain 401 Unauthorized (note: error bodies on this route are plain strings or { "error": ... }, not the nested error object used elsewhere).

Path Parameters

ParameterTypeRequiredDescription
idstringYesConnector ID
endpointIdstringYesEndpoint ID

Request Body

The body is validated with Zod. iteration_params is required and comes in two shapes; everything else is optional.

FieldTypeRequiredDescription
iteration_paramsobjectYesThe iteration plan — simple or paired (see below)
parameter_valuesobjectNoBase path-parameter values applied to every iteration
query_parameter_valuesobjectNoBase query-parameter values
custom_headersobjectNoExtra request headers
runtime_parameter_valuesobjectNoValues for connector runtime parameters / input variables (override baked-in static values)
body_paramsobjectNoRequest body: { "type": "json" | "form-data" | "urlencoded" | "raw", "content": string }
endpoint_configobjectNoInline endpoint config (id, path, method, friendly_name). Preferred over the stored endpoint so unpublished edits are honoured
recursion_configobjectNoTree traversal per iteration: { enabled, idPath, targetParam, conditionPath?, conditionValue?, maxDepth (1–10) }
pagination_configobjectNoFollow all pages within each iteration (standard pagination config)
rate_limit_configobjectNo{ delayMs (0–60000), respectRetryAfter } — delay between iterations and HTTP 429 retry behaviour
credential_slot_idstringNoWhich stored credential slot to use (from the analyst's selection)

Simple iteration

{
"iteration_params": {
"param_name": "userId",
"param_location": "path",
"values": ["U1", "U2", "U3"]
}
}

param_location is one of path, query, body.

Paired iteration

Iterate over (outer, inner) pairs, mapping each side to one or more parameters:

{
"iteration_params": {
"paired": true,
"param_mappings": [
{ "param_name": "channelId", "param_location": "path", "paired_field": "outer" },
{ "param_name": "ts", "param_location": "query", "paired_field": "inner" }
],
"pairs": [
{ "outer": "C1", "inner": "169..." },
{ "outer": "C2", "inner": "170..." }
]
}
}

Response (SSE Stream)

On success the response is Content-Type: text/event-stream (with Cache-Control: no-cache). Events are emitted as event: <name> / data: <json> frames:

EventWhenPayload
sessionFirst, immediately{ "sessionId": string, "total": number }
countersAs pages/children are fetched{ "pagination": number, "recursion": number }
progressAfter each iterationiteration index, total, url, statusCode, responseTimeMs, paramValue, error, responseData, recursionResult, paginationResult
rate_limit_waitAround a delay / 429 retry{ "reason": "retry_after" | "configured_delay", "waitDurationMs", "waitingSince" }, then null when the wait ends
stoppedThe client aborted{ "index": number, "reason": "User stopped" }
completeAt the end{ "success", "totalTimeMs", "successCount", "failureCount", "iterationCount" }
errorOn a fatal error{ "message": string }

The stream aborts cleanly if the client disconnects (the abort cancels in-flight requests).

Example progress frame

event: progress
data: {"index":0,"total":3,"url":"https://slack.com/api/users.info?user=U1","statusCode":200,"responseTimeMs":142,"paramValue":"U1","responseData":[ ... ]}

Reconnect / Poll Session

GET /api/connectors/{id}/endpoints/{endpointId}/test/stream?sessionId={sessionId}

Returns the current state of a running or finished session (for reconnection). Requires authentication and a sessionId query parameter.

Response

{
"sessionId": "sess_abc",
"status": "running",
"progress": [ ... ],
"results": [ ... ],
"error": null
}

Example Request

curl -N -X POST "https://api.traces.io/api/connectors/conn_slack001/endpoints/ep_user_info/test/stream" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"iteration_params": { "param_name": "userId", "param_location": "query", "values": ["U1","U2"] }
}'

Error Responses

Error bodies on this route are plain text (or a Zod error object), not the standard nested error shape.

StatusConditionBody
401Not authenticatedUnauthorized
400Invalid JSONInvalid JSON
400Body failed validation{ "error": <zod format> }
400No credentials configuredNo credentials configured
400Missing platform URL / input variablesConnector has no platform URL configured (check input variables)
400Token exchange or auth build failedToken exchange failed: ... / Auth error: ...
404Connector not foundConnector not found
404Endpoint not foundEndpoint not found
500Failed to load credentialsFailed to retrieve credentials

On the GET (reconnect) variant: 400 Missing sessionId and 404 Session not found are also possible.