Affiliate REST API v.2

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.

The provided key serves as your access token and must be included in the X-API-KEY header of each API request.

curl -X GET "https://api.sourceknowledge.com/affiliate/v2/advertisers" -H "accept: application/json" -H "X-API-KEY: [Your API key]"

The legacy authentication method which uses USERNAME and PASSWORD will be deprecated in the near future. Please transition to the new token-base authentication to ensure uninterrupted service

Rate Limits: API servers expect no more than 200 reqs/minute & same request retry is limited to 10 times/minute. Any call beyond these rate limits will result in “HTTP 429 error responses, i.e., Too Many Requests.”

Transport Layer Security (TLS) Protocol Required Version: 1.3

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

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

Endpoint

Status Codes

Code

Description

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

[ { "id": 0, "name": "string" } ]

Returns Advertisers

Endpoint

Filters

Name

Description

Name

Description

page

Optional. Defaults to 1

Results page number.

Example: page=2

Status Codes

Code

Description

Code

Description

200

Returned when successful

401

Returned when not authorized

403

Returned when access is forbidden

Sample response data

Response Body:

{ "itemsCount": 0, "items": [ { "id": 0, "name": "string", "businessUrl": "string", "categoryId": 0, "categoryName": "string" } ], "hasMore": true, "page": 0 }

Endpoint

Filters

Name

Description

Name

Description

body

Required

Advertiser settings

Example:

 

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

Status Codes

Code

Description

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:

Returns detailed information about the advertiser

Endpoint

Filters

Name

Description

Name

Description

id

Required

Advertiser Id

Example: id=10

Status Codes

Code

Description

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:

Endpoint

Filters

Name

Description

Name

Description

id

Required

Advertiser Id

Example: id=10

body

Required

Advertiser settings

Example:

 

To list categories, see /affiliate/v2/categories

Status Codes

Code

Description

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:

 

Campaigns

Stats

Publisher Bid Control

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].

Following are the details on how to do this on each end-point. It also lists the breaking changes.

1. GET Campaign id [Return campaign data]

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]

Breaking Changes:

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

Version 1

Version 2

 

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.]

Breaking Changes:

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

Version 1

Version 2

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

API version 1 (deprecated)