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

# Add ad files

> Get images and videos to your agent's ads: attach them in ChatGPT, share a link, or upload from a sandbox. File types, size limits, and the AI enhancements that stay off unless you turn them on.

Agents put your images and videos in DATALYR's ad file library first, then use them in
ads. Every file in the library has an `asset_id` the agent reuses.

## Pick how to send a file

| Where the file is | What to do | Tool the agent uses |
| - | - | - |
| Attached in ChatGPT | Attach it to your message | `import_ad_assets` with the attached files |
| Online: Google Drive, Dropbox, or a direct file link | Paste the link | `import_ad_assets` with `urls` |
| In Claude, Claude Code or Codex, as a file the agent can read | Attach it, or name the path | `create_asset_upload`, an upload, then `finish_asset_upload` |
| Already in the library | Ask the agent to reuse it | `list_ad_assets` |

`import_ad_assets` takes 1 to 20 files per call. The agent waits until each file's
status is `ready` before it makes an ad with it.

## Share a link

| Link | Rule |
| - | - |
| Google Drive | Share the file as **Anyone with the link**. DATALYR converts the share link to a download. Files over 100 MB must be uploaded instead. |
| Dropbox | A shared link to the file itself, not a folder |
| Any other link | It must return the file, not a web page. `https` only, on a public address, with at most 3 redirects. |

## Upload from a sandbox

<Steps>
  <Step title="Ask for an upload slot">
    The agent calls `create_asset_upload` with the file's type and exact size in bytes. It gets an upload URL and headers, valid for 15 minutes.
  </Step>

  <Step title="Upload the file">
    The agent sends the raw bytes with a `PUT` to that URL, with exactly those headers.
  </Step>

  <Step title="Finish">
    The agent calls `finish_asset_upload`. DATALYR checks the real type, size, dimensions and duration.
  </Step>
</Steps>

```bash theme={null}
curl -X PUT --data-binary @spring-4x5.jpg \
  -H "Content-Type: image/jpeg" \
  "UPLOAD_URL_FROM_CREATE_ASSET_UPLOAD"
```

| Rule | Detail |
| - | - |
| Files up to 95 MB | Upload to `api.datalyr.com` |
| Larger files | Upload to the storage host named in the upload URL |
| Claude | If the sandbox refuses the host, allow `api.datalyr.com` under **Settings → Capabilities**. Allow the storage host too for files over 95 MB. |
| The same file twice | `finish_asset_upload` returns the first copy's `asset_id`. The agent uses that one. |

## Library limits

| Kind | Types | Largest file |
| - | - | - |
| Image | JPEG, PNG, GIF, WebP | 30 MB |
| Video | MP4, MOV | 500 MB |

DATALYR reads the type from the file's bytes, never from its name. A file that doesn't
decode, or a video whose length can't be read, fails with the reason. Re-export a
failing video as MP4 (H.264).

Each platform takes a narrower set than the library:

| Platform | Images | Videos |
| - | - | - |
| Meta | JPEG or PNG | MP4 or MOV, 1 second to 241 minutes |
| TikTok | JPEG or PNG, at most 1440×2560 pixels | MP4 or MOV, 1 second to 10 minutes |
| Google Ads | JPEG, PNG or GIF, up to 5120 KB. Demand Gen logos up to 150 KB. | YouTube videos only, by video id. Uploaded video files aren't used. |

Shapes and minimum sizes per format are on [Meta](/agent-ads/meta),
[TikTok](/agent-ads/tiktok) and [Google Ads](/agent-ads/google). Before writing an ad,
the agent calls `get_ad_requirements` for the exact rules of the ad set or ad group.

## AI enhancements stay off

Each platform can change your creative with its own AI: crop, expand, add music, translate,
or generate new versions. DATALYR sends every enhancement explicitly, and each is off
unless you turn it on.

| Source of the setting | Wins over |
| - | - |
| The ad's own `enhancements` value | Everything |
| The workspace default in **Settings → Ad publishing → Enhancements** | The platform's own default |
| Nothing set | Off |

The preview's `Enhancements:` line names each one that is on. To change the workspace
defaults, open **Enhancements**, pick the platform, and turn each switch on or off.
Agents can change these defaults with `update_ad_publish_settings`.

<Accordion title="Every enhancement per platform">
  | Platform | Enhancements |
  | - | - |
  | Meta | Adapt to placement, Visual touch-ups, Adjust brightness and contrast, Expand image, Generate backgrounds, Image animation, Add templates, Add overlays, Text improvements, Translate text, Translate text in images, Enhance CTA, Relevant comments, Add stickers, Reveal details over time, Dynamic description, Video auto-crop, Video filters, Expand video, Translate voiceover, Multi-advertiser ads |
  | TikTok | Video quality enhancement, Music refresh, Image quality enhancement, Image resize |
  | Google Ads, display and Demand Gen image ads | Generate image design versions, Generate animated images, Generate videos from assets, Asset enhancements (display), Auto-generated video (display) |
  | Google Ads, Demand Gen video ads | Generate shorter videos, Generate vertical videos, Landing page text |
</Accordion>

## Verify

1. Ask the agent: `List my ad files.`
2. Confirm your file appears with status `ready` and the width, height and duration you expect.
3. Open **Settings → Ad publishing → Activity** and confirm the `Uploaded …` entry.

## When it does not work

| Symptom | Cause | Fix |
| - | - | - |
| `Google Drive sent a web page, not the file` | The file isn't shared publicly, or it's over 100 MB. | Share as **Anyone with the link**, or upload it instead. |
| `Dropbox sent a web page, not the file` | The link points to a folder or a preview page. | Use a shared link to the file itself. |
| The upload is refused in Claude | The sandbox blocks `api.datalyr.com`. | Allow it under **Settings → Capabilities**. |
| `size_mismatch` | The upload's size differs from the declared bytes. | Ask the agent to call `create_asset_upload` again with the exact size. |
| `This upload link is invalid or expired` | More than 15 minutes passed. | Ask the agent to start the upload again. |
| `Google takes images up to 5120 KB.` | The image is too large for Google Ads. | Export a smaller file. |

## Next

* [Meta](/agent-ads/meta): image and video shapes per Meta format.
* [How agents publish](/agent-ads/how-publishing-works): what the preview shows about files.
* [Agent ad tools](/agent-ads/tools): the file tools and their inputs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.