Media

Rename or move a file, set its alt text, title or tags, or restore it

name and folder change the path in the library (the extension stays); the 640 version moves with it. A site keeps the file under the path it has until you deploy again. alt sets the alt text; null removes it. title, description and tags (replacing the old ones) are yours to fill. restore: true puts a file from the trash back on its old path (or next to it when that is taken now); a file in the trash cannot change otherwise (409). 409 conflict when another file already has the new path.

patch/media/{id}

Request

  • Base URL: https://api.hypamoon.com/api/v1
  • URL: https://api.hypamoon.com/api/v1/media/{id}
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://app.hypamoon.com/oauth/authorize, token URL https://api.hypamoon.com/oauth/token, scopes: sites:write)

Path parameters

idstring uuid required

The id of the file.

Request body

namestring

A new file name. The extension always stays that of the file.

folderstring nullable

Move the file to this folder under /media/; null or an empty string for /media/ itself.

altstring nullable

The alt text for the image; null removes it.

titlestring nullable

A display name; null removes it.

descriptionstring nullable

A free description; null removes it.

tagsstring[]

The tags of the file, replacing the old ones; [] removes them. At most 20.

restoretrue

Put a file from the trash back where it was (or next to it, when that name is taken now).

Response

The file after the change.

idstring uuid required

The id of the file in the library.

pathstring required

Where the file goes on a site when you add it with deploy_site media, like /media/portfolio/project-12/03.webp.

folderstring required

The folder under /media/, empty for /media/ itself.

namestring required

The file name in the library.

original_namestring nullable required

The name on the user's computer, when it differs.

content_typestring required
bytesinteger required
widthinteger nullable required
heightinteger nullable required
altstring nullable required

The alt text, set with update_media.

urlstring nullable required

Where the file is served, on the first site that has it at this path. null: it is on no site yet; it is private until you add it with deploy_site media.

variantsobject required

For photos: 640, the small version for srcset and thumbnails.

srcsetstring nullable required

A ready srcset for an img tag once the file is on a site: small webp versions at 160, 320, 640 and 1280 wide (from /_hypamoon/img on that site) plus the file itself. Always add sizes with the width it is shown at, like sizes="52px" for a thumbnail.

thumbnail_urlstring nullable required

A small webp, 160 wide, for thumbnails up to about 80 px (search suggestions, lists, a cart). null while the file is on no site, or for a file that is not a photo.

original_keptboolean required

The full-size original is kept privately. It never goes on a site; the user downloads it in the portal.

source'upload' | 'portaal' | 'site' | 'import' required

upload: an upload link; portaal: the portal; site: it was already on a site; import: an import.

access'team' | 'public' | 'paid' required

Who can open the file. team: only the project's members and this chat (the default for every file).

titlestring nullable required

A display name, set with update_media.

descriptionstring nullable required

A free description, set with update_media.

tagsstring[] required

Tags to filter on, set with update_media.

kind'image' | 'video' | 'audio' | 'pdf' | 'font' | 'archive' | 'document' | 'data' | 'other' required

image, video, audio, pdf, font, archive, document, data or other, from the file type.

deleted_atstring nullable required

When it went to the trash; null when it is not in the trash. A file stays in the trash for 30 days.

purge_atstring nullable required

When the trash deletes it for good. Restore it before then with update_media restore: true.

deleted_fromstring nullable required

The path it had before it went to the trash; restore puts it back there.

created_atstring required
updated_atstring required

Changes

No recorded changes to this operation across all 1 revision of this API.