Skip to content
Start here

Cancel a bulk action job

client.EmailSecurity.Investigate.Bulk.Cancel.New(ctx, jobID, body) (*InvestigateBulkCancelNewResponse, error)
POST/accounts/{account_id}/email-security/investigate/bulk/{job_id}/cancel

Marks the job as cancelled and stops any pending message processing. The job record remains visible in list and detail endpoints.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloud Email Security: Write
ParametersExpand Collapse
jobID string
formatuuid
body InvestigateBulkCancelNewParams
AccountID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type InvestigateBulkCancelNewResponse struct{…}
ActionParams InvestigateBulkCancelNewResponseActionParams
One of the following:
type InvestigateBulkCancelNewResponseActionParamsMove struct{…}
Destination InvestigateBulkCancelNewResponseActionParamsMoveDestination
One of the following:
const InvestigateBulkCancelNewResponseActionParamsMoveDestinationInbox InvestigateBulkCancelNewResponseActionParamsMoveDestination = "Inbox"
const InvestigateBulkCancelNewResponseActionParamsMoveDestinationJunkEmail InvestigateBulkCancelNewResponseActionParamsMoveDestination = "JunkEmail"
const InvestigateBulkCancelNewResponseActionParamsMoveDestinationDeletedItems InvestigateBulkCancelNewResponseActionParamsMoveDestination = "DeletedItems"
const InvestigateBulkCancelNewResponseActionParamsMoveDestinationRecoverableItemsDeletions InvestigateBulkCancelNewResponseActionParamsMoveDestination = "RecoverableItemsDeletions"
const InvestigateBulkCancelNewResponseActionParamsMoveDestinationRecoverableItemsPurges InvestigateBulkCancelNewResponseActionParamsMoveDestination = "RecoverableItemsPurges"
Type InvestigateBulkCancelNewResponseActionParamsMoveType
ExpectedDisposition InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionOptional
One of the following:
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionMalicious InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "MALICIOUS"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionMaliciousBec InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "MALICIOUS-BEC"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionSuspicious InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "SUSPICIOUS"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionSpoof InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "SPOOF"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionSpam InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "SPAM"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionBulk InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "BULK"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionEncrypted InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "ENCRYPTED"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionExternal InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "EXTERNAL"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionUnknown InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "UNKNOWN"
const InvestigateBulkCancelNewResponseActionParamsMoveExpectedDispositionNone InvestigateBulkCancelNewResponseActionParamsMoveExpectedDisposition = "NONE"
type InvestigateBulkCancelNewResponseActionParamsRelease struct{…}
Type InvestigateBulkCancelNewResponseActionParamsReleaseType
ActionType InvestigateBulkCancelNewResponseActionType
One of the following:
const InvestigateBulkCancelNewResponseActionTypeMove InvestigateBulkCancelNewResponseActionType = "MOVE"
const InvestigateBulkCancelNewResponseActionTypeRelease InvestigateBulkCancelNewResponseActionType = "RELEASE"
CreatedAt Time
formatdate-time
JobID string
formatuuid
MessagesFailed int64
MessagesPending int64
MessagesSuccessful int64
SearchParams InvestigateBulkCancelNewResponseSearchParams
DeprecatedActionLog boolOptional

Deprecated, use GET /investigate/{investigate_id}/action_log instead. End of life: November 1, 2026.

AlertID stringOptional
DeliveryStatus InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusOptional

Delivery status of the message.

One of the following:
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusDelivered InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "delivered"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusMoved InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "moved"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusQuarantined InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "quarantined"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusRejected InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "rejected"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusDeferred InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "deferred"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusBounced InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "bounced"
const InvestigateBulkCancelNewResponseSearchParamsDeliveryStatusQueued InvestigateBulkCancelNewResponseSearchParamsDeliveryStatus = "queued"
DetectionsOnly boolOptional
Domain stringOptional
End TimeOptional

End of search date range

formatdate-time
ExactSubject stringOptional
FinalDisposition InvestigateBulkCancelNewResponseSearchParamsFinalDispositionOptional
One of the following:
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionMalicious InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "MALICIOUS"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionMaliciousBec InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "MALICIOUS-BEC"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionSuspicious InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "SUSPICIOUS"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionSpoof InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "SPOOF"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionSpam InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "SPAM"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionBulk InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "BULK"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionEncrypted InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "ENCRYPTED"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionExternal InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "EXTERNAL"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionUnknown InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "UNKNOWN"
const InvestigateBulkCancelNewResponseSearchParamsFinalDispositionNone InvestigateBulkCancelNewResponseSearchParamsFinalDisposition = "NONE"
MessageAction InvestigateBulkCancelNewResponseSearchParamsMessageActionOptional
One of the following:
const InvestigateBulkCancelNewResponseSearchParamsMessageActionPreview InvestigateBulkCancelNewResponseSearchParamsMessageAction = "PREVIEW"
const InvestigateBulkCancelNewResponseSearchParamsMessageActionQuarantineReleased InvestigateBulkCancelNewResponseSearchParamsMessageAction = "QUARANTINE_RELEASED"
const InvestigateBulkCancelNewResponseSearchParamsMessageActionMoved InvestigateBulkCancelNewResponseSearchParamsMessageAction = "MOVED"
MessageID stringOptional
Metric stringOptional
Query stringOptional
Recipient stringOptional
Sender stringOptional
Start TimeOptional

Beginning of search date range

formatdate-time
Subject stringOptional
Submissions boolOptional
Status InvestigateBulkCancelNewResponseStatus
One of the following:
const InvestigateBulkCancelNewResponseStatusPending InvestigateBulkCancelNewResponseStatus = "PENDING"
const InvestigateBulkCancelNewResponseStatusDiscovering InvestigateBulkCancelNewResponseStatus = "DISCOVERING"
const InvestigateBulkCancelNewResponseStatusProcessing InvestigateBulkCancelNewResponseStatus = "PROCESSING"
const InvestigateBulkCancelNewResponseStatusCompleted InvestigateBulkCancelNewResponseStatus = "COMPLETED"
const InvestigateBulkCancelNewResponseStatusFailed InvestigateBulkCancelNewResponseStatus = "FAILED"
const InvestigateBulkCancelNewResponseStatusCancelled InvestigateBulkCancelNewResponseStatus = "CANCELLED"
const InvestigateBulkCancelNewResponseStatusSkipped InvestigateBulkCancelNewResponseStatus = "SKIPPED"
TotalMessagesDiscovered int64
Comment stringOptional
CompletedAt TimeOptional
formatdate-time
StartedAt TimeOptional
formatdate-time
StatusMessage stringOptional

Cancel a bulk action job

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  cancel, err := client.EmailSecurity.Investigate.Bulk.Cancel.New(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    email_security.InvestigateBulkCancelNewParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", cancel.JobID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "action_params": {
      "destination": "Inbox",
      "type": "MOVE",
      "expected_disposition": "MALICIOUS"
    },
    "action_type": "MOVE",
    "created_at": "2019-12-27T18:11:19.117Z",
    "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "messages_failed": 0,
    "messages_pending": 0,
    "messages_successful": 0,
    "search_params": {
      "action_log": true,
      "alert_id": "alert_id",
      "delivery_status": "delivered",
      "detections_only": true,
      "domain": "domain",
      "end": "2022-07-25T14:30:00Z",
      "exact_subject": "exact_subject",
      "final_disposition": "MALICIOUS",
      "message_action": "PREVIEW",
      "message_id": "message_id",
      "metric": "metric",
      "query": "query",
      "recipient": "recipient",
      "sender": "sender",
      "start": "2022-06-25T14:30:00Z",
      "subject": "subject",
      "submissions": true
    },
    "status": "PENDING",
    "total_messages_discovered": 0,
    "comment": "comment",
    "completed_at": "2019-12-27T18:11:19.117Z",
    "started_at": "2019-12-27T18:11:19.117Z",
    "status_message": "status_message"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "action_params": {
      "destination": "Inbox",
      "type": "MOVE",
      "expected_disposition": "MALICIOUS"
    },
    "action_type": "MOVE",
    "created_at": "2019-12-27T18:11:19.117Z",
    "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "messages_failed": 0,
    "messages_pending": 0,
    "messages_successful": 0,
    "search_params": {
      "action_log": true,
      "alert_id": "alert_id",
      "delivery_status": "delivered",
      "detections_only": true,
      "domain": "domain",
      "end": "2022-07-25T14:30:00Z",
      "exact_subject": "exact_subject",
      "final_disposition": "MALICIOUS",
      "message_action": "PREVIEW",
      "message_id": "message_id",
      "metric": "metric",
      "query": "query",
      "recipient": "recipient",
      "sender": "sender",
      "start": "2022-06-25T14:30:00Z",
      "subject": "subject",
      "submissions": true
    },
    "status": "PENDING",
    "total_messages_discovered": 0,
    "comment": "comment",
    "completed_at": "2019-12-27T18:11:19.117Z",
    "started_at": "2019-12-27T18:11:19.117Z",
    "status_message": "status_message"
  },
  "success": true
}