Save the shot before you send it
You submit a five-second shot of a ferry crossing a harbor. The terminal disconnects before a progress indicator appears. Two records can get you back to that shot: the Idempotency-Key saved before submission and the task id returned after acceptance. On SmarToken, a task ID lets you check progress immediately. If the receipt went missing, the original key and request body give you a recovery path.
Run the following once in Bash with Python 3 and curl available. It creates local files for one shot. Choose a directory name that identifies the shot and take. If that directory already exists, inspect its records. Supply your API credential through SMTOKEN_API_KEY as shown on the model page.
(
set -e
umask 077
mkdir harbor-shot-01
cd harbor-shot-01
python3 -c 'import uuid; print(uuid.uuid4())' > request.key
cat > request.json <<'JSON'
{"model":"kling-video-v4","prompt":"A blue ferry crosses a still harbor at dawn. Fixed camera.","duration":5,"resolution":"720p"}
JSON
)Keep request.key beside request.json. One identifies the intended generation, the other preserves what you sent. A director changing the blue ferry to a red one is requesting a new take. Give that take its own directory and key. When recovering the original take, keep using the original API credential.
Decide whether to repeat the submission
For the first submission, run this from the parent of the shot directory. This command requests a real generation and may incur a charge. It prints the name of a new receipt file for each attempt. When the response arrives, look for its id and status.
(
set -e
cd harbor-shot-01
receipt=$(mktemp ./receipt.XXXXXX)
echo "$receipt"
curl --fail-with-body --silent --show-error --max-time 60 \
-H "Authorization: Bearer ${SMTOKEN_API_KEY:?set SMTOKEN_API_KEY}" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(cat request.key)" \
--data-binary @request.json \
-o "$receipt" https://thesmartoken.com/v1/videos/generations
cat "$receipt"
)Inspect the saved receipts first. If one contains the task ID, move on to the status request. If the submission outcome is unknown, no receipt contains an ID, and you still have the original files and credential, repeat the second block once. It reuses the exact key and body. Generating a fresh key could create a second order. If the outcome is still unclear, keep both receipts, the submission time and the shot name for support. Remove credentials from any material you share.
With a task ID, switch to the status URL
Copy the id field from the receipt into the shell variable VIDEO_ID, for example by entering VIDEO_ID='your-actual-task-id'. The submission path ends in generations. The status path appends the ID directly to /v1/videos/. Read status in the response to decide what to do next.
curl --fail-with-body --silent --show-error --max-time 30 \
-H "Authorization: Bearer ${SMTOKEN_API_KEY:?set SMTOKEN_API_KEY}" \
"https://thesmartoken.com/v1/videos/${VIDEO_ID:?set VIDEO_ID from the submission receipt}"| Observation | Next action |
|---|---|
| queued or running | Keep the same ID and check again after a delay. If polling disconnects, repeat the GET. |
| succeeded with a content_url | Download the file from the returned relative path on SmarToken using the original API credential. Open it and check the shot and duration. |
| review | Keep the ID and ask support to reconcile the task and balance hold. A new order may place another hold. |
| rejected | The task was not accepted for generation. Check the response and account details before deciding what to do next. |
| 404 | Check the host, status path, original task ID and API credential against your submission record. |
If an editor has the ID and loses their connection midway through polling, reconnect and query that ID. Once the result says succeeded, download and play the file before handing it to the editor. A temporary balance hold records a separate part of the transaction and does not establish that a clip is ready.
Polling limits and retention
Set a polling interval and an overall deadline; follow any retry guidance returned for rate limiting. If the outcome remains unclear, retain the records for support. Task retention and result expiry were not independently measured here; check the current endpoint documentation.
Real task receipts: queued, running and succeeded
On December 1, 2026, we submitted one kling-video-v4 task on the SmarToken playground: a blue ferry crosses a still harbor, fixed camera, 5 seconds at 720p. After POST /api/playground/videos, we queried /api/playground/videos/<task_id> using the same task ID. The redacted excerpts below use <task_id> for that same ID in all three responses.
Submission response (HTTP 202)
{
"id": "<task_id>",
"object": "video.task",
"model": "kling-video-v4",
"status": "queued",
"created": 1796118675
}Running status (HTTP 200)
{
"id": "<task_id>",
"object": "video.task",
"model": "kling-video-v4",
"status": "running",
"created": 1796118675
}Success status (HTTP 200)
{
"id": "<task_id>",
"object": "video.task",
"model": "kling-video-v4",
"status": "succeeded",
"created": 1796118675,
"content_url": "/api/playground/videos/<task_id>/content",
"usage": {
"total_tokens": 490625
}
}At 17:51:16 UTC+8 we received queued; at 17:51:28 we first observed running; at 17:54:32 we first observed succeeded with a download path; at 17:54:46 the download succeeded. The result is 1280 × 720 at 24 fps, with a video stream of about 5.042 seconds; the settled charge was $0.628. Two later lookups of the same ID still returned succeeded. This run did not experience a real timeout, failure or retry and does not verify recovery from an unknown submission outcome. The completed video is linked below. The playground routes used here differ from the /v1/videos API routes above.
Authentication failure is not a generation failure
On December 1, 2026, we sent a minimal POST to /v1/videos/generations without an Authorization header. It returned HTTP 401 and the error below, with no task ID. This checks submission authentication, not a failure during video generation. Check the credential before submitting; do not treat this response as a failed generation task.
{
"error": {
"message": "Invalid API key",
"type": "invalid_request_error"
}
}