Replace image or image metadata | Moov Documentation

Replace image or image metadata

Replace an existing image and, optionally, its metadata.

This endpoint replaces the existing image with the new PNG, JPEG, or WebP. Omit the metadata form section to keep existing metadata. Duplicate images, and requests larger than 16MB will be rejected.

PUT

/accounts/{accountID}/images/{imageID}

Ask

curl -X PUT "https://api.moov.io/accounts/{accountID}/images/{imageID}" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.04.00" \
  -F "image=@/path/to/image" \
  -F 'metadata={}'

Ask

import { Moov } from "@moovio/sdk";
import { openAsBlob } from "node:fs";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.images.update({
    accountID: "310f4f19-45cf-4429-9aae-8e93827ecb0d",
    imageID: "8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47",
    imageUploadRequestMultiPart: {
      image: await openAsBlob("example.file"),
    },
  });

console.log(result);
}

run();

Ask

declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$imageUploadRequestMultiPart = new Components\ImageUploadRequestMultiPart(
    image: new Components\Image(
        fileName: 'example.file',
        content: file_get_contents('example.file');,
    ),
);

$response = $sdk->images->update(
    accountID: '310f4f19-45cf-4429-9aae-8e93827ecb0d',
    imageID: '8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47',
    imageUploadRequestMultiPart: $imageUploadRequestMultiPart
);

if ($response->imageMetadata !== null) {
    // handle response
}

Ask

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.errors.ImageRequestValidationError;
import io.moov.sdk.models.operations.UpdateImageResponse;
import io.moov.sdk.utils.Utils;
import java.io.FileInputStream;
import java.lang.Exception;

public class Application {

public static void main(String[] args) throws GenericError, ImageRequestValidationError, Exception {

Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

UpdateImageResponse res = sdk.images().update()
                .accountID("310f4f19-45cf-4429-9aae-8e93827ecb0d")
                .imageID("8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47")
                .imageUploadRequestMultiPart(ImageUploadRequestMultiPart.builder()
                    .image(Image.builder()
                        .fileName("example.file")
                        .content(Utils.readBytesAndClose(new FileInputStream("example.file")))
                        .build())
                    .build())
                .call();

}
}

Ask

from moovio_sdk import Moov
from moovio_sdk.models import components

with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

res = moov.images.update(account_id="310f4f19-45cf-4429-9aae-8e93827ecb0d", image_id="8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47", image={
        "file_name": "example.file",
        "content": open("example.file", "rb"),
    })

# Handle response
    print(res)

Ask

require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
  security: Models::Components::Security.new(
    username: '',
    password: ''
  )
)
res = s.images.update(account_id: '310f4f19-45cf-4429-9aae-8e93827ecb0d', image_id: '8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47', image_upload_request_multi_part: Models::Components::ImageUploadRequestMultiPart.new(
  image: Models::Components::Image.new(
    file_name: 'example.file',
    content: File.binread('example.file')
  )
))

unless res.image_metadata.nil?
  # handle response
end

Ask

using Moov.Sdk;
using Moov.Sdk.Models.Components;

var sdk = new MoovClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.Images.UpdateAsync(
    accountID: "310f4f19-45cf-4429-9aae-8e93827ecb0d",
    imageID: "8ef109f8-5a61-4355-b2e4-b8ac2f6f6f47",
    body: new ImageUploadRequestMultiPart() {
        Image = new Image() {
            FileName = "example.file",
            Content = System.IO.File.ReadAllBytes("example.file"),
        },
    }
);
// handle response

The request completed successfully.

Example

Metadata about an uploaded image.

{
  "imageID": "string",
  "publicID": "string",
  "altText": "string",
  "link": "https://api.moov.io/images/qJRAaAwwF5hmfeAFdHjIb",
  "createdOn": "2019-08-24T14:15:22Z",
  "updatedOn": "2019-08-24T14:15:22Z",
  "disabledOn": "2019-08-24T14:15:22Z"
}

Response headers

A unique identifier used to trace requests.

The server could not understand the request due to invalid syntax.

Example

{
  "error": "string"
}

Response headers

A unique identifier used to trace requests.

The request contained missing or expired authentication.

Response headers

A unique identifier used to trace requests.

The user is not authorized to make the request.

Response headers

A unique identifier used to trace requests.

The requested resource was not found.

Response headers

A unique identifier used to trace requests.

The request conflicted with the current state of the target resource.

Example

{
  "error": "string"
}

Response headers

A unique identifier used to trace requests.

The request was well-formed, but the contents failed validation. Check the request for missing or invalid fields.

Example

{
  "image": "string",
  "metadata": {
    "altText": "string"
  }
}

Response headers

A unique identifier used to trace requests.

Request was refused due to rate limiting.

Response headers

A unique identifier used to trace requests.

The request failed due to an unexpected error.

Response headers

A unique identifier used to trace requests.

The request failed because a downstream service failed to respond.

Response headers

A unique identifier used to trace requests.

Set this header to v2026.04.00 to use the API described in this specification. When omitted, the server defaults to v2024.01.00, which may not match the behavior documented here.

Possible values:

v2026.04.00

Request body for creating or updating image metadata.

Show child attributes