Deals API

Deals API

ClearLine Deals can be created, edited and viewed using the API.

This feature is available for ClearLine account types.

Creating a ClearLine Deal

REST API

Method: POST

Endpoint: /api/v1/clearline_deals

Fields:

Field

Data Type

Required

Notes

Field

Data Type

Required

Notes

is_active

bool

True

sets status

name

string

True

Name of Deal in ClearLine

note

string

False

 

deal_setting_attributes

object

True

*See information for field below

 

*Fields for "deal_setting_attributes" object:

Field

Data Type

Required

Notes

Field

Data Type

Required

Notes

external_deal_id

string

True

Deal ID for SSP

auction_type

string

True

Can be any value of:

  • pg

  • fixed_price

  • auction_price

gross_rate

string

True

CPM Rate for Deal. Example is "20.25"

 

cURL Example

curl -X POST \ 'https://console.clearline.magnite.com/api/v1/clearline_deals' \ --header 'Accept: */*' \ --header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data-raw '{ "is_active": false, "name": "test-deal-documentation", "note": "For API Documentation", "deal_setting_attributes": { "external_deal_id": "magnite_deal_id", "auction_type": "pg", "gross_rate": "0.01" } }'

Response: Status code 200

{ "id": 914, "is_active": false, "name": "test-deal-documentation", "originator": false, "note": "For API Documentation", "created_at": "2024-09-06T21:00:32.427Z", "updated_at": "2024-09-06T21:00:32.427Z", "deal_setting_id": 914, "deal_setting": { "id": 914, "external_deal_id": "magnite_deal_id", "auction_type": "pg", "gross_rate": "0.01", "generate_external_deal_id": false, "deleted_at": null, "created_at": "2024-09-06T21:00:32.425Z", "updated_at": "2024-09-06T21:00:32.425Z", "seller_rate": null, "gross_rate_currency": "USD", "seller_rate_currency": "USD" } }

 

Getting a ClearLine Deal

REST API

Method: GET

Endpoint: /api/v1/clearline_deals/<id>

 

cURL Example

curl -X GET \ 'https://console.clearline.magnite.com/api/v1/clearline_deals/914' \ --header 'Accept: */*' \ --header 'Authorization: authtokenhere'

 

Response: Status code 200

{ "id": 914, "is_active": false, "name": "test-deal-documentation", "originator": false, "note": "For API Documentation", "created_at": "2024-09-06T21:00:32.427Z", "updated_at": "2024-09-06T21:00:32.427Z", "deal_setting_id": 914, "deal_setting": { "id": 914, "external_deal_id": "magnite_deal_id", "auction_type": "pg", "gross_rate": "0.01", "generate_external_deal_id": false, "deleted_at": null, "created_at": "2024-09-06T21:00:32.425Z", "updated_at": "2024-09-06T21:00:32.425Z", "seller_rate": null, "gross_rate_currency": "USD", "seller_rate_currency": "USD" } }

Modifying a ClearLine Deal

REST API

Method: PUT

Endpoint: /api/v1/clearline_deals/<id>

Note: If updating anything within the deal_settings_attributes object, you must always include the id, external_deal_id, auction_type, and gross_rate properties.

 

cURL Example (updating the gross_rate to $5.67)

curl -X PUT \ 'https://console.clearline.magnite.com/api/v1/clearline_deals/914' \ --header 'Accept: */*' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data-raw '{ "deal_setting_attributes": { "id": 914, "external_deal_id": "magnite_deal_id", "auction_type": "pg", "gross_rate": "5.67" } }'

 

Response: Status code 200

{ "id": 914, "is_active": false, "name": "test-deal-documentation", "originator": false, "note": "For API Documentation", "created_at": "2024-09-06T21:00:32.427Z", "updated_at": "2024-09-06T21:00:32.427Z", "deal_setting_id": 914, "deal_setting": { "external_deal_id": "magnite_deal_id", "auction_type": "pg", "gross_rate": "5.67", "id": 914, "generate_external_deal_id": false, "deleted_at": null, "created_at": "2024-09-06T21:00:32.425Z", "updated_at": "2024-09-06T21:25:27.307Z", "seller_rate": null, "gross_rate_currency": "USD", "seller_rate_currency": "USD" } }