# Schema

## AdId
- **Type**: int32  
- **Required**: True  
- **Description**: The Ad the targeting rule applies to

## SegmentId
- **Type**: int32  
- **Required**: True  
- **Description**: Id of the Segment

## IsExclude
- **Type**: boolean  
- **Defaults**: false  
- **Description**: Whether targeting is to be excluded or included

# Responses

## 200
- **Type**: object  
  - **Id**: integer (Defaults to 0)  
  - **AdId**: integer (Defaults to 0)  
  - **SegmentId**: integer (Defaults to 0)  
  - **IsExclude**: boolean (Defaults to false)  
  - **Segment**: object  
    - **Source**: string  
    - **Name**: string  
    - **Reach**: object  
      - **Description**: string  
      - **Category**: string

## 400

---

# Code Example

```curl
curl -X POST -H "X-Adzerk-ApiKey:<APIKEY>" -H "Content-Type:application/json" https://api.kevel.co/v1/ad/{AdId}/segmenttargeting --data-binary '{"SegmentId":123456,"IsExclude":false}'
```

# Example Response

```json
{
  "Id": 56789,
  "AdId": 55555,
  "SegmentId": 123456,
  "IsExclude": false,
  "Segment": {
    "Source": "audience",
    "Name": "best customers",
    "Reach": {
      "all_time": 3187463,
      "28d": 387434
    },
    "Description": "top 1% spenders in the last 30 days.",
    "Category": "CRM"
  }
}
```

---
