Campaigns

Cancel a campaign run

Best-effort cancellation: pending recipients are skipped, while deliveries already handed off for sending may finish. Returns the updated run.

POST
/v1/campaigns/{id}/runs/{runId}/cancel

Best-effort cancellation: pending recipients are skipped, while deliveries already handed off for sending may finish. Returns the updated run.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^camp_[0-9a-hjkmnp-tv-z]{16,24}$
runId*string
Match^crun_[0-9a-hjkmnp-tv-z]{16,24}$

Response Body

CampaignRunAction

application/json
  1. response
success*boolean
item*
Example Request
import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.campaigns.cancelRun({  "id": "example",  "runId": "example"});
Example Response
{  "success": true,  "item": {    "id": "string",    "campaignId": "string",    "status": "scheduled",    "scheduledFor": "string",    "idempotencyKey": "string",    "startedAt": "string",    "completedAt": "string",    "contentSnapshot": {      "channel": "email",      "email": {        "subject": "string",        "html": "string",        "text": "string",        "attachments": [          {            "filename": "string",            "content": "string",            "mediaId": "string",            "contentType": "string",            "size": 1          }        ],        "publicationId": "string",        "inputContractId": "string",        "templateId": "string",        "templateSlug": "string",        "templateData": {          "property1": "string",          "property2": "string"        },        "locale": "string",        "timeZone": "string",        "inReplyToMessageId": "string",        "replyTo": [          "string"        ],        "topicId": "string",        "tracking": {          "opens": true,          "clicks": true        },        "footer": {          "enabled": true        },        "headers": {          "property1": "string",          "property2": "string"        },        "preheader": "string"      },      "issue": {        "path": "string",        "commit": "string"      },      "from": {        "email": "string",        "name": "string"      },      "replyMailboxId": "string",      "conversationId": "string",      "metadata": {        "property1": "string",        "property2": "string"      }    },    "audienceSnapshot": {      "topicId": "string",      "includeTags": [        "string"      ],      "excludeTags": [        "string"      ],      "contactIds": [        "string"      ],      "groupIds": [        "string"      ]    },    "policySnapshot": {      "pageSize": 100    },    "totalRecipients": 0,    "dispatchedCount": 0,    "failedCount": 0,    "skippedCount": 0,    "pendingCount": 0,    "skippedReasons": [      {        "reason": "unsubscribed",        "count": 0      }    ],    "estimatedCompletionAt": "string",    "failureReason": "string",    "holdReason": "string",    "holdDomainId": "string",    "holdUntil": "string",    "capacityWarning": "string",    "lastContactId": "string",    "createdBy": "string",    "actorEmail": "string",    "memberRole": "string",    "createdAt": "string",    "updatedAt": "string"  }}

Related documentation