Mojimoto Docs
Start free
Docs Concepts Media

Media

Upload images and files to a project's media library, link them from media fields and read them back with their dimensions and alt text.

Every project has a media library: the images and files its entries use. A file you upload becomes an asset with an id, a URL and a few facts about the file. A media field in an entry links to an asset, and the Delivery API returns the whole asset in its place, so your front end gets the URL, the alt text and the dimensions in one request.

Upload a file

There are three ways in, and they all land in the same library.

Where How
Dashboard Open Media and choose Upload, or drop a file into the picker of a media field while you edit an entry. Editors and above can upload.
Management API POST /manage/assets as a multipart form, with a write token.
MCP server The upload-asset-tool tool, given a public url or content_base64 with a filename. See MCP server.
POST/api/v1/{project}/manage/assets
terminal
curl -X POST "https://mojimoto.com/api/v1/acme/manage/assets" \
  -H "Authorization: Bearer mjmt_your_write_token" \
  -F "file=@loaf.jpg" \
  -F "alt=A loaf on a board"
Field Type Description
file file Required. Any kind of file, up to 20 MB.
alt string Alt text, up to 255 characters.
filename string A name to store in place of the file's own, up to 255 characters.

The response is a 201 with the new asset:

json
{
  "id": 7,
  "url": "https://files.example.com/projects/128/assets/pX3vQ9mK2LwZ8nRbT5cJ7yHd1FgA4sU6eViO0tNq.jpg",
  "filename": "loaf.jpg",
  "mime_type": "image/jpeg",
  "width": 2400,
  "height": 1600,
  "alt": "A loaf on a board"
}

The largest file is 20 MB, whichever way you upload. A token limited to certain operations needs Upload media to call this endpoint. This response names the type mime_type. Everywhere else it is content_type.

The host in url above is an example. Treat the URL as opaque and use it as it is given.

What is stored about a file

Stored Description
File name The name the file was uploaded with, or the filename you sent.
Content type Worked out from the file itself, for example image/jpeg or application/pdf.
Size In bytes.
Width and height In pixels, for images whose size can be read. null for anything else.
Alt text One description per asset, shared by every entry that uses it.

Open a file in Media to change its alt text, copy its URL or delete it. An image can also be resized there: you give the longest side in pixels and the stored file is replaced with the smaller one. The original is not kept.

The media field and its fit

A media field holds a link to an asset and a fit:

json
{
  "hero": { "asset_id": 7, "fit": "cover" }
}

fit is cover or contain. It is a note from the editor to your front end about how the image should sit in its frame: cover fills the frame, contain shows the whole image inside it. Editors choose it beside the field as Cover or Within. Mojimoto does not change the file either way. Leave fit out and it is cover.

When an entry is published, every asset it links to has to exist in the same project. If one does not, publishing fails with a 422 such as Hero links to a file that does not exist in this project.

How an asset comes back

The Delivery API replaces the link with the asset:

json
"hero": {
  "id": 7,
  "url": "https://files.example.com/projects/128/assets/pX3vQ9mK2LwZ8nRbT5cJ7yHd1FgA4sU6eViO0tNq.jpg",
  "alt": "A loaf on a board",
  "width": 2400,
  "height": 1600,
  "content_type": "image/jpeg",
  "fit": "cover"
}

An empty media field is null, and so is one whose asset has been deleted. Media inside blocks and inside linked entries is expanded in the same way. The url points at the stored file itself.

List the media library

GET/api/v1/{project}/assets
GET/api/v1/{project}/assets/{id}

A read token is enough. The list is paged like entries are.

Parameter Type Description
page integer The page to return, from 1.
per_page integer Assets per page. Default 20, at most 100.
sort string -id for newest first. Oldest first otherwise.
content_type string Only files whose type starts with this, for example image or application/pdf.
json
{
  "results": [
    {
      "id": 7,
      "url": "https://files.example.com/projects/128/assets/pX3vQ9mK2LwZ8nRbT5cJ7yHd1FgA4sU6eViO0tNq.jpg",
      "filename": "loaf.jpg",
      "alt": "A loaf on a board",
      "content_type": "image/jpeg",
      "size": 482113,
      "width": 2400,
      "height": 1600,
      "created_at": "2026-11-26T09:14:02+00:00",
      "updated_at": "2026-11-26T09:14:02+00:00"
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 1,
  "total_pages": 1
}

A token limited to certain content types gets a 403 here. It still receives the media used in the entries it can read. The rest of the read endpoints are in the Delivery API reference.

Legacy URL-only values

Older and imported content can hold a media value that is a plain URL, or a { "url": "...", "fit": "..." } object with no asset behind it. These are still accepted and still delivered, in the same shape, with id, alt, width, height and content_type all null.

For new content, upload the file and link it by asset_id. An image object copied from another CMS, with keys such as dimensions and no asset_id, is refused with a 422 that tells you to upload the file first.

Storage and your plan

Each file in the library counts as one record, and its size counts towards the project's media storage. On the Free plan an upload that would pass either allowance is refused, with a 422 over the API. On a paid plan uploads are never refused. The numbers are on Technical limits.

Something wrong or missing on this page? Tell us and we will fix it.

© 2026 Your Ikigai Ltd · Registered in England & Wales, no. 15274889 文 · モジモト