Guides

REST API Quickstart

Read, create, filter, update, and delete data through the Monospace REST API.

Make your first API request, see data come back, and learn the core operations you will use every day. This guide uses curl and fetch — no SDK or dependencies required.

Get Your API Key

In the Studio, go to Account Settings > Access and create a new API key. Copy the key — you will use it in the Authorization header for every request.

Set it as an environment variable so the examples below work as-is:

export MONOSPACE_API_KEY="your-api-key-here"

All API requests follow this URL pattern:

https://{your-instance}/api/{project}/items/{collection}

This guide assumes you have a project named blog with an articles collection that has id, title, status, and content fields.

Read Your Data

Fetch all articles from your collection:

curl "https://example.monospace.io/api/blog/items/articles?fields=id,title,status" \
  -H "Authorization: Bearer $MONOSPACE_API_KEY"

Every response wraps the result in a { data } envelope. You should see something like:

{
  "data": [
    { "id": 1, "title": "Hello World", "status": "published" },
    { "id": 2, "title": "Draft Post", "status": "draft" }
  ]
}

That's it — your data is live and accessible over HTTP.

Results are limited to 100 items by default. Use limit and offset query parameters to paginate.

Create an Item

Send a POST request with a JSON array body. The API always expects an array, even for a single item:

curl -X POST "https://example.monospace.io/api/blog/items/articles?fields=id,title,status" \
  -H "Authorization: Bearer $MONOSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{ "title": "My New Article", "status": "draft" }]'

Response:

{
  "data": [
    { "id": 3, "title": "My New Article", "status": "draft" }
  ]
}

The fields query parameter controls which fields are returned in the response — it does not affect what gets written. All fields in the body are always persisted.

Filter and Sort

Add query parameters to narrow and order your results. Filters use bracket notation:

curl -g "https://example.monospace.io/api/blog/items/articles?fields=id,title,status&filter[status][_eq]=published&sort[][title][direction]=asc&limit=10" \
  -H "Authorization: Bearer $MONOSPACE_API_KEY"

Common filter operators:

OperatorDescriptionExample
_eqEqualsfilter[status][_eq]=published
_neqNot equalsfilter[status][_neq]=archived
_containsContains substringfilter[title][_contains]=API
_gt, _ltGreater/less thanfilter[views][_gt]=100
_inMatches any value in listfilter[status][_in][0]=draft&filter[status][_in][1]=published

Sort uses direction with asc or desc:

sort[0][created_at][direction]=desc
The -field prefix syntax (e.g. sort=-title) is not supported. Always use the direction object syntax.

Update and Delete

Update an Item

Send a PATCH request with only the fields you want to change. Append the item ID to the URL:

curl -X PATCH "https://example.monospace.io/api/blog/items/articles/3?fields=id,title,status" \
  -H "Authorization: Bearer $MONOSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "published" }'

Delete an Item

Send a DELETE request with the item ID. Returns no content on success:

curl -X DELETE "https://example.monospace.io/api/blog/items/articles/3" \
  -H "Authorization: Bearer $MONOSPACE_API_KEY"

Next Steps

  • Filtering — build advanced filters with logical operators and relational quantifiers
  • Field Selection — select nested fields, use wildcards, and control response shape
  • Relational Data — fetch and write related items in a single request
  • SDK Installation — add type safety and autocomplete with the TypeScript SDK
Copyright © 2026