Skip to content
Last updated

Upload a Thumbnail or Update an Image

Endpoint:

PUT https://api.mailjet.com/v1/data/images/:id/:content_type

A thumbnail is a smaller version of your image. We strongly recommend uploading a thumbnail to improve loading times in the Mailjet gallery.

Upload or update the thumbnail of an existing image or update an existing image. The content_type parameter determines whether the request is for an image (content) or a thumbnail (thumbnail).

URL Parameters:

id: The ID of the image. content_type: Either content or thumbnail.

Request Content Type:

multipart/mixed or multipart/form-data

Request Parts:

file (required): The binary data of the image. Supported content types: image/jpeg, image/png, image/svg, image/gif, image/webp.

Example Request

curl --request PUT \
  --url https://api.mailjet.com/v1/data/images/a3da1de2-2319-44e9-9c75-e6a00a2ec5da/thumbnail \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --form 'file=@"postman-cloud:///1eee6a09-165d-4570-99d2-1e863ed3ac2c";type=image/jpeg'

Status Code 200

Response Data Field Structure

NameTypeDescription
IDstringThe ID of the image.
NamestringThe name of the image.
StatusstringIndicates whether the image is open or locked.
TargetContentstringIndicates the purpose of the image. Possible values: image, background, video or social.
ImageSizeintegerThe size of the image file in bytes.
LabelIDsarray of integersAn array of IDs representing labels associated with the image.
IsStarredbooleanIndicates whether the image is marked as a favorite.
ImageURLstringThe URL where the image is stored.
ThumbnailUrlstringThe URL where the thumbnail is stored.
CreatedAtDateTime UTCThe date and time when the image was created.
UpdatedAtDateTime UTCThe date and time when the image was last updated.
ExpiresAtDateTime UTCThe date and time when the image will expire.

API Response

{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": "a3da1de2-2319-44e9-9c75-e6a00a2ec5da",
            "OrganisationID": 2,
            "Name": "My Image",
            "Status": "open",
            "TargetContent": "image",
            "ImageSize": 425155,
            "ThumbnailSize": 425155,
            "TotalSize": 850310,
            "LabelIDs": [],
            "IsStarred": false,
            "ImageUrl": "https://0abcd.mjt.lu/img2/0abcd/a3da1de2-2319-44e9-9c75-e6a00a2ec5da/content",
            "ThumbnailUrl": "https://0abcd.mjt.lu/img2/0abcd/a3da1de2-2319-44e9-9c75-e6a00a2ec5da/thumbnail",
            "CreatedAt": "2024-05-23T12:51:58.97041Z",
            "UpdatedAt": "2024-05-23T13:17:52.522524Z",
            "ExpiresAt": "2024-12-10T00:00:00Z"
        }
    ]
}