Link Search Menu Expand Document

Add or alter campaign groups

This endpoint allows you to add or alter campaign groups.

Contents

Overview

Call name alter-campaign-group
Endpoint URL https://api0.spaaza.com/internal/alter-campaign-group
Request methods POST, PUT
Request Content-Type application/json, application/x-www-form-urlencoded
Response Content-Type application/json
Auth required yes

Version-specific information

This endpoint is available from version 1.0.

Permissions and authentication

This endpoint requires admin authentication with WRITE access to the chain.

HTTP parameters

Parameter Description
chain_id (integer, mandatory) The ID of the chain
id (integer, conditional) The ID of the campaign group to update. Required for updates, omit for creation
name (string, conditional, max=255) The name of the campaign group. Required for creation
active_date_from (datetime, optional) The start date for the campaign group in YYYY-MM-DD HH:MM:SS format
active_date_until (datetime, optional) The end date for the campaign group in YYYY-MM-DD HH:MM:SS format

Headers

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

Parameter Description
N/A N/A

Sample request

Creating a new campaign group

curl -X POST https://api0.spaaza.com/internal/alter-campaign-group \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "chain_id": 123,
    "name": "Summer Campaign Group",
    "active_date_from": "2025-06-01 00:00:00",
    "active_date_until": "2025-08-31 23:59:59"
  }'

Updating an existing campaign group

curl -X PUT https://api0.spaaza.com/internal/alter-campaign-group \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "chain_id": 123,
    "id": 456,
    "name": "Updated Summer Campaign Group",
    "active_date_from": "2025-06-15 00:00:00",
    "active_date_until": "2025-09-15 23:59:59"
  }'

Sample response

{
  "result": "ok",
  "data": {
    "id": 456,
    "chain_id": 123,
    "name": "Summer Campaign Group",
    "active_date_from": "2025-06-01 00:00:00",
    "active_date_until": "2025-08-31 23:59:59",
    "created_at": "2025-08-12 14:30:00",
    "updated_at": "2025-08-12 14:30:00"
  }
}

Possible error responses

Error code Error name HTTP status Description
6 no_valid_session 401 The user needs to be logged in and a valid session key needs to be sent
68 permission_denied_or_non_existent 403 This user has insufficient permissions for this object or the object does not exist
217 chain_id_not_found 400 No record has been found for that chain_id
417 string_parameter_too_long 400 One of the parameters passed is too long
419 parameter_invalid 400 One of the parameters is invalid and should be in a different format
441 parameter_missing 400 A parameter is missing
462 parameter_mismatch 400 Parameters supplied do not match