Create a campaign
You can create a campaign in the dashboard or through the API. Both routes use the same fields.
Fields
Section titled “Fields”| Field | Type | Notes |
|---|---|---|
name |
string | Required. Maximum 255 characters. |
description |
string | Maximum 2000 characters. |
enabled |
boolean | Whether the campaign accepts leads. Defaults to false. |
routing_strategy |
string | highest_bid or priority. See Routing and eligibility. |
schema |
array | Up to 100 field definitions. See Lead schema. |
provider_ids |
array of strings | Providers assigned to the campaign. For priority routing the order is the priority. See Assigning providers. |
Create a campaign
Section titled “Create a campaign”- Open Campaigns and choose Create campaign.
- Enter a name and, optionally, a description.
- Choose a routing strategy.
- Add the fields you want Pingdex to validate. Leave the schema empty if you want to accept any JSON object.
- Select the providers to assign. For
priorityrouting, put them in priority order. - Leave Enabled off while you review, then turn it on when you are ready to accept leads.
- Save the campaign.
Send a POST request to the campaigns endpoint with your API key. See API authentication for how to authenticate and Campaigns API for the full reference.
curl https://api.pingdex.io/api/v1/campaigns \ --request POST \ --header "Authorization: Bearer $PINGDEX_API_KEY" \ --header "Content-Type: application/json" \ --data @campaign.jsonWhere campaign.json contains:
{ "name": "Home insurance, UK", "description": "Quote requests from the spring comparison landing page.", "enabled": false, "routing_strategy": "highest_bid", "schema": [ { "name": "email", "type": "string", "required": true }, { "name": "postcode", "type": "string", "required": true }, { "name": "property_value", "type": "integer", "required": false }, { "name": "marketing_consent", "type": "boolean", "required": true } ], "provider_ids": [ "0b6f1e2a-3c4d-4e5f-8a9b-1c2d3e4f5a6b", "7d8e9f0a-1b2c-4d3e-9f4a-5b6c7d8e9f01" ]}After you create a campaign
Section titled “After you create a campaign”- Check that every assigned provider is enabled and compatible with the routing strategy.
- Enable the campaign if you created it disabled.
- Submit a test lead. See Submit a lead.