Request Status and Polling
Track request progress and retrieve request-level outputs.
While webhooks are the primary completion mechanism, polling is useful when:
- validating integration health
- running backfills or migrations
- reconciling missed webhook deliveries
Use GET /v1/data/{namespace}/requests/{requestId} for checking request status and retrieving request-level outputs inline when they fit within the inline response size limit.
Use GET /v1/data/{namespace}/requests/{requestId}/results/download-url to retrieve a temporary URL for larger request outputs.
Checking request status
Section titled “Checking request status”Endpoint: GET /v1/data/{namespace}/requests/{requestId}
Example response:
{ "namespace": "products", "request_id": "req_01h2m7qdmdjckc30e1mnq6xqfd", "status": "ingesting", "data": []}The data attribute is always empty while data is being ingested and processed (i.e., status != "succeeded"). status can be one of queued, uploading (upload URL requests only), ingesting, succeeded, and failed. See Errors for what each failure state means and how to handle it.
Retrieve inline request outputs
Section titled “Retrieve inline request outputs”Endpoint: GET /v1/data/{namespace}/requests/{requestId}
Example inline response shape:
{ "namespace": "products", "request_id": "req_01h2m7qdmdjckc30e1mnq6xqfd", "status": "succeeded", "data": [ { "id": "product_12345", "output": { "actions": [], "labels": [{ "label": "policy.example_violation" }], "fields": {} }, "metadata": {}, "url": "https://app.safetykit.com/..." } ]}The inline status endpoint returns 413 when a completed request output exceeds the 5 MiB inline response limit.
Retrieve a download URL
Section titled “Retrieve a download URL”Endpoint: GET /v1/data/{namespace}/requests/{requestId}/results/download-url
Example response:
{ "namespace": "products", "request_id": "req_01h2m7qdmdjckc30e1mnq6xqfd", "status": "succeeded", "data_url": "https://s3.amazonaws.com/...", "data_count": 1200, "data_expires_at": "2026-01-15T12:30:00.000Z"}Before processing completes, the download URL endpoint keeps the same shape and returns null for data_url, data_count, and data_expires_at.
Downloaded JSONL result shape
Section titled “Downloaded JSONL result shape”The data_url file is JSONL with one result object per line.
Each line follows the same structure as request-level object outputs in the data array:
{"id":"product_12345","output":{"actions":[],"labels":[{"label":"policy.example_violation"}],"fields":{}},"metadata":{"source":"backfill"},"url":"https://app.safetykit.com/..."}{"id":"product_67890","output":{"actions":[{"action":"manual_review","queue":"high_risk"}],"labels":[],"fields":{}},"metadata":{},"url":"https://app.safetykit.com/..."}When parsing this file:
- read line by line (streaming), not as one large JSON document
- treat
metadataas optional - treat
output: nullas an object that failed and was not reviewed - map rows to your original content with
id
import readline from "node:readline";import { createReadStream } from "node:fs";
async function parseResultJsonl(path: string) { const rl = readline.createInterface({ input: createReadStream(path), crlfDelay: Infinity, });
for await (const line of rl) { if (!line.trim()) continue; const row = JSON.parse(line); await upsertResult(row.id, row.output, row.metadata ?? {}, row.url); }}import json
def parse_result_jsonl(path: str): with open(path, "r", encoding="utf-8") as f: for line in f: line = line.strip() if not line: continue row = json.loads(line) upsert_result( row["id"], row.get("output"), row.get("metadata", {}), row["url"], )import kotlinx.serialization.json.Jsonimport kotlinx.serialization.json.jsonObjectimport kotlinx.serialization.json.jsonPrimitiveimport java.nio.file.Filesimport java.nio.file.Path
fun parseResultJsonl(path: Path) { Files.lines(path).use { lines -> lines .filter { it.isNotBlank() } .forEach { line -> val row = Json.parseToJsonElement(line).jsonObject upsertResult( row["id"]!!.jsonPrimitive.content, row["output"], row["metadata"], row["url"]!!.jsonPrimitive.content, ) } }}import com.fasterxml.jackson.databind.JsonNode;import com.fasterxml.jackson.databind.ObjectMapper;import java.nio.file.Files;import java.nio.file.Path;import java.util.stream.Stream;
void parseResultJsonl(Path path) throws Exception { ObjectMapper objectMapper = new ObjectMapper();
try (Stream<String> lines = Files.lines(path)) { for (String line : lines.filter(line -> !line.isBlank()).toList()) { JsonNode row = objectMapper.readTree(line); upsertResult( row.get("id").asText(), row.get("output"), row.path("metadata"), row.get("url").asText() ); } }}Polling loop guidance
Section titled “Polling loop guidance”- poll every 3-10 seconds
- stop polling when status is
succeededorfailed - use the download URL endpoint for large outputs or after a
413from the inline status endpoint - treat polling as a complement, not replacement, for webhooks
See Copy-and-Paste Quickstart for copy-paste polling and webhook examples.