---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/direct/doc/dg-v4/en/live/AdImageAssociation_Get.md
  - https://yandex.com/dev/direct/doc/dg-v4/ru/live/AdImageAssociation_Get.md
  - href: en/live/AdImageAssociation_Get.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/direct/doc/dg-v4/en/llms.txt

# Get
Returns data on associations of images with ads.
## Restrictions


{% note alert %}

The method only supports text and image ads. To work with all types of ads, use the [Ads](https://yandex.com/dev/direct/doc/ref-v5/ads/ads.html) service in version 5 of the API. [More about ad types...](https://yandex.com/dev/direct/doc/dg/objects/ad.htmlad.md)

{% endnote %}


The method response may contain no more than 10,000 associations.

The total number of associations that meet the specified criteria is shown in the TotalObjectsCount output parameter. If the total is more than 10,000, you must use the Limit and Offset parameters to set up paged selection in order to get all the associations.

## Input data

The input data structure in JSON is shown below.

```javascript
{
   "method": "AdImageAssociation",
   "param": {
      /* AdImageAssociationRequest */
      "Action": (string),
      "SelectionCriteria": {
         /* AdImageAssociationSelectionCriteria */
         "Logins": [
            (string)
            ...
         ],
         "AdImageHashes": [
            (string)
            ...
         ],
         "StatusAdImageModerate": [
            (string)
            ...
         ],
         "AdIDS": [
            (long)
            ...
         ],
         "CampaignIDS": [
            (int)
            ...
         ],
         "Limit": (int),
         "Offset": (int)
      }
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
|
**<sup >Required</sup>**
||

||
**<sub >AdImageAssociationRequest object</sub>**
||
||
`Action`
|
Action: Get.
|
Yes
||
||
`SelectionCriteria`
|
The `AdImageAssociationSelectionCriteria` object, which contains criteria for selecting image associations.
|
For agencies
||

||
**<sub >AdImageAssociationSelectionCriteria object</sub>**
||
||
`Logins`
|
For agencies, an array containing usernames of clients (no more than 10) to perform the operation for.

For advertisers, this parameter is ignored.
|
For agencies
||
||
`AdImageHashes`
|
Array containing the hashes of images (no more than 10,000).
|
No
||
||
`StatusAdImageModerate`
|
Array of strings containing the moderation status of images:

- New — Image has not been checked.
- Pending — Moderation in progress.
- Yes — Approved.
- No — Rejected.

Selects images with all the statuses listed in the array.
|
No
||
||
`AdIDS`
|
Array of IDs (no more than 10,000) for ads that images are associated with.
|
No
||
||
`CampaignIDS`
|
Array of IDs (no more than 10,000) for campaigns that images are associated with.
|
No
||
||
`Limit`
|
The number of associations in the response. The maximum allowed value is 10,000. If omitted, the limit is 10,000.

When combined with the `Offset` parameter, this allows you to organize paginated selections from the database.
|
No
||
||
`Offset`
|
The number of associations that should be skipped when getting the selection. If omitted, 0 is assumed.

When combined with the `Limit` parameter, this allows you to organize paginated selections from the database.
|
No
||

||
**Notes**
||
||
1. For advertisers: If the `SelectionCriteria` structure is empty, you will get all the associations (up to 10,000).
1. If the `SelectionCriteria` structure has more than one criterion set, you will get the associations that simultaneously match all the criteria. For example, if the `AdImageHashes` and `AdIDS` parameters are set with the string "Yes", you will get associations if their hashes are in the `AdImageHashes` array, and their ad IDs are also in the `AdIDS` array.
||
|#

## Output data

The output data structure in JSON is shown below.

```javascript
{
   "data": {
      /* AdImageAssociationResponse */
      "AdImageAssociations": [
         {  /* AdImageAssociation */
            "AdID": (long),
            "AdImageHash": (string),
            "Login": (string),
            "CampaignID": (int),
            "StatusAdImageModerate": (string),
            "ModerateRejectionReasons": [
               {  /* RejectReason */
                  "Type": (string),
                  "Text": (string)
               }
               ...
            ]
         }
         ...
      ],
      "TotalObjectsCount": (int)
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
||

||
**<sub >AdImageAssociationResponse object</sub>**
||
||
`AdImageAssociations`
|
Array of `AdImageAssociation` objects containing information about images.
||
||
`TotalObjectsCount`
|
The total number of associations that match the set criteria (without the `Limit` parameter).
||

||
**<sub >AdImageAssociation object</sub>**
||
||
`AdID`
|
Identifier of the ad that the image is associated with.
||
||
`AdImageHash`
|
Hash of the image.
||
||
`Login`
|
Username of the image's owner.
||
||
`CampaignID`
|
The campaign ID.
||
||
`StatusAdImageModerate`
|
The image's moderation status:

- New — Image has not been checked.
- Pending — Moderation in progress.
- Yes — Approved.
- No — Rejected.
||
||
`ModerateRejectionReasons`
|
Array of `RejectReason` objects. These objects describe the reasons that caused the image for the ad to be rejected.
||

||
**<sub >RejectReason object</sub>**
||
||
`Type`
|
The type of object that was rejected during moderation: AdImage.
||
||
`Text`
|
Reason for rejection during moderation.
||
|#

## Examples of input data

# Python

```python
{
   'Action': 'Get',
   'SelectionCriteria': {
      'StatusAdImageModerate': ['Yes'],
      'CampaignIDS': [1327944, 1327974],
      'Limit': 20,
      'Offset': 60
   }
}
```

# PHP

```php
array(
   'Action' => 'Get',
   'SelectionCriteria' => array(
      'StatusAdImageModerate' => array('Yes'),
      'CampaignIDS' => array(1327944, 1327974),
      'Limit' => 20,
      'Offset' =60
   )
)
```

# Perl

```perl
{
   'Action' => 'Get',
   'SelectionCriteria' ={
      'StatusAdImageModerate' => ['Yes'],
      'CampaignIDS' => [1327944, 1327974],
      'Limit' => 20,
      'Offset' =60
   }
}
```


