Skip to content

Cancel Job Invocation

apps.job_invocations.cancel(strjob_invocation_id, JobInvocationCancelParams**kwargs) -> JobInvocationCancelResponse
post/v2/apps/{app_id}/job-invocations/{job_invocation_id}/cancel

Cancel a specific job invocation for an app.

ParametersExpand Collapse
app_id: str
job_invocation_id: str
job_name: Optional[str]

The job name to list job invocations for.

ReturnsExpand Collapse
class JobInvocationCancelResponse:
id: Optional[str]
completed_at: Optional[datetime]
formatdate-time
created_at: Optional[datetime]
formatdate-time
deployment_id: Optional[str]
job_name: Optional[str]
phase: Optional[Literal["UNKNOWN", "PENDING", "RUNNING", 4 more]]

The phase of the job invocation

Accepts one of the following:
"UNKNOWN"
"PENDING"
"RUNNING"
"SUCCEEDED"
"FAILED"
"CANCELED"
"SKIPPED"
started_at: Optional[datetime]
formatdate-time
trigger: Optional[Trigger]
manual: Optional[TriggerManual]

Details about the manual trigger, if applicable

user: Optional[TriggerManualUser]

The user who triggered the job

email: Optional[str]
formatemail
full_name: Optional[str]
uuid: Optional[str]
scheduled: Optional[TriggerScheduled]

The schedule for the job

schedule: Optional[TriggerScheduledSchedule]
cron: Optional[str]

The cron expression defining the schedule

time_zone: Optional[str]

The time zone for the schedule

type: Optional[Literal["MANUAL", "SCHEDULE", "UNKNOWN"]]

The type of trigger that initiated the job invocation.

Accepts one of the following:
"MANUAL"
"SCHEDULE"
"UNKNOWN"
Cancel Job Invocation
from gradient import Gradient

client = Gradient(
    access_token="My Access Token",
)
response = client.apps.job_invocations.cancel(
    job_invocation_id="123e4567-e89b-12d3-a456-426",
    app_id="4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf",
)
print(response.id)
{
  "job_invocation": [
    {
      "id": "ba32b134-569c-4c0c-ba02-8ffdb0492ece",
      "job_name": "good-job",
      "deployment_id": "c020763f-ddb7-4112-a0df-7f01c69fc00b",
      "phase": "SUCCEEDED",
      "created_at": "2025-09-11T11:04:05Z",
      "started_at": "2025-09-11T11:04:10Z",
      "completed_at": "2025-09-11T11:04:40Z",
      "trigger": [
        {
          "type": "SCHEDULED",
          "scheduled": [
            {
              "schedule": {
                "cron": "*/2 * * * *",
                "time_zone": "UTC"
              }
            }
          ]
        }
      ]
    }
  ]
}
Returns Examples
{
  "job_invocation": [
    {
      "id": "ba32b134-569c-4c0c-ba02-8ffdb0492ece",
      "job_name": "good-job",
      "deployment_id": "c020763f-ddb7-4112-a0df-7f01c69fc00b",
      "phase": "SUCCEEDED",
      "created_at": "2025-09-11T11:04:05Z",
      "started_at": "2025-09-11T11:04:10Z",
      "completed_at": "2025-09-11T11:04:40Z",
      "trigger": [
        {
          "type": "SCHEDULED",
          "scheduled": [
            {
              "schedule": {
                "cron": "*/2 * * * *",
                "time_zone": "UTC"
              }
            }
          ]
        }
      ]
    }
  ]
}