[{"data":1,"prerenderedAt":548},["ShallowReactive",2],{"api-authentication":3},{"article":4,"sections":517,"prevSection":518,"nextSection":523},{"id":5,"title":6,"avatar":7,"body":8,"description":510,"docx":7,"extension":511,"meta":512,"navigation":180,"order":85,"path":513,"pdf":7,"pdfLabel":7,"procurementPack":7,"seo":514,"slug":14,"stem":515,"__hash__":516},"content\u002Fapi\u002Fauthentication.md","Authentication",null,{"type":9,"value":10,"toc":497},"minimark",[11,15,24,29,56,62,66,72,124,129,188,192,253,257,260,320,324,356,360,402,406,460,464,467,490,493],[12,13,6],"h1",{"id":14},"authentication",[16,17,18,19,23],"p",{},"The HeadshotPro API uses Bearer token authentication. All requests must include your API key in the ",[20,21,22],"code",{},"Authorization"," header.",[25,26,28],"h2",{"id":27},"getting-your-api-key","Getting Your API Key",[30,31,32,36,47,53],"ol",{},[33,34,35],"li",{},"Log in to HeadshotPro as a Team Owner or Admin",[33,37,38,39,43,44],{},"Navigate to ",[40,41,42],"strong",{},"Admin Dashboard"," > ",[40,45,46],{},"API",[33,48,49,50],{},"Click ",[40,51,52],{},"Generate API Key",[33,54,55],{},"Copy and securely store your key",[16,57,58,61],{},[40,59,60],{},"Important:"," API keys are shown only once. Store them securely and never commit them to source control.",[25,63,65],{"id":64},"making-authenticated-requests","Making Authenticated Requests",[16,67,68,69,71],{},"Include your API key in the ",[20,70,22],{}," header:",[73,74,79],"pre",{"className":75,"code":76,"language":77,"meta":78,"style":78},"language-bash shiki shiki-themes dark-plus","curl -X GET \"https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\"\n","bash","",[20,80,81,105,116],{"__ignoreMap":78},[82,83,86,90,94,98,101],"span",{"class":84,"line":85},"line",1,[82,87,89],{"class":88},"sCudf","curl",[82,91,93],{"class":92},"scz_3"," -X",[82,95,97],{"class":96},"sKc5r"," GET",[82,99,100],{"class":96}," \"https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization\"",[82,102,104],{"class":103},"svVle"," \\\n",[82,106,108,111,114],{"class":84,"line":107},2,[82,109,110],{"class":92},"  -H",[82,112,113],{"class":96}," \"Authorization: Bearer YOUR_API_KEY\"",[82,115,104],{"class":103},[82,117,119,121],{"class":84,"line":118},3,[82,120,110],{"class":92},[82,122,123],{"class":96}," \"Content-Type: application\u002Fjson\"\n",[125,126,128],"h3",{"id":127},"nodejs-example","Node.js Example",[73,130,134],{"className":131,"code":132,"language":133,"meta":78,"style":78},"language-javascript shiki shiki-themes dark-plus","const response = await fetch('https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization', {\n  method: 'GET',\n  headers: {\n    'Authorization': `Bearer ${process.env.HEADSHOTPRO_API_KEY}`,\n    'Content-Type': 'application\u002Fjson'\n  }\n});\n\nconst data = await response.json();\n","javascript",[20,135,136,141,146,151,157,163,169,175,182],{"__ignoreMap":78},[82,137,138],{"class":84,"line":85},[82,139,140],{},"const response = await fetch('https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization', {\n",[82,142,143],{"class":84,"line":107},[82,144,145],{},"  method: 'GET',\n",[82,147,148],{"class":84,"line":118},[82,149,150],{},"  headers: {\n",[82,152,154],{"class":84,"line":153},4,[82,155,156],{},"    'Authorization': `Bearer ${process.env.HEADSHOTPRO_API_KEY}`,\n",[82,158,160],{"class":84,"line":159},5,[82,161,162],{},"    'Content-Type': 'application\u002Fjson'\n",[82,164,166],{"class":84,"line":165},6,[82,167,168],{},"  }\n",[82,170,172],{"class":84,"line":171},7,[82,173,174],{},"});\n",[82,176,178],{"class":84,"line":177},8,[82,179,181],{"emptyLinePlaceholder":180},true,"\n",[82,183,185],{"class":84,"line":184},9,[82,186,187],{},"const data = await response.json();\n",[125,189,191],{"id":190},"python-example","Python Example",[73,193,197],{"className":194,"code":195,"language":196,"meta":78,"style":78},"language-python shiki shiki-themes dark-plus","import requests\n\nheaders = {\n    'Authorization': f'Bearer {os.environ[\"HEADSHOTPRO_API_KEY\"]}',\n    'Content-Type': 'application\u002Fjson'\n}\n\nresponse = requests.get(\n    'https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization',\n    headers=headers\n)\n","python",[20,198,199,204,208,213,218,222,227,231,236,241,247],{"__ignoreMap":78},[82,200,201],{"class":84,"line":85},[82,202,203],{},"import requests\n",[82,205,206],{"class":84,"line":107},[82,207,181],{"emptyLinePlaceholder":180},[82,209,210],{"class":84,"line":118},[82,211,212],{},"headers = {\n",[82,214,215],{"class":84,"line":153},[82,216,217],{},"    'Authorization': f'Bearer {os.environ[\"HEADSHOTPRO_API_KEY\"]}',\n",[82,219,220],{"class":84,"line":159},[82,221,162],{},[82,223,224],{"class":84,"line":165},[82,225,226],{},"}\n",[82,228,229],{"class":84,"line":171},[82,230,181],{"emptyLinePlaceholder":180},[82,232,233],{"class":84,"line":177},[82,234,235],{},"response = requests.get(\n",[82,237,238],{"class":84,"line":184},[82,239,240],{},"    'https:\u002F\u002Fserver.headshotpro.com\u002Fapi\u002Fv2\u002Forganization',\n",[82,242,244],{"class":84,"line":243},10,[82,245,246],{},"    headers=headers\n",[82,248,250],{"class":84,"line":249},11,[82,251,252],{},")\n",[25,254,256],{"id":255},"api-key-scopes","API Key Scopes",[16,258,259],{},"API keys are scoped to your organization. All actions performed with the key are associated with your organization and subject to your plan's limits.",[261,262,263,276],"table",{},[264,265,266],"thead",{},[267,268,269,273],"tr",{},[270,271,272],"th",{},"Scope",[270,274,275],{},"Description",[277,278,279,288,296,304,312],"tbody",{},[267,280,281,285],{},[282,283,284],"td",{},"Organization",[282,286,287],{},"Read organization details and credits",[267,289,290,293],{},[282,291,292],{},"Invites",[282,294,295],{},"Create, list, and revoke invitations",[267,297,298,301],{},[282,299,300],{},"Teams",[282,302,303],{},"Manage teams and team membership",[267,305,306,309],{},[282,307,308],{},"Models",[282,310,311],{},"List and manage AI models",[267,313,314,317],{},[282,315,316],{},"Photos",[282,318,319],{},"Access generated headshots",[25,321,323],{"id":322},"security-best-practices","Security Best Practices",[30,325,326,332,338,344,350],{},[33,327,328,331],{},[40,329,330],{},"Never expose keys in client-side code"," - API keys should only be used server-side",[33,333,334,337],{},[40,335,336],{},"Use environment variables"," - Store keys in environment variables, not in code",[33,339,340,343],{},[40,341,342],{},"Rotate keys periodically"," - Generate new keys and invalidate old ones",[33,345,346,349],{},[40,347,348],{},"Monitor usage"," - Review API logs for unexpected activity",[33,351,352,355],{},[40,353,354],{},"Limit access"," - Only share keys with team members who need them",[25,357,359],{"id":358},"authentication-errors","Authentication Errors",[261,361,362,374],{},[264,363,364],{},[267,365,366,369,372],{},[270,367,368],{},"Status",[270,370,371],{},"Code",[270,373,275],{},[277,375,376,389],{},[267,377,378,381,386],{},[282,379,380],{},"401",[282,382,383],{},[20,384,385],{},"UNAUTHORIZED",[282,387,388],{},"Missing or invalid API key",[267,390,391,394,399],{},[282,392,393],{},"403",[282,395,396],{},[20,397,398],{},"FORBIDDEN",[282,400,401],{},"Key valid but lacks permission for this action",[125,403,405],{"id":404},"example-error-response","Example Error Response",[73,407,411],{"className":408,"code":409,"language":410,"meta":78,"style":78},"language-json shiki shiki-themes dark-plus","{\n  \"success\": false,\n  \"error\": \"Invalid API key\",\n  \"code\": \"UNAUTHORIZED\"\n}\n","json",[20,412,413,419,434,446,456],{"__ignoreMap":78},[82,414,415],{"class":84,"line":85},[82,416,418],{"class":417},"sTNBD","{\n",[82,420,421,425,428,431],{"class":84,"line":107},[82,422,424],{"class":423},"s3F5K","  \"success\"",[82,426,427],{"class":417},": ",[82,429,430],{"class":92},"false",[82,432,433],{"class":417},",\n",[82,435,436,439,441,444],{"class":84,"line":118},[82,437,438],{"class":423},"  \"error\"",[82,440,427],{"class":417},[82,442,443],{"class":96},"\"Invalid API key\"",[82,445,433],{"class":417},[82,447,448,451,453],{"class":84,"line":153},[82,449,450],{"class":423},"  \"code\"",[82,452,427],{"class":417},[82,454,455],{"class":96},"\"UNAUTHORIZED\"\n",[82,457,458],{"class":84,"line":159},[82,459,226],{"class":417},[25,461,463],{"id":462},"regenerating-your-api-key","Regenerating Your API Key",[16,465,466],{},"If your API key is compromised:",[30,468,469,477,482,487],{},[33,470,471,472,43,475],{},"Go to ",[40,473,474],{},"Settings",[40,476,46],{},[33,478,49,479],{},[40,480,481],{},"Delete API Key",[33,483,49,484,486],{},[40,485,52],{}," to create a new one",[33,488,489],{},"Update all applications using the old key",[16,491,492],{},"The old key is immediately invalidated when deleted.",[494,495,496],"style",{},"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 pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}html pre.shiki code .svVle, html code.shiki .svVle{--shiki-default:#D7BA7D}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}",{"title":78,"searchDepth":107,"depth":107,"links":498},[499,500,504,505,506,509],{"id":27,"depth":107,"text":28},{"id":64,"depth":107,"text":65,"children":501},[502,503],{"id":127,"depth":118,"text":128},{"id":190,"depth":118,"text":191},{"id":255,"depth":107,"text":256},{"id":322,"depth":107,"text":323},{"id":358,"depth":107,"text":359,"children":507},[508],{"id":404,"depth":118,"text":405},{"id":462,"depth":107,"text":463},"Learn how to authenticate with the HeadshotPro API using API keys","md",{},"\u002Fapi\u002Fauthentication",{"title":6,"description":510},"api\u002Fauthentication","J4AJnCebmy1KURRmW1C5BdwUzmx4b8IyF9nmMOUhBCU",[518,522,523,525,527,529,532,534,536,539,542,545],{"title":519,"slug":520,"order":521},"API Overview","index",0,{"title":6,"slug":14,"order":85},{"title":284,"slug":524,"order":107},"organization",{"title":292,"slug":526,"order":118},"invites",{"title":300,"slug":528,"order":153},"teams",{"title":530,"slug":531,"order":159},"Team Members","team-members",{"title":308,"slug":533,"order":165},"models",{"title":316,"slug":535,"order":171},"photos",{"title":537,"slug":538,"order":177},"Whitelabel","whitelabel",{"title":540,"slug":541,"order":184},"Errors","errors",{"title":543,"slug":544,"order":243},"Rate Limits","rate-limits",{"title":546,"slug":547,"order":249},"Webhooks","webhooks",1792465014317]