Cancel Job
Endpoint: Cancel Job
This endpoint allows users to cancel a specific job associated with an app. The job is identified by its job_id
, and the app it belongs to is identified by its app_id
. A job can only be canceled if it is still in progress or queued.
URL
PUT https://api.rungen.ai/app/{app_id}/job/{job_id}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
app_id | String | Yes | The unique identifier of the app the job belongs to. |
job_id | String | Yes | The unique identifier of the job to cancel. |
Headers
Header | Type | Required | Description |
---|---|---|---|
X-Authenticated-User-Id | String | Yes | The unique identifier of the user canceling the job. |
x-api-key | String | Yes | Your API key for authentication. |
x-team-id | String | No | The unique identifier for the team. If omitted, the request operates in the user's personal context. |
Example Request
curl --location --request PUT 'https://api.rungen.ai/app/48cfa519-f5fc-4bf1-8476-1345536a2c7a/job/09e04b85-2ff2-4f1b-acf0-ae97ce3bafb8' \
--header 'X-Authenticated-User-Id: ee4988a7-48e2-44ae-81f5-178a44ebeb58' \
--header 'x-api-key: 123456789abc'
Response
Success
Status Code: 200 OK
Response Body:
{
"data": {
"job_id": "09e04b85-2ff2-4f1b-acf0-ae97ce3bafb8",
"status": "CANCELED"
}
}
Response Fields
Field | Type | Description |
---|---|---|
data.job_id | String | The unique identifier of the canceled job. |
data.status | String | The updated status of the job (CANCELED ). |
Error Responses
Status Code: 404 Not Found
Example Response Body:
{
"error": "Job with ID '09e04b85-2ff2-4f1b-acf0-ae97ce3bafb8' not found for App ID '48cfa519-f5fc-4bf1-8476-1345536a2c7a'."
}
Status Code: 403 Forbidden
Example Response Body:
{
"error": "Unauthorized access. Invalid API key."
}
Status Code: 409 Conflict
Example Response Body:
{
"error": "Job cannot be canceled because it has already completed."
}
Notes
- Job Status: A job can only be canceled if it is in the
QUEUED
orRUNNING
state. Attempting to cancel a job that isCOMPLETED
orFAILED
will result in a conflict error. - Authentication: Ensure the
x-api-key
andX-Authenticated-User-Id
headers are valid. If working within a team context, include thex-team-id
header to access team jobs. - Team Context: If the
x-team-id
header is provided, the cancellation action will apply to the job within the specified team.