GET /api/jobs/:id
Retrieves the current status and metadata for a specific job.
Path Parameters
The unique job identifier returned from /api/generate.
Response
Always "success" if the job exists.
Job details object containing the following fields: The job’s unique identifier (UUID).
Current job state. One of: queued, running, completed, failed, cancelled. See Job States for details. Whether cancellation has been requested for this job.
File path to the generated video. Only present when state is completed. Example: "/home/user/MoneyPrinter/output.mp4"
Error description if state is failed. Otherwise null.
ISO 8601 timestamp when the job was created. Example: "2024-03-15T10:30:00.000Z"
ISO 8601 timestamp when the job started processing. null if still queued.
ISO 8601 timestamp when the job finished (completed or failed). null if still in progress.
Example Request
curl http://localhost:8080/api/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890
Example Response
{
"status" : "success" ,
"job" : {
"id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890" ,
"state" : "running" ,
"cancelRequested" : false ,
"resultPath" : null ,
"errorMessage" : null ,
"createdAt" : "2024-03-15T10:30:00.000Z" ,
"startedAt" : "2024-03-15T10:30:05.123Z" ,
"completedAt" : null
}
}
Error Response
{
"status" : "error" ,
"message" : "Job not found."
}
HTTP Status: 404 Not Found
GET /api/jobs/:id/events
Retrieves progress events for a specific job. Supports incremental polling by providing the last received event ID.
Path Parameters
The unique job identifier.
Query Parameters
Return only events with an ID greater than this value. Used for incremental polling. Example: after=42 returns events with ID 43, 44, 45, etc.
Response
Always "success" if the job exists.
Array of event objects, ordered by creation time (oldest first). Unique event identifier. Use this value in the after query parameter for incremental polling.
Event type. Typically "log" for progress messages. See Events for all event types. Log level: info, success, warning, error.
Human-readable event message. Examples:
"Generating script..."
"Searching for footage..."
"Rendering video..."
Optional structured data associated with the event. Contents vary by event type.
Unix timestamp (seconds since epoch) when the event was created. Example: 1710499800.123
Example Request
# Get all events
curl http://localhost:8080/api/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890/events
# Get events after ID 42
curl http://localhost:8080/api/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890/events?after= 42
Example Response
{
"status" : "success" ,
"events" : [
{
"id" : 43 ,
"type" : "log" ,
"level" : "info" ,
"message" : "Generating script..." ,
"payload" : null ,
"timestamp" : 1710499805.123
},
{
"id" : 44 ,
"type" : "log" ,
"level" : "success" ,
"message" : "Script generated successfully" ,
"payload" : { "wordCount" : 250 },
"timestamp" : 1710499812.456
},
{
"id" : 45 ,
"type" : "log" ,
"level" : "info" ,
"message" : "Searching for footage..." ,
"payload" : null ,
"timestamp" : 1710499813.789
}
]
}
Error Response
{
"status" : "error" ,
"message" : "Job not found."
}
HTTP Status: 404 Not Found
POST /api/jobs/:id/cancel
Requests cancellation of a specific job. The job will be cancelled gracefully at the next checkpoint.
Path Parameters
The unique job identifier to cancel.
Response
"success" if cancellation was requested.
Always "Cancellation requested."
Example Request
curl -X POST http://localhost:8080/api/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel
Example Response
{
"status" : "success" ,
"message" : "Cancellation requested."
}
Error Response
{
"status" : "error" ,
"message" : "Job not found."
}
HTTP Status: 404 Not Found
Cancellation is not immediate. The job will be cancelled at the next safe checkpoint. Check the cancelRequested field in the job status to confirm the request was received.
POST /api/cancel
Cancels the latest active job (running or queued). Prioritizes running jobs over queued jobs.
This endpoint cancels ANY active job, not a specific one. Use POST /api/jobs/:id/cancel to cancel a specific job.
Response
"success" if a job was found and cancellation was requested.
Always "Cancellation requested."
The ID of the job that was cancelled.
Example Request
curl -X POST http://localhost:8080/api/cancel
Example Response
{
"status" : "success" ,
"message" : "Cancellation requested." ,
"jobId" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Error Response
{
"status" : "error" ,
"message" : "No active job found."
}
HTTP Status: 404 Not Found