Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

2API Version 2 - Release Date: March 01, 2022

Authentication

To get started, please obtain your unique API key by logging into your account and navigating to the Account Details page > API key section. This page allows you to also refresh/revoke the generated keys to maintain the high level of security for your applications.

...

Affiliates can access: https://api.sourceknowledge.com/doc/affiliate to view an interactive documentation, which shows and describes all our available endpoints and parameters, and gives Affiliates the ability to test the endpoints directly on the page. Be aware that when interacting with create/edit API as it could update your campaign settings.

API version 2

Why should we use version 2?

Version 2 includes:

  • Improvements in the consistency of the results.

  • Performance improvements on endpoints.

  • New features that allow writing operations and provide automated and remote campaign control.

Advertisers

Expand
titleCategories

Returns advertiser categories. If you do not have access to this end point, please contact your account manager.

Endpoint

/affiliate/v2/categories

e.g. /affiliate/v2/categories

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
[
  {
    "id": 0,
    "name": "string"
  }
]
Expand
titleGET Advertisers

Returns Advertisers

Endpoint

/affiliate/v2/advertisers

e.g. /affiliate/v2/advertisers

Filters

Name

Description

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "id": 0,
      "name": "string",
      "businessUrl": "string",
      "categoryId": 0,
      "categoryName": "string"
    }
  ],
  "hasMore": true,
  "page": 0
}
Expand
titleCreate advertiser [POST Advertisers]

Endpoint

Tip

/affiliate/v2/advertisers

e.g. /affiliate/v2/advertisers

Filters

Name

Description

body

Required

Advertiser settings

Example:

Code Block
languagejson
{
  "name": "string",
  "businessUrl": "string",
  "categoryId": 0
}

To get list categories with ids see /affiliate/v2/categories

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "businessUrl": "string",
  "categoryId": 0,
  "categoryName": "string"
}
Expand
titleGET Advertisers id

Returns detailed information about the advertiser

Endpoint

/affiliate/v2/advertisers/{id}

e.g. /affiliate/v2/advertisers/10

Filters

Name

Description

id

Required

Advertiser Id

Example: id=10

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "businessUrl": "string",
  "categoryId": 0,
  "categoryName": "string"
}
Expand
titleEdit advertiser [PUT Advertisers id]

Endpoint

Tip

/affiliate/v2/advertisers/{id}

e.g. /affiliate/v2/advertisers/10

Filters

Name

Description

id

Required

Advertiser Id

Example: id=10

body

Required

Advertiser settings

Example:

Code Block
languagejson
{
  "name": "string",
  "businessUrl": "string",
  "categoryId": 0
}

To list categories, see /affiliate/v2/categories

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "businessUrl": "string",
  "categoryId": 0,
  "categoryName": "string"
}

Campaigns

Expand
titleGET Campaigns

Returns advertiser's campaigns. If you do not have access to this end point, please contact your account manager.

Endpoint

/affiliate/v2/campaigns

e.g. /affiliate/v2/campaigns

Filters

Name

Description

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

advertiserId

Optional

Advertiser id to filter the results

Example: advertiserId=10

Status Codes

Code

Description

200

Returned when successful

400

Returned when advertiserId id is not a numeric value

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the advertiser was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "id": 0,
      "name": "string",
      "active": true,
      "status": 0,
      "start": "string",
      "end": "string",
      "updated": "string",
      "advertiser": {
        "id": 0,
        "name": "string"
      }
    }
  ],
  "hasMore": true,
  "page": 0
}

Value

Meaning

Description

status

Campaign Status

The status of the campaign.

name*

Campaign Name

Name of the Campaign

start*

Campaign Start Date

Date and time of the Start of the Campaign

end

Campaign End Date

Date and time of the End of the Campaign. null if the campaign has no end date.

updated

Campaign Update date

Date and time the campaign was last updated.

Status

Value

Description

1

Live

0

Paused

Expand
titleCreate campaign [POST Campaigns]

Endpoint

Tip

/api/agency/v2/campaigns

e.g. /api/agency/v2/campaigns

Filters

Name

Description

body

Required

Campaign settings

Example:

Code Block
languagejson
{
  "name": "string",
  "start": "2022-02-15",
  "end": "2022-02-15",
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ],
  "strategyId": 3,
  "advertiserId": 0
}

Value

Meaning

Description

name*

Campaign Name

(string) Name of the Campaign

start*

Campaign Start Date

(string) Date and time of the Start of the Campaign, format: YYY-MM-DD

end

Campaign End Date

(string) Date and time of the End of the Campaign. null if the campaign has no end date, format: YYY-MM-DD

dailyBudget*

Daily Budget

(float) e.g. 150 or 150.50

cpc*

CPC($)

(float) Cost Per Click e.g. 0.25

trackingUrl*

Tracking Url

(string) e.g. https://track.click.com?a=2

allowDeepLink

Allows deep linking.

(string) true or false. Default is false

geoTargeting*

Geos to target

(string) Two digit Country code e.g US, CA, GB

deviceTargeting

Device Targeting

(string) Mobile or Desktop

If not passed, defaults to all

partnerChannels

comma separated ids for channel

(int) You can get channels through /affiliate/v2/channels API

If not passed, defaults to all channels

strategyId*

Only accepts 3

(int) Domain Targeting (3)

advertiserId*

Advertiser Id

(int) Advertiser Id, get list from /affiliate/v2/advertisers

Status Codes

Code

Description

200

Returned when successful

400

Returned when an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the advertiser was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleGET Campaigns id

Returns campaign data

Endpoint

/affiliate/v2/campaigns/{id}

e.g. /affiliate/v2/campaigns/100100

Filters

Name

Description

id

Required

Campaign Id

Example: id=100100

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ], 
  "partnerChannels": [
    0
  ]
}
Expand
titleChange campaign status [POST Campaigns id]

Endpoint

Tip

/affiliate/v2/campaigns/{id}

e.g. /affiliate/v2/campaigns/100100

Filters

Name

Description

id

Required

Campaign Id

Example: id=100100

body

Required

Flag to set the status (true | false)

Example:

Code Block
languagejson
{
  "active": true
}

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleChange campaigns status in bulk

Endpoint

Tip

/affiliate/v2/campaigns/bulk-status

Filters

Name

Description

body

Required

campaignIds: List of all campaignIds to have their statuses updated. Max allowed 20 campaigns per call

active: Flag to set the status (true | false)

Example:

Code Block
languagejson
{
  "campaignIds": [
    11111111,22222222,33333333,44444444
  ],
  "active": false
}

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleEdit campaign [PUT Campaigns id]

Endpoint

Tip

/affiliate/v2/campaigns/{id}

e.g. /affiliate/v2/campaigns/100100

Filters

Name

Description

id

Required

Campaign Id

Example: id=100100

body

Required

Campaign settings

Example:

Code Block
languagejson
{
  "name": "string",
  "end": "2022-02-15",
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}

Value

Meaning

Description

name

Campaign Name

(string) Name of the Campaign

start

Campaign Start Date

(string) Date and time of the Start of the Campaign, format: YYY-MM-DD

end

Campaign End Date

(string) Date and time of the End of the Campaign. null if the campaign has no end date, format: YYY-MM-DD

dailyBudget

Daily Budget

(float) e.g. 150 or 150.50

cpc

CPC($)

(float) Cost Per Click e.g. 0.25

trackingUrl

Tracking Url

(string) e.g. https://track.click.com?a=2

allowDeepLink

Allows deep linking.

(string) true or false. Default is false

geoTargeting

Geos to target

(string) Two digit Country code e.g US, CA, GB

deviceTargeting

Device Targeting

(string) Mobile or Desktop

If not passed, defaults to all

partnerChannels

comma separated ids for channel

(int) You can get channels through /affiliate/v2/channels API

If not passed, defaults to all channels

strategyId

Only accepts 3

(int) Domain Targeting (3)

advertiserId

Advertiser Id

(int) Advertiser Id, get list from /affiliate/v2/advertisers

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleArchive/Unarchive a campaign [POST Campaigns id]

Endpoint

Tip

/affiliate/v2/campaigns/{id}/archive

e.g. /affiliate/v2/campaigns/100100/archive

Filters

Name

Description

id

Required

Campaign Id

Example: id=100100

body

Required

Archiving status

Example:

Code Block
languagejson
{
  "archive": true
}

Value

Meaning

Description

archive

Campaign Archiving Status

(string) true or false
Update archiving status, set "archive": true to archive a campaign, set "archive": false to unarchive a campaign

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleArchive/Unarchive campaigns in bulk

Endpoint

Tip

/affiliate/v2/campaigns/bulk-archive

Filters

Name

Description

body

Required

campaignIds: List of all campaignIds to be archived/unarchived. Max allowed 20 campaigns per call

archive: Flag to set the status (true | false)

Example:

Code Block
languagejson
{
  "campaignIds": [
    11111111,22222222,33333333,44444444
  ],
  "archive": true
}

Value

Meaning

Description

archive

Campaign Archiving Status

(string) true or false
Update archiving status, set "archive": true to archive a campaign, set "archive": false to unarchive a campaign

Status Codes

Code

Description

200

Returned when successful

400

When an invalid request or payload is sent to the server

401

Returned when not authorized

403

Returned when access is forbidden

404

Returned when the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "active": true,
  "status": 0,
  "start": "string",
  "end": "string",
  "updated": "string",
  "advertiser": {
    "id": 0,
    "name": "string"
  },
  "dailyBudget": 0,
  "cpc": 0,
  "trackingUrl": "string",
  "allowDeepLink": true,
  "geoTargeting": [
    "string"
  ],
  "deviceTargeting": [
    "string"
  ],
  "partnerChannels": [
    0
  ]
}
Expand
titleChannels

Get Partner Channels

Endpoint

/affiliate/v2/channels

e.g. /affiliate/v2/channels

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
[
  {
    "id": 0,
    "name": "string"
  }
]

Stats

Expand
titleBy Campaign

Returns stats by campaign in a given period of time

Endpoint

/affiliate/v2/stats/by-campaign

e.g. GET /affiliate/v2/stats/by-campaign?from=2021-02-01&to=2021-03-01

Filters

Name

Description

from

Required

Data start date, support up to two years (Y-m-d)

Example: from=2022-01-01

to

Required

Data end date. (Y-m-d)

Example: to=2022-01-31

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

advertiserId

Optional

Advertiser id to filter results

Example: advertiserId=10

Status Codes

Code

Description

200

Returned when successful

400

When date range is not provided or the dates for the range are not in the expected format. When advertiserId id is not a numeric value

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "spend": 0,
      "revenue": 0,
      "cpa": 0,
      "ecpc": 0,
      "roas": 0,
      "clicks": 0,
      "impressions": 0,
      "conversions": 0,
      "id": 0,
      "name": "string",
      "advertiser": {
        "id": 0,
        "name": "string"
      }
    }
  ],
  "hasMore": true,
  "page": 0
}
Expand
titleCampaigns Stats By Publisher - Channel Summary Report

Returns campaign stats in a given period of time grouped by publisher

Endpoint

/api/affiliate/v2/stats/campaigns/{id}/by-publisher

e.g. GET /api/affiliate/v2/stats/campaigns/100100/by-publisher?from=2021-02-01&to=2021-03-01

Filters

Name

Description

id

Required

Campaign id

Example: id=100100

from

Required

Data start date, support up to three months(Y-m-d)

Example: from=2022-01-01

to

Required

Data end date. (Y-m-d)

Example: to=2022-01-31

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

channel

Optional

Channel

Example: channel=test_channel

subid

Optional

Sub-ID

Example: subid=abc1234defg456

Status Codes

Code

Description

200

Returned when successful

400

When date range is not provided or the dates for the range are not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "spend": 0,
      "revenue": 0,
      "cpa": 0,
      "ecpc": 0,
      "roas": 0,
      "clicks": 0,
      "impressions": 0,
      "conversions": 0,
      "winRate": 0,
      "bidFactor": 0,
      "subId": "string",
      "channel": "string",
      "active": true
    }
  ],
  "hasMore": true,
  "page": 0
}

Publisher Bid Control

Expand
titleSet/Update Sub Id/Publisher Bid Factor [POST]

Sets a subId bid factor for a campaign.

Endpoint

/affiliate/v2/campaigns/{id}/bid-factor

e.g. POST affiliate/v2/campaigns/213213/bid-factor

Content Type: application/json

Post Data

Name

Description

subId

Required

Sub Id, Publisher Id of type string

bidFactor

Required

Bid factor of type float e.g. 2.5, To block set it to 0 and to un-block with default bid set it to 1

Status Codes

Code

Description

200

Returned when successful

400

When an Invalid Payload

Cases:

- The specified sub id does not exist

- Try to block all sub ids previously allowed on the associated list.

Error message: 'canNotBlockAllSubIds'

This error happened when we are trying to block all sub ids from the allow list associated with the campaign. For system implementation reasons, each campaign with an associated allow list must have at least one of the list's sub ids active (bid factor > 0).

If you receive this error it means that you are trying to block all sub ids for this campaign, as a suggestion it would be best just pause the campaign.

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "subId": "string",
  "bidFactor": 0
}
Expand
titleBulk Set/Update Sub Id/Publisher Bid Factor [POST]

Sets a subId bid factor for a campaign.

Endpoint

/affiliate/v2/campaigns/{id}/bid-factors

e.g. POST affiliate/v2/campaigns/213213/bid-factors

Content Type: application/json

Post Data

Name

Description

subId

Required

Sub Id, Publisher Id of type string

bidFactor

Required

Bid factor of type float e.g. 2.5, To block set it to 0 and to un-block with default bid set it to 1

Sample post data

Post Body:

Code Block
languagejson
{
  "subIds": [
    {
      "subId": "subID1",
      "bidFactor": 2
    },
    {
      "subId": "subID2",
      "bidFactor": 1.5
    }
  ]
}

Status Codes

Code

Description

200

Returned when successful

400

When an Invalid Payload

Cases:

  • The specified sub id does not exist

  • Try to block all sub ids previously allowed on the associated list.

Error message: 'canNotBlockAllSubIds'

This error happened when we are trying to block all sub ids from the allow list associated with the campaign. For system implementation reasons, each campaign with an associated allow list must have at least one of the list's sub ids active (bid factor > 0).

If you receive this error it means that you are trying to block all sub ids for this campaign, as a suggestion it would be best just pause the campaign.

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "subIds": [
    {
      "subId": "subID1",
      "bidFactor": 2
    },
    {
      "subId": "subID2",
      "bidFactor": 1.5
    }
  ]
}
Expand
titleGet Control Lists - Allow and Block Lists [GET]

Returns Allow and Block lists

Endpoint

/affiliate/v2/control-lists

e.g. GET /affiliate/v2/control-lists

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "id": 0,
      "name": "string",
      "type": "string",
      "global": true,
      "updated": "string"
    }
  ],
  "hasMore": true,
  "page": 0
}
Expand
titleCreate a control list [POST]

Creates a control list (Allow or Block List)

Endpoint

/affiliate/v2/control-lists

e.g. POST affiliate/v2/control-lists

Content Type: application/json

Post Data

Name

Description

name

Required

Name of list, type string

type

Required

allow, block

resetBidFactors

Defaults to false

true/false

if you want to keep or erase and reset any existing bidfactors on the subids in this list. Please note, if the subid is not present in the allow list, you will lose your bidfactor data in both options by saving this list.

subIds

Required

Array, Comma separated list of subids to include in list

campaigns

Array, comma separated list of campaigns to attach this list on creation.

Key campaigns is Required but if you want to just create a list without linking to campaign, leave list empty e.g.

Code Block
languagejson
"campaigns": []

global

By default it’s false

true/false

Status Codes

Code

Description

200

Returned when successful

400

When an Invalid Payload

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "type": "string",
  "global": true,
  "updated": "string",
  "campaigns": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "subIds": [
    "string"
  ]
}
Expand
titleGet a Control List [GET]

Gets a list by Id

Endpoint

/affiliate/v2/control-lists/{id}

e.g. GET affiliate/v2/control-lists/878789

Status Codes

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "type": "string",
  "global": true,
  "updated": "string",
  "campaigns": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "subIds": [
    "string"
  ]
}
Expand
titleUpdate a list [PUT]

Updates a list (Please note that if you just want to add subids to a list, use /affiliate/v2/control-lists/{id}/append, see next end-point)

Endpoint

/affiliate/v2/control-lists/{id}

e.g. PUT affiliate/v2/control-lists/53456

Content Type: application/json

Post Data: (You can only pass the fields, you wish to update)

Name

Description

name

Name of list, type string

type

allow, block

resetBidFactors

Defaults to false

true/false

if you want to keep or erase and reset any existing bidfactors on the subids in this list. Please note, if the subid is not present in the allow list, you will lose your bidfactor data in both options by saving this list.

subIds

Array, Comma separated list of subids to include in list

campaigns

Array, comma separated list of campaigns to attach this list on creation.

global

By default it’s false

true/false

Status Codes

Code

Description

200

Returned when successful

400

When an Invalid Payload

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "type": "string",
  "global": true,
  "updated": "string",
  "campaigns": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "subIds": [
    "string"
  ]
}
Expand
titleAdd subIds to a list.

Add Sub Ids to a list

Endpoint

/affiliate/v2/control-lists/{id}/append

e.g. PUT affiliate/v2/control-lists/654655/append

Content Type: application/json

Post Data:

Name

Description

subIds

Array, Comma separated list of subids to add to the list e.g.
["string1", “string2“]

Status Codes

Code

Description

200

Returned when successful

400

When an Invalid Payload

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 0,
  "name": "string",
  "type": "string",
  "global": true,
  "updated": "string",
  "campaigns": [
    {
      "id": 0,
      "name": "string"
    }
  ],
  "subIds": [
    "string"
  ]
}

Migration Guide:

Steps for starting using V2 version of the API, https://api.sourceknowledge.com/affiliate/v2/[endpoint], instead of https://app.sourceknowledge.com/api/agency/[endpoint].

...

No breaking change
Replace [ https://app.sourceknowledge.com/api/agency/campaign/{id}] -> [https://api.sourceknowledge.com/affiliate/v2/campaigns/{id}]

2. POST Campaign id [Changes campaign status]

No breaking change
Replace [ https://app.sourceknowledge.com/api/agency/campaign/{id}] -> [https://api.sourceknowledge.com/affiliate/v2/campaigns/{id}]

3.- PUT Campaign id [Edit campaign]

No breaking change
Replace [ https://app.sourceknowledge.com/api/agency/campaign/{id}] -> [https://api.sourceknowledge.com/affiliate/v2/campaigns/{id}]

4.- Campaigns [Return a list of campaigns]

...

The breaking change is in the Response Body. In Version 1, the advertiser is at the object’s first level with a list of campaigns associated, while in Version 2, the campaigns are at the first level and each one has the associated advertiser.

Version 1

Version 2

Code Block
languagejson
{
  "itemsCount": 33,
  "items": [
    {
      "id": 1750,
      "name": "Example Advertiser 1",
      "campaigns": [
        {
          "id": 100100,
          "name": "Example_Campaign_1",
          "status": 0,
          "start": "2021-02-03T05:00:00+00:00",
          "end": null,
          "updated": "2021-07-27T14:42:38+00:00"
        },
        {
          "id": 100101,
          "name": "Example_Campaign_2",
          "status": 0,
          "start": "2021-05-26T04:00:00+00:00",
          "end": null,
          "updated": "2021-07-05T19:06:13+00:00"
        }
      ]
    },
    {
      "id": 1751,
      "name": "Example Advertiser 2",
      "campaigns": [
        {
          "id": 100102,
          "name": "Example_Campaign_1",
          "status": 1,
          "start": "2021-02-03T05:00:00+00:00",
          "end": null,
          "updated": "2021-08-19T10:01:42+00:00"
        },
        {
          "id": 100103,
          "name": "Example_Campaign_2",
          "status": 0,
          "start": "2021-05-26T04:00:00+00:00",
          "end": null,
          "updated": "2021-07-14T19:42:33+00:00"
        }
      ],
   "hasMore":true,
   "page":1
}

Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "id": 100100,
      "name": "Example_Campaign_1",
      "active": true,
      "status": 0,
      "start": "2021-02-03T05:00:00+00:00",
      "end": null,
      "updated": "2021-07-27T14:42:38+00:00",
      "advertiser": {
        "id": 1750,
        "name": "Example Advertiser 1"
      }
    },
    {
      "id": 100101,
      "name": "Example_Campaign_2",
      "active": true,
      "status": 0,
      "start": "2021-05-26T04:00:00+00:00",
      "end": null,
      "updated": "2021-07-05T19:06:13+00:00",
      "advertiser": {
        "id": 1750,
        "name": "Example Advertiser 1"
      }
    },
    {
      "id": 100102,
      "name": "Example_Campaign_1",
      "active": true,
      "status": 0,
      "start": "2021-02-03T05:00:00+00:00",
      "end": null,
      "updated": "2021-08-19T10:01:42+00:00",
      "advertiser": {
        "id": 1751,
        "name": "Example Advertiser 2"
      }
    },    
    {
      "id": 100103,
      "name": "Example_Campaign_2",
      "active": true,
      "status": 0,
      "start": "2021-05-26T04:00:00+00:00",
      "end": null,
      "updated": "2021-07-14T19:42:33+00:00",
      "advertiser": {
        "id": 1751,
        "name": "Example Advertiser 2"
      }
    }
  ],
  "hasMore": true,
  "page": 0
}

Replace [ https://app.sourceknowledge.com/api/agency/campaigns] -> [https://api.sourceknowledge.com/affiliate/v2/campaigns]

5. Advertiser stats [Returns advertisers stats in a given period of time.]

...

The breaking change is in the Response Body. In Version 1, the advertiser is at the object’s first level with a list of campaigns associated, while in Version 2, the campaigns are at the first level and each one has the associated advertiser.

Version 1

Version 2

Code Block
languagejson
{
  "itemsCount": 2,
  "items": [
    {
      "id": 1444,
      "name": "Example advertiser 1",
      "campaign_stats": [
        {
          "id": 100100,
          "name": "Example_Campaign_1",
          "clicks": 0,
          "conversions": 0,
          "cpa": 0,
          "ctr": 0,
          "impressions": 0,
          "spend": 0,
          "revenue": 0
        }
      ]
    },
    {
      "id": 1445,
      "name": "Example advertiser 2",
      "campaign_stats": [
        {
          "id": 100101,
          "name": "Example_Campaign_2",
          "clicks": 0,
          "conversions": 0,
          "cpa": 0,
          "ctr": 0,
          "impressions": 0,
          "spend": 0,
          "revenue": 0
      }
    ],
   "hasMore":true,
   "page":1
}
Code Block
languagejson
{
  "itemsCount": 0,
  "items": [
    {
      "spend": 0,
      "revenue": 0,
      "cpa": 0,
      "ecpc": 0,
      "roas": 0,
      "clicks": 0,
      "impressions": 0,
      "conversions": 0,
      "id": 100100,
      "name": "Example_Campaign_1",
      "advertiser": {
        "id": 1444,
        "name": "Example advertiser 1"
      }
    },
    {
      "spend": 0,
      "revenue": 0,
      "cpa": 0,
      "ecpc": 0,
      "roas": 0,
      "clicks": 0,
      "impressions": 0,
      "conversions": 0,
      "id": 100101,
      "name": "Example_Campaign_2",
      "advertiser": {
        "id": 1445,
        "name": "Example advertiser 2"
      }
    }
  ],
  "hasMore": true,
  "page": 0
}

Replace [https://app.sourceknowledge.com/api/agency/advertisers/stats] -> [https://api.sourceknowledge.com/affiliate/v2/stats/by-campaign]

API version 1 (deprecated)

Expand
titleGET Campaign id

Returns campaign data

Endpoint

/api/agency/campaign/{id}

e.g. GET /api/agency/campaign/100100

Filters

Name

Description

id

Required

A single value of the campaign id

Example: id=100100

Status Codes

Code

Description

200

Returned when successful

400

Returned when date range is not provided or the dates for the range are not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 100100,
  "name": "Example_Campaign_1",
  "status": 0,
  "start": "2021-05-26T04:00:00+00:00",
  "end": null,
  "updated": "2021-05-28T15:29:38+00:00",
  "advertiser": {
    "id": 1789,
    "name": "Example_Advertiser_1"
  },
  "dailyBudget": 25.50,
  "cpc": 0.05,
  "trackingUrl": "https://randomtracker.com/tr?clinkID=xKX18YO-j-VqbVyA-_4ieOr2ULklKSObi4AemLx7fNWq6ujEyBa_anUTL6toPnTx3IYj&pubID=laKsuNTi0KlbZxuQz-MnRPXxSw&siteID=hfqkqdPg&placementID={sub_id}&trackingID={clickid}&loc.country={device.geo.ext.country_code2}&cost.cpc={adv_price}&url.dest={oadest}",
  "allowDeepLink": true,
  "geoTargeting": [
    "US"
  ],
  "deviceTargeting": [
    "Mobile"
  ]
}
Expand
titlePOST Campaign id

Changes campaign status and returns campaign data

Endpoint

Tip

/api/agency/campaign/{id}

e.g. POST /api/agency/campaign/100100

Filters

Name

Description

id

Required

A single value of the campaign id

Example: id=100100

body

Optional

Changes status of campaign to either live (true) or paused (false)

Example:

Code Block
languagejson
{
  "active": true
}

Status Codes

Code

Description

200

Returned when successful

400

Returned when date range is not provided or the dates for the range are not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 100100,
  "name": "Example_Campaign_1",
  "status": 0,
  "start": "2021-05-26T04:00:00+00:00",
  "end": null,
  "updated": "2021-05-28T15:29:38+00:00",
  "advertiser": {
    "id": 1789,
    "name": "Example_Advertiser_1"
  },
  "dailyBudget": 25.50,
  "cpc": 0.05,
  "trackingUrl": "https://randomtracker.com/tr?clinkID=xKX18YO-j-VqbVyA-_4ieOr2ULklKSObi4AemLx7fNWq6ujEyBa_anUTL6toPnTx3IYj&pubID=laKsuNTi0KlbZxuQz-MnRPXxSw&siteID=hfqkqdPg&placementID={sub_id}&trackingID={clickid}&loc.country={device.geo.ext.country_code2}&cost.cpc={adv_price}&url.dest={oadest}",
  "allowDeepLink": true,
  "geoTargeting": [
    "US"
  ],
  "deviceTargeting": [
    "Mobile"
  ]
}
Expand
titlePUT Campaign id

Edits an existing campaign and returns campaign data

Endpoint

Tip

/api/agency/campaign/{id}

e.g. PUT /api/agency/campaign/100100

Filters

Name

Description

id

Required

A single value of the campaign id

Example: id=100100

body

Set of fields to be updated on the campaign. You don’t need to pass all fields on the request, only the ones you want to update. You can know the field names doing a GET to the endpoint to get the current campaign data.

Example:

Code Block
languagejson
{
  "name": "Example_Campaign_1",
  "end": null,
  "dailyBudget": 26.30,
  "cpc": 0.7,
  "trackingUrl": "https://randomtracker.com/tr?clinkID=xKX18YO-j-VqbVyA-_4ieOr2ULklKSObi4AemLx7fNWq6ujEyBa_anUTL6toPnTx3IYj&pubID=laKsuNTi0KlbZxuQz-MnRPXxSw&siteID=hfqkqdPg&placementID={sub_id}&trackingID={clickid}&loc.country={device.geo.ext.country_code2}&cost.cpc={adv_price}&url.dest={oadest}",
  "allowDeepLink": true,
  "geoTargeting": [
    "US", "CA"
  ],
  "deviceTargeting": [
    "Mobile"
  ]
}

Status Codes

Code

Description

200

Returned when successful

400

Returned when any value is not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

404

When the campaign was not found

Sample response data

Response Body:

Code Block
languagejson
{
  "id": 100100,
  "name": "Example_Campaign_1",
  "status": 0,
  "start": "2021-05-26T04:00:00+00:00",
  "end": null,
  "updated": "2021-05-28T15:29:38+00:00",
  "advertiser": {
    "id": 1789,
    "name": "Example_Advertiser_1"
  },
  "dailyBudget": 26.30,
  "cpc": 0.7,
  "trackingUrl": "https://randomtracker.com/tr?clinkID=xKX18YO-j-VqbVyA-_4ieOr2ULklKSObi4AemLx7fNWq6ujEyBa_anUTL6toPnTx3IYj&pubID=laKsuNTi0KlbZxuQz-MnRPXxSw&siteID=hfqkqdPg&placementID={sub_id}&trackingID={clickid}&loc.country={device.geo.ext.country_code2}&cost.cpc={adv_price}&url.dest={oadest}",
  "allowDeepLink": true,
  "geoTargeting": [
    "US", "CA"
  ],
  "deviceTargeting": [
    "Mobile"
  ]
}

Expand
titleAdvertiser stats

Returns advertisers stats in a given period of time.

Endpoint

/api/agency/advertisers/stats

e.g. GET /api/agency/advertisers/stats?from=2021-02-01&to=2021-03-01

Filters

Name

Description

from

Required

Date range start. (Y-m-d)

Example: from=2021-01-01

to

Required

Date range end. (Y-m-d)

Example: to=2021-01-31

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

advertiserId

Optional

A single value of the advertiser id

Example: advertiserId=1

Status Codes

Code

Description

200

Returned when successful

400

Returned when date range is not provided or the dates for the range are not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 2,
  "items": [
    {
      "id": 1444,
      "name": "Example advertiser 1",
      "campaign_stats": [
        {
          "id": 100100,
          "name": "Example_Campaign_1",
          "clicks": 0,
          "conversions": 0,
          "cpa": 0,
          "ctr": 0,
          "impressions": 0,
          "spend": 0,
          "revenue": 0
        }
      ]
    },
    {
      "id": 1445,
      "name": "Example advertiser 2",
      "campaign_stats": [
        {
          "id": 100101,
          "name": "Example_Campaign_2",
          "clicks": 0,
          "conversions": 0,
          "cpa": 0,
          "ctr": 0,
          "impressions": 0,
          "spend": 0,
          "revenue": 0
      }
    ],
   "hasMore":true,
   "page":1
}

Advertiser

Value

Meaning

Description

id*

Advertiser ID

ID of the Advertiser

name*

Advertiser Name

Name of the Advertiser

campaign_stats*

Advertiser Campaign stats

Array of Advertiser’s campaigns statistics

Campaigns

Value

Meaning

Description

id*

Campaign ID

ID of the Campaign

name*

Campaign Name

Name of the Campaign

Expand
titleCampaigns

Returns a list of campaigns

Endpoint

/api/agency/campaigns

e.g. GET /api/agency/campaigns

Filters

Name

Description

page

Optional. Defaults to 1

Results page number.

Example: page=2

Info

When the response contains “hasMore”: true, it means that more results are available.

If you called the endpoint with page=1, then you need to call it again with page=2 to get more.

advertiserId

Optional

A single value of the advertiser id

Example: advertiserId=1

Status Codes

Code

Description

200

Returned when successful

400

Returned when date range is not provided or the dates for the range are not in the expected format

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

Code Block
languagejson
{
  "itemsCount": 33,
  "items": [
    {
      "id": 1750,
      "name": "Example Advertiser 1",
      "campaigns": [
        {
          "id": 100100,
          "name": "Example_Campaign_1",
          "status": 0,
          "start": "2021-02-03T05:00:00+00:00",
          "end": null,
          "updated": "2021-07-27T14:42:38+00:00"
        },
        {
          "id": 100101,
          "name": "Example_Campaign_2",
          "status": 0,
          "start": "2021-05-26T04:00:00+00:00",
          "end": null,
          "updated": "2021-07-05T19:06:13+00:00"
        }
      ]
    },
    {
      "id": 1751,
      "name": "Example Advertiser 2",
      "campaigns": [
        {
          "id": 100102,
          "name": "Example_Campaign_1",
          "status": 1,
          "start": "2021-02-03T05:00:00+00:00",
          "end": null,
          "updated": "2021-08-19T10:01:42+00:00"
        },
        {
          "id": 100103,
          "name": "Example_Campaign_2",
          "status": 0,
          "start": "2021-05-26T04:00:00+00:00",
          "end": null,
          "updated": "2021-07-14T19:42:33+00:00"
        }
      ],
   "hasMore":true,
   "page":1
}

Value

Meaning

Description

status

Campaign Status

The status of the campaign.

name*

Campaign Name

Name of the Campaign

start*

Campaign Start Date

Date and time of the Start of the Campaign

end

Campaign End Date

Date and time of the End of the Campaign. null if the campaign has no end date.

updated

Campaign Update date

Date and time the campaign was last updated.

Status

Value

Description

1

Live

0

Paused

...