Search

Search items

Returns a page of the items you can read whose text or tags match q, and of their table rows whose searchable columns match it, best first unless you give a sort. A row result names the row in row. Ties come in item ID order.

GET
/search

Authorization

bearerAuth
headerAuthorizationBearer <token>

Authenticate with an API key (marfa_k1_…) or an OAuth access token (marfa_at_…).

Query parameters

q*string

The text to search for. Marfa matches every word by its stem, in any order, and the last word as the start of a word. Wrap the query in double quotes to match a phrase. At most 500 characters, and 16 distinct words outside quotes.

Length1 <= length
type?string

Only return items of these types and their subtypes: a comma-separated list of up to 10, such as core.note,app.*. A wildcard such as core.* matches every type under that prefix.

state?string

Only return items in these lifecycle states: one state or a comma-separated list, such as active,archived. Without it, you get active items. any on its own searches every state. Trashed items are never searchable.

source?string

Only return items stamped with this source.

tier?string

Only return items in this tier. Omit it or send all for both tiers.

Value in"library""feed""all"
include?string

Comma-separated extras. system also returns system.* items, which are left out by default. A system. type filter does the same.

tags?string

Comma-separated tags. Only return items that carry all of them. At most 100 distinct tags, each at most 128 characters.

limit?integer

The maximum number of results to return.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor from the previous page. Leave it out to get the first page.

filter?string

A filter expression, as on GET /items. A term naming an edge type, edge[<type>] or backref[<type>], matches by relationship and needs read on that edge type.

sort?string

How to order the results: relevance (the default), created_at, updated_at, occurred_at, last_activity_at or properties.<field>, such as properties.due_at. Items without a value for a property come last.

Match^(relevance|created_at|updated_at|occurred_at|last_activity_at|properties\.[a-z0-9_]+)$
direction?string

Sort direction. Defaults to desc: best match first under relevance, newest or largest first otherwise. Under relevance, asc puts the worst match first.

Value in"asc""desc"
occurred_after?string

Only return items whose own time (occurred_at, else created_at) is after this time. For the modification time, use updated_after.

Length1 <= length
occurred_before?string

Only return items whose own time (occurred_at, else created_at) is before this time.

Length1 <= length
updated_after?string

Only return items changed at or after this time. Items can share an instant, so the bound includes it. It doesn't change the ordering, so it works with any sort.

Length1 <= length
updated_before?string

Only return items changed before this time. It doesn't change the ordering, so it works with any sort.

Length1 <= length

Response body

About errors

Returns a page of results. Each page runs the search again, so a change between two pages can repeat or skip a result. Marfa reads at most 10,000 results deep: the page that reaches that depth has next_cursor: null.

application/json
  1. response

One page of search results.

data*array<>

The results, in the order of sort.

next_cursor*|

Pass as cursor for the next page; null on the last. A page can be short, or empty, with a cursor still to follow, so a walk stops on null and never on a short page.

  • missing_required_field: q is missing.
  • validation_error: a parameter is unknown or invalid, such as a state that isn't a lifecycle state or any, a time that isn't an instant, or a cursor from another search or sort.
  • unknown_type: type is a concrete type that nothing registers.
application/json
  1. response

An error response.

error*

What went wrong.

unauthorized: the request has no credential, or its credential is not valid. For a key that has expired, details.expired_at says when it expired.

application/json
  1. response

An error response.

error*

What went wrong.

  • type_not_permitted: your credential reaches no type, or type names a type you can't read with none readable under it.
  • edge_type_not_permitted: the filter has an edge or backref term for an edge type you can't read.
application/json
  1. response

An error response.

error*

What went wrong.

contract_mismatch: X-Marfa-Contract names another contract version than this instance speaks, or is not a whole number. Nothing was done.

application/json
  1. response

An error response.

error*

What went wrong.

rate_limited: you sent too many requests. Wait for the number of seconds in Retry-After, then try again.

application/json
  1. response

An error response.

error*

What went wrong.

internal_error: Marfa failed in a way it didn't expect, and the request may not have completed. Read what you changed before you repeat a write.

application/json
  1. response

An error response.

error*

What went wrong.

write_contention: the database was busy, and Marfa couldn't complete the request in time. Nothing changed. Try the request again. While a restore runs, details.reason is restore_running.

application/json
  1. response

An error response.

error*

What went wrong.

insufficient_storage: the disk that holds the instance's data has no room for the request, or the request would leave less free than the instance keeps in reserve. Nothing changed, unless details.write_outcome is unknown, which means the write may have landed: read what you changed before you repeat it. Free space on the disk, then try the request again.

application/json
  1. response

An error response.

error*

What went wrong.

curl -X GET 'http://localhost:8600/search?q=string'
About errors
{  "data": [    {      "item": {        "id": "01a1011a-4902-76cf-a4a9-88e99c038c8d",        "type": "acme.deal",        "state": "active",        "tier": "library",        "created_at": "2026-10-03T09:37:25.975Z",        "updated_at": "2026-10-03T09:39:50.097Z",        "last_activity_at": "2026-10-03T09:39:50.097Z",        "occurred_at": "2026-10-03T09:37:25.975Z",        "source": "crm",        "source_id": "deal-1042",        "version": 2,        "schema_version": 1,        "trashed_at": null,        "read_only": false,        "properties": {          "name": "Renewal for Example Co",          "amount": 12000,          "stage": "won"        }      },      "metadata": {        "item_id": "01a1011a-4902-76cf-a4a9-88e99c038c8d",        "tags": [          "renewal"        ],        "extensions": {}      },      "relevance_score": 1,      "snippet_html": "<mark>Renewal</mark> for Example Co"    }  ],  "next_cursor": null}