Cancel a campaign
POST
https://api.voice-agent.gowajee.ai/api/campaign/:id/cancelSets the campaign to CANCELLED. This cannot be undone. You can cancel a campaign that is DRAFT, SCHEDULED,
RUNNING or PAUSED.
- Calls waiting to be dialled become
CANCELLED. No webhook is sent for them. - Calls already ringing or in a conversation finish normally, and their results are still delivered.
- To only stop for a while, use pause instead.
Path parameters
Section titled “Path parameters”| Name | Description |
|---|---|
id |
The campaign ID. |
No request body.
Request
Section titled “Request”curl -X POST "https://api.voice-agent.gowajee.ai/api/campaign/eac2489c-672c-455e-ab8c-4e0ecd18d7dc/cancel" \ -H "X-API-Key: $GOWAJEE_API_KEY"const res = await fetch(`https://api.voice-agent.gowajee.ai/api/campaign/${campaignId}/cancel`, { method: 'POST', headers: { 'X-API-Key': process.env.GOWAJEE_API_KEY },});res = requests.post( f"https://api.voice-agent.gowajee.ai/api/campaign/{campaign_id}/cancel", headers={"X-API-Key": os.environ["GOWAJEE_API_KEY"]}, timeout=30,)Response
Section titled “Response”{ "success": true, "message": "Campaign status updated to CANCELLED successfully", "data": { "id": "eac2489c-672c-455e-ab8c-4e0ecd18d7dc", "status": "CANCELLED" }}data.status is the campaign’s status after the request.
{ "success": true, "message": "Campaign is already CANCELLED", "data": { "id": "eac2489c-672c-455e-ab8c-4e0ecd18d7dc", "status": "CANCELLED" }}Cancelling a campaign that is already CANCELLED succeeds and changes nothing, so it is safe to send twice.
{ "success": false, "statusCode": 409, "code": "INVALID_CAMPAIGN_STATE", "message": "Cannot cancel a COMPLETED campaign", "errors": ["Cannot cancel a COMPLETED campaign"]}{ "success": false, "statusCode": 404, "code": "CAMPAIGN_NOT_FOUND", "message": "Campaign not found", "errors": ["Campaign not found"]}Errors
Section titled “Errors”The body is the usual error envelope.
| Status | code |
message |
Cause |
|---|---|---|---|
400 |
INVALID_ID |
id must be a valid UUID |
The id in the path isn’t a UUID. |
404 |
CAMPAIGN_NOT_FOUND |
Campaign not found |
Wrong id, or the campaign belongs to another organization. |
409 |
INVALID_CAMPAIGN_STATE |
Cannot cancel a <STATUS> campaign |
A COMPLETED or EXPIRED campaign can’t be cancelled. It has already finished. See State rules. |