Create Deal

Create Deal

POST https://api.ocamba.com/v1/hood/deals
Creates a new Deal object

Rate limits:

  • Burst: 10/s
  • Steady: 150/m

Request schema

body

Response schemas

curl -X POST \
 "https://api.ocamba.com/v1/hood/deals" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "example deal name",
  "description": "example description",
  "type": "dsp",
  "structure": "cpa",
  "partner_id": "1000232",
  "frequency_cap": {
    "max_value": 12,
    "per_unit": "week"
  },
  "time_window": 3600,
  "status": "active",
  "effective_status": "active",
  "base_price": 1.12,
  "clickthrough": false,
  "system": 0,
  "base_price_priority": true,
  "country_price": {
    "RS": 12.11
  },
  "device_price": {
    "desktop": 2.11,
    "mobile": 1.55
  },
  "event_price": {
    "click": 1.15,
    "view": 0.1
  },
  "unique_conversion": true,
  "total_spend_cap": 12551
}'
const url = 'https://api.ocamba.com/v1/hood/deals';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "example deal name",
      "description": "example description",
      "type": "dsp",
      "structure": "cpa",
      "partner_id": "1000232",
      "frequency_cap": {
        "max_value": 12,
        "per_unit": "week"
      },
      "time_window": 3600,
      "status": "active",
      "effective_status": "active",
      "base_price": 1.12,
      "clickthrough": false,
      "system": 0,
      "base_price_priority": true,
      "country_price": {
        "RS": 12.11
      },
      "device_price": {
        "desktop": 2.11,
        "mobile": 1.55
      },
      "event_price": {
        "click": 1.15,
        "view": 0.1
      },
      "unique_conversion": true,
      "total_spend_cap": 12551
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/deals");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "example deal name",
    "description" => "example description",
    "type" => "dsp",
    "structure" => "cpa",
    "partner_id" => "1000232",
    "frequency_cap" => [
      "max_value" => 12,
      "per_unit" => "week"
    ],
    "time_window" => 3600,
    "status" => "active",
    "effective_status" => "active",
    "base_price" => 1.12,
    "clickthrough" => false,
    "system" => 0,
    "base_price_priority" => true,
    "country_price" => [
      "RS" => 12.11
    ],
    "device_price" => [
      "desktop" => 2.11,
      "mobile" => 1.55
    ],
    "event_price" => [
      "click" => 1.15,
      "view" => 0.1
    ],
    "unique_conversion" => true,
    "total_spend_cap" => 12551
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

201 Created

{
  "id": "1000251",
  "company_id": "6197120",
  "name": "example deal name",
  "description": "example description",
  "type": "dsp",
  "structure": "cpa",
  "partner_id": "1000232",
  "status": "active",
  "effective_status": "active",
  "postback": "https://dev-t.ocmhood.com/conv?click_id={OCMH_CLICK_ID}&price={PRICE}&currency={CURRENCY}&ref={REFERENCE}&event={EVENT}&device={DEVICE}&session_id={SESSION_ID}",
  "frequency_cap": {
    "max_value": 12,
    "per_unit": "week"
  },
  "clickthrough": false,
  "time_window": 3600,
  "country_price": {
    "RS": 12.11
  },
  "device_price": {
    "desktop": 2.11,
    "mobile": 1.55
  },
  "event_price": {
    "click": 1.15,
    "view": 0.1
  },
  "unique_conversion": true,
  "total_spend_cap": 12551,
  "base_price": 1.12,
  "system": 0,
  "base_price_priority": true,
  "create_time": "2024-07-18 11:27:55",
  "update_time": "2024-07-18 11:27:55"
}

400 Bad Request

{
  "code": 400,
  "title": "Bad request.",
  "message": "The request is not valid.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}

500 Internal Server Error

{
  "code": 500,
  "title": "Internal server error.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses