Skip to main content

Deleting a campaign

Contents​

Overview​

PropertyValue
Call namedelete-campaign
Endpoint URLhttps://{API hostname}/internal/delete-campaign
Request methodsDELETE
Request Content-Typeapplication/json, application/x-www-form-urlencoded
Response Content-Typeapplication/json
Auth requiredyes

The delete-campaign endpoint deletes an existing campaign. When a campaign is deleted, any webhooks associated with the campaign are also deleted. The campaign is set to inactive and marked as deleted.

Version-specific information​

There is currently no version-specific information for this endpoint.

Permissions and authentication​

The performing user needs to be logged in and have write access to the entity (business or chain) to which the campaign is connected. The user must have permissions_business_chain_campaign set to true in the permissions table.

If the chain has restrict_campaign_enable set to true, deleting a campaign that is currently active additionally requires the campaign_enable permission (or super user access). Inactive campaigns can be deleted without the campaign_enable permission.

HTTP parameters​

The following HTTP parameters can be passed to the API:

ParameterDescription
campaign_id(integer, mandatory) The ID of the campaign to delete.

Headers​

The following headers can/must be passed to the API call:

ParameterDescription
N/AN/A

Sample request​

curl -X DELETE https://{API hostname}/internal/delete-campaign \
-H "X-Spaaza-Session-User-Id: 1548854" \
-H "X-Spaaza-Session-Key: 564e5b4faa7f639dacf1983f1dae62155d5734b789b06b5986c43bfe2542854e" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 1234
}'

Sample response​

Returns an OK code and a JSON representation confirming the deletion:

{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"campaign_id": 1234,
"is_active": false,
"is_deleted": true,
"result_type": "delete-campaign"
}
}

Possible error responses​

The following represents a list of possible error responses for the delete-campaign endpoint:

CodeName and DescriptionHTTP Status Code
6no_valid_session
The user needs to be logged in and a valid session key needs to be sent
401
68permission_denied_or_non_existent
This user has insufficient permissions for this object or the object does not exist.
403
244campaign_id_invalid
The campaign_id passed must be an integer
400
245campaign_id_not_present
The campaign_id must be passed as a parameter
400
246campaign_id_not_found
The campaign_id supplied could not be found.
404