Campaigns

Create a new Campaign

A user can have only one campaign. If the user has an active campaign, the request fails with 400. If the user's campaign was deleted, it is restored with the new values.

POST
/campaigns

Authorization

appToken write
AuthorizationBearer <token>

App access token issued by POST /tokens (client credentials). Full-access Apps hold the read and write scopes, read-only Apps hold read only. Send it as Authorization: Bearer <token>.

In: header

Scope: write

Header Parameters

X-B2Core-Origin-Host?string

Host of the B2Core front the partner is logged in on (from the browser Origin). When it is listed in ADS_LINK_ALLOWED_HOSTS, referral link URIs in the response are built on this host; otherwise on ADS_LINK_HOST.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/campaigns" \  -H "Content-Type: application/json" \  -d '{}'
{  "campaignId": "string",  "name": "string",  "uri": "http://example.com",  "utmCampaign": "string",  "utmContent": "string",  "utmMedium": "string",  "utmSource": "string",  "utmTerm": "string",  "linkId": "string",  "userId": "string",  "link": {    "linkId": "string",    "name": "string",    "uri": "http://example.com"  },  "createTime": "2019-08-24T14:15:22Z",  "updateTime": "2019-08-24T14:15:22Z"}
{  "message": "string",  "code": "string",  "errors": {    "property1": [      "string"    ],    "property2": [      "string"    ]  },  "details": [    {      "field": "string",      "issue": "string"    }  ]}
{  "message": "string",  "code": "string",  "errors": {    "property1": [      "string"    ],    "property2": [      "string"    ]  },  "details": [    {      "field": "string",      "issue": "string"    }  ]}
{  "error": {    "message": "This App is read-only and cannot perform this operation.",    "code": "insufficient_scope"  }}
{  "message": "string",  "code": "string",  "errors": {    "property1": [      "string"    ],    "property2": [      "string"    ]  },  "details": [    {      "field": "string",      "issue": "string"    }  ]}
{  "message": "string",  "code": "string",  "errors": {    "property1": [      "string"    ],    "property2": [      "string"    ]  },  "details": [    {      "field": "string",      "issue": "string"    }  ]}