---
title: "Images"
description: "Reference documentation for the Images endpoints in the Klaviyo REST API."
url: "https://developers.klaviyo.com/en/v2025-01-15/reference/images"
revision: "2025-01-15"
llmsTxt: "https://developers.klaviyo.com/en/v2025-01-15/reference/images/llms.txt"
---

# Images

## Before you begin

Check out our [general API overview](https://developers.klaviyo.com/en/reference.md) before getting started with specific endpoints.

Use the [Images API](https://developers.klaviyo.com/en/reference/get_images.md) to automate the process of retrieving, uploading, and updating images in your Klaviyo account.

## Use cases

Here are some use cases supported by the Images API:

* Get all images in an account.
* Get an image by image ID.
* Import an image from a URL or data URI.
* Update an image by image ID.
* Upload an image from a file.

> [!NOTE]
> Create and upload images to your Klaviyo account [using AI with our Images API](https://www.klaviyo.com/blog/solution-recipe-using-ai-and-apis-to-create-and-upload-images-to-your-klaviyo-account#using-klaviyo-s-apis-to-upload-images-4).

## Data model

A retrieved image has the following:

* `id`

    The ID of the image.

* `attributes`
    * `name`

        A name for the image. Defaults to the filename if not provided. If the name matches an existing image, a suffix will be added.

    * `image_url`

        An existing image URL to import the image from.

    * `format`

        The type of file (e.g., jpeg). Supported formats include jpeg, png, and gif.

    * `size`

        The size of the image in bytes. Maximum file size is 5 MB.

    * `hidden`

        Whether the image is shown in the asset library (defaults to false).

    * `updated_at`

        The timestamp of when the image was last updated.

## Upload an image

Check out the examples below on using the Images API to import an image from a URL or file.

### Upload an image from URL

To upload an image from a URL, you’ll need to include the image URL in your request payload to [Upload Image From URL](https://developers.klaviyo.com/en/reference/upload_image_from_url.md). The request and response should look something like this:

```json Request
{
   "data": {
       "type": "image",
       "attributes": {
           "import_from_url": "https://via.placeholder.com/150",
           "name": "Blue T-Shirt",
           "hidden": false
       }
   }
}
```
```json Response
{
    "data": {
        "type": "image",
        "id": "193828341",
        "attributes": {
            "name": "Blue T-Shirt",
            "image_url": "https://via.placeholder.com/150",
            "format": "jpeg",
            "size": 32335,
            "hidden": false,
            "updated_at": "2025-01-16T21:44:39.021934+00:00"
        },
        "links": {
            "self": "https://a.klaviyo.com/api/images/193828341/"
        }
    },
    "links": {
        "self": "https://a.klaviyo.com/api/images"
    }
}
```

### Upload an image from file

To upload an image from a file, use the [Upload Image From File](https://developers.klaviyo.com/en/reference/upload_image_from_file.md) endpoint. Here's an example request and response:

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/image-upload \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'content-type: multipart/form-data' \
     --header 'revision: 2025-01-15' \
     --form hidden=false \
     --form file='@baseballcap.jpeg' \
     --form 'name=baseball cap'
```
```json Response
{
    "data": {
        "type": "image",
        "id": "195062861",
        "attributes": {
            "name": "baseball cap",
            "image_url": "https://d3k81ch9hvuctc.cloudfront.net/company/your_company_id/images/141a0b0b-3f5f-4798-a4b5-61f0785b7958.jpeg",
            "format": "jpeg",
            "size": 9634,
            "hidden": false,
            "updated_at": "2025-01-16T18:06:14.845463+00:00"
        },
        "links": {
            "self": "https://a.klaviyo.com/api/images/195062861/"
        }
    },
    "links": {
        "self": "https://a.klaviyo.com/api/image-upload"
    }
}
```

Here's how the example image appears in Klaviyo:

<img src="https://files.readme.io/5da34d6f5e584d0012355da071da0ba82950518be55d81ffdb724407d551dd12-blue_tshirt.png" alt="" loading="lazy" />

## Get Image(s)

The Get Image(s) endpoints are useful for fetching images from your Klaviyo account. When making a [Get Image](https://developers.klaviyo.com/en/reference/get_image.md) or [Get Images](https://developers.klaviyo.com/en/reference/get_images.md) request, here’s an example of how it could look:

```curl Request
curl --request GET \
     --url 'https://a.klaviyo.com/api/images?page%5Bsize%5D=20' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2025-01-15'
```
```json Response
{
   "data": [
       {
           "type": "image",
           "id": "167135588",
           "attributes": {
               "name": "test",
               "image_url": "https://via.placeholder.com/150",
               "format": "jpeg",
               "size": 1143579,
               "hidden": false,
               "updated_at": "2024-09-03T17:23:19+00:00"
           },
           "links": {
               "self": "https://a.klaviyo.com/api/images/167135588/"
           }
       }
   ],
   "links": {
       "self": "https://a.klaviyo.com/api/images",
       "next": null,
       "prev": null
   }
}
```

## Querying images

Querying images with the Images API can help you achieve many use cases, e.g., fetching a list of images with a size greater than 1 MB and less than 5 MB. Check out the supported query parameters below and [test them out with our latest Postman collection](https://developers.klaviyo.com/en/docs/use_klaviyos_postman_collections.md). Note that support for given operators and fields is endpoint-specific. Review the API reference documentation for more information on allowed fields and query operators.

| Parameter | Description                                                                                                                                                 | Query example                                    |
| :-------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- |
| `filter`  | Retrieve a subset of catalog resources, e.g., all jpeg images. Learn about the [filter query parameter](https://developers.klaviyo.com/en/docs/filtering_.md). | `GET /api/images?filter=equals(format,"jpeg")`   |
| `sort`    | Sort images, e.g., by size (smallest to largest). Learn about the [sort query parameter](https://developers.klaviyo.com/en/docs/sorting_.md).                  | `GET /api/images?sort=size`                      |
| `fields`  | Request for only specified image data, e.g., image URL. Learn more about [sparse fieldsets](https://developers.klaviyo.com/en/docs/sparse_fieldsets.md).       | `GET /api/images?fields[image]=image_url,format` |

## Additional resources

* [Images in emails reference](https://help.klaviyo.com/hc/en-us/articles/115005253688)
* [Getting started with Canva](https://help.klaviyo.com/hc/en-us/articles/23364424365339)
* [How to add a background image to an email template or section](https://help.klaviyo.com/hc/en-us/articles/115005255968-How-to-add-a-background-image-to-an-email-template-or-section)

## Endpoints

- [Get Images](https://developers.klaviyo.com/en/v2025-01-15/reference/get_images.md): `GET /api/images`
- [Get Image](https://developers.klaviyo.com/en/v2025-01-15/reference/get_image.md): `GET /api/images/{id}`
- [Upload Image From URL](https://developers.klaviyo.com/en/v2025-01-15/reference/upload_image_from_url.md): `POST /api/images`
- [Update Image](https://developers.klaviyo.com/en/v2025-01-15/reference/update_image.md): `PATCH /api/images/{id}`
- [Upload Image From File](https://developers.klaviyo.com/en/v2025-01-15/reference/upload_image_from_file.md): `POST /api/image-upload`
