Campaigns API - Stannp Direct Mail API Documentation

List campaigns

Use the API to get a list of your campaigns.

[GET]
https://api-eu1.stannp.com/v1/campaigns/list

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/list" \
-u {API_KEY}:
    

Response Example

{
  "success": true,
  "data": [
    {
      "id": "222",
      "account_id": "9",
      "name": "a5 test",
      "template_id": "0",
      "type": "a5-postcard",
      "trigger_date": null,
      "send_date": null,
      "trigger_offset": null,
      "created": "2015-04-26T10:40:00Z",
      "updated": "2015-04-26T10:40:00Z",
      "status": "draft",
      "recipients_group": "0",
      "recipients_filter": "",
      "recipients_validated": "valid",
      "recipients": "0",
      "recipients_not_valid": "0",
      "dispatched": "0",
      "cost": "0.00",
      "voucher_code": "",
      "image": null
    },
    {
      "id": "221",
      "account_id": "9",
      "name": "April Campaign",
      "template_id": "195",
      "type": "a6-postcard",
      "trigger_date": null,
      "send_date": null,
      "trigger_offset": null,
      "created": "2015-04-26T10:15:40Z",
      "updated": "2015-04-26T10:15:40Z",
      "status": "draft",
      "recipients_group": "0",
      "recipients_filter": "",
      "recipients_validated": "valid",
      "recipients": "0",
      "recipients_not_valid": "0",
      "dispatched": "0",
      "cost": "0.00",
      "voucher_code": "",
      "image": "https://api-eu1.stannp.com/v1/uploads/9/image-1430044053.webp"
    }
  ]
}

Get a single campaign

Use the API to get the details for a campaign specified with id.

[GET]
https://api-eu1.stannp.com/v1/campaigns/get/:id

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/get/:id" \
-u {API_KEY}:
    

Response Example

{
  "success": true,
  "data": {
    "id": "126",
    "name": "Stannp Test Campaign",
    "template_id": "111",
    "type": "a6-postcard",
    "trigger_date": null,
    "send_date": null,
    "trigger_offset": null,
    "created": "2015-03-17 11:04:19",
    "updated": "2015-03-21 09:10:05",
    "status": "dispatched",
    "recipients_group": "15",
    "recipients_filter": "",
    "recipients_validated": "valid",
    "recipients": "232",
    "recipients_not_valid": "0",
    "cost": "0.00",
    "voucher_code": "",
    "image": "https://api-eu1.stannp.com/v1/uploads/9/image-1426590259.webp",
    "size": "A6"
  }
}

Create a new campaign

Use the API to create a campaign on our platform.

[POST]
https://api-eu1.stannp.com/v1/campaigns/create

Parameters

ParameterDetailsDescription
name
body str required
Name your campaign for reference.
type
body str required
The type of campaign this will be.
template_id
body int required
A template ID to make a copy of. If left out or set to "0" then a blank template of the correct format will be used.
file
body file optional
A single or multi-page PDF file to use as the design artwork. Can be a URL or binary file.
front
body file optional
A PDF or JPG file to use as the front image. Can be a URL or binary file.
back
body file optional
A PDF or JPG file to use as the back image. Can be a URL or binary file.
size
body str optional
Required when using file or front & back images. Example "A4" or "A5" or "A6".
save
body bool optional
Optional when using file or front & back images. Save the uploaded file as a new design template on your account.
group_id
body int required
A group ID.
what_recipients
body str optional
What recipients do you want this campaign to go to? "all" is every recipient in the group. "valid" sends to only UK validated addresses. "not_valid" sends to only UK non-validated addresses. "int" sends to only international addresses.
addons
body str optional
If you have an addon code.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/create" \
-u {API_KEY}: \
-d "name=My Campaign" \
-d "type=A6-postcard" \
-d "template_id=12345" \
-d "group_id=12345" 
    

Response Example

{
  "success": true,
  "data": {
    "id": "266"
  }
}

Produce a sample

Use the API to produce a PDF sample of your campaign. This link will be valid for 30 minutes.

[POST]
https://api-eu1.stannp.com/v1/campaigns/sample

Parameters

ParameterDetailsDescription
id
body int required
The id of the campaign to produce a sample for.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/sample" \
-u {API_KEY}: \
-d "id=0" 
    

Response Example

{
  "success": true,
  "data": "https://stannpstorage.blob.core.windows.net/pdf-samples/12345_12345678_sample_11234567890-GDBNYWVCJBJIBVGGVC.pdf"
}

Approve a campaign

When approving a campaign you take full responsibility for any spelling mistakes or design flaws. Once approved we will select all recipient data at this point and future changes to the same data will not apply to this campaign. This campaign will then be locked so you will be unable to make changes to the design or recipient selection.

[POST]
https://api-eu1.stannp.com/v1/campaigns/approve

Parameters

ParameterDetailsDescription
id
body int required
The id of the campaign to approve.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/approve" \
-u {API_KEY}: \
-d "id=0" 
    

Response Example

{
  "success": true,
  "data": true
}

Campaign Cost

Use the API to obtain the rates of your campaign and the breakdown of recipients.

[POST]
https://api-eu1.stannp.com/v1/campaigns/cost

Parameters

ParameterDetailsDescription
id
body int required
The id of the campaign to find out the cost of booking.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/cost" \
-u {API_KEY}: \
-d "id=0" 
    

Response Example

{
  "success": true,
  "data": {
    "rate": "0.41",
    "non_valid_rate": "0.51",
    "delivery_rate": "0.00",
    "international_rate": "0.00",
    "valid": "14.35",
    "not_valid": "191.25",
    "international": "0.00",
    "delivery_charge": "0.00",
    "net": "205.60",
    "vat": "41.12",
    "total": "246.72"
  }
}

Available Booking Dates

Use the API to get the available dates you can use to book your campaign.

[POST]
https://api-eu1.stannp.com/v1/campaigns/availableDates

Parameters

ParameterDetailsDescription
start
body date optional
YYYY-mm-dd (defaults to today).
end
body date optional
YYYY-mm-dd (defaults to 30 days time).

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/availableDates" \
-u {API_KEY}: \
-d "start=2025-11-03" \
-d "end=2025-12-03" 
    

Response Example

{
  "success": true,
  "data": [
    "2024-10-09",
    "2024-10-10",
    "2024-10-11",
    "2024-10-12",
    "2024-10-13",
    "2024-10-14",
    "2024-10-15",
    "2024-10-16",
    "2024-10-17",
    "2024-10-18",
    "2024-10-19"
  ]
}

Book a campaign

When booking your campaign, payment will be taken from your balance.

[POST]
https://api-eu1.stannp.com/v1/campaigns/book

Parameters

ParameterDetailsDescription
id
body int required
The id of the campaign to book.
send_date
body date required
The dispatch date of the campaign. Must be in a YYYY-MM-DD format. eg: 2024-10-09
next_available_date
body bool optional
Default is true. We will book the campaign on the next available date if your send date is not available. Set to false if you want to receive an error if the date is not available.
use_balance
body bool optional
Set to true to use your balance to pay for the campaign. Default is true. If you do not pay for the campaign using balance the campaign will be scheduled but will not be posted till payment.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/book" \
-u {API_KEY}: \
-d "id=0" \
-d "send_date=2025-11-03" \
-d "use_balance=1" 
    

Response Example

{
  "success": true,
  "data": true
}

Delete a campaign

Use the API to delete a campaign. You can only delete campaigns that have not been booked. Note that this will permanently delete the campaign.

[POST]
https://api-eu1.stannp.com/v1/campaigns/delete

Parameters

ParameterDetailsDescription
id
body int required
The id of the campaign to delete.

Request Example

        curl "https://api-eu1.stannp.com/v1/campaigns/delete" \
-u {API_KEY}: \
-d "id=0" 
    

Response Example

{
  "success": true,
  "data": 1
}