> ## Documentation Index
> Fetch the complete documentation index at: https://developers.criteo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Advertiser-Level Targeting

export const EndpointBadge = ({method = "GET", children}) => {
  const METHOD_STYLES = {
    GET: {
      bg: "mint-bg-[#2AB673]"
    },
    POST: {
      bg: "mint-bg-[#3064E3]"
    },
    PUT: {
      bg: "mint-bg-[#C28C30]"
    },
    PATCH: {
      bg: "mint-bg-[#DA622B]"
    },
    DELETE: {
      bg: "mint-bg-[#CB3A32]"
    },
    API: {
      bg: "mint-bg-black"
    }
  };
  const key = method.toUpperCase();
  const styles = METHOD_STYLES[key] ?? METHOD_STYLES.API;
  return <div className="relative mt-7">
      <span className={`absolute -top-2 -left-2 z-10 ${styles.bg} text-white px-2.5 py-0.5 rounded-full text-xs font-bold tracking-wide`}>
        {key}
      </span>
      {children}
    </div>;
};

## **Domain Blocking**

<Warning>
  **Please Note**

  In the examples below, we will use \{advertiserId} as a placeholder.  Please replace this placeholder with your advertiser id.
</Warning>

### **Retrieve Targeting List**

Use this call to retrieve a list of of blocked or allowed domains for your advertiser.\
 

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/domain-rules
  ```
</EndpointBadge>

The API will return the type, mode and a corresponding array containing 3 parameters.  The array parameters are "value", "readonly" and "active".

* The  **value** parameter contains the domain.
* The **readonly** flag indicates if you can change the rule.  Rules added by Criteo are not editable and will always return true.
* The **active** flag indicates if the rule is activated and currently being taken into account.  Please note that there is a delay between setting-up the rule and this field changing.

```json Sample Return Body theme={null}
{
  "data": {
    "type": "DomainTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "type": "DOMAIN",
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "first.com",
          "readonly": true,
          "active": false
        },
        {
          "value": "second.com",
          "readonly": false,
          "active": false
        },
        {
          "value": "third.com",
          "readonly": true,
          "active": true
        }
      ]
    }
  }
}
```

 

### **Add A New Targeting List**

Use this endpoint to create a list for the given advertiser.  You can specify either a "BLOCKLIST" or "ALLOWLIST" in the payload.

<Warning>
  **Warning**

  If there is already a **domain** list defined for the advertiser, it will overwrite it.  It will not affect the **bundle** list.
</Warning>

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/domain-rules
  ```
</EndpointBadge>

The request body should contain the "mode" and an array of objects containing the domains to block/allow.

* The **mode** parameter can be "BLOCKLIST" or "ALLOWLIST".

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "DomainTargetingRule",
        "attributes": {
            "mode": "BLOCKLIST", // BLOCKLIST or ALLOWLIST
            "type": "domain",
            "data": [
                {
                    "value": "first.com"
                },
                {
                    "value": "second.com"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Success Response theme={null}
{
  "data": {
    "type": "DomainTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "first.com",
          "readonly": false,
          "active": false
        },
        {
          "value": "second.com",
          "readonly": false,
          "active": false
        },
      ],
    }
  }
}
```

 

### **Add Domains To An Existing List**

Use this call to add a domain(s) to the existing list.\
 

<EndpointBadge method="put">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/domain-rules
  ```
</EndpointBadge>

The request body should contain an array of objects containing the domain(s) that you want to add.

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "DomainTargetingRule",
        "attributes": {
            "data": [
                {
                    "value": "first.com"
                },
                {
                    "value": "second.com"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Response Body theme={null}
{
  "data": {
    "type": "DomainTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "first.com",
          "readonly": false,
          "active": false
        },
        {
          "value": "second.com",
          "readonly": false,
          "active": false
        },
      ],
    }
  }
}
```

 

### **Remove Domains From An Existing List**

Use this call remove a domain(s) from an existing list.\
 

<EndpointBadge method="delete">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/domain-rules
  ```
</EndpointBadge>

The request body should contain an array of objects containing the domain(s) that you want to remove.

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "DomainTargetingRule",
        "attributes": {
            "data": [
                {
                    "value": "first.com"
                },
                {
                    "value": "second.com"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Response Body theme={null}
{
  "data": {
    "type": "DomainTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "first.com",
          "readonly": false,
          "active": false
        },
        {
          "value": "second.com",
          "readonly": false,
          "active": false
        },
      ],
    }
  }
}
```

## **App Bundle Blocking**

<Warning>
  **Please Note**

  In the examples below, we will use \{advertiserId} as a placeholder.  Please replace this placeholder with your advertiser id.
</Warning>

### **Retrieve Targeting List**

Use this call to retrieve a list of of blocked or allowed app bundles for your advertiser.\
 

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/bundle-rules
  ```
</EndpointBadge>

The API will return the type, mode and a corresponding array containing 3 parameters.  The array parameters are "value", "readonly" and "active".

* The  **value** parameter contains the app bundle.
* The **readonly** flag indicates if you can change the rule.  Rules added by Criteo are not editable and will always return true.
* The **active** flag indicates if the rule is activated and currently being taken into account.  Please note that there is a delay between setting-up the rule and this field changing.

```json Sample Return Body theme={null}
{
  "data": {
    "type": "BundleTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "type": "BUNDLE",
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "com.first",
          "readonly": true,
          "active": false
        },
        {
          "value": "com.second",
          "readonly": true,
          "active": false
        },
        {
          "value": "com.third",
          "readonly": true,
          "active": true
        }
      ]
    }
  }
}
```

 

### **Add A New Targeting List**

Use this endpoint to create a list for the given advertiser.  You can specify either a "BLOCKLIST" or "ALLOWLIST" in the payload.

<Warning>
  **Warning**

  If there is already a **app bundle** list defined for the advertiser, it will overwrite it.  It will not affect the **domain** list.
</Warning>

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/bundle-rules
  ```
</EndpointBadge>

The request body should contain the "mode" and an array of objects containing the app bundles to block/allow.

* The **mode** parameter can be "BLOCKLIST" or "ALLOWLIST".

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "BundleTargetingRule",
        "attributes": {
            "mode": "BLOCKLIST", // BLOCKLIST or ALLOWLIST
            "data": [
                {
                    "value": "com.first"
                },
                {
                    "value": "com.second"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Request Response theme={null}
{
  "data": {
    "type": "BundleTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "type": "BUNDLE",
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "com.first",
          "readonly": false,
          "active": false
        },
        {
          "value": "com.second",
          "readonly": false,
          "active": false
        },
      ]
    }
  }
}
```

 

### **Add App Bundles To An Existing List**

Use this call to add a bundle(s) to the existing list.\
 

<EndpointBadge method="put">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/bundle-rules
  ```
</EndpointBadge>

The request body should contain an array of objects containing the app bundle(s) that you want to add.

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "BundleTargetingRule",
        "attributes": {
            "data": [
                {
                    "value": "com.first"
                },
                {
                    "value": "com.second"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Response Body theme={null}
{
  "data": {
    "type": "BundleTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "com.first",
          "readonly": false,
          "active": false
        },
        {
          "value": "com.second",
          "readonly": false,
          "active": false
        },
      ],
    }
  }
}
```

 

### **Remove App Bundles From An Existing List**

Use this call remove a bundle(s) from an existing list.\
 

<EndpointBadge method="delete">
  ```http theme={null}
  https://api.criteo.com/preview/advertisers/{advertiserId}/targeting/bundle-rules
  ```
</EndpointBadge>

The request body should contain an array of objects containing the bundle(s) that you want to remove.

Please reference the below for a sample payload.

```json Sample Request Body theme={null}
{
    "data": {
        "type": "BundleTargetingRule",
        "attributes": {
            "data": [
                {
                    "value": "com.first"
                },
                {
                    "value": "com.second"
                }
            ]
        }
    }
}
```

A successful response will return a similar payload to the get request above.  Please reference the below for a sample returned payload.

```json Sample Response Body theme={null}
{
  "data": {
    "type": "BundleTargetingRule",
    "id": "f4dc0549-e464-46f4-a5e5-6622912ddd07",
    "attributes": {
      "mode": "BLOCKLIST",
      "data": [
        {
          "value": "com.first",
          "readonly": false,
          "active": false
        },
        {
          "value": "com.second",
          "readonly": false,
          "active": false
        },
      ],
    }
  }
}
```
