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.
Body parameters
typestringRequired
Must be exactly "upload".
attributes.pathstringOptional
Upload path
Example: "/45/1496845848-digital-cats.jpg"
attributes.basenamestringOptional
Upload basename
Example: "digital-cats"
attributes.copyrightstring, nullOptional
Copyright
Example: "2020 DatoCMS"
attributes.authorstring, nullOptional
Author
Example: "Mark Smith"
attributes.notesstring, nullOptional
Notes
Example: "Nyan the cat"
attributes.tagsOptional
Tags
Type:
Array<string>
Example: ["cats"]
attributes.default_field_metadataobjectOptional
For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
Example: {
en: {
title: "this is the default title",
alt: "this is the default alternate text",
custom_data: { foo: "bar" },
focal_point: { x: 0.5, y: 0.5 },
},
}
relationships.creator.dataOptional
The entity (account/collaborator/access token) who created the asset