Quickstart
From no account to your first API call in five minutes, with curl and then with the JavaScript client.
This page takes you from nothing to published content arriving as JSON. You create a project that already has content in it, copy its read token, call the API with curl, then make the same call with @mojimoto/client.
You need a terminal with curl. Step 4 needs Node.js 18 or later.
1. Create a project
Sign up at https://mojimoto.com/register, confirm your email address and choose Create a project. The form asks for two names: your organisation and the project. An organisation's first project is free, with no card and no time limit.
Leave Start with a sample site ticked. It is ticked for you on your very first project, and it fills the project with a small bakery's website so that your first API call returns real content:
| Content type | Format | Published entries |
|---|---|---|
site_settings |
single | 1 |
author |
collection | 1 (sam-baker) |
post |
collection | 2, each with a reference to the author |
page |
collection | 2 (home and about), each built from blocks in a sections field |
It is ordinary content. Rename it, change it or delete it whenever you like.
Every new project also starts with one locale, en-gb, as its default.
The Get started screen
Creating a project lands you on Get started. It sits under Developer in the sidebar, so you can come back to it. It has four steps: have some content, make your first API call, fetch it from your site, or hand it to your coding agent. The commands on it already carry this project's id and its public read token, so they run as they are. The rest of this page follows the same steps.
If you unticked the sample site, step 1 of that screen has an Add the sample site button. It works on a project that has no content types yet, and needs the developer role or above.
Starting from a template instead
If your organisation has saved templates, the form also shows Start from a template. A template gives the new project a content model and no entries, and the sample site is skipped. See Templates.
2. Get a read token
Every project comes with a public read token. It reads published content and nothing else, so it is safe to ship in a front end. It cannot be revoked. Copy it from API keys in the sidebar, or from any command on the Get started screen.
You also need the project's id, the 16 character handle in those same commands. It is the {project} part of every API address.
Put both in your shell so the commands below can be pasted as they are. Replace the two values with your own:
export MOJIMOTO_PROJECT=acme
export MOJIMOTO_TOKEN=mjmt_your_read_tokenTo make a token of your own, open API keys, give it a name under Custom tokens and press Create token. Every token can read published content. Tick preview to read drafts or write to change content. A custom token is shown once, so copy it straight away. Only a project admin can create tokens. More in Authentication.
3. Make your first API call
List the published posts, one per page to keep the output short:
curl "https://mojimoto.com/api/v1/$MOJIMOTO_PROJECT/documents?type=post&per_page=1" \
-H "Authorization: Bearer $MOJIMOTO_TOKEN"The response, formatted here for reading:
{
"results": [
{
"id": 3,
"uid": "why-we-start-at-4am",
"type": "post",
"lang": "en-gb",
"status": "published",
"published_at": "2026-11-26T09:15:02+00:00",
"updated_at": "2026-11-26T09:15:02+00:00",
"data": {
"title": "Why we start at 4am",
"slug": "why-we-start-at-4am",
"published_on": "2026-03-02T08:00:00+00:00",
"excerpt": "Good bread takes time. Here is what happens in the bakery before the doors open.",
"body": [
{
"type": "paragraph",
"text": "The ovens go on at four. By the time the first customer arrives, the dough has been proving since the afternoon before.",
"spans": []
},
{
"type": "heading2",
"text": "Slow on purpose",
"spans": []
},
{
"type": "paragraph",
"text": "A long, cool prove gives the loaf its flavour and its crust. There is no shortcut for it, so we start early instead.",
"spans": []
}
],
"author": {
"id": 2,
"uid": "sam-baker",
"type": "author",
"lang": "en-gb",
"status": "published",
"published_at": "2026-11-26T09:15:02+00:00",
"updated_at": "2026-11-26T09:15:02+00:00",
"data": {
"name": "Sam Baker",
"slug": "sam-baker",
"role": "Head baker"
}
}
}
}
],
"page": 1,
"per_page": 1,
"total_results": 2,
"total_pages": 2,
"lang": "en-gb",
"ref": "published"
}What you are looking at:
resultsholds the entries. Each one has the same envelope (id,uid,type,lang,status, two dates) and its fields underdata.bodyis a rich text field. It arrives as a list of blocks, never as an HTML string.authoris a reference field. The linked entry is included in full, one level deep by default.- The numbers after
resultsare for paging. Ask for the next post with&page=2.
Now fetch a page built from sections:
curl "https://mojimoto.com/api/v1/$MOJIMOTO_PROJECT/documents?type=page&uid=home" \
-H "Authorization: Bearer $MOJIMOTO_TOKEN"Its sections field is a list of blocks, each {"id", "type", "data"}, in the order an editor arranged them.
If the token is missing or wrong, the API answers 401:
{
"message": "Missing API token. Provide it as a Bearer token in the Authorization header."
}Every parameter, filter and response field is in the Content Delivery API reference.
4. Make the same call with the client
@mojimoto/client is the JavaScript and TypeScript client. It runs anywhere fetch does. Install it in any folder:
npm install @mojimoto/clientSave this as first-call.mjs:
import { createClient } from '@mojimoto/client'
const cms = createClient({
endpoint: 'https://mojimoto.com/api/v1',
project: process.env.MOJIMOTO_PROJECT,
token: process.env.MOJIMOTO_TOKEN,
})
const posts = await cms.all({ type: 'post' })
for (const post of posts) {
console.log(`${post.data.title} - by ${post.data.author.data.name}`)
}
const home = await cms.byUid('page', 'home')
console.log(home.data.sections.map((section) => section.type))Run it in the same shell, so it can read the two variables you exported:
node first-call.mjsWhy we start at 4am - by Sam Baker
A new sourdough for spring - by Sam Baker
[ 'hero', 'text', 'call_to_action' ]all fetches every page of results and returns one array. byUid returns the first entry of a type with that uid, or null. The other methods and options are on the JavaScript client page.
5. Where to go next
- Model your own content: Content model, Field types and Blocks.
- Query it well: filters, sorting and reference depth in the Content Delivery API.
- Use it in a framework: Next.js, Nuxt, React, Vue or Laravel.
- Get autocomplete for your fields: Generated types.
- Show drafts on a staging site: Preview.
- Rebuild your site when content is published: Webhooks.
- Write content from a script: Content Management API.
- Hand the work to a coding agent: Working with AI agents.
Something wrong or missing on this page? Tell us and we will fix it.