[{"data":1,"prerenderedAt":1410},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fdevelopers\u002Fauthentication":3,"docs-navigation":1361,"docs-surround-\u002Fdocs\u002Fdevelopers\u002Fauthentication":1407},{"id":4,"title":5,"body":6,"description":1352,"extension":1353,"icon":1354,"meta":1355,"navigation":1356,"path":1357,"seo":1358,"stem":1359,"__hash__":1360},"docs\u002Fdocs\u002F2.developers\u002F1.authentication.md","Authentication",{"type":7,"value":8,"toc":1333},"minimark",[9,13,17,22,41,44,48,51,62,65,261,265,272,277,283,294,344,354,358,361,421,423,467,470,474,478,488,535,539,542,642,645,772,777,797,801,876,878,937,941,944,968,979,983,986,1038,1041,1044,1048,1051,1092,1096,1099,1151,1154,1164,1170,1176,1182,1188,1194,1206,1268,1271,1275,1278,1323,1329],[10,11,5],"h1",{"id":12},"authentication",[14,15,16],"p",{},"The Hostsmith API uses OAuth 2.0 with Authorization Code + PKCE for authentication. This is the same flow used by MCP clients like Claude Code and Cursor.",[18,19,21],"h2",{"id":20},"overview","Overview",[23,24,25,29,32,35,38],"ol",{},[26,27,28],"li",{},"Your application redirects the user to Hostsmith to authorize access",[26,30,31],{},"The user reviews the requested permissions and approves",[26,33,34],{},"Hostsmith redirects back to your application with an authorization code",[26,36,37],{},"Your application exchanges the code for an access token",[26,39,40],{},"Use the access token as a Bearer token in API requests",[14,42,43],{},"Access tokens are short-lived JWTs (1 hour). Refresh tokens are provided to obtain new access tokens without re-authorizing.",[18,45,47],{"id":46},"discovery","Discovery",[14,49,50],{},"The authorization server publishes its configuration at a well-known endpoint:",[52,53,58],"pre",{"className":54,"code":56,"language":57},[55],"language-text","GET https:\u002F\u002Fhostsmith.net\u002F.well-known\u002Foauth-authorization-server\n","text",[59,60,56],"code",{"__ignoreMap":61},"",[14,63,64],{},"Response:",[52,66,70],{"className":67,"code":68,"language":69,"meta":61,"style":61},"language-json shiki shiki-themes github-dark","{\n  \"issuer\": \"https:\u002F\u002Fhostsmith.net\",\n  \"authorization_endpoint\": \"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize\",\n  \"token_endpoint\": \"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Ftoken\",\n  \"registration_endpoint\": \"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fregister\",\n  \"revocation_endpoint\": \"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Frevoke\",\n  \"response_types_supported\": [\"code\"],\n  \"grant_types_supported\": [\"authorization_code\", \"refresh_token\"],\n  \"code_challenge_methods_supported\": [\"S256\"],\n  \"token_endpoint_auth_methods_supported\": [\"none\"],\n  \"scopes_supported\": [\n    \"sites:read\",\n    \"sites:write\",\n    \"domains:read\",\n    \"files:write\"\n  ]\n}\n","json",[59,71,72,81,98,111,124,137,150,165,184,197,210,219,227,235,243,249,255],{"__ignoreMap":61},[73,74,77],"span",{"class":75,"line":76},"line",1,[73,78,80],{"class":79},"s95oV","{\n",[73,82,84,88,91,95],{"class":75,"line":83},2,[73,85,87],{"class":86},"sDLfK","  \"issuer\"",[73,89,90],{"class":79},": ",[73,92,94],{"class":93},"sU2Wk","\"https:\u002F\u002Fhostsmith.net\"",[73,96,97],{"class":79},",\n",[73,99,101,104,106,109],{"class":75,"line":100},3,[73,102,103],{"class":86},"  \"authorization_endpoint\"",[73,105,90],{"class":79},[73,107,108],{"class":93},"\"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize\"",[73,110,97],{"class":79},[73,112,114,117,119,122],{"class":75,"line":113},4,[73,115,116],{"class":86},"  \"token_endpoint\"",[73,118,90],{"class":79},[73,120,121],{"class":93},"\"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Ftoken\"",[73,123,97],{"class":79},[73,125,127,130,132,135],{"class":75,"line":126},5,[73,128,129],{"class":86},"  \"registration_endpoint\"",[73,131,90],{"class":79},[73,133,134],{"class":93},"\"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fregister\"",[73,136,97],{"class":79},[73,138,140,143,145,148],{"class":75,"line":139},6,[73,141,142],{"class":86},"  \"revocation_endpoint\"",[73,144,90],{"class":79},[73,146,147],{"class":93},"\"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Frevoke\"",[73,149,97],{"class":79},[73,151,153,156,159,162],{"class":75,"line":152},7,[73,154,155],{"class":86},"  \"response_types_supported\"",[73,157,158],{"class":79},": [",[73,160,161],{"class":93},"\"code\"",[73,163,164],{"class":79},"],\n",[73,166,168,171,173,176,179,182],{"class":75,"line":167},8,[73,169,170],{"class":86},"  \"grant_types_supported\"",[73,172,158],{"class":79},[73,174,175],{"class":93},"\"authorization_code\"",[73,177,178],{"class":79},", ",[73,180,181],{"class":93},"\"refresh_token\"",[73,183,164],{"class":79},[73,185,187,190,192,195],{"class":75,"line":186},9,[73,188,189],{"class":86},"  \"code_challenge_methods_supported\"",[73,191,158],{"class":79},[73,193,194],{"class":93},"\"S256\"",[73,196,164],{"class":79},[73,198,200,203,205,208],{"class":75,"line":199},10,[73,201,202],{"class":86},"  \"token_endpoint_auth_methods_supported\"",[73,204,158],{"class":79},[73,206,207],{"class":93},"\"none\"",[73,209,164],{"class":79},[73,211,213,216],{"class":75,"line":212},11,[73,214,215],{"class":86},"  \"scopes_supported\"",[73,217,218],{"class":79},": [\n",[73,220,222,225],{"class":75,"line":221},12,[73,223,224],{"class":93},"    \"sites:read\"",[73,226,97],{"class":79},[73,228,230,233],{"class":75,"line":229},13,[73,231,232],{"class":93},"    \"sites:write\"",[73,234,97],{"class":79},[73,236,238,241],{"class":75,"line":237},14,[73,239,240],{"class":93},"    \"domains:read\"",[73,242,97],{"class":79},[73,244,246],{"class":75,"line":245},15,[73,247,248],{"class":93},"    \"files:write\"\n",[73,250,252],{"class":75,"line":251},16,[73,253,254],{"class":79},"  ]\n",[73,256,258],{"class":75,"line":257},17,[73,259,260],{"class":79},"}\n",[18,262,264],{"id":263},"client-registration","Client registration",[14,266,267,268,271],{},"Before starting the OAuth flow, your application needs a ",[59,269,270],{},"client_id",". There are two options:",[273,274,276],"h3",{"id":275},"option-1-client-id-metadata-document-recommended","Option 1: Client ID Metadata Document (recommended)",[14,278,279,280,282],{},"Host a JSON metadata document at an HTTPS URL and use that URL as your ",[59,281,270],{},". No registration step needed - Hostsmith fetches the metadata when the user authorizes.",[14,284,285,286,289,290,293],{},"Example: if your app is at ",[59,287,288],{},"https:\u002F\u002Fmyapp.example.com",", host this at ",[59,291,292],{},"https:\u002F\u002Fmyapp.example.com\u002F.well-known\u002Foauth-client",":",[52,295,297],{"className":67,"code":296,"language":69,"meta":61,"style":61},"{\n  \"client_id\": \"https:\u002F\u002Fmyapp.example.com\u002F.well-known\u002Foauth-client\",\n  \"client_name\": \"My App\",\n  \"redirect_uris\": [\"https:\u002F\u002Fmyapp.example.com\u002Fcallback\"]\n}\n",[59,298,299,303,315,327,340],{"__ignoreMap":61},[73,300,301],{"class":75,"line":76},[73,302,80],{"class":79},[73,304,305,308,310,313],{"class":75,"line":83},[73,306,307],{"class":86},"  \"client_id\"",[73,309,90],{"class":79},[73,311,312],{"class":93},"\"https:\u002F\u002Fmyapp.example.com\u002F.well-known\u002Foauth-client\"",[73,314,97],{"class":79},[73,316,317,320,322,325],{"class":75,"line":100},[73,318,319],{"class":86},"  \"client_name\"",[73,321,90],{"class":79},[73,323,324],{"class":93},"\"My App\"",[73,326,97],{"class":79},[73,328,329,332,334,337],{"class":75,"line":113},[73,330,331],{"class":86},"  \"redirect_uris\"",[73,333,158],{"class":79},[73,335,336],{"class":93},"\"https:\u002F\u002Fmyapp.example.com\u002Fcallback\"",[73,338,339],{"class":79},"]\n",[73,341,342],{"class":75,"line":126},[73,343,260],{"class":79},[14,345,346,347,350,351,353],{},"Then use ",[59,348,349],{},"client_id=https:\u002F\u002Fmyapp.example.com\u002F.well-known\u002Foauth-client"," in the authorization request. The ",[59,352,270],{}," field in the document must match the URL.",[273,355,357],{"id":356},"option-2-dynamic-client-registration","Option 2: Dynamic Client Registration",[14,359,360],{},"Register your client programmatically:",[52,362,366],{"className":363,"code":364,"language":365,"meta":61,"style":61},"language-bash shiki shiki-themes github-dark","POST https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fregister\nContent-Type: application\u002Fjson\n\n{\n  \"client_name\": \"My App\",\n  \"redirect_uris\": [\"https:\u002F\u002Fmyapp.example.com\u002Fcallback\"]\n}\n","bash",[59,367,368,377,385,391,395,404,417],{"__ignoreMap":61},[73,369,370,374],{"class":75,"line":76},[73,371,373],{"class":372},"svObZ","POST",[73,375,376],{"class":93}," https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fregister\n",[73,378,379,382],{"class":75,"line":83},[73,380,381],{"class":372},"Content-Type:",[73,383,384],{"class":93}," application\u002Fjson\n",[73,386,387],{"class":75,"line":100},[73,388,390],{"emptyLinePlaceholder":389},true,"\n",[73,392,393],{"class":75,"line":113},[73,394,80],{"class":79},[73,396,397,399,401],{"class":75,"line":126},[73,398,319],{"class":372},[73,400,293],{"class":86},[73,402,403],{"class":93}," \"My App\",\n",[73,405,406,408,410,413,415],{"class":75,"line":139},[73,407,331],{"class":372},[73,409,293],{"class":86},[73,411,412],{"class":79}," [",[73,414,336],{"class":93},[73,416,339],{"class":79},[73,418,419],{"class":75,"line":152},[73,420,260],{"class":79},[14,422,64],{},[52,424,426],{"className":67,"code":425,"language":69,"meta":61,"style":61},"{\n  \"client_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"client_name\": \"My App\",\n  \"redirect_uris\": [\"https:\u002F\u002Fmyapp.example.com\u002Fcallback\"]\n}\n",[59,427,428,432,443,453,463],{"__ignoreMap":61},[73,429,430],{"class":75,"line":76},[73,431,80],{"class":79},[73,433,434,436,438,441],{"class":75,"line":83},[73,435,307],{"class":86},[73,437,90],{"class":79},[73,439,440],{"class":93},"\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"",[73,442,97],{"class":79},[73,444,445,447,449,451],{"class":75,"line":100},[73,446,319],{"class":86},[73,448,90],{"class":79},[73,450,324],{"class":93},[73,452,97],{"class":79},[73,454,455,457,459,461],{"class":75,"line":113},[73,456,331],{"class":86},[73,458,158],{"class":79},[73,460,336],{"class":93},[73,462,339],{"class":79},[73,464,465],{"class":75,"line":126},[73,466,260],{"class":79},[14,468,469],{},"Dynamically registered clients expire unless a user completes the authorization flow, which makes the client permanent.",[18,471,473],{"id":472},"authorization-flow","Authorization flow",[273,475,477],{"id":476},"_1-generate-pkce-challenge","1. Generate PKCE challenge",[14,479,480,481,484,485,293],{},"PKCE is required for all authorization requests. Generate a random ",[59,482,483],{},"code_verifier"," and derive the ",[59,486,487],{},"code_challenge",[52,489,493],{"className":490,"code":491,"language":492,"meta":61,"style":61},"language-javascript shiki shiki-themes github-dark","\u002F\u002F Generate a random 43-character code verifier\nconst verifier = crypto.randomUUID() + crypto.randomUUID();\nconst encoder = new TextEncoder();\nconst digest = await crypto.subtle.digest(\"SHA-256\", encoder.encode(verifier));\nconst challenge = btoa(String.fromCharCode(...new Uint8Array(digest)))\n  .replace(\u002F\\+\u002Fg, \"-\")\n  .replace(\u002F\\\u002F\u002Fg, \"_\")\n  .replace(\u002F=+$\u002F, \"\");\n","javascript",[59,494,495,500,505,510,515,520,525,530],{"__ignoreMap":61},[73,496,497],{"class":75,"line":76},[73,498,499],{},"\u002F\u002F Generate a random 43-character code verifier\n",[73,501,502],{"class":75,"line":83},[73,503,504],{},"const verifier = crypto.randomUUID() + crypto.randomUUID();\n",[73,506,507],{"class":75,"line":100},[73,508,509],{},"const encoder = new TextEncoder();\n",[73,511,512],{"class":75,"line":113},[73,513,514],{},"const digest = await crypto.subtle.digest(\"SHA-256\", encoder.encode(verifier));\n",[73,516,517],{"class":75,"line":126},[73,518,519],{},"const challenge = btoa(String.fromCharCode(...new Uint8Array(digest)))\n",[73,521,522],{"class":75,"line":139},[73,523,524],{},"  .replace(\u002F\\+\u002Fg, \"-\")\n",[73,526,527],{"class":75,"line":152},[73,528,529],{},"  .replace(\u002F\\\u002F\u002Fg, \"_\")\n",[73,531,532],{"class":75,"line":167},[73,533,534],{},"  .replace(\u002F=+$\u002F, \"\");\n",[273,536,538],{"id":537},"_2-redirect-to-authorize","2. Redirect to authorize",[14,540,541],{},"Open the authorization URL in the user's browser:",[52,543,545],{"className":363,"code":544,"language":365,"meta":61,"style":61},"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize?\n  client_id=YOUR_CLIENT_ID&\n  redirect_uri=https:\u002F\u002Fmyapp.example.com\u002Fcallback&\n  response_type=code&\n  code_challenge=YOUR_CHALLENGE&\n  code_challenge_method=S256&\n  scope=sites:read sites:write files:write&\n  state=RANDOM_STATE\n",[59,546,547,552,567,579,590,602,614,632],{"__ignoreMap":61},[73,548,549],{"class":75,"line":76},[73,550,551],{"class":372},"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize?\n",[73,553,554,557,561,564],{"class":75,"line":83},[73,555,556],{"class":79},"  client_id",[73,558,560],{"class":559},"snl16","=",[73,562,563],{"class":93},"YOUR_CLIENT_ID",[73,565,566],{"class":79},"&\n",[73,568,569,572,574,577],{"class":75,"line":100},[73,570,571],{"class":79},"  redirect_uri",[73,573,560],{"class":559},[73,575,576],{"class":93},"https:\u002F\u002Fmyapp.example.com\u002Fcallback",[73,578,566],{"class":79},[73,580,581,584,586,588],{"class":75,"line":113},[73,582,583],{"class":79},"  response_type",[73,585,560],{"class":559},[73,587,59],{"class":93},[73,589,566],{"class":79},[73,591,592,595,597,600],{"class":75,"line":126},[73,593,594],{"class":79},"  code_challenge",[73,596,560],{"class":559},[73,598,599],{"class":93},"YOUR_CHALLENGE",[73,601,566],{"class":79},[73,603,604,607,609,612],{"class":75,"line":139},[73,605,606],{"class":79},"  code_challenge_method",[73,608,560],{"class":559},[73,610,611],{"class":93},"S256",[73,613,566],{"class":79},[73,615,616,619,621,624,627,630],{"class":75,"line":152},[73,617,618],{"class":79},"  scope",[73,620,560],{"class":559},[73,622,623],{"class":93},"sites:read",[73,625,626],{"class":372}," sites:write",[73,628,629],{"class":93}," files:write",[73,631,566],{"class":79},[73,633,634,637,639],{"class":75,"line":167},[73,635,636],{"class":79},"  state",[73,638,560],{"class":559},[73,640,641],{"class":93},"RANDOM_STATE\n",[14,643,644],{},"Parameters:",[646,647,648,664],"table",{},[649,650,651],"thead",{},[652,653,654,658,661],"tr",{},[655,656,657],"th",{},"Parameter",[655,659,660],{},"Required",[655,662,663],{},"Description",[665,666,667,680,692,706,717,730,742,755],"tbody",{},[652,668,669,674,677],{},[670,671,672],"td",{},[59,673,270],{},[670,675,676],{},"Yes",[670,678,679],{},"Your client ID (UUID or metadata URL)",[652,681,682,687,689],{},[670,683,684],{},[59,685,686],{},"redirect_uri",[670,688,676],{},[670,690,691],{},"Must match a registered redirect URI",[652,693,694,699,701],{},[670,695,696],{},[59,697,698],{},"response_type",[670,700,676],{},[670,702,703,704],{},"Always ",[59,705,59],{},[652,707,708,712,714],{},[670,709,710],{},[59,711,487],{},[670,713,676],{},[670,715,716],{},"S256 PKCE challenge",[652,718,719,724,726],{},[670,720,721],{},[59,722,723],{},"code_challenge_method",[670,725,676],{},[670,727,703,728],{},[59,729,611],{},[652,731,732,737,739],{},[670,733,734],{},[59,735,736],{},"scope",[670,738,676],{},[670,740,741],{},"Space-separated list of scopes",[652,743,744,749,752],{},[670,745,746],{},[59,747,748],{},"state",[670,750,751],{},"Recommended",[670,753,754],{},"Random string to prevent CSRF - verify it on callback",[652,756,757,762,764],{},[670,758,759],{},[59,760,761],{},"resource",[670,763,751],{},[670,765,766,767],{},"API resource identifier(s) - see ",[768,769,771],"a",{"href":770},"#resource-binding","Resource binding",[14,773,774,775,293],{},"The user sees a consent screen listing the requested permissions. After approval, Hostsmith redirects to your ",[59,776,686],{},[52,778,780],{"className":363,"code":779,"language":365,"meta":61,"style":61},"https:\u002F\u002Fmyapp.example.com\u002Fcallback?code=AUTH_CODE&state=RANDOM_STATE\n",[59,781,782],{"__ignoreMap":61},[73,783,784,787,790,793,795],{"class":75,"line":76},[73,785,786],{"class":372},"https:\u002F\u002Fmyapp.example.com\u002Fcallback?code",[73,788,789],{"class":93},"=AUTH_CODE",[73,791,792],{"class":79},"&state",[73,794,560],{"class":559},[73,796,641],{"class":93},[273,798,800],{"id":799},"_3-exchange-code-for-tokens","3. Exchange code for tokens",[52,802,804],{"className":363,"code":803,"language":365,"meta":61,"style":61},"POST https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Ftoken\nContent-Type: application\u002Fx-www-form-urlencoded\n\ngrant_type=authorization_code&\ncode=AUTH_CODE&\nclient_id=YOUR_CLIENT_ID&\nredirect_uri=https:\u002F\u002Fmyapp.example.com\u002Fcallback&\ncode_verifier=YOUR_VERIFIER\n",[59,805,806,813,820,824,836,847,857,867],{"__ignoreMap":61},[73,807,808,810],{"class":75,"line":76},[73,809,373],{"class":372},[73,811,812],{"class":93}," https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Ftoken\n",[73,814,815,817],{"class":75,"line":83},[73,816,381],{"class":372},[73,818,819],{"class":93}," application\u002Fx-www-form-urlencoded\n",[73,821,822],{"class":75,"line":100},[73,823,390],{"emptyLinePlaceholder":389},[73,825,826,829,831,834],{"class":75,"line":113},[73,827,828],{"class":79},"grant_type",[73,830,560],{"class":559},[73,832,833],{"class":93},"authorization_code",[73,835,566],{"class":79},[73,837,838,840,842,845],{"class":75,"line":126},[73,839,59],{"class":79},[73,841,560],{"class":559},[73,843,844],{"class":93},"AUTH_CODE",[73,846,566],{"class":79},[73,848,849,851,853,855],{"class":75,"line":139},[73,850,270],{"class":79},[73,852,560],{"class":559},[73,854,563],{"class":93},[73,856,566],{"class":79},[73,858,859,861,863,865],{"class":75,"line":152},[73,860,686],{"class":79},[73,862,560],{"class":559},[73,864,576],{"class":93},[73,866,566],{"class":79},[73,868,869,871,873],{"class":75,"line":167},[73,870,483],{"class":79},[73,872,560],{"class":559},[73,874,875],{"class":93},"YOUR_VERIFIER\n",[14,877,64],{},[52,879,881],{"className":67,"code":880,"language":69,"meta":61,"style":61},"{\n  \"access_token\": \"eyJhbGciOiJSUzI1NiIs...\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 3600,\n  \"refresh_token\": \"rt_a1b2c3d4...\"\n}\n",[59,882,883,887,899,911,923,933],{"__ignoreMap":61},[73,884,885],{"class":75,"line":76},[73,886,80],{"class":79},[73,888,889,892,894,897],{"class":75,"line":83},[73,890,891],{"class":86},"  \"access_token\"",[73,893,90],{"class":79},[73,895,896],{"class":93},"\"eyJhbGciOiJSUzI1NiIs...\"",[73,898,97],{"class":79},[73,900,901,904,906,909],{"class":75,"line":100},[73,902,903],{"class":86},"  \"token_type\"",[73,905,90],{"class":79},[73,907,908],{"class":93},"\"Bearer\"",[73,910,97],{"class":79},[73,912,913,916,918,921],{"class":75,"line":113},[73,914,915],{"class":86},"  \"expires_in\"",[73,917,90],{"class":79},[73,919,920],{"class":86},"3600",[73,922,97],{"class":79},[73,924,925,928,930],{"class":75,"line":126},[73,926,927],{"class":86},"  \"refresh_token\"",[73,929,90],{"class":79},[73,931,932],{"class":93},"\"rt_a1b2c3d4...\"\n",[73,934,935],{"class":75,"line":139},[73,936,260],{"class":79},[18,938,940],{"id":939},"making-api-requests","Making API requests",[14,942,943],{},"Include the access token as a Bearer token:",[52,945,947],{"className":363,"code":946,"language":365,"meta":61,"style":61},"curl https:\u002F\u002Fuse2.api.hostsmith.net\u002Fv1\u002Fsites \\\n  -H \"Authorization: Bearer eyJhbGciOiJSUzI1NiIs...\"\n",[59,948,949,960],{"__ignoreMap":61},[73,950,951,954,957],{"class":75,"line":76},[73,952,953],{"class":372},"curl",[73,955,956],{"class":93}," https:\u002F\u002Fuse2.api.hostsmith.net\u002Fv1\u002Fsites",[73,958,959],{"class":86}," \\\n",[73,961,962,965],{"class":75,"line":83},[73,963,964],{"class":86},"  -H",[73,966,967],{"class":93}," \"Authorization: Bearer eyJhbGciOiJSUzI1NiIs...\"\n",[14,969,970,971,974,975,978],{},"A ",[59,972,973],{},"401"," response means the token is missing, expired, or invalid. Check the ",[59,976,977],{},"WWW-Authenticate"," header for details.",[18,980,982],{"id":981},"refreshing-tokens","Refreshing tokens",[14,984,985],{},"Access tokens expire after 1 hour. Use the refresh token to get a new one:",[52,987,989],{"className":363,"code":988,"language":365,"meta":61,"style":61},"POST https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Ftoken\nContent-Type: application\u002Fx-www-form-urlencoded\n\ngrant_type=refresh_token&\nrefresh_token=rt_a1b2c3d4...&\nclient_id=YOUR_CLIENT_ID\n",[59,990,991,997,1003,1007,1018,1029],{"__ignoreMap":61},[73,992,993,995],{"class":75,"line":76},[73,994,373],{"class":372},[73,996,812],{"class":93},[73,998,999,1001],{"class":75,"line":83},[73,1000,381],{"class":372},[73,1002,819],{"class":93},[73,1004,1005],{"class":75,"line":100},[73,1006,390],{"emptyLinePlaceholder":389},[73,1008,1009,1011,1013,1016],{"class":75,"line":113},[73,1010,828],{"class":79},[73,1012,560],{"class":559},[73,1014,1015],{"class":93},"refresh_token",[73,1017,566],{"class":79},[73,1019,1020,1022,1024,1027],{"class":75,"line":126},[73,1021,1015],{"class":79},[73,1023,560],{"class":559},[73,1025,1026],{"class":93},"rt_a1b2c3d4...",[73,1028,566],{"class":79},[73,1030,1031,1033,1035],{"class":75,"line":139},[73,1032,270],{"class":79},[73,1034,560],{"class":559},[73,1036,1037],{"class":93},"YOUR_CLIENT_ID\n",[14,1039,1040],{},"Response includes a new access token and a new refresh token (rotation). The old refresh token is invalidated.",[14,1042,1043],{},"Refresh tokens are valid for 90 days from the original authorization. After that, the user must re-authorize through the consent flow.",[18,1045,1047],{"id":1046},"revoking-tokens","Revoking tokens",[14,1049,1050],{},"To revoke a refresh token (e.g. on user logout):",[52,1052,1054],{"className":363,"code":1053,"language":365,"meta":61,"style":61},"POST https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Frevoke\nContent-Type: application\u002Fx-www-form-urlencoded\n\ntoken=rt_a1b2c3d4...&\nclient_id=YOUR_CLIENT_ID\n",[59,1055,1056,1063,1069,1073,1084],{"__ignoreMap":61},[73,1057,1058,1060],{"class":75,"line":76},[73,1059,373],{"class":372},[73,1061,1062],{"class":93}," https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Frevoke\n",[73,1064,1065,1067],{"class":75,"line":83},[73,1066,381],{"class":372},[73,1068,819],{"class":93},[73,1070,1071],{"class":75,"line":100},[73,1072,390],{"emptyLinePlaceholder":389},[73,1074,1075,1078,1080,1082],{"class":75,"line":113},[73,1076,1077],{"class":79},"token",[73,1079,560],{"class":559},[73,1081,1026],{"class":93},[73,1083,566],{"class":79},[73,1085,1086,1088,1090],{"class":75,"line":126},[73,1087,270],{"class":79},[73,1089,560],{"class":559},[73,1091,1037],{"class":93},[18,1093,1095],{"id":1094},"scopes","Scopes",[14,1097,1098],{},"Request only the scopes your application needs:",[646,1100,1101,1110],{},[649,1102,1103],{},[652,1104,1105,1108],{},[655,1106,1107],{},"Scope",[655,1109,663],{},[665,1111,1112,1121,1131,1141],{},[652,1113,1114,1118],{},[670,1115,1116],{},[59,1117,623],{},[670,1119,1120],{},"List and view sites",[652,1122,1123,1128],{},[670,1124,1125],{},[59,1126,1127],{},"sites:write",[670,1129,1130],{},"Create, update, and delete sites",[652,1132,1133,1138],{},[670,1134,1135],{},[59,1136,1137],{},"domains:read",[670,1139,1140],{},"List and view domains",[652,1142,1143,1148],{},[670,1144,1145],{},[59,1146,1147],{},"files:write",[670,1149,1150],{},"Upload and manage site files",[18,1152,771],{"id":1153},"resource-binding",[14,1155,1156,1157,1159,1160,1163],{},"The ",[59,1158,761],{}," parameter binds the access token to specific API endpoints by setting the JWT ",[59,1161,1162],{},"aud"," (audience) claim. Each regional API validates that its identifier is present in the token's audience.",[14,1165,1166,1167,1169],{},"To bind a token to a single region, include one ",[59,1168,761],{}," parameter:",[52,1171,1174],{"className":1172,"code":1173,"language":57},[55],"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize?\n  ...&\n  resource=https:\u002F\u002Fuse2.api.hostsmith.net\n",[59,1175,1173],{"__ignoreMap":61},[14,1177,1178,1179,1181],{},"To bind a token to multiple regions, include ",[59,1180,761],{}," multiple times:",[52,1183,1186],{"className":1184,"code":1185,"language":57},[55],"https:\u002F\u002Fhostsmith.net\u002Fapi\u002Foauth\u002Fauthorize?\n  ...&\n  resource=https:\u002F\u002Fuse2.api.hostsmith.net&\n  resource=https:\u002F\u002Feuc1.api.hostsmith.net\n",[59,1187,1185],{"__ignoreMap":61},[14,1189,1190,1191,293],{},"Each regional API publishes its resource identifier at ",[59,1192,1193],{},"\u002F.well-known\u002Foauth-protected-resource",[52,1195,1197],{"className":363,"code":1196,"language":365,"meta":61,"style":61},"curl https:\u002F\u002Fuse2.api.hostsmith.net\u002F.well-known\u002Foauth-protected-resource\n",[59,1198,1199],{"__ignoreMap":61},[73,1200,1201,1203],{"class":75,"line":76},[73,1202,953],{"class":372},[73,1204,1205],{"class":93}," https:\u002F\u002Fuse2.api.hostsmith.net\u002F.well-known\u002Foauth-protected-resource\n",[52,1207,1209],{"className":67,"code":1208,"language":69,"meta":61,"style":61},"{\n  \"resource\": \"https:\u002F\u002Fuse2.api.hostsmith.net\",\n  \"authorization_servers\": [\"https:\u002F\u002Fhostsmith.net\"],\n  \"scopes_supported\": [\"sites:read\", \"sites:write\", \"domains:read\", \"files:write\"]\n}\n",[59,1210,1211,1215,1227,1238,1264],{"__ignoreMap":61},[73,1212,1213],{"class":75,"line":76},[73,1214,80],{"class":79},[73,1216,1217,1220,1222,1225],{"class":75,"line":83},[73,1218,1219],{"class":86},"  \"resource\"",[73,1221,90],{"class":79},[73,1223,1224],{"class":93},"\"https:\u002F\u002Fuse2.api.hostsmith.net\"",[73,1226,97],{"class":79},[73,1228,1229,1232,1234,1236],{"class":75,"line":100},[73,1230,1231],{"class":86},"  \"authorization_servers\"",[73,1233,158],{"class":79},[73,1235,94],{"class":93},[73,1237,164],{"class":79},[73,1239,1240,1242,1244,1247,1249,1252,1254,1257,1259,1262],{"class":75,"line":113},[73,1241,215],{"class":86},[73,1243,158],{"class":79},[73,1245,1246],{"class":93},"\"sites:read\"",[73,1248,178],{"class":79},[73,1250,1251],{"class":93},"\"sites:write\"",[73,1253,178],{"class":79},[73,1255,1256],{"class":93},"\"domains:read\"",[73,1258,178],{"class":79},[73,1260,1261],{"class":93},"\"files:write\"",[73,1263,339],{"class":79},[73,1265,1266],{"class":75,"line":126},[73,1267,260],{"class":79},[14,1269,1270],{},"If you need to call the API in both regions, include both resource identifiers when authorizing. The resulting token will be valid for both.",[18,1272,1274],{"id":1273},"regional-endpoints","Regional endpoints",[14,1276,1277],{},"The API is deployed in multiple regions. Choose the region where your sites are hosted:",[646,1279,1280,1293],{},[649,1281,1282],{},[652,1283,1284,1287,1290],{},[655,1285,1286],{},"Region",[655,1288,1289],{},"Endpoint",[655,1291,1292],{},"Resource identifier",[665,1294,1295,1309],{},[652,1296,1297,1300,1305],{},[670,1298,1299],{},"US East (Ohio)",[670,1301,1302],{},[59,1303,1304],{},"https:\u002F\u002Fuse2.api.hostsmith.net",[670,1306,1307],{},[59,1308,1304],{},[652,1310,1311,1314,1319],{},[670,1312,1313],{},"EU (Frankfurt)",[670,1315,1316],{},[59,1317,1318],{},"https:\u002F\u002Feuc1.api.hostsmith.net",[670,1320,1321],{},[59,1322,1318],{},[14,1324,1325,1326,1328],{},"Include the resource identifier(s) in the ",[59,1327,761],{}," parameter when authorizing to bind the token to the API.",[1330,1331,1332],"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 .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}",{"title":61,"searchDepth":83,"depth":83,"links":1334},[1335,1336,1337,1341,1346,1347,1348,1349,1350,1351],{"id":20,"depth":83,"text":21},{"id":46,"depth":83,"text":47},{"id":263,"depth":83,"text":264,"children":1338},[1339,1340],{"id":275,"depth":100,"text":276},{"id":356,"depth":100,"text":357},{"id":472,"depth":83,"text":473,"children":1342},[1343,1344,1345],{"id":476,"depth":100,"text":477},{"id":537,"depth":100,"text":538},{"id":799,"depth":100,"text":800},{"id":939,"depth":83,"text":940},{"id":981,"depth":83,"text":982},{"id":1046,"depth":83,"text":1047},{"id":1094,"depth":83,"text":1095},{"id":1153,"depth":83,"text":771},{"id":1273,"depth":83,"text":1274},"How to authenticate with the Hostsmith API using OAuth 2.0.","md","solar:lock-keyhole-bold",{},null,"\u002Fdocs\u002Fdevelopers\u002Fauthentication",{"title":5,"description":1352},"docs\u002F2.developers\u002F1.authentication","55xKUOcal2WIrtm5K0lX1TymbuAvdGrKqiH2Z9SKars",[1362],{"title":1363,"path":1364,"stem":1365,"children":1366,"page":1406},"Docs","\u002Fdocs","docs",[1367,1394],{"title":1368,"path":1369,"stem":1370,"children":1371,"page":-1,"icon":1373},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started\u002Findex",[1372,1374,1378,1382,1386,1390],{"title":1368,"path":1369,"stem":1370,"icon":1373},"solar:rocket-bold",{"title":1375,"path":1376,"stem":1377},"Introduction","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",{"title":1379,"path":1380,"stem":1381},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F2.quick-start",{"title":1383,"path":1384,"stem":1385},"Sites","\u002Fdocs\u002Fgetting-started\u002Fsites","docs\u002F1.getting-started\u002F3.sites",{"title":1387,"path":1388,"stem":1389},"Custom Domains","\u002Fdocs\u002Fgetting-started\u002Fcustom-domains","docs\u002F1.getting-started\u002F4.custom-domains",{"title":1391,"path":1392,"stem":1393},"Support","\u002Fdocs\u002Fgetting-started\u002Fsupport","docs\u002F1.getting-started\u002F5.support",{"title":1395,"path":1396,"stem":1397,"children":1398,"page":-1,"icon":1400},"Developers","\u002Fdocs\u002Fdevelopers","docs\u002F2.developers\u002Findex",[1399,1401,1402],{"title":1395,"path":1396,"stem":1397,"icon":1400},"solar:code-bold",{"title":5,"path":1357,"stem":1359},{"title":1403,"path":1404,"stem":1405},"API Explorer","\u002Fdocs\u002Fdevelopers\u002Fapi-explorer","docs\u002F2.developers\u002F2.api-explorer",false,[1408,1409],{"title":1395,"path":1396,"stem":1397,"icon":1400,"children":-1},{"title":1403,"path":1404,"stem":1405,"children":-1},1776101071368]