Skip to content

API quickstart

By the end of this page your code pushes documents into a collection and searches them. You need a Typemo account and a terminal; every step shows curl and the TypeScript SDK side by side. The management API lives at https://api.typemo.com/v1, search at https://search.typemo.com/v1.

1. Create a project and an empty collection

Section titled “1. Create a project and an empty collection”

Sign up and create your project in the setup wizard, as in the Quickstart. At the Data step, name the collection products and pick API under Other: the collection is created empty, waiting for your code.

Open Project & account → API keys and create a Write & Read key. It can create and change documents, so it stays on your server; keep it in an environment variable.

Terminal window
export TYPEMO_KEY=sq_your_write_key
Terminal window
curl -s https://api.typemo.com/v1/collections \
-H "Authorization: Bearer $TYPEMO_KEY"

The answer lists the project’s collections under data; copy the id of products.

Send up to 1,000 documents per request. id is the one field every document needs; the rest are yours.

Terminal window
curl -s https://api.typemo.com/v1/collections/COLLECTION_ID/documents \
-H "Authorization: Bearer $TYPEMO_KEY" \
-H "Content-Type: application/json" \
-d '{ "documents": [
{ "id": "tee-001", "title": "Cotton T-shirt", "price": 29, "url": "/products/cotton-tee" },
{ "id": "tee-002", "title": "Linen T-shirt", "price": 39, "url": "/products/linen-tee" }
] }'

The answer counts what was indexed: { "indexed": 2, "rejected": 0, … }.

Roles tell the widget and the assistant which field is the title, the link and the price. Typemo never guesses them from field names, so set them once.

Terminal window
curl -s -X PATCH https://api.typemo.com/v1/collections/COLLECTION_ID \
-H "Authorization: Bearer $TYPEMO_KEY" \
-H "Content-Type: application/json" \
-d '{ "roles": { "title": "title", "url": "url", "price": "price" } }'
Terminal window
curl -sL "https://search.typemo.com/v1/collections/COLLECTION_ID/search?q=linen" \
-H "X-API-Key: $TYPEMO_KEY"

The answer holds found, the hits with your fields, and facets for any filters you set.

You now have a collection your code fills and searches.

Next: build a search UI on it with InstantSearch, or read API basics for regions, errors and rate limits.