---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/direct/doc/dg-v4/en/live/AdImage_Upload.md
  - https://yandex.com/dev/direct/doc/dg-v4/ru/live/AdImage_Upload.md
  - href: en/live/AdImage_Upload.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

# Upload
Asynchronously uploads images from a list of URLs. The synchronous response contains the numbers of upload tasks.
## Input data

The input data structure in JSON is shown below.

```javascript
{
   "method": "AdImage",
   "param": {
      /* AdImageRequest */
      "Action": (string),
      "AdImageURLData": [
         {  /* AdImageURL */
            "Login": (string),
            "URL": (string),
            "Name": (string)
         }
         ...
      ]
   }
}
```

Parameters are described below.


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

||
**<sub >AdImageRequest object</sub>**
||
||
`Action`
|
Action: Upload.
|
Yes
||
||
`AdImageURLData`
|
Array of `AdImageURL` objects (no more than 10,000) containing information about images being uploaded.
|
Yes
||

||
**<sub >AdImageURL object</sub>**
||
||
`Login`
|
Username of the client who owns the image.

For advertisers, this parameter is ignored.
|
For agencies
||
||
`URL`
|
Image link.
|
Yes
||
||
`Name`
|
Caption for the image (any description).
|
Yes
||
|#

## Output data


{% note alert %}

An error when creating an upload task (adding to the queue) for one of the images does not cause the entire operation to be canceled and does not affect the successful creation of upload tasks for the other images.

{% endnote %}


The output data structure in JSON is shown below.

```javascript
{
   "data": {
      /* AdImageResponse */
      "ActionsResult": [
         {  /* AdImageActionResult */
            "AdImageUploadTaskID": (int),
            "Errors": [
               {  /* Error */
                  "FaultCode": (int),
                  "FaultString": (string),
                  "FaultDetail": (string)
               }
               ...
            ],
         }
         ...
      ]
   }
}
```

Parameters are described below.


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

||
**<sub >AdImageResponse object</sub>**
||
||
`ActionsResult`
|
Array of `AdImageActionResult` objects. Each object corresponds to an item in the `AdImageURLData` input array and contains:

- The number of the upload task, if the image was successfully added to the queue.
- The `Errors` array, if an error occurred.

The items in the array are in the same order as the objects in the `AdImageURL` input array.
||

||
**<sub >AdImageActionResult object</sub>**
||
||
`AdImageUploadTaskID`
|
Number of the created upload task. This number can be used for checking the upload status using the [CheckUploadStatus](https://yandex.com/dev/direct/doc/dg-v4/en/live/AdImage_CheckUploadStatus.md) action.
||
||
`Errors`
|
Array of `Error` objects — errors that occured when adding images to the upload queue.
||

||
**<sub >Error object</sub>**
||
||
`FaultCode`
|
Error code.
||
||
`FaultString`
|
Textual message about the error.
||
||
`FaultDetail`
|
Detailed description of the reason for the error.
||
|#

## Examples of input data

# Python

```python
{
   'Action': 'Upload',
   'AdImageURLData': [
      {
         'Login': 'agrom',
         'URL': 'http://site.ru/files/image001.png',
         'Name': u'Elephants: new collection'
      },
      {
         'Login': 'agrom',
         'URL': 'http://site.ru/files/image002.png',
         'Name': u'Elephants: certification and maintenance'
      },
      {
         'Login': 'larry',
         'URL': 'http://example.net/files/pic.png',
         'Name': u'Stock up on peanuts'
      }
   ]
}
```

# PHP

```php
array(
   'Action' => 'Upload',
   'AdImageURLData' => array(
      array(
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image001.png',
         'Name' ='Elephants: new collection'
      ),
      array(
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image002.png',
         'Name' ='Elephants: certification and maintenance'
      ),
      array(
         'Login' => 'larry',
         'URL' => 'http://example.net/files/pic.png',
         'Name' ='Stock up on peanuts'
      )
   )
)
```

# Perl

```perl
{
   'Action' => 'Upload',
   'AdImageURLData' => [
      {
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image001.png',
         'Name' ='Elephants: new collection'
      },
      {
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image002.png',
         'Name' ='Elephants: certification and maintenance'
      },
      {
         'Login' => 'larry',
         'URL' => 'http://example.net/files/pic.png',
         'Name' ='Stock up on peanuts'
      },
   ]
}
```

