## Search your account `GET https://getkollek.com/api/search` Search everything your account holds in one call: items, collections, copies, photos, loans, locations, sets, series, categories, tags and documents. The query is split into words. Every word has to match somewhere in a record, so adding a word narrows the result rather than widening it. A word matches from its start, which means spi finds Spider-Man, and case and punctuation are ignored, so asm-300, asm 300 and ASM_300 behave the same. Single character words are never indexed on their own, so they are dropped. A query made only of single characters therefore returns nothing rather than everything. Names and descriptions are encrypted at rest, so the search runs against an index of keyed hashes rather than the text itself. That index is built as records change; a freshly upgraded instance fills it by running php artisan search:rebuild-index once. A result is scored by the weakest field its words matched in: 100 when every word appeared in the name of the record, 80 for an identifier or a file name, 60 for something filed around it such as its collection or a tag, and 30 for a description or a note. Results come back ranked, at most 50 of them, and total says how many matched in all. Objects in the trash are not searched. Every result carries a self link to the screen in the web app that shows it. A tag is only visible to owners and editors, so results of that type are absent for a viewer. **Permissions:** Any member of the account. Results never cross accounts. ### Query parameters - `q` (string, required): The words to search for, up to 255 characters. - `type` (string, optional): Narrow the results to one kind of record. One of item, collection, copy, photo, loan, location, set, series, category, tag or document. **Returns:** A search_results object. ### Example request ```bash curl https://getkollek.com/api/search?q=spider \ -H "Authorization: Bearer $API_KEY" \ -H "Accept: application/json" ``` ### Example response `Status: 200` ```json { "data": { "type": "search_results", "attributes": { "query": "spider", "total": 4, "matched": 4, "truncated": false, "counts": { "item": 2, "copy": 1, "tag": 1 }, "results": [ { "type": "item", "id": "812", "title": "Amazing Spider-Man #365", "context": "2 copies", "collection_name": "Marvel Comics 1990s", "score": 100, "name_match": true, "links": { "self": "https://getkollek.com/api/collections/3/items/812" } }, { "type": "item", "id": "640", "title": "Amazing Spider-Man #300", "context": "1 copy", "collection_name": "Marvel Comics 1990s", "score": 100, "name_match": true, "links": { "self": "https://getkollek.com/api/collections/3/items/640" } }, { "type": "copy", "id": "990", "title": "ASM-300-B", "context": "Amazing Spider-Man #300 · Very Fine · Display Case", "collection_name": "Marvel Comics 1990s", "score": 60, "name_match": false, "links": { "self": "https://getkollek.com/api/collections/3/items/640/copies/990" } }, { "type": "tag", "id": "18", "title": "spider-man", "context": "41 items", "collection_name": null, "score": 100, "name_match": true, "links": { "self": "https://getkollek.com/api/settings/tags" } } ] } } } ```