[{"data":1,"prerenderedAt":440},["ShallowReactive",2],{"docs-cloud/api-keys":3},{"id":4,"title":5,"body":6,"description":430,"extension":431,"meta":432,"navigation":260,"path":433,"seo":434,"seoDescription":435,"seoTitle":436,"sitemap":437,"stem":438,"__hash__":439},"docs/docs/cloud/api-keys.md","API Keys",{"type":7,"value":8,"toc":422},"minimark",[9,13,22,33,38,91,94,98,111,216,227,231,234,357,362,374,378,408,418],[10,11,5],"h1",{"id":12},"api-keys",[14,15,16,17,21],"p",{},"Your instance API key can do everything: read, change and delete all your data.\nKeep it on your server. For everything else, such as a search box in the\nbrowser, a separate app or a partner integration, create ",[18,19,20],"strong",{},"scoped keys",": each\none can only use the actions and indexes you choose, and you can delete it at\nany time without touching anything else.",[14,23,24,25,32],{},"These are standard ",[26,27,31],"a",{"href":28,"rel":29},"https://www.meilisearch.com/docs/learn/security/basic_security",[30],"nofollow","Meilisearch API keys",",\nso the official SDKs accept them as they are.",[34,35,37],"h2",{"id":36},"create-a-key-in-the-portal","Create a key in the portal",[39,40,41,55,88],"ol",{},[42,43,44,45,50,51,54],"li",{},"In ",[26,46,49],{"href":47,"rel":48},"https://app.celersearch.com",[30],"app.celersearch.com",", open your instance and\ngo to ",[18,52,53],{},"API keys",".",[42,56,57,58,61,62],{},"Click ",[18,59,60],{},"New key"," and choose:\n",[63,64,65,76,82],"ul",{},[42,66,67,70,71,75],{},[18,68,69],{},"Access",": ",[72,73,74],"em",{},"Search only"," (the usual choice for a front end), or custom\nactions such as adding documents or reading settings.",[42,77,78,81],{},[18,79,80],{},"Indexes",": the indexes the key may use, or all indexes.",[42,83,84,87],{},[18,85,86],{},"Expires"," (optional): the key stops working at the end of that day (UTC).",[42,89,90],{},"Copy the key that appears. You can reveal it again later from the same page.",[14,92,93],{},"Each instance can have up to 50 keys created this way.",[34,95,97],{"id":96},"or-create-keys-with-the-api","Or create keys with the API",[14,99,100,101,110],{},"Your instance API key can manage keys with the standard Meilisearch\n",[26,102,105,109],{"href":103,"rel":104},"https://www.meilisearch.com/docs/reference/api/keys",[30],[106,107,108],"code",{},"/keys"," endpoint",":",[112,113,118],"pre",{"className":114,"code":115,"language":116,"meta":117,"style":117},"language-bash shiki shiki-themes github-light github-dark","curl -X POST \"$CELERSEARCH_URL/keys\" \\\n  -H \"Authorization: Bearer $CELERSEARCH_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  --data '{\n    \"description\": \"Storefront search\",\n    \"actions\": [\"search\"],\n    \"indexes\": [\"products\"],\n    \"expiresAt\": null\n  }'\n","bash","",[106,119,120,150,167,177,186,192,198,204,210],{"__ignoreMap":117},[121,122,125,129,133,137,140,144,147],"span",{"class":123,"line":124},"line",1,[121,126,128],{"class":127},"sScJk","curl",[121,130,132],{"class":131},"sj4cs"," -X",[121,134,136],{"class":135},"sZZnC"," POST",[121,138,139],{"class":135}," \"",[121,141,143],{"class":142},"sVt8B","$CELERSEARCH_URL",[121,145,146],{"class":135},"/keys\"",[121,148,149],{"class":131}," \\\n",[121,151,153,156,159,162,165],{"class":123,"line":152},2,[121,154,155],{"class":131},"  -H",[121,157,158],{"class":135}," \"Authorization: Bearer ",[121,160,161],{"class":142},"$CELERSEARCH_API_KEY",[121,163,164],{"class":135},"\"",[121,166,149],{"class":131},[121,168,170,172,175],{"class":123,"line":169},3,[121,171,155],{"class":131},[121,173,174],{"class":135}," \"Content-Type: application/json\"",[121,176,149],{"class":131},[121,178,180,183],{"class":123,"line":179},4,[121,181,182],{"class":131},"  --data",[121,184,185],{"class":135}," '{\n",[121,187,189],{"class":123,"line":188},5,[121,190,191],{"class":135},"    \"description\": \"Storefront search\",\n",[121,193,195],{"class":123,"line":194},6,[121,196,197],{"class":135},"    \"actions\": [\"search\"],\n",[121,199,201],{"class":123,"line":200},7,[121,202,203],{"class":135},"    \"indexes\": [\"products\"],\n",[121,205,207],{"class":123,"line":206},8,[121,208,209],{"class":135},"    \"expiresAt\": null\n",[121,211,213],{"class":123,"line":212},9,[121,214,215],{"class":135},"  }'\n",[14,217,218,219,222,223,226],{},"The answer contains the new key (",[106,220,221],{},"key",") and its id (",[106,224,225],{},"uid","). A key works through\nyour endpoint as soon as it's created, and stops working as soon as it's deleted.",[34,228,230],{"id":229},"use-a-key-from-the-browser","Use a key from the browser",[14,232,233],{},"A search-only key limited to the right indexes is safe to ship in front-end\ncode:",[112,235,239],{"className":236,"code":237,"language":238,"meta":117,"style":117},"language-js shiki shiki-themes github-light github-dark","import { Meilisearch } from 'meilisearch'\n\nconst client = new Meilisearch({\n  host: 'https://your-endpoint-url',\n  apiKey: 'your-search-only-key',\n})\n\nconst { hits } = await client.index('products').search('running shoes')\n","js",[106,240,241,256,262,282,293,303,308,312],{"__ignoreMap":117},[121,242,243,247,250,253],{"class":123,"line":124},[121,244,246],{"class":245},"szBVR","import",[121,248,249],{"class":142}," { Meilisearch } ",[121,251,252],{"class":245},"from",[121,254,255],{"class":135}," 'meilisearch'\n",[121,257,258],{"class":123,"line":152},[121,259,261],{"emptyLinePlaceholder":260},true,"\n",[121,263,264,267,270,273,276,279],{"class":123,"line":169},[121,265,266],{"class":245},"const",[121,268,269],{"class":131}," client",[121,271,272],{"class":245}," =",[121,274,275],{"class":245}," new",[121,277,278],{"class":127}," Meilisearch",[121,280,281],{"class":142},"({\n",[121,283,284,287,290],{"class":123,"line":179},[121,285,286],{"class":142},"  host: ",[121,288,289],{"class":135},"'https://your-endpoint-url'",[121,291,292],{"class":142},",\n",[121,294,295,298,301],{"class":123,"line":188},[121,296,297],{"class":142},"  apiKey: ",[121,299,300],{"class":135},"'your-search-only-key'",[121,302,292],{"class":142},[121,304,305],{"class":123,"line":194},[121,306,307],{"class":142},"})\n",[121,309,310],{"class":123,"line":200},[121,311,261],{"emptyLinePlaceholder":260},[121,313,314,316,319,322,325,328,331,334,337,340,343,346,349,351,354],{"class":123,"line":206},[121,315,266],{"class":245},[121,317,318],{"class":142}," { ",[121,320,321],{"class":131},"hits",[121,323,324],{"class":142}," } ",[121,326,327],{"class":245},"=",[121,329,330],{"class":245}," await",[121,332,333],{"class":142}," client.",[121,335,336],{"class":127},"index",[121,338,339],{"class":142},"(",[121,341,342],{"class":135},"'products'",[121,344,345],{"class":142},").",[121,347,348],{"class":127},"search",[121,350,339],{"class":142},[121,352,353],{"class":135},"'running shoes'",[121,355,356],{"class":142},")\n",[358,359,361],"h3",{"id":360},"tenant-tokens","Tenant tokens",[14,363,364,365,370,371,373],{},"To give each signed-in user their own view of an index (for example only their\nown documents), sign a ",[26,366,369],{"href":367,"rel":368},"https://www.meilisearch.com/docs/learn/security/multitenancy_tenant_tokens",[30],"tenant token","\non your server with a search key and its ",[106,372,225],{},", and hand the token to the\nbrowser. Your endpoint accepts tenant tokens signed with any of your scoped\nsearch keys.",[34,375,377],{"id":376},"what-your-endpoint-doesnt-accept","What your endpoint doesn't accept",[63,379,380,398],{},[42,381,382,385,386,389,390,393,394,397],{},[18,383,384],{},"Keys with full access"," (the ",[106,387,388],{},"*"," action) or ",[18,391,392],{},"key-management actions","\n(",[106,395,396],{},"keys.*","): use the instance API key for those, from your server. This also\napplies to the engine's built-in \"Default Admin API Key\".",[42,399,400,403,404,54],{},[18,401,402],{},"Dumps and snapshots"," stay disabled for every key; your data is protected by\nencrypted ",[26,405,407],{"href":406},"/docs/cloud/backups","backups",[409,410,412],"warning",{"title":411},"If the instance API key is replaced",[14,413,414,415,417],{},"Meilisearch derives every key's value from the instance API key. If we ever\nreplace your instance API key (for example after a leak), all your scoped keys\nget new values: copy the new ones from ",[18,416,53],{}," and update your apps.",[419,420,421],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}",{"title":117,"searchDepth":152,"depth":152,"links":423},[424,425,426,429],{"id":36,"depth":152,"text":37},{"id":96,"depth":152,"text":97},{"id":229,"depth":152,"text":230,"children":427},[428],{"id":360,"depth":169,"text":361},{"id":376,"depth":152,"text":377},"Give each app or front end its own key that can only do what it needs, such as search one index, instead of sharing your instance API key.","md",{},"/docs/cloud/api-keys",{"title":5,"description":430},"Create search-only and scoped Meilisearch API keys for your CelerSearch instance, use them from the browser, and sign tenant tokens.","Scoped API Keys for Managed Meilisearch",{"loc":433},"docs/cloud/api-keys","mMb9M_PcATRuPNqYC0KeqNsUrPE2Qq33gZ6qEq680IU",1795039838514]