Skip to content

Cancel Job Invocation

client.Apps.JobInvocations.Cancel(ctx, appID, jobInvocationID, body) (*AppJobInvocationCancelResponse, error)
post/v2/apps/{app_id}/job-invocations/{job_invocation_id}/cancel

Cancel a specific job invocation for an app.

ParametersExpand Collapse
appID string
jobInvocationID string
body AppJobInvocationCancelParams
JobName param.Field[string]optional

The job name to list job invocations for.

ReturnsExpand Collapse
type AppJobInvocationCancelResponse struct{…}
ID stringoptional
CompletedAt Timeoptional
formatdate-time
CreatedAt Timeoptional
formatdate-time
DeploymentID stringoptional
JobName stringoptional
Phase AppJobInvocationCancelResponsePhaseoptional

The phase of the job invocation

Accepts one of the following:
const AppJobInvocationCancelResponsePhaseUnknown AppJobInvocationCancelResponsePhase = "UNKNOWN"
const AppJobInvocationCancelResponsePhasePending AppJobInvocationCancelResponsePhase = "PENDING"
const AppJobInvocationCancelResponsePhaseRunning AppJobInvocationCancelResponsePhase = "RUNNING"
const AppJobInvocationCancelResponsePhaseSucceeded AppJobInvocationCancelResponsePhase = "SUCCEEDED"
const AppJobInvocationCancelResponsePhaseFailed AppJobInvocationCancelResponsePhase = "FAILED"
const AppJobInvocationCancelResponsePhaseCanceled AppJobInvocationCancelResponsePhase = "CANCELED"
const AppJobInvocationCancelResponsePhaseSkipped AppJobInvocationCancelResponsePhase = "SKIPPED"
StartedAt Timeoptional
formatdate-time
Trigger AppJobInvocationCancelResponseTriggeroptional
Manual AppJobInvocationCancelResponseTriggerManualoptional

Details about the manual trigger, if applicable

User AppJobInvocationCancelResponseTriggerManualUseroptional

The user who triggered the job

Email stringoptional
formatemail
FullName stringoptional
Uuid stringoptional
Scheduled AppJobInvocationCancelResponseTriggerScheduledoptional

The schedule for the job

Schedule AppJobInvocationCancelResponseTriggerScheduledScheduleoptional
Cron stringoptional

The cron expression defining the schedule

TimeZone stringoptional

The time zone for the schedule

Type AppJobInvocationCancelResponseTriggerTypeoptional

The type of trigger that initiated the job invocation.

Accepts one of the following:
const AppJobInvocationCancelResponseTriggerTypeManual AppJobInvocationCancelResponseTriggerType = "MANUAL"
const AppJobInvocationCancelResponseTriggerTypeSchedule AppJobInvocationCancelResponseTriggerType = "SCHEDULE"
const AppJobInvocationCancelResponseTriggerTypeUnknown AppJobInvocationCancelResponseTriggerType = "UNKNOWN"
Cancel Job Invocation
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Apps.JobInvocations.Cancel(
    context.TODO(),
    "4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf",
    "123e4567-e89b-12d3-a456-426",
    gradient.AppJobInvocationCancelParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
              }
            }
          ]
        }
      ]
    }
  ]
}