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.
2. Create a key
Section titled “2. Create a key”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.
export TYPEMO_KEY=sq_your_write_key3. Find the collection’s id
Section titled “3. Find the collection’s id”curl -s https://api.typemo.com/v1/collections \ -H "Authorization: Bearer $TYPEMO_KEY"npm i @typemo-org/sdkpnpm add @typemo-org/sdkyarn add @typemo-org/sdkbun add @typemo-org/sdkimport { Typemo } from '@typemo-org/sdk';
const typemo = new Typemo({ apiKey: process.env.TYPEMO_KEY });const collections = await typemo.collections.list();The answer lists the project’s collections under data; copy the id of products.
4. Push documents
Section titled “4. Push documents”Send up to 1,000 documents per request. id is the one field every document needs; the rest are
yours.
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" } ] }'await typemo.documents.upsert('COLLECTION_ID', { 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, … }.
5. Name the roles
Section titled “5. Name the roles”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.
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" } }'await typemo.collections.update('COLLECTION_ID', { roles: { title: 'title', url: 'url', price: 'price' }});6. Search
Section titled “6. Search”curl -sL "https://search.typemo.com/v1/collections/COLLECTION_ID/search?q=linen" \ -H "X-API-Key: $TYPEMO_KEY"const results = await typemo.search('COLLECTION_ID', { q: 'linen' });console.log(results.found, results.hits[0]?.title);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.