# Create Affiliate Caps

| HTTP method | Endpoint                                                   |
| ----------- | ---------------------------------------------------------- |
| **POST**    | **/v1/offers/{offer\_id}/affiliate\_caps/{affiliate\_id}** |

## Path parameters <a href="#path-parameters" id="path-parameters"></a>

| Parameter     | Description                      |
| ------------- | -------------------------------- |
| offer\_id     | The unique id for the offer.     |
| affiliate\_id | The unique id for the affiliate. |

**NOTE :When meet CPS offer，affiliate cap type can be only set as the same type with Offer Cap.**

**If offer cap type is 1 or 2, affiliate cap type only can be set as 1, 4 or 2, 5(type=1 or 2 means conversion cap, type=4 or 5 means click cap).**

**If offer cap type is 3 (budget cap), then affiliate cap type only can be set as 3 (budget cap).**

**If offer cap type is set as 0 (no cap), affiliate cap can be set as 1, 2, 3, 4, 5.**

## Request body parameters <a href="#request-body-parameters" id="request-body-parameters"></a>

| Field           | Type    | Description                                                                                       | Nullable |
| --------------- | ------- | ------------------------------------------------------------------------------------------------- | -------- |
| cap\_budget     | string  |                                                                                                   |          |
| cap\_click      | integer |                                                                                                   |          |
| cap\_type       | integer | Cap type:  1 total\_conversion  2 daily\_conversion 3 total\_budget 4 total\_click 5 daily\_click | No       |
| cap\_conversion | integer |                                                                                                   |          |
| category        | integer | The type of code: 1 Shared  2 Private                                                             | No       |

## Response body parameters <a href="#response-body-parameters" id="response-body-parameters"></a>

| Field           | Type    | Description                    |
| --------------- | ------- | ------------------------------ |
| id              | integer |                                |
| offer\_id       | integer |                                |
| affiliate\_id   | integer |                                |
| cap\_budget     | string  |                                |
| cap\_click      | integer |                                |
| cap\_type       | integer | Cap type                       |
| cap\_conversion | integer |                                |
| category        | integer | The type of code.              |
| create\_time    | integer | The Creation time of the code. |

## Example request <a href="#example-request" id="example-request"></a>

**Request POST** <https://{networkname}.api.offerslook.com/v1/offers/16/affiliate_caps/8>

```
    {

      "category": 2,
      "cap_type": 2,
      "cap_conversion": 223
    }
```

## Example response <a href="#example-response" id="example-response"></a>

```
    {
      "code": 0,
      "message": "Success",
      "data": {
        "affiliate_cap": [
          {
            "id": 17,
            "affiliate_id": 8,
            "campaign_id": 16,
            "cap_type": 2,
            "cap_click": 0,
            "cap_conversion": 223,
            "cap_budget": "0",
            "category": 2,
            "create_time": 1462591223
          }
        ]
      }
    }
```
