# Content Delivery API

Reference for the read API - every endpoint, query parameter, filter operator and response shape for fetching published content.

The Content Delivery API is a read-only JSON API that serves the published content of a project. Use it to get entries onto a website, into an app or into a static build. It also serves the project's content model, its media library and generated TypeScript types.

It only returns published content. To read drafts, call the same endpoints as the [Content Preview API](/docs/api/preview). To create or change content, use the [write API](/docs/api/management).

A request is a `GET` with a token in the `Authorization` header:

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=tag" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 4,
      "uid": "baking",
      "type": "tag",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:09:15+00:00",
      "updated_at": "2026-02-10T10:09:15+00:00",
      "data": {
        "name": "Baking"
      }
    },
    {
      "id": 5,
      "uid": "beginners",
      "type": "tag",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:09:48+00:00",
      "updated_at": "2026-02-10T10:09:48+00:00",
      "data": {
        "name": "Beginners"
      }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 2,
  "total_pages": 1,
  "lang": "en-gb",
  "ref": "published"
}
```

The API calls an entry a document in its paths and parameters. They are the same thing.

## Base URL

```text
https://mojimoto.com/api/v1/{project}
```

`{project}` names the project. It takes either of two values:

| Value | Example | What it is |
| --- | --- | --- |
| Project ID | `078ad5dd81217a5c` | 16 hexadecimal characters. It is in the address bar when the project is open in the dashboard, and in the URLs the API keys and API reference pages give you to copy. |
| Slug | `acme` | The project's readable slug. |

The slug is looked up first, then the ID. The examples on this page use the slug `acme` because it is easier to read.

Every endpoint answers `GET` and `HEAD`. Responses are JSON, apart from the [generated types](#get-generated-types). The headers, caching and rate limits are described in [HTTP details](/docs/api/http-details).

## Authentication

Send a project token as a bearer token in the `Authorization` header. Any token created in the dashboard can read, and every project comes with a public read token on its API keys page, so that is the one to start with. The token has to belong to the project in the URL, and it is only read from the header, never from the query string. [Authentication](/docs/api/authentication) covers creating tokens, their abilities and what each refusal means.

## The shape of an entry

Every entry has the same envelope, whatever its content type. The fields you modelled are inside `data`.

```bash
curl "https://mojimoto.com/api/v1/acme/documents/6?select=fields.title,fields.published_on,fields.reading_time,fields.featured,fields.cover,fields.tags" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 6,
  "uid": "sourdough-starter",
  "type": "post",
  "lang": "en-gb",
  "status": "published",
  "published_at": "2026-03-02T09:14:07+00:00",
  "updated_at": "2026-03-02T09:14:07+00:00",
  "data": {
    "title": "How to keep a sourdough starter alive",
    "published_on": "2026-03-02T09:00:00+00:00",
    "reading_time": 6,
    "featured": true,
    "cover": {
      "id": 1,
      "url": "https://files.example.com/projects/1/assets/k2Jd8sLq0XvYb3nRt6WzAe1CuHf5GmPo9TiNs4Vx.jpg",
      "alt": "A sourdough loaf on a wooden board",
      "width": 2400,
      "height": 1600,
      "content_type": "image/jpeg",
      "fit": "cover"
    },
    "tags": [
      {
        "id": 4,
        "uid": "baking",
        "type": "tag",
        "lang": "en-gb",
        "status": "published",
        "published_at": "2026-02-10T10:09:15+00:00",
        "updated_at": "2026-02-10T10:09:15+00:00",
        "data": {
          "name": "Baking"
        }
      },
      {
        "id": 5,
        "uid": "beginners",
        "type": "tag",
        "lang": "en-gb",
        "status": "published",
        "published_at": "2026-02-10T10:09:48+00:00",
        "updated_at": "2026-02-10T10:09:48+00:00",
        "data": {
          "name": "Beginners"
        }
      }
    ]
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer | The entry's id. Use it to fetch the entry directly and to filter on links. |
| `uid` | string or null | The entry's slug, unique within its content type. `null` for entries of a `single` or `component` content type. |
| `type` | string | The api id of the entry's content type. |
| `lang` | string | The locale this entry was served from. With [locale fallback](#locales-and-fallback) it can differ from the locale you asked for. |
| `status` | string | Always `published` on this API. The Preview API can also return `draft`. |
| `published_at` | string or null | When the version being served was published. Only a draft has `null` here, and only the Preview API returns drafts. |
| `updated_at` | string | When the version being served was saved. |
| `data` | object | The entry's fields, keyed by field api id. |

Timestamps are ISO 8601 in UTC, written with a `+00:00` offset.

Three things to know about `data`:

- A field the entry has no value for is usually left out. Link, media and blocks fields are the exception and are always there: `null` for an empty `reference` or `media` field, `[]` for an empty `references` or `blocks` field.
- A field that was saved empty comes back as it was saved, which can be `null` or `""`. Treat a missing key, `null` and `""` the same way.
- When there is nothing at all to put in `data`, it is an empty array (`[]`), not an empty object.

[How each field type is returned](#how-each-field-type-is-returned) lists the value every field type gives you.

## Collections and pagination

Endpoints that return many things wrap them in the same envelope and page them by number.

| Field | Type | Description |
| --- | --- | --- |
| `results` | array | The items on this page. |
| `page` | integer | The page you are on, starting at 1. |
| `per_page` | integer | The page size that was applied. |
| `total_results` | integer | How many items match across all pages. |
| `total_pages` | integer | How many pages there are. Never less than 1. |
| `lang` | string | Entries only. The locale you asked for. |
| `ref` | string | Entries only. `published`, or `preview` when the Preview API served drafts. |

Two parameters move through the pages:

| Parameter | Type | Description |
| --- | --- | --- |
| `page` | integer | The page to return. Defaults to `1`. Anything below 1 becomes 1. |
| `per_page` | integer | Items per page. Defaults to `20`, at most `100`. A larger number becomes 100, and a number below 1 becomes 1. |

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&per_page=2&page=2&select=fields.title" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 8,
      "uid": "new-opening-hours",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-05-01T12:03:20+00:00",
      "updated_at": "2026-05-01T12:03:20+00:00",
      "data": {
        "title": "New opening hours"
      }
    }
  ],
  "page": 2,
  "per_page": 2,
  "total_results": 3,
  "total_pages": 2,
  "lang": "en-gb",
  "ref": "published"
}
```

To read everything, keep asking for the next page until `page` equals `total_pages`. A page past the end is not an error: it returns an empty `results` with the totals still filled in. There are no cursors and no `Link` headers.

Entries come back in the order they were created, oldest first, unless you [sort them](#sort-entries).

## Endpoints

### List entries

```http
GET /api/v1/{project}/documents
```

Returns the published entries of a project, a page at a time. With no parameters it returns entries of every content type in the default locale.

| Parameter | Type | Description |
| --- | --- | --- |
| `type` | string | Only entries of this content type, by its api id. |
| `uid` | string | Only entries with exactly this `uid`. |
| `lang` | string | The locale to serve. Defaults to the project's default locale. See [Locales and fallback](#locales-and-fallback). |
| `page`, `per_page` | integer | See [Collections and pagination](#collections-and-pagination). |
| `sort` | string | The order of the results. See [Sort entries](#sort-entries). |
| `fields.{field}` | string | Filter on a field's value. Needs `type`. See [Filter by a field](#filter-by-a-field). |
| `select` | string | Return only some fields. See [Select fields](#select-fields). |
| `depth` | integer | How many levels of linked entries to include, `1` to `3`. See [Follow links with depth](#follow-links-with-depth). |
| `ref` | string | `preview` asks for drafts. See the [Content Preview API](/docs/api/preview). |

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&per_page=2&select=fields.title,fields.category" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 6,
      "uid": "sourdough-starter",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-03-02T09:14:07+00:00",
      "updated_at": "2026-03-02T09:14:07+00:00",
      "data": {
        "title": "How to keep a sourdough starter alive",
        "category": "guides"
      }
    },
    {
      "id": 7,
      "uid": "weekend-croissants",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-04-18T08:41:53+00:00",
      "updated_at": "2026-04-18T08:41:53+00:00",
      "data": {
        "title": "Weekend croissants",
        "category": "recipes"
      }
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_results": 3,
  "total_pages": 2,
  "lang": "en-gb",
  "ref": "published"
}
```

An entry with nothing published in the locale you asked for is left out. A `type` the project does not have returns an empty list, not an error.

### Get one entry

```http
GET /api/v1/{project}/documents/{id}
```

Returns one entry by its numeric `id`. The response is the entry itself, with no envelope around it.

| Parameter | Type | Description |
| --- | --- | --- |
| `lang` | string | The locale to serve. Defaults to the project's default locale. |
| `select` | string | Return only some fields. |
| `depth` | integer | How many levels of linked entries to include, `1` to `3`. |
| `ref` | string | `preview` asks for the draft. See the [Content Preview API](/docs/api/preview). |

```bash
curl "https://mojimoto.com/api/v1/acme/documents/2" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 2,
  "uid": "sam-okafor",
  "type": "author",
  "lang": "en-gb",
  "status": "published",
  "published_at": "2026-02-10T10:05:40+00:00",
  "updated_at": "2026-02-10T10:05:40+00:00",
  "data": {
    "name": "Sam Okafor",
    "team": {
      "id": 1,
      "uid": "bakery",
      "type": "team",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:02:11+00:00",
      "updated_at": "2026-02-10T10:02:11+00:00",
      "data": {
        "name": "Bakery"
      }
    }
  }
}
```

The response is `404` when the id is not a number, when no entry with that id exists in this project, or when the entry has nothing published in the locale. The last case says so:

```json
{
  "message": "No content for that locale."
}
```

There is no endpoint that takes a `uid` in the path. To fetch an entry by its slug, [list with `type` and `uid`](#find-entries-by-type-and-uid) and take the first result.

### List content types

```http
GET /api/v1/{project}/content-types
```

Returns the whole content model in one response, ordered by api id. It takes no parameters and is not paged.

```bash
curl "https://mojimoto.com/api/v1/acme/content-types" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

The response is an object with one key, `content_types`. This one is shortened to a single content type:

```json
{
  "content_types": [
    {
      "api_id": "tag",
      "label": "Tag",
      "format": "page",
      "repeatable": true,
      "schema": {
        "Main": {
          "name": {
            "type": "symbol",
            "config": {
              "label": "Name"
            }
          }
        }
      }
    }
  ]
}
```

| Field | Type | Description |
| --- | --- | --- |
| `api_id` | string | The content type's id. It is the `type` of its entries. |
| `label` | string | Its name in the dashboard. |
| `format` | string | `page` for a collection of many entries, `single` for a type with exactly one entry, `component` for a building block edited inside another entry. |
| `repeatable` | boolean | An older flag kept for compatibility. Read `format` instead. |
| `schema` | object | The fields, grouped by the tab they sit on in the editor. Each field is `{ "type": ..., "config": ... }`. |

[Content model](/docs/concepts/content-model) explains formats, and [Field types](/docs/concepts/field-types) lists every `type` and its `config`.

### Get one content type

```http
GET /api/v1/{project}/content-types/{api_id}
```

Returns one content type by its api id, in the same shape as an item of the list.

```bash
curl "https://mojimoto.com/api/v1/acme/content-types/author" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "api_id": "author",
  "label": "Author",
  "format": "page",
  "repeatable": true,
  "schema": {
    "Main": {
      "name": {
        "type": "symbol",
        "config": {
          "label": "Name",
          "required": true
        }
      },
      "team": {
        "type": "reference",
        "config": {
          "label": "Team",
          "content_types": [
            "team"
          ]
        }
      }
    }
  }
}
```

An api id the project does not have is a `404` that names it:

```json
{
  "message": "This project has no content type called \"recipe\"."
}
```

### List assets

```http
GET /api/v1/{project}/assets
```

Returns the files in the project's media library, a page at a time, oldest first.

| Parameter | Type | Description |
| --- | --- | --- |
| `page`, `per_page` | integer | See [Collections and pagination](#collections-and-pagination). |
| `sort` | string | `-id` returns the newest first. Any other value leaves the oldest first. |
| `content_type` | string | Only files whose media type starts with this value. `image` matches every image, `image/png` only PNG files, `application/pdf` only PDF files. |

```bash
curl "https://mojimoto.com/api/v1/acme/assets" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 1,
      "url": "https://files.example.com/projects/1/assets/k2Jd8sLq0XvYb3nRt6WzAe1CuHf5GmPo9TiNs4Vx.jpg",
      "filename": "sourdough.jpg",
      "alt": "A sourdough loaf on a wooden board",
      "content_type": "image/jpeg",
      "size": 248113,
      "width": 2400,
      "height": 1600,
      "created_at": "2026-02-27T16:45:12+00:00",
      "updated_at": "2026-02-27T16:45:12+00:00"
    },
    {
      "id": 2,
      "url": "https://files.example.com/projects/1/assets/Pq7Lm2Zx9Kc4Vb8Nn1Hh6Gg3Ff5Dd0SsAaWwEeRr.pdf",
      "filename": "menu.pdf",
      "alt": null,
      "content_type": "application/pdf",
      "size": 91822,
      "width": null,
      "height": null,
      "created_at": "2026-02-27T16:45:12+00:00",
      "updated_at": "2026-02-27T16:45:12+00:00"
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 2,
  "total_pages": 1
}
```

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer | The asset's id. |
| `url` | string | Where the file is served from. It is a plain file URL. |
| `filename` | string | The file's name. |
| `alt` | string or null | The alt text stored with the asset. |
| `content_type` | string | The file's media type, such as `image/jpeg`. |
| `size` | integer | The file size in bytes. |
| `width`, `height` | integer or null | The pixel size of an image. `null` for other files. |
| `created_at`, `updated_at` | string | When the asset was uploaded and last changed. |

The host in `url` is wherever the project's files are stored. The examples here use `files.example.com` in its place, so read the URL from the response and do not build it yourself.

### Get one asset

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

Returns one asset by its numeric `id`, in the same shape as an item of the list.

```bash
curl "https://mojimoto.com/api/v1/acme/assets/1" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 1,
  "url": "https://files.example.com/projects/1/assets/k2Jd8sLq0XvYb3nRt6WzAe1CuHf5GmPo9TiNs4Vx.jpg",
  "filename": "sourdough.jpg",
  "alt": "A sourdough loaf on a wooden board",
  "content_type": "image/jpeg",
  "size": 248113,
  "width": 2400,
  "height": 1600,
  "created_at": "2026-02-27T16:45:12+00:00",
  "updated_at": "2026-02-27T16:45:12+00:00"
}
```

The response is `404` when the id is not a number or when the asset is not in this project.

### Get generated types

```http
GET /api/v1/{project}/types
```

Returns a TypeScript module that describes every content type in the project, ready to save as a file. It is the one endpoint that does not return JSON: the response is `Content-Type: application/typescript; charset=utf-8` and is marked as a download named `mojimoto.generated.ts`.

```bash
curl "https://mojimoto.com/api/v1/acme/types" \
  -H "Authorization: Bearer mjmt_your_read_token" \
  -o mojimoto.generated.ts
```

```ts mojimoto.generated.ts
// Generated by Mojimoto - do not edit by hand.
// Project: acme

export interface MojimotoDocument<T extends string, D> {
  id: number
  uid: string | null
  type: T
  lang: string
  status: "draft" | "published"
  published_at: string | null
  updated_at: string
  data: D
}

// ... the link, media and block types, then one type per content type ...

export type TagData = {
  name: string
}
```

That is the start of the file and one of its types, with the rest left out. The full module also has a type for links, media and blocks, a `...Data` type for each content type, and a `MojimotoAnyDocument` union of them all. [Generated types](/docs/tools/generated-types) shows how to use it.

## Find entries by type and uid

`type` and `uid` are exact matches and can be used alone or together.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&uid=weekend-croissants" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

| Request | Returns |
| --- | --- |
| `?type=post` | Every published post. |
| `?uid=baking` | Every published entry whose `uid` is `baking`, in any content type. |
| `?type=post&uid=weekend-croissants` | That one post, as a list of one. |
| `?type=site_settings` | The single entry of a `single` content type, as a list of one. Its `uid` is `null`. |

A `uid` is only unique within one content type, so send `type` with it. When nothing matches, `results` is empty and the status is still `200`.

## Filter by a field

Add `fields.{field}` to a list request to keep only the entries whose field matches. `{field}` is the field's api id. Filters always need `type`, because a field belongs to one content type.

An operator goes in square brackets after the field name: `fields.{field}[operator]=value`. With no operator the filter means "equals".

| Operator | Meaning |
| --- | --- |
| none | Equals the value. |
| `[ne]` | Does not equal the value. |
| `[in]` | Equals any value in a comma-separated list. |
| `[nin]` | Equals none of the values in a comma-separated list. |
| `[exists]` | `true` for entries that have a value, `false` for entries that do not. |
| `[gt]`, `[gte]` | Greater than, greater than or equal to. |
| `[lt]`, `[lte]` | Less than, less than or equal to. |
| `[match]` | Contains the text, ignoring case. |

The examples below run against three published posts:

| `uid` | `category` | `reading_time` | `featured` | `published_on` | `author` | `tags` | `cover` |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `sourdough-starter` | `guides` | `6` | `true` | `2026-03-02T09:00:00+00:00` | entry `2` | entries `4`, `5` | an image |
| `weekend-croissants` | `recipes` | `12` | `false` | `2026-04-18T08:30:00+00:00` | entry `3` | entry `4` | empty |
| `new-opening-hours` | `news` | `1` | not set | `2026-05-01T12:00:00+00:00` | entry `2` | none | empty |

> **Note:** curl reads square brackets as a range. Pass `-g` as the examples do, or write them as `%5B` and `%5D`. A `+` in a value has to be written `%2B`, or it arrives as a space.

### Equals

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&fields.category=recipes" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `weekend-croissants`. The match is exact and case-sensitive, so `fields.category=Recipes` returns nothing. On a number field the value is compared as a number: `fields.reading_time=6` returns `sourdough-starter`.

### Not equal

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.category[ne]=news" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter` and `weekend-croissants`. An entry with no value in the field does not equal anything, so `[ne]` includes it.

### In a list

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.category[in]=news,recipes" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `weekend-croissants` and `new-opening-hours`. The list takes between 1 and 100 values. Spaces around a value are ignored.

### Not in a list

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.category[nin]=news,recipes" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter`. Like `[ne]`, it includes entries with no value in the field.

### Has a value

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.cover[exists]=true" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter`, the only post with a cover. `fields.cover[exists]=false` returns the other two.

`[exists]` works on every field type and takes `true` or `false`. A field has no value when it is missing, `null`, an empty string, an empty list or an empty object. `false` and `0` are values, so `fields.featured[exists]=true` returns `sourdough-starter` and `weekend-croissants`.

### Greater than and less than

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.reading_time[gt]=5" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter` and `weekend-croissants`.

The four operators, around the same value:

| Request | Returns |
| --- | --- |
| `fields.reading_time[gt]=6` | `weekend-croissants` |
| `fields.reading_time[gte]=6` | `sourdough-starter`, `weekend-croissants` |
| `fields.reading_time[lt]=6` | `new-opening-hours` |
| `fields.reading_time[lte]=6` | `sourdough-starter`, `new-opening-hours` |

Use two operators on the same field for a range. This returns the posts dated in April 2026, which is `weekend-croissants`:

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.published_on[gte]=2026-04-01&fields.published_on[lt]=2026-05-01" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Number fields are compared as numbers. Every other field these operators work on, dates included, is compared as text, not as a date. ISO 8601 dates sort correctly as text as long as they are all written the same way, and that is why a bare `2026-04-01` works as a boundary.

### Text search

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.title[match]=SOURDOUGH" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter`, whose title is "How to keep a sourdough starter alive". `[match]` finds the text anywhere in the field and ignores case. `%` and `_` are matched as those characters, not as wildcards.

### Filter on a boolean

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&fields.featured=true" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter`. A box that was never ticked is stored as `false` or not at all, so `false` means "not true": `fields.featured=false` returns both `weekend-croissants` and `new-opening-hours`. `fields.featured[ne]=true` does the same.

### Filter on a link

Filter a `reference` or `references` field by the `id` of the linked entry.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&fields.author=2" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Returns `sourdough-starter` and `new-opening-hours`, the posts whose author is entry `2`.

On a `references` field the filter asks whether the list holds the entry:

| Request | Returns |
| --- | --- |
| `fields.tags=5` | `sourdough-starter`, the only post tagged with entry `5` |
| `fields.tags[in]=4,5` | `sourdough-starter`, `weekend-croissants`: tagged with either |
| `fields.tags[ne]=4` | `new-opening-hours`: not tagged with entry `4` |
| `fields.tags[nin]=4,5` | `new-opening-hours`: tagged with neither |
| `fields.tags[exists]=false` | `new-opening-hours`: no tags at all |
| `fields.author[in]=2,3` | all three posts |

You can only filter on the id of a linked entry, not on the fields inside it.

### Combine filters

Several filters are joined with AND. This returns `weekend-croissants`:

```bash
curl -g "https://mojimoto.com/api/v1/acme/documents?type=post&fields.category=recipes&fields.reading_time[gt]=10" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

Filters work with `uid`, `lang`, `sort`, `select`, `depth` and paging. `total_results` and `total_pages` count the entries that passed the filters. Filters test the same version of the entry that is served, including values filled in by [locale fallback](#locales-and-fallback).

### Operators each field type takes

| Field type | Operators |
| --- | --- |
| `symbol`, `text`, `slug`, `select`, `date` | equals, `[ne]`, `[in]`, `[nin]`, `[exists]`, `[match]`, `[gt]`, `[gte]`, `[lt]`, `[lte]` |
| `number` | equals, `[ne]`, `[in]`, `[nin]`, `[exists]`, `[gt]`, `[gte]`, `[lt]`, `[lte]` |
| `boolean` | equals, `[ne]`, `[exists]` |
| `reference`, `references` | equals, `[ne]`, `[in]`, `[nin]`, `[exists]` |
| `rich_text`, `media`, `blocks`, `location`, `json` | `[exists]` |

### When a filter is refused

A filter the API cannot apply is a `422` that says what is wrong and what would work. Nothing is guessed.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&fields.titel=Weekend" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "message": "\"post\" has no field called \"titel\". Its fields are: title, summary, body, category, published_on, reading_time, featured, cover, author, tags.",
  "errors": {
    "fields.titel": [
      "\"post\" has no field called \"titel\". Its fields are: title, summary, body, category, published_on, reading_time, featured, cover, author, tags."
    ]
  }
}
```

The key in `errors` is the parameter at fault. The other refusals read like this:

| Cause | Message |
| --- | --- |
| A filter or field sort with no `type` | `Filtering or sorting by a field needs a content type, because fields belong to one. Add it to the request, like ?type=post&fields.title=Hello` |
| A filter or field sort with a `type` the project does not have | `This project has no content type called "recipe".` |
| An operator the field type does not take | `[match] can't be used on "body", a rich_text field. It takes: [exists].` |
| A value that is not a number, on a number field | `fields.reading_time[gt] takes a number, and "long" is not one.` |
| A value that is not an id, on a link field | `fields.author takes the id of the linked entry, like 42.` |
| A value other than true or false, on `[exists]` or a boolean field | `fields.cover[exists] takes true or false.` |
| An empty list, or more than 100 values | `fields.category[in] takes between 1 and 100 values, separated by commas.` |
| The same filter sent as an array, such as `fields.category[in][]=news` | `fields.category[in] takes one value. For several, separate them with commas: fields.category[in]=a,b,c` |
| A sort by a field that cannot be sorted | `Entries can't be sorted by "body", a rich_text field. Sort by a text, number, date or boolean field instead.` |

`true` and `false` can also be written `1` and `0`.

## Sort entries

`sort` takes one value. Put `-` in front of it for descending order.

| Value | Orders by |
| --- | --- |
| `id` | The entry's id, which is the order entries were created in. The default. |
| `uid` | The entry's `uid`. |
| `created_at` | When the entry was created. |
| `updated_at` | When the entry's own record last changed. This is not the `updated_at` in the response: saving or publishing content does not move it. To order by a date that means something to readers, sort by a date field of your own. |
| `fields.{field}` | The value of one of the entry's fields. Needs `type`. |

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&sort=-fields.published_on&select=fields.title,fields.published_on" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 8,
      "uid": "new-opening-hours",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-05-01T12:03:20+00:00",
      "updated_at": "2026-05-01T12:03:20+00:00",
      "data": {
        "title": "New opening hours",
        "published_on": "2026-05-01T12:00:00+00:00"
      }
    },
    {
      "id": 7,
      "uid": "weekend-croissants",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-04-18T08:41:53+00:00",
      "updated_at": "2026-04-18T08:41:53+00:00",
      "data": {
        "title": "Weekend croissants",
        "published_on": "2026-04-18T08:30:00+00:00"
      }
    },
    {
      "id": 6,
      "uid": "sourdough-starter",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-03-02T09:14:07+00:00",
      "updated_at": "2026-03-02T09:14:07+00:00",
      "data": {
        "title": "How to keep a sourdough starter alive",
        "published_on": "2026-03-02T09:00:00+00:00"
      }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 3,
  "total_pages": 1,
  "lang": "en-gb",
  "ref": "published"
}
```

Sorting by a field follows these rules:

- It works on `symbol`, `text`, `slug`, `select`, `date`, `number`, `boolean` and `reference` fields. Sorting by a `references`, `rich_text`, `media`, `blocks`, `location` or `json` field is a `422`.
- A `number` field is ordered as numbers. Every other field is ordered as text, so a `reference` field is ordered by the linked entry's id read as text.
- Entries with no value in the field come last, in ascending and descending order alike.
- Entries with the same value are ordered by id, oldest first.

A `sort` value that is neither one of the four names above nor a `fields.` name is ignored without an error, and the entries come back in the default order. A `fields.` name the content type does not have is a `422` that lists the fields it does have.

## Select fields

`select` trims `data` to the fields you name. It takes field names separated by commas, each written `fields.{field}`.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&uid=weekend-croissants&select=fields.title,fields.summary" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 7,
      "uid": "weekend-croissants",
      "type": "post",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-04-18T08:41:53+00:00",
      "updated_at": "2026-04-18T08:41:53+00:00",
      "data": {
        "title": "Weekend croissants",
        "summary": "Three days, one batch."
      }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 1,
  "total_pages": 1,
  "lang": "en-gb",
  "ref": "published"
}
```

- It works on the list, with or without `type`, and on a single entry.
- `id`, `uid`, `type`, `lang`, `status` and the two timestamps are always returned. They cannot be selected or left out.
- Linked entries and media in fields you did not select are not looked up, which makes list responses smaller and faster.
- It only trims the entry you asked for. A linked entry inside a selected field comes back whole.
- A selected field the entry has no value for is left out. A name that is not a field of the entry is ignored.

Anything other than `fields.{field}` names is a `422`:

```json
{
  "message": "select takes field names separated by commas, like select=fields.title,fields.slug. An entry's id, uid, type and dates are always returned.",
  "errors": {
    "select": [
      "select takes field names separated by commas, like select=fields.title,fields.slug. An entry's id, uid, type and dates are always returned."
    ]
  }
}
```

## Follow links with depth

A `reference` field links to one entry and a `references` field to an ordered list of them. The API does not hand you ids to look up: it puts the linked entries into the response. `depth` says how many levels of links to follow. It defaults to `1` and goes up to `3`. A lower number becomes 1 and a higher one becomes 3.

With the default, the entries linked from the one you asked for are included in full, and their own links are cut down to a stub:

```bash
curl "https://mojimoto.com/api/v1/acme/documents/6?select=fields.author" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 6,
  "uid": "sourdough-starter",
  "type": "post",
  "lang": "en-gb",
  "status": "published",
  "published_at": "2026-03-02T09:14:07+00:00",
  "updated_at": "2026-03-02T09:14:07+00:00",
  "data": {
    "author": {
      "id": 2,
      "uid": "sam-okafor",
      "type": "author",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:05:40+00:00",
      "updated_at": "2026-02-10T10:05:40+00:00",
      "data": {
        "name": "Sam Okafor",
        "team": {
          "id": 1,
          "type": "team",
          "uid": "bakery"
        }
      }
    }
  }
}
```

With `depth=2` the author's team is included too:

```bash
curl "https://mojimoto.com/api/v1/acme/documents/6?select=fields.author&depth=2" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 6,
  "uid": "sourdough-starter",
  "type": "post",
  "lang": "en-gb",
  "status": "published",
  "published_at": "2026-03-02T09:14:07+00:00",
  "updated_at": "2026-03-02T09:14:07+00:00",
  "data": {
    "author": {
      "id": 2,
      "uid": "sam-okafor",
      "type": "author",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:05:40+00:00",
      "updated_at": "2026-02-10T10:05:40+00:00",
      "data": {
        "name": "Sam Okafor",
        "team": {
          "id": 1,
          "uid": "bakery",
          "type": "team",
          "lang": "en-gb",
          "status": "published",
          "published_at": "2026-02-10T10:02:11+00:00",
          "updated_at": "2026-02-10T10:02:11+00:00",
          "data": {
            "name": "Bakery"
          }
        }
      }
    }
  }
}
```

A link can come back in one of three ways:

| What you get | When |
| --- | --- |
| The linked entry, in the same shape as any entry | The link is within `depth` and the linked entry is published in the locale being served. |
| A stub: `{ "id": 1, "type": "team", "uid": "bakery" }` | The link is beyond `depth`, or the linked entry exists but has nothing published in the locale. |
| Nothing | The linked entry has been deleted. A `reference` field is `null` and a `references` field leaves the entry out of its list. |

To tell an entry from a stub, check for `data`. A stub never has it.

Linked entries are served in the same locale as the request and follow the same fallbacks. The order of a `references` field is the order editors put the entries in. Media is included in full at every level, whatever `depth` is. A higher `depth` means more work for every entry on a page, so ask for the lowest number that gives your page what it needs.

[Links](/docs/concepts/links) explains how to model with them.

## Locales and fallback

`lang` chooses the locale. Leave it out and you get the project's default locale. Locale codes are lower case, such as `en-gb` and `fr-fr`, and are matched exactly.

By default a locale is served from itself alone. An entry with nothing published in that locale is left out of lists and is a `404` by id. A locale the project does not have behaves the same way: an empty list, and no error.

A project can set a locale to fall back to another in its settings, and that one to another in turn. A request for a locale with a fallback is then served like this:

- An entry with nothing published in the locale is served from the nearest fallback that has it.
- A field the translation leaves empty is filled from the nearest fallback that has a value, one field at a time. Empty means missing, `null`, `""` or `[]`. `false` and `0` are values and are kept.
- Linked entries are resolved the same way.
- Filters and field sorts see the values as they are served.

Each entry's own `lang` tells you where it came from. The `lang` at the top of a list is the locale you asked for. Here `fr-fr` falls back to `en-gb`, and only one of the two tags has been translated:

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=tag&lang=fr-fr" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 4,
      "uid": "baking",
      "type": "tag",
      "lang": "fr-fr",
      "status": "published",
      "published_at": "2026-05-20T14:30:02+00:00",
      "updated_at": "2026-05-20T14:30:02+00:00",
      "data": {
        "name": "Pâtisserie"
      }
    },
    {
      "id": 5,
      "uid": "beginners",
      "type": "tag",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-10T10:09:48+00:00",
      "updated_at": "2026-02-10T10:09:48+00:00",
      "data": {
        "name": "Beginners"
      }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 2,
  "total_pages": 1,
  "lang": "fr-fr",
  "ref": "published"
}
```

An entry that has its own version in the locale keeps that locale in `lang`, even when some of its fields were filled from a fallback. Only published content is used to fill in. An entry that no locale in the chain has published is still left out, and is still a `404` by id.

[Locales](/docs/concepts/locales) covers adding locales and setting fallbacks.

## How each field type is returned

| Field type | Value in `data` |
| --- | --- |
| `symbol`, `text`, `slug`, `select` | A string. |
| `number` | A number. |
| `boolean` | `true` or `false`. |
| `date` | A string, exactly as it was saved. The dashboard's date picker saves a local date and time with no time zone, such as `2026-03-02T09:00`. A value written through the write API is kept as it was sent. |
| `rich_text` | An array of blocks, or `null` when empty. See [Rich text](#rich-text). |
| `media` | A media object, or `null` when empty. See [Media](#media). |
| `reference` | The linked entry, a stub, or `null`. See [Follow links with depth](#follow-links-with-depth). |
| `references` | An array of linked entries and stubs. `[]` when empty. |
| `blocks` | An array of blocks. `[]` when empty. See [Blocks](#blocks). |
| `location` | An object with `lat` and `lon`, such as `{ "lat": 53.7457, "lon": -0.3367 }`. |
| `json` | Whatever JSON was saved. |

### Media

A media field is returned as an object that describes the linked asset, not as a bare URL.

```json
{
  "cover": {
    "id": 1,
    "url": "https://files.example.com/projects/1/assets/k2Jd8sLq0XvYb3nRt6WzAe1CuHf5GmPo9TiNs4Vx.jpg",
    "alt": "A sourdough loaf on a wooden board",
    "width": 2400,
    "height": 1600,
    "content_type": "image/jpeg",
    "fit": "cover"
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer or null | The asset's id. The same id works on the [assets endpoints](#get-one-asset). |
| `url` | string | Where the file is served from. |
| `alt` | string or null | The alt text stored with the asset. It is the same wherever the asset is used. |
| `width`, `height` | integer or null | The pixel size of an image. `null` for other files. |
| `content_type` | string or null | The file's media type. |
| `fit` | string | `cover` or `contain`. How the editor asked for the image to sit in its frame. It is a hint for your front end, set on each field, and the API does not change the file. |

`url` is a plain file URL. Two cases to handle:

- An empty media field is `null`, and so is one whose asset has been deleted.
- Older and imported content can hold only a URL. It is returned in the same shape with `id`, `alt`, `width`, `height` and `content_type` all `null`.

[Media](/docs/concepts/media) covers the media library.

### Rich text

A rich text field is returned as an array of blocks, never as an HTML string. An empty one is `null`.

```bash
curl "https://mojimoto.com/api/v1/acme/documents/6?select=fields.body" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "id": 6,
  "uid": "sourdough-starter",
  "type": "post",
  "lang": "en-gb",
  "status": "published",
  "published_at": "2026-03-02T09:14:07+00:00",
  "updated_at": "2026-03-02T09:14:07+00:00",
  "data": {
    "body": [
      {
        "type": "heading2",
        "text": "Feeding",
        "spans": []
      },
      {
        "type": "paragraph",
        "text": "Feed your starter once a day with equal parts flour and water. See our flour guide.",
        "spans": [
          {
            "start": 18,
            "end": 28,
            "type": "strong"
          },
          {
            "start": 67,
            "end": 82,
            "type": "hyperlink",
            "data": {
              "link_type": "Web",
              "url": "https://example.com/flour"
            }
          }
        ]
      },
      {
        "type": "list-item",
        "text": "50g flour",
        "spans": []
      },
      {
        "type": "list-item",
        "text": "50g water",
        "spans": []
      }
    ]
  }
}
```

The editor produces these blocks:

| Block `type` | Shape | Notes |
| --- | --- | --- |
| `paragraph` | `type`, `text`, `spans` | An empty paragraph is kept, with `text` as `""`. |
| `heading1` to `heading6` | `type`, `text`, `spans` | |
| `preformatted` | `type`, `text`, `spans` | |
| `list-item` | `type`, `text`, `spans` | A bullet. Items that follow each other form one list. |
| `o-list-item` | `type`, `text`, `spans` | A numbered item. Lists are flat: there is no nesting. |
| `image` | `type`, `url`, and `alt` when there is one | |
| `table` | `type`, `rows` | Each row is `{ "cells": [...] }`. Each cell has `text` and `spans`, and `"header": true` when it is a heading cell. |

`text` is plain text. A `\n` inside it is a line break. Formatting is in `spans`, which mark ranges of `text`:

| Span `type` | Meaning |
| --- | --- |
| `strong` | Bold. |
| `em` | Italic. |
| `hyperlink` | A link. The address is in `data.url`. |

`start` and `end` count UTF-16 code units, which is how JavaScript indexes a string, so `text.slice(start, end)` is the marked text. In the example, `slice(18, 28)` is "once a day".

Rich text that was written through the write API or imported is returned as it was stored, so it can hold block and span types the editor does not make, such as `embed`. Skip the types your renderer does not know.

[Rich text](/docs/frameworks/rich-text) covers rendering it.

### Blocks

A blocks field is returned as an ordered array. Each block has an `id`, the `type` of block it is, and its own fields in `data`.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=page&uid=home&select=fields.sections" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 11,
      "uid": "home",
      "type": "page",
      "lang": "en-gb",
      "status": "published",
      "published_at": "2026-02-11T09:00:00+00:00",
      "updated_at": "2026-02-11T09:00:00+00:00",
      "data": {
        "sections": [
          {
            "id": "40191014e3",
            "type": "hero",
            "data": {
              "heading": "Fresh every morning",
              "image": {
                "id": 1,
                "url": "https://files.example.com/projects/1/assets/k2Jd8sLq0XvYb3nRt6WzAe1CuHf5GmPo9TiNs4Vx.jpg",
                "alt": "A sourdough loaf on a wooden board",
                "width": 2400,
                "height": 1600,
                "content_type": "image/jpeg",
                "fit": "contain"
              }
            }
          },
          {
            "id": "038d27908a",
            "type": "quote",
            "data": {
              "text": [
                {
                  "type": "paragraph",
                  "text": "Best loaf in town.",
                  "spans": []
                }
              ]
            }
          }
        ]
      }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 1,
  "total_pages": 1,
  "lang": "en-gb",
  "ref": "published"
}
```

Media and rich text inside a block are returned the same way as at the top level. A block's `id` is a string that stays the same between requests for the same content, so it is safe to use as a render key. Blocks cannot hold links to other entries.

[Blocks](/docs/concepts/blocks) covers modelling with them.

## Tokens limited to content types

A token can be limited to some content types. On this API that changes what it is given:

- Lists leave out entries of other types, and filters on them return an empty list.
- An entry of another type is a `404` by id.
- The content types endpoints only show the types the token may read.
- The assets endpoints are a `403`, because the media library is not split by content type.
- Media and linked entries inside an entry the token can read are still included in it, whatever their type.

The entries and content types such a token is given are sent with `Cache-Control: no-store, private`, so they are never shared with another token.

## Caching

Published responses are made to be cached. Each one carries an `ETag` and is sent with:

```text
Cache-Control: max-age=0, public, s-maxage=60, stale-while-revalidate=86400
```

In practice that means a shared cache can hold a response for 60 seconds, so a publish can take up to a minute to show at a URL that is already cached. Send the `ETag` back in `If-None-Match` and an unchanged response is a `304` with no body. [HTTP details](/docs/api/http-details) has the full behaviour.

## Errors

Errors are JSON with a `message`. A `422` also has `errors`, keyed by the parameter at fault.

| Status | When |
| --- | --- |
| `401` | The token is missing or not valid. |
| `402` | The project's subscription has ended and its grace period has passed. |
| `403` | The token belongs to another project, or is limited to some content types and asked for assets. |
| `404` | The project, entry, content type or asset does not exist, or the entry has nothing published in the locale. |
| `422` | A filter, a field sort or `select` could not be applied. |
| `429` | Too many requests. See [rate limits](/docs/api/http-details). |

[Errors](/docs/api/errors) describes each of them in full.
