Skip to main content
Query Kling Task
All four Kling generation endpoints share this query endpoint. Use data.id from the submission response.

Query Parameters

external_task_ids is unsupported. Upstream IDs, callback IDs and custom external_task_id values cannot replace the gateway task ID.

Response

State Handling

Poll about every 15 seconds and back off on rate limits or transient network errors. Responses contain the latest state obtained by the gateway and may lag by a few seconds. A client wait timeout is not a server task failure; keep the ID and continue querying rather than creating a replacement task.

Error Handling

Check both HTTP status and JSON code. A [gateway] message prefix identifies gateway rejections, such as a model/endpoint mismatch, empty prompt or batch query. Upstream rejections retain upstream error details and request IDs. Keep request_id and the task ID for troubleshooting.

Complete Python Workflow

Install requests and set MIXROUTE_API_KEY. The first run submits one task; setting KLING_TASK_ID queries an existing task instead. POST is not retried automatically; after a submission timeout, check the console first.
Result URLs point to third-party media and may use expiring signatures or retention limits. Save successful outputs promptly rather than treating their URLs as permanent storage. Do not download them with the authenticated session or append your API Key to the URL.