[{"data":1,"prerenderedAt":241},["ShallowReactive",2],{"dev-\u002Fdeveloper\u002Fdocs\u002Fkeys":3},{"id":4,"title":5,"body":6,"description":232,"extension":233,"faq":234,"meta":235,"navigation":132,"noindex":236,"path":237,"seo":238,"stem":239,"__hash__":240},"content\u002Fdeveloper\u002Fdocs\u002Fkeys.md","API keys — how the client finds your key",{"type":7,"value":8,"toc":223},"minimark",[9,14,18,23,36,40,45,56,84,99,103,106,158,161,165,172,180,183,189,199,203,219],[10,11,13],"h1",{"id":12},"api-keys","API keys",[15,16,17],"p",{},"Every call to the Quicopt service carries your API key. The key tells the\nservice whose allowance a solve counts against, so each account has its own.",[19,20,22],"h2",{"id":21},"get-a-key","Get a key",[15,24,25,30,31,35],{},[26,27,29],"a",{"href":28},"\u002Fsignup","Sign up"," with your email address. We send you your key by email; it\nstarts with ",[32,33,34],"code",{},"qo_",". Keys from before sign-up was introduced no longer work.",[19,37,39],{"id":38},"give-the-key-to-the-client","Give the key to the client",[41,42,44],"h3",{"id":43},"environment-variable-recommended","Environment variable (recommended)",[15,46,47,48,51,52,55],{},"Set ",[32,49,50],{},"QUICOPT_API_KEY",", and ",[32,53,54],{},"Client()"," picks the key up without any argument:",[57,58,63],"pre",{"className":59,"code":60,"language":61,"meta":62,"style":62},"language-bash shiki shiki-themes github-dark","export QUICOPT_API_KEY=qo_your_key_here\n","bash","",[32,64,65],{"__ignoreMap":62},[66,67,70,74,78,81],"span",{"class":68,"line":69},"line",1,[66,71,73],{"class":72},"snl16","export",[66,75,77],{"class":76},"s95oV"," QUICOPT_API_KEY",[66,79,80],{"class":72},"=",[66,82,83],{"class":76},"qo_your_key_here\n",[15,85,86,87,90,91,94,95,98],{},"On Windows (PowerShell): ",[32,88,89],{},"$env:QUICOPT_API_KEY = \"qo_your_key_here\"",". Add the\nline to your shell profile to keep it across sessions. The Julia, R and Ruby\nclients read the same variable; in R you can also put the line\n",[32,92,93],{},"QUICOPT_API_KEY=qo_your_key_here"," into your ",[32,96,97],{},".Renviron"," and restart R.",[41,100,102],{"id":101},"in-code","In code",[15,104,105],{},"You can pass the key directly:",[57,107,111],{"className":108,"code":109,"language":110,"meta":62,"style":62},"language-python shiki shiki-themes github-dark","from quicopt import Client\n\nclient = Client(api_key=\"qo_your_key_here\")\n","python",[32,112,113,127,134],{"__ignoreMap":62},[66,114,115,118,121,124],{"class":68,"line":69},[66,116,117],{"class":72},"from",[66,119,120],{"class":76}," quicopt ",[66,122,123],{"class":72},"import",[66,125,126],{"class":76}," Client\n",[66,128,130],{"class":68,"line":129},2,[66,131,133],{"emptyLinePlaceholder":132},true,"\n",[66,135,137,140,142,145,149,151,155],{"class":68,"line":136},3,[66,138,139],{"class":76},"client ",[66,141,80],{"class":72},[66,143,144],{"class":76}," Client(",[66,146,148],{"class":147},"s9osk","api_key",[66,150,80],{"class":72},[66,152,154],{"class":153},"sU2Wk","\"qo_your_key_here\"",[66,156,157],{"class":76},")\n",[15,159,160],{},"The key then travels with your code, into repositories, notebooks and logs.\nPrefer the environment variable for anything you share.",[19,162,164],{"id":163},"when-the-key-is-missing-or-invalid","When the key is missing or invalid",[15,166,167,168,171],{},"The call fails with a ",[32,169,170],{},"QuicoptError"," that says what is wrong. Without a key:",[57,173,178],{"className":174,"code":176,"language":177,"meta":62},[175],"language-text","quicopt.client.QuicoptError: keys are no longer issued on a first call; register at https:\u002F\u002Fquicopt.com\u002Fsignup to receive one by mail, then send it as Authorization: Bearer \u003Ckey>\n","text",[32,179,176],{"__ignoreMap":62},[15,181,182],{},"With a key the service does not know, for example a mistyped one or one from\nbefore sign-up:",[57,184,187],{"className":185,"code":186,"language":177,"meta":62},[175],"quicopt.client.QuicoptError: unknown or invalid API key. Keys from before sign-up was introduced no longer work; to get a new key, register at https:\u002F\u002Fquicopt.com\u002Fsignup to receive one by mail, then send it as Authorization: Bearer \u003Ckey>\n",[32,188,186],{"__ignoreMap":62},[15,190,191,192,194,195,198],{},"Check that ",[32,193,50],{}," is set in the shell that runs your code\n(",[32,196,197],{},"echo $QUICOPT_API_KEY",") and that it matches the key from your email.",[19,200,202],{"id":201},"keep-your-key-private","Keep your key private",[15,204,205,206,209,210,213,214,218],{},"Treat the key like a password: keep it out of version control (a ",[32,207,208],{},".env"," file\nbelongs in ",[32,211,212],{},".gitignore",") and out of anything you publish. If a key has leaked,\n",[26,215,217],{"href":216},"\u002Fdeveloper\u002Fdocs\u002Fsupport#contact","tell us"," right away.",[220,221,222],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}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);}",{"title":62,"searchDepth":129,"depth":129,"links":224},[225,226,230,231],{"id":21,"depth":129,"text":22},{"id":38,"depth":129,"text":39,"children":227},[228,229],{"id":43,"depth":136,"text":44},{"id":101,"depth":136,"text":102},{"id":163,"depth":129,"text":164},{"id":201,"depth":129,"text":202},"Get a Quicopt API key by signing up, give it to the client through QUICOPT_API_KEY, and read what a missing or invalid key returns.","md",null,{},false,"\u002Fdeveloper\u002Fdocs\u002Fkeys",{"title":5,"description":232},"developer\u002Fdocs\u002Fkeys","BKpA1i9XPATs9VUKfAFC5wkF7F-HsVu6t0IQbIbfzBM",1794337679384]