Submit a generation
tong_generation_submitSubmit the configured action using your Tong account and credits. Follow the saved operation until it finishes.
/v1/tools/tong_generation_submit/operationsRequest example#
curl -X POST 'https://platform.tongai.io/v1/tools/tong_generation_submit/operations' \ -H "Authorization: Bearer $TONG_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 45be69f1-c266-4a09-a82c-bf3c6303eb03" \ -d '{ "input": { "params": { "id": "000000000000000000000001" }, "body": { "quoteId": "fixture-image-quote-token", "prompt": "A quiet street at blue hour", "operation": "TEXT_TO_IMAGE", "inputAssetIds": [], "parameters": { "textToImageModel": "tong_ea55aff4f3b5c8aba3a35569", "ratio": "16:9" } } }}'Configuration
curl --versionPermissions#
Use a server-side API key for your account, or OAuth for each customer’s account. Never send keys in prompts or tool arguments.
generation:writecredits:spendRequest body#
REST requests wrap the tool arguments in input. MCP calls send the same arguments directly.
paramsobjectRequiredShow nested fields
idstringRequiredA 24-character hexadecimal ID.
"000000000000000000000001"bodyobjectRequiredShow nested fields
quoteIdstringRequiredUse the quote submission value returned for this exact configuration.
Minimum length: 1 characters.
Maximum length: 120 characters.
"fixture-image-quote-token"promptstringRequiredDescribe the result you want to create.
Minimum length: 1 characters.
Maximum length: 5000 characters.
"A quiet street at blue hour"operationstringRequiredSelect the workflow supported by the chosen model.
"TEXT_TO_IMAGE""IMAGE_EDIT""CHARACTER_RECREATE""CHARACTER_RECREATE_SPICY""TEXT_TO_VIDEO""IMAGE_TO_VIDEO""CHARACTER_TO_VIDEO""CHARACTER_TO_VIDEO_SPICY""FIRST_LAST_TO_VIDEO""TEXT_TO_IMAGE"inputAssetIdsstring[]RequiredMaximum items: 120.
[]parametersobjectRequiredShow nested fields
directorRequiredReferenceCountintegerOptionalMinimum: 1.
Maximum: 20.
referenceDirectionobjectOptionalShow nested fields
versionnumberRequired1capabilityRevisionstringRequiredMinimum length: 1 characters.
Maximum length: 100 characters.
keepVideoSoundbooleanOptionalseedintegerOptionalMinimum: 0.
Maximum: 2147483647.
automaticShotsbooleanOptionalautomaticDurationbooleanOptionaloutputResolutionstringOptional"720p-SR""1080p-SR""1440p-SR"bitratestringOptional"standard""high"returnLastFramebooleanOptionaldocumentUrlstringOptionalFormat: uri.
Maximum length: 2048 characters.
subjectSequenceintegerOptionalMinimum: 0.
Maximum: 999.
subjectsobject[]OptionalMaximum items: 6.
Show nested fields
idstringRequiredUse a numbered subject label, for example Subject1.
namestringRequiredMinimum length: 1 characters.
Maximum length: 80 characters.
descriptionstringOptionalMaximum length: 500 characters.
assetIdsstring[]RequiredMinimum items: 1.
Maximum items: 4.
shotsobject[]OptionalMinimum items: 1.
Maximum items: 6.
Show nested fields
idstringRequiredMinimum length: 1 characters.
Maximum length: 80 characters.
promptstringRequiredDescribe the result you want to create.
Minimum length: 1 characters.
Maximum length: 1800 characters.
durationSecondsintegerRequiredMinimum: 1.
Maximum: 15.
referencesobject[]RequiredUse owned asset IDs that satisfy the selected model’s reference capabilities.
Maximum items: 120.
Show nested fields
idstringRequiredMinimum length: 1 characters.
Maximum length: 80 characters.
assetIdstringRequiredUse the identifier of an asset owned by the authorized account.
A 24-character hexadecimal ID.
fieldstringRequiredMinimum length: 1 characters.
Maximum length: 80 characters.
labelstringRequiredUse a numbered reference label, for example Image1.
autoEnhancePromptbooleanOptionalpromptEnhancementIdstringOptionalA 24-character hexadecimal ID.
negativePromptModestringOptional"REPLACE"cameraMotionstringOptional"AUTO""ORBIT_RIGHT""ORBIT_LEFT""PUSH_IN""PULL_BACK""RISE"qualityPresetstringOptional"REALISTIC""DRAFT"casualPhoneFinishbooleanOptionalrecreateReferenceRolesstring[]OptionalMinimum items: 2.
Maximum items: 20.
characterVideoReferenceRolesstring[]OptionalMinimum items: 1.
Maximum items: 30.
imageModelstringOptionalMinimum length: 1 characters.
Maximum length: 150 characters.
textToImageModelstringOptionalMinimum length: 1 characters.
Maximum length: 150 characters.
"tong_ea55aff4f3b5c8aba3a35569"videoModelstringOptionalMinimum length: 1 characters.
Maximum length: 150 characters.
durationSecondsintegerOptionalMinimum: 2.
Maximum: 30.
resolutionstringOptional"480p""720p""768p""1080p""2k""4k"ratiostringOptional"21:9""16:9""4:3""1:1""3:4""9:16""adaptive""16:9"videoStylestringOptional"NATURAL_PHONE""CINEMATIC""FOLLOW_PROMPT"generateAudiobooleanOptionalseedintegerOptionalMinimum: 0.
Maximum: 2147483647.
promptExtendbooleanOptionalnegativePromptstringOptionalMaximum length: 2000 characters.
workspaceProjectIdstring | nullOptionalA 24-character hexadecimal ID.
characterProfileIdstringOptionalA 24-character hexadecimal ID.
annotationsobject[]OptionalMaximum items: 8.
Show nested fields
xnumberRequiredMinimum: 0.
Maximum: 1.
ynumberRequiredMinimum: 0.
Maximum: 1.
radiusnumberRequiredMinimum: 0.02.
Maximum: 0.5.
commentstringRequiredMinimum length: 1 characters.
Maximum length: 500 characters.
filmSceneobjectOptionalShow nested fields
projectIdstringRequiredUse the identifier of a project owned by the authorized account.
A 24-character hexadecimal ID.
shotIdstringRequiredUse letters, numbers, underscores or hyphens.
Minimum length: 1 characters.
Maximum length: 120 characters.
revisionintegerRequiredMinimum: 0.
Maximum: 9007199254740991.
filmReferenceobjectOptionalShow nested fields
projectIdstringRequiredUse the identifier of a project owned by the authorized account.
A 24-character hexadecimal ID.
entityIdstringRequiredUse letters, numbers, underscores or hyphens.
Minimum length: 1 characters.
Maximum length: 120 characters.
revisionintegerRequiredMinimum: 0.
Maximum: 9007199254740991.
Request headers#
Authorization: Bearer $TONG_API_KEYContent-Type: application/jsonIdempotency-Key: 45be69f1-c266-4a09-a82c-bf3c6303eb03Keep one UUID for each intended action and reuse it after a timeout or retry. A different input with the same UUID is rejected.
Response fields#
An accepted request is not a finished generation. Track the saved job until its output is ready.
Accepted means the request was saved. Read its operation to follow execution.
{ "id": "e8aa0a87-6cd9-42eb-975a-b72bf43218c8", "tool": "tong_generation_submit", "category": "generation", "channel": "api", "state": "queued", "status": "accepted", "stage": "admission", "dispatch_status": "pending", "created_at": "2026-10-22T09:00:00.000Z", "updated_at": "2026-10-22T09:00:00.000Z", "detail_expires_at": null, "detail_expired": false, "timing": { "dispatch_started_at": null, "acknowledged_at": null, "completed_at": null, "dispatch_acknowledgement_ms": null, "end_to_end_ms": null }, "review": null, "result": null, "error": null, "billing": { "status": "pending", "usage_credits": "0.000000", "wallet_debited_credits": "0.000000" }}idstringRequiredThe unique ID of the saved operation.
A UUID, for example e8aa0a87-6cd9-42eb-975a-b72bf43218c8.
toolstringRequiredcategorystringRequiredchannelstringRequired"api""mcp"statestringRequiredThe current execution state of the saved work.
"queued""running""waiting""needs_review""paused""reconciling""succeeded""failed""cancelled"statusstringRequiredThe overall status to use when tracking the operation.
"accepted""running""needs_review""paused""reconciling""succeeded""failed""cancelled"stagestringRequiredThe current phase of the operation.
"admission""dispatch""review""generation""reconciliation""complete"dispatch_statusstringRequiredWhether the tool accepted the request. An acknowledgement does not mean generation is complete.
"pending""unknown""acknowledged"created_atstringRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
updated_atstringRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
detail_expires_atstring | nullRequiredWhen stored operation details expire. A null value means no expiry is currently set.
ISO 8601 date and time, for example 2026-10-22T09:00:00Z.
detail_expiredbooleanRequiredWhether the stored operation details have expired.
timingobjectRequiredTimestamps and elapsed times for tracking this operation.
Show nested fields
dispatch_started_atstring | nullRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
acknowledged_atstring | nullRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
completed_atstring | nullRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
dispatch_acknowledgement_msnumber | nullRequiredMinimum: 0.
end_to_end_msnumber | nullRequiredMinimum: 0.
reviewJSON | nullRequiredReview information when the operation needs human input; otherwise null.
resultJSON | nullRequiredThe output returned by this tool, or null while no output is available.
errorobject | nullRequiredThe public error code if the operation failed; otherwise null.
Show nested fields
codestringRequiredbillingobjectRequiredCustomer credit usage and wallet charges. Output readiness and billing settlement are separate.
Show nested fields
statusstringRequired"none""pending""settled""released""reconciling"usage_creditsstringRequiredA decimal string with six decimal places, for example 1.250000.
wallet_debited_creditsstringRequiredA decimal string with six decimal places, for example 1.250000.
released_creditsstringOptionalA decimal string with six decimal places, for example 1.250000.
refunded_creditsstringOptionalA decimal string with six decimal places, for example 1.250000.
unfunded_creditsstringOptionalA decimal string with six decimal places, for example 1.250000.
pending_creditsstringOptionalA decimal string with six decimal places, for example 1.250000.
tokensobjectOptionalShow nested fields
inputnumberOptionalMinimum: 0.
outputnumberOptionalMinimum: 0.
cachednumberOptionalMinimum: 0.
cache_writenumberOptionalMinimum: 0.
componentsobject[]OptionalShow nested fields
idstringOptionalsource_idstringRequiredtoolstringRequiredmodelstring | nullRequiredchannelstringRequired"api""mcp"credential_idstringRequiredkindstringRequired"text_pool""reasoning""generation"usage_creditsstringRequiredA decimal string with six decimal places, for example 1.250000.
wallet_debited_creditsstringRequiredA decimal string with six decimal places, for example 1.250000.
evidence_atstringOptionalISO 8601 date and time, for example 2026-10-22T09:00:00Z.
updated_atstringOptionalISO 8601 date and time, for example 2026-10-22T09:00:00Z.
quoteobjectOptionalThe quoted configuration, price and submission values, when a quote is available.
Show nested fields
idstringRequiredA UUID, for example e8aa0a87-6cd9-42eb-975a-b72bf43218c8.
operation_idstringRequiredA UUID, for example e8aa0a87-6cd9-42eb-975a-b72bf43218c8.
toolstringRequiredoperationstring | nullRequiredmodelstring | nullRequiredconfigurationobjectRequiredsubmit_valuestringRequiredsubmit_fieldstringRequiredquoted_creditsstring | nullRequiredA decimal string with six decimal places, for example 1.250000.
expires_atstring | nullRequiredISO 8601 date and time, for example 2026-10-22T09:00:00Z.
MCP call#
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "tong_generation_submit", "arguments": { "params": { "id": "000000000000000000000001" }, "body": { "quoteId": "fixture-image-quote-token", "prompt": "A quiet street at blue hour", "operation": "TEXT_TO_IMAGE", "inputAssetIds": [], "parameters": { "textToImageModel": "tong_ea55aff4f3b5c8aba3a35569", "ratio": "16:9" } } }, "_meta": { "io.tongai/idempotency-key": "45be69f1-c266-4a09-a82c-bf3c6303eb03" } }}REST requests wrap the tool arguments in input. MCP calls send the same arguments directly.
Response
{ "jsonrpc": "2.0", "id": 1, "result": { "structuredContent": { "id": "e8aa0a87-6cd9-42eb-975a-b72bf43218c8", "tool": "tong_generation_submit", "category": "generation", "channel": "mcp", "state": "queued", "status": "accepted", "stage": "admission", "dispatch_status": "pending", "created_at": "2026-10-22T09:00:00.000Z", "updated_at": "2026-10-22T09:00:00.000Z", "detail_expires_at": null, "detail_expired": false, "timing": { "dispatch_started_at": null, "acknowledged_at": null, "completed_at": null, "dispatch_acknowledgement_ms": null, "end_to_end_ms": null }, "review": null, "result": null, "error": null, "billing": { "status": "pending", "usage_credits": "0.000000", "wallet_debited_credits": "0.000000" } }, "content": [ { "type": "text", "text": "{\"id\":\"e8aa0a87-6cd9-42eb-975a-b72bf43218c8\",\"tool\":\"tong_generation_submit\",\"category\":\"generation\",\"channel\":\"mcp\",\"state\":\"queued\",\"status\":\"accepted\",\"stage\":\"admission\",\"dispatch_status\":\"pending\",\"created_at\":\"2026-10-22T09:00:00.000Z\",\"updated_at\":\"2026-10-22T09:00:00.000Z\",\"detail_expires_at\":null,\"detail_expired\":false,\"timing\":{\"dispatch_started_at\":null,\"acknowledged_at\":null,\"completed_at\":null,\"dispatch_acknowledgement_ms\":null,\"end_to_end_ms\":null},\"review\":null,\"result\":null,\"error\":null,\"billing\":{\"status\":\"pending\",\"usage_credits\":\"0.000000\",\"wallet_debited_credits\":\"0.000000\"}}" } ] }}Errors and limits#
| HTTP | Error | Recovery |
|---|---|---|
400 | Invalid requestREQUEST_INVALID | Correct the fields identified by the error before trying again. |
401 | Invalid credentialCREDENTIAL_INVALID | Check the credential, its expiry and whether it has been revoked. |
402 | Insufficient creditsINSUFFICIENT_CREDITS | Add credits to the account that owns the credential, then continue the saved work. |
403 | Permission deniedSCOPE_REQUIRED | Use a credential with the required scopes and access to the selected resource. |
404 | Resource unavailableRESOURCE_UNAVAILABLE | Check the resource ID and that it belongs to the authorized account. |
409 | Intent conflictIDEMPOTENCY_CONFLICT | Reuse an intent only with its original request. Use a new UUID for a different action. |
429 | Rate limitedRATE_LIMITED | Wait for Retry-After before retrying the same intended request. |
503 | Temporarily unavailableDEPENDENCY_UNAVAILABLE | Wait for Retry-After and retry with the same intent. Check the saved operation after a timeout. |