Show examples in:
    Update an upload

    Depending on the attributes that you pass, you can use this endpoint to:

    • Update regular attributes like author, notes, copyright, default_field_metadata, etc.;
    • Rename the asset by passing a different basename attribute;
    • Upload a new version of the asset by passing a different path attribute;

    Just like POST /uploads endpoint, an asyncronous job ID might be returned instead of the regular response. See the Create a new upload section for more details.

    We strongly recommend to use our JS or Ruby client to upload new assets, as they provide helper methods that take care of all the details for you.


    path  string  Optional

    Upload path

    basename  string  Optional

    Upload basename

    copyright  string, null  Optional


    author  string, null  Optional


    notes  string, null  Optional


    tags  Array<string>  Optional


    default_field_metadata  object  Optional

    For each of the project's locales, the default metadata to apply if nothing is specified at record's level.

    creator  { type: "account", id: }, { type: "access_token", id: }, { type: "user", id: }, { type: "sso_user", id: }, { type: "organization", id: }  Optional

    The entity (account/collaborator/access token) who created the asset. It must be an object with type (e.g. 'account') and id properties.


    Returns a upload resource object.


    The following examples are available:

    Update/rename assets
    Example code:
    import {
    } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const uploadId = 4124;
    // we can either update regular attributes:
    await client.uploads.update(uploadId, {
    author: 'New author!',
    copyright: 'New copyright',
    default_field_metadata: {
    en: {
    alt: 'new default alt',
    title: 'new default title',
    focal_point: {
    x: 0.3,
    y: 0.6,
    custom_data: {},
    // associate a new file with the existing upload object:
    await client.uploads.update(uploadId, {
    path: await uploadLocalFileAndReturnPath(client, './image.jpg', {
    // if you want, you can specify a different base name for the uploaded file
    filename: 'different-image-name.png',
    // or rename the uploaded file in the CDN (for SEO purposes):
    const updatedUpload = await client.uploads.update(uploadId, {
    basename: 'this-will-be-the-new-file-basename',