[{"data":1,"prerenderedAt":3024},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Fquickstart":351,"api-spec:guide:\u002Fapi\u002Fquickstart":3014},[4,28,57,95,115,301,317,331],{"id":5,"title":6,"links":7,"groups":27},"start","Start here",[8,11,15,18,21,24],{"title":9,"to":10},"Overview","\u002Fapi",{"title":12,"to":13,"status":14},"Quickstart","\u002Fapi\u002Fquickstart","available",{"title":16,"to":17,"status":14},"Environments","\u002Fapi\u002Fenvironments",{"title":19,"to":20,"status":14},"Authentication","\u002Fapi\u002Fauthentication",{"title":22,"to":23,"status":14},"Organizations","\u002Fapi\u002Forganizations",{"title":25,"to":26,"status":14},"Permissions","\u002Fapi\u002Fpermissions",[],{"id":29,"title":30,"links":31,"groups":56},"concepts","Concepts",[32,35,38,41,44,47,50,53],{"title":33,"to":34,"status":14},"Requests and responses","\u002Fapi\u002Frequests-and-responses",{"title":36,"to":37,"status":14},"Identifiers","\u002Fapi\u002Fidentifiers",{"title":39,"to":40,"status":14},"Pagination","\u002Fapi\u002Fpagination",{"title":42,"to":43},"Errors","\u002Fapi\u002Ferrors",{"title":45,"to":46,"status":14},"Rate limits","\u002Fapi\u002Frate-limits",{"title":48,"to":49,"status":14},"Retries","\u002Fapi\u002Fretries-and-idempotency",{"title":51,"to":52,"status":14},"Security","\u002Fapi\u002Fsecurity",{"title":54,"to":55,"status":14},"Versioning","\u002Fapi\u002Fversioning",[],{"id":58,"title":59,"links":60,"groups":94},"resources","Guides",[61,64,67,70,73,76,79,82,85,88,91],{"title":62,"to":63,"status":14},"Students","\u002Fapi\u002Fguides\u002Fstudents",{"title":65,"to":66,"status":14},"Bulk registration","\u002Fapi\u002Fguides\u002Fbulk-registration",{"title":68,"to":69,"status":14},"Passwords","\u002Fapi\u002Fguides\u002Fpasswords",{"title":71,"to":72,"status":14},"Supervisors","\u002Fapi\u002Fguides\u002Fsupervisors",{"title":74,"to":75,"status":14},"Reference data","\u002Fapi\u002Fguides\u002Freference-data",{"title":77,"to":78,"status":14},"API account","\u002Fapi\u002Fguides\u002Fapi-account",{"title":80,"to":81,"status":14},"Sign-in links","\u002Fapi\u002Fguides\u002Fsign-in-links",{"title":83,"to":84,"status":14},"Exams","\u002Fapi\u002Fguides\u002Fexams",{"title":86,"to":87,"status":14},"Applications","\u002Fapi\u002Fguides\u002Fapplications",{"title":89,"to":90,"status":14},"Group challenges","\u002Fapi\u002Fguides\u002Fgroup-challenges",{"title":92,"to":93,"status":14},"Certificates and reports","\u002Fapi\u002Fguides\u002Fcertificates-and-reports",[],{"id":96,"title":97,"links":98,"groups":114},"tutorials","Tutorials",[99,102,105,108,111],{"title":100,"to":101,"status":14},"Register and apply","\u002Fapi\u002Ftutorials\u002Fregister-and-apply",{"title":103,"to":104,"status":14},"Send a student to the panel","\u002Fapi\u002Ftutorials\u002Fsend-student-to-panel",{"title":106,"to":107,"status":14},"Change an application","\u002Fapi\u002Ftutorials\u002Fchange-an-application",{"title":109,"to":110,"status":14},"Collect results","\u002Fapi\u002Ftutorials\u002Fcollect-results",{"title":112,"to":113,"status":14},"Token handling","\u002Fapi\u002Ftutorials\u002Ftoken-handling",[],{"id":116,"title":117,"links":118,"groups":125},"reference","Reference",[119,122],{"title":120,"to":121},"All endpoints","\u002Fapi\u002Freference",{"title":123,"to":124},"Sandbox console","\u002Fapi\u002Fconsole",[126,135,145,166,206,212,230,255,271],{"tag":127,"slug":128,"links":129},"Health","health",[130],{"title":131,"to":132,"method":133,"deprecated":134},"Check that the API is up","\u002Fapi\u002Freference\u002Fget-health","GET",false,{"tag":77,"slug":136,"links":137},"api-account",[138,142],{"title":139,"to":140,"method":141,"deprecated":134},"Revoke the token you send, before it expires","\u002Fapi\u002Freference\u002Frevoke-token","POST",{"title":143,"to":144,"method":133,"deprecated":134},"Fetch the API account your token belongs to","\u002Fapi\u002Freference\u002Fget-current-api-account",{"tag":74,"slug":146,"links":147},"reference-data",[148,151,154,157,160,163],{"title":149,"to":150,"method":133,"deprecated":134},"List the countries a student can be registered in","\u002Fapi\u002Freference\u002Flist-countries",{"title":152,"to":153,"method":133,"deprecated":134},"Fetch one country by its id","\u002Fapi\u002Freference\u002Fget-country",{"title":155,"to":156,"method":133,"deprecated":134},"List the grades a student can be registered with","\u002Fapi\u002Freference\u002Flist-grades",{"title":158,"to":159,"method":133,"deprecated":134},"Fetch one grade by its id","\u002Fapi\u002Freference\u002Fget-grade",{"title":161,"to":162,"method":133,"deprecated":134},"List the organizations and their ids","\u002Fapi\u002Freference\u002Flist-organizations",{"title":164,"to":165,"method":133,"deprecated":134},"Fetch one organization by its id","\u002Fapi\u002Freference\u002Fget-organization",{"tag":62,"slug":167,"links":168},"students",[169,172,175,178,181,184,187,191,194,197,200,203],{"title":170,"to":171,"method":133,"deprecated":134},"List your students","\u002Fapi\u002Freference\u002Flist-students",{"title":173,"to":174,"method":141,"deprecated":134},"Register a student","\u002Fapi\u002Freference\u002Fregister-student",{"title":176,"to":177,"method":141,"deprecated":134},"Check a registration without registering the student","\u002Fapi\u002Freference\u002Fcheck-student-registration",{"title":179,"to":180,"method":141,"deprecated":134},"Register many students at once","\u002Fapi\u002Freference\u002Fcreate-student-import",{"title":182,"to":183,"method":133,"deprecated":134},"Follow a batch of students you sent","\u002Fapi\u002Freference\u002Fget-student-import",{"title":185,"to":186,"method":133,"deprecated":134},"Fetch one of your students","\u002Fapi\u002Freference\u002Fget-student",{"title":188,"to":189,"method":190,"deprecated":134},"Update one of your students","\u002Fapi\u002Freference\u002Fupdate-student","PUT",{"title":192,"to":193,"method":190,"deprecated":134},"Set the sign-in password of one of your students","\u002Fapi\u002Freference\u002Fset-student-password",{"title":195,"to":196,"method":133,"deprecated":134},"List your students who can use this organization","\u002Fapi\u002Freference\u002Flist-org-students",{"title":198,"to":199,"method":133,"deprecated":134},"Fetch one of your students, if they can use this organization","\u002Fapi\u002Freference\u002Fget-org-student",{"title":201,"to":202,"method":190,"deprecated":134},"Update one of your students and give them access to this organization","\u002Fapi\u002Freference\u002Fupdate-org-student",{"title":204,"to":205,"method":190,"deprecated":134},"Link one of your students to a supervisor on this organization","\u002Fapi\u002Freference\u002Flink-student-supervisor",{"tag":80,"slug":207,"links":208},"sign-in-links",[209],{"title":210,"to":211,"method":141,"deprecated":134},"Create a single-use sign-in link for one of your students","\u002Fapi\u002Freference\u002Fcreate-signin-link",{"tag":83,"slug":213,"links":214},"exams",[215,218,221,224,227],{"title":216,"to":217,"method":133,"deprecated":134},"List the exams open for applications","\u002Fapi\u002Freference\u002Flist-exams",{"title":219,"to":220,"method":133,"deprecated":134},"List an organization’s exam categories","\u002Fapi\u002Freference\u002Flist-exam-categories",{"title":222,"to":223,"method":133,"deprecated":134},"Fetch one exam category","\u002Fapi\u002Freference\u002Fget-exam-category",{"title":225,"to":226,"method":133,"deprecated":134},"List the exams one of your students can apply to","\u002Fapi\u002Freference\u002Flist-available-exams",{"title":228,"to":229,"method":133,"deprecated":134},"Fetch one exam that is open for applications","\u002Fapi\u002Freference\u002Fget-exam",{"tag":86,"slug":231,"links":232},"applications",[233,236,239,242,245,248,251],{"title":234,"to":235,"method":133,"deprecated":134},"List your students’ applications in this organization","\u002Fapi\u002Freference\u002Flist-applications",{"title":237,"to":238,"method":141,"deprecated":134},"Enter one of your students for an exam","\u002Fapi\u002Freference\u002Fcreate-application",{"title":240,"to":241,"method":133,"deprecated":134},"List your students’ applications for one exam","\u002Fapi\u002Freference\u002Flist-exam-applications",{"title":243,"to":244,"method":133,"deprecated":134},"List one of your students’ applications in this organization","\u002Fapi\u002Freference\u002Flist-student-applications",{"title":246,"to":247,"method":133,"deprecated":134},"Fetch one of your students’ applications","\u002Fapi\u002Freference\u002Fget-application",{"title":249,"to":250,"method":190,"deprecated":134},"Move one of your students’ applications to another exam","\u002Fapi\u002Freference\u002Fmove-application",{"title":252,"to":253,"method":254,"deprecated":134},"Withdraw one of your students from an exam","\u002Fapi\u002Freference\u002Fdelete-application","DELETE",{"tag":256,"slug":257,"links":258},"Documents","documents",[259,262,265,268],{"title":260,"to":261,"method":133,"deprecated":134},"Download a certificate file","\u002Fapi\u002Freference\u002Fdownload-certificate",{"title":263,"to":264,"method":133,"deprecated":134},"List one of your students’ released certificates","\u002Fapi\u002Freference\u002Flist-student-certificates",{"title":266,"to":267,"method":133,"deprecated":134},"Download a result report file","\u002Fapi\u002Freference\u002Fdownload-report",{"title":269,"to":270,"method":133,"deprecated":134},"List one of your students’ released result reports","\u002Fapi\u002Freference\u002Flist-student-reports",{"tag":89,"slug":272,"links":273},"group-challenges",[274,277,280,283,286,289,292,295,298],{"title":275,"to":276,"method":133,"deprecated":134},"List the group challenges an organization runs","\u002Fapi\u002Freference\u002Flist-group-challenges",{"title":278,"to":279,"method":133,"deprecated":134},"Fetch one group challenge","\u002Fapi\u002Freference\u002Fget-group-challenge",{"title":281,"to":282,"method":133,"deprecated":134},"List the groups your students are in for a group challenge","\u002Fapi\u002Freference\u002Flist-group-challenge-groups",{"title":284,"to":285,"method":133,"deprecated":134},"Fetch one group, with its steps and files","\u002Fapi\u002Freference\u002Fget-group-challenge-group",{"title":287,"to":288,"method":133,"deprecated":134},"List what has happened in one group","\u002Fapi\u002Freference\u002Flist-group-challenge-activity",{"title":290,"to":291,"method":141,"deprecated":134},"Send a group’s finished work for one of your students","\u002Fapi\u002Freference\u002Fsubmit-group-challenge-work",{"title":293,"to":294,"method":141,"deprecated":134},"Submit one step of a group for one of your students","\u002Fapi\u002Freference\u002Fsubmit-group-challenge-step",{"title":296,"to":297,"method":133,"deprecated":134},"List your students’ eligibility and groups for a group challenge","\u002Fapi\u002Freference\u002Flist-group-challenge-students",{"title":299,"to":300,"method":133,"deprecated":134},"Fetch one of your students’ eligibility and group for a group challenge","\u002Fapi\u002Freference\u002Fget-group-challenge-student",{"id":302,"title":303,"links":304,"groups":316},"clients","Clients",[305,307,310,313],{"title":9,"to":306,"status":14},"\u002Fapi\u002Fclients",{"title":308,"to":309,"status":14},"Node.js","\u002Fapi\u002Fclients\u002Fnode",{"title":311,"to":312,"status":14},"PHP","\u002Fapi\u002Fclients\u002Fphp",{"title":314,"to":315,"status":14},"Build your own","\u002Fapi\u002Fclients\u002Fbuild-your-own",[],{"id":318,"title":319,"links":320,"groups":330},"agents","AI agents",[321,324,327],{"title":322,"to":323},"AI connections","\u002Fapi\u002Fmcp",{"title":325,"to":326},"What it can do","\u002Fapi\u002Fmcp\u002Ftools",{"title":328,"to":329},"Agent skills","\u002Fapi\u002Fskills",[],{"id":332,"title":333,"links":334,"groups":350},"help","Help",[335,338,341,344,347],{"title":336,"to":337,"status":14},"Glossary","\u002Fapi\u002Fglossary",{"title":339,"to":340,"status":14},"FAQ","\u002Fapi\u002Ffaq",{"title":342,"to":343,"status":14},"Troubleshooting","\u002Fapi\u002Ftroubleshooting",{"title":345,"to":346,"status":14},"Support","\u002Fapi\u002Fsupport",{"title":348,"to":349},"Changelog","\u002Fapi\u002Fchangelog",[],{"id":352,"title":12,"body":353,"description":3004,"extension":3005,"meta":3006,"navTitle":12,"navigation":738,"operations":3007,"order":3010,"path":13,"section":5,"seo":3011,"status":14,"stem":3012,"__hash__":3013},"apiGuides\u002Fapi\u002Fquickstart.md",{"type":354,"value":355,"toc":2985},"minimark",[356,360,384,395,400,403,489,504,523,533,537,540,599,605,609,615,671,676,680,697,895,921,924,939,1143,1165,1169,1172,1411,1415,1420,1456,1463,1529,1795,1798,1832,1848,1852,1874,1902,2154,2160,2163,2293,2428,2436,2440,2443,2468,2540,2554,2558,2569,2573,2638,2641,2710,2716,2720,2785,2788,2863,2869,2873,2945,2949,2981],[357,358,359],"p",{},"This page takes you from \"I have credentials\" to \"I have a working token and the ids I need for every other call\". You will:",[361,362,363,367,370,378],"ol",{},[364,365,366],"li",{},"Keep your credentials on your server.",[364,368,369],{},"Sign a token (Node.js, PHP or bash).",[364,371,372,373,377],{},"Call ",[374,375,376],"code",{},"GET \u002Fv1\u002Fapi-account\u002Fvalidate-me"," to prove the token works.",[364,379,372,380,383],{},[374,381,382],{},"GET \u002Fv1\u002Forganization"," to get the organization ids that every organization route needs.",[357,385,386,387,390,391,394],{},"Plan on about ten minutes. Every command below runs against production, ",[374,388,389],{},"https:\u002F\u002Fapi.main-team.org\u002Fv1",", so read ",[392,393,16],"a",{"href":17}," before you write any data.",[396,397,399],"h2",{"id":398},"before-you-start","Before you start",[357,401,402],{},"You need four things:",[404,405,406,422],"table",{},[407,408,409],"thead",{},[410,411,412,416,419],"tr",{},[413,414,415],"th",{},"You need",[413,417,418],{},"Why",[413,420,421],{},"Where it comes from",[423,424,425,440,453,478],"tbody",{},[410,426,427,434,437],{},[428,429,430,431],"td",{},"An ",[374,432,433],{},"apiKey",[428,435,436],{},"Names your account. It is not secret.",[428,438,439],{},"Issued by an operator, together with the secret",[410,441,442,447,450],{},[428,443,430,444],{},[374,445,446],{},"apiSecret",[428,448,449],{},"Signs your tokens. It is secret and shown to you only once.",[428,451,452],{},"Issued by an operator",[410,454,455,458,473],{},[428,456,457],{},"Roles on your account",[428,459,460,461,464,465,468,469,472],{},"Every route needs a permission. For this page you need ",[374,462,463],{},"api\u002F*"," and ",[374,466,467],{},"organization\u002Fread",", both on ",[374,470,471],{},"mto",".",[428,474,475,476],{},"Set by an operator. See ",[392,477,25],{"href":26},[410,479,480,483,486],{},[428,481,482],{},"A server with a correct clock",[428,484,485],{},"Tokens carry timestamps, and the API allows only 30 seconds of clock difference",[428,487,488],{},"NTP on your server",[357,490,491,492,499,500,503],{},"There is no public sign-up. Access is by arrangement: write to ",[493,494,495],"strong",{},[392,496,498],{"href":497},"mailto:info@main-team.org","info@main-team.org"," to request an account. Say which organizations you work with and what your integration will do, so the operator can give you the right roles from the start (the ready-made role profiles in ",[392,501,25],{"href":502},"\u002Fapi\u002Fpermissions#ready-made-role-profiles"," are a good way to ask).",[357,505,430,506,508,509,512,513,516,517,519,520,472],{},[374,507,433],{}," looks like ",[374,510,511],{},"key_7fQx2LmN9pRtVw3YzA1bC4dE",": ",[374,514,515],{},"key_"," followed by exactly 24 characters. An ",[374,518,446],{}," starts with ",[374,521,522],{},"secret_",[524,525,527],"callout",{"type":526},"security",[357,528,529,530,532],{},"The ",[374,531,446],{}," is shown once, when the account is created. It cannot be recovered later, and there is no way to change it on an existing account. Put it in your secret store straight away. Never commit it, never put it in a browser or mobile app, and never paste it into a website, including online JWT debuggers.",[396,534,536],{"id":535},"step-1-store-your-credentials","Step 1: Store your credentials",[357,538,539],{},"Keep both values in your server's environment or secret manager, never in source code. The examples on this page read them from two environment variables:",[541,542,547],"pre",{"className":543,"code":544,"language":545,"meta":546,"style":546},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","export MTO_API_KEY='key_7fQx2LmN9pRtVw3YzA1bC4dE'\nexport MTO_API_SECRET='secret_...'   # the full value, including the \"secret_\" prefix\nexport MTO_API_BASE='https:\u002F\u002Fapi.main-team.org\u002Fv1'\n","bash","",[374,548,549,569,586],{"__ignoreMap":546},[550,551,554,558,562,565],"span",{"class":552,"line":553},"line",1,[550,555,557],{"class":556},"sHUrx","export",[550,559,561],{"class":560},"suds8"," MTO_API_KEY",[550,563,564],{"class":556},"=",[550,566,568],{"class":567},"sT6z2","'key_7fQx2LmN9pRtVw3YzA1bC4dE'\n",[550,570,572,574,577,579,582],{"class":552,"line":571},2,[550,573,557],{"class":556},[550,575,576],{"class":560}," MTO_API_SECRET",[550,578,564],{"class":556},[550,580,581],{"class":567},"'secret_...'",[550,583,585],{"class":584},"sLBg1","   # the full value, including the \"secret_\" prefix\n",[550,587,589,591,594,596],{"class":552,"line":588},3,[550,590,557],{"class":556},[550,592,593],{"class":560}," MTO_API_BASE",[550,595,564],{"class":556},[550,597,598],{"class":567},"'https:\u002F\u002Fapi.main-team.org\u002Fv1'\n",[357,600,601,602,604],{},"Use the secret exactly as it was issued: the whole string, ",[374,603,522],{}," prefix included, with no trailing newline or spaces. If you read it from a file, trim the line ending. A secret with an extra newline signs tokens that the API refuses.",[396,606,608],{"id":607},"step-2-sign-a-token","Step 2: Sign a token",[357,610,611,612,614],{},"The API has no login endpoint. You sign your own short-lived token, a JSON Web Token (JWT), with your ",[374,613,446],{},", and send it as a bearer token. The token must have:",[616,617,618,635,647],"ul",{},[364,619,620,621,624,625,464,628,631,632,634],{},"the header ",[374,622,623],{},"alg"," set to ",[374,626,627],{},"HS256",[374,629,630],{},"kid"," set to your ",[374,633,433],{},",",[364,636,637,638,631,641,643,644,646],{},"the claim ",[374,639,640],{},"sub",[374,642,433],{}," (the same value as ",[374,645,630],{},"),",[364,648,649,650,653,654,657,658,661,662,664,665,668,669,472],{},"the claims ",[374,651,652],{},"iat"," (issued at) and ",[374,655,656],{},"exp"," (expires), both in ",[493,659,660],{},"seconds"," since the Unix epoch, with ",[374,663,656],{}," at most ",[493,666,667],{},"3600"," seconds after ",[374,670,652],{},[357,672,673,675],{},[392,674,19],{"href":20}," explains each rule, and has token caching and a full troubleshooting checklist. The shortest working versions are below.",[677,678,308],"h3",{"id":679},"nodejs",[541,681,683],{"className":543,"code":682,"language":545,"meta":546,"style":546},"npm install jsonwebtoken\n",[374,684,685],{"__ignoreMap":546},[550,686,687,691,694],{"class":552,"line":553},[550,688,690],{"class":689},"soyes","npm",[550,692,693],{"class":567}," install",[550,695,696],{"class":567}," jsonwebtoken\n",[541,698,702],{"className":699,"code":700,"language":701,"meta":546,"style":546},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u002F\u002F mint-token.js\nconst jwt = require('jsonwebtoken');\n\nconst apiKey = process.env.MTO_API_KEY;\nconst apiSecret = process.env.MTO_API_SECRET;\n\nconst iat = Math.floor(Date.now() \u002F 1000); \u002F\u002F seconds, not milliseconds\nconst token = jwt.sign(\n  { sub: apiKey, iat, exp: iat + 3600 },\n  apiSecret,\n  { algorithm: 'HS256', keyid: apiKey }, \u002F\u002F keyid becomes the \"kid\" header\n);\n\nconsole.log(token);\n","js",[374,703,704,709,734,740,759,776,781,818,837,852,858,873,878,883],{"__ignoreMap":546},[550,705,706],{"class":552,"line":553},[550,707,708],{"class":584},"\u002F\u002F mint-token.js\n",[550,710,711,714,718,721,725,728,731],{"class":552,"line":571},[550,712,713],{"class":556},"const",[550,715,717],{"class":716},"s-5SL"," jwt",[550,719,720],{"class":556}," =",[550,722,724],{"class":723},"sKwhi"," require",[550,726,727],{"class":560},"(",[550,729,730],{"class":567},"'jsonwebtoken'",[550,732,733],{"class":560},");\n",[550,735,736],{"class":552,"line":588},[550,737,739],{"emptyLinePlaceholder":738},true,"\n",[550,741,743,745,748,750,753,756],{"class":552,"line":742},4,[550,744,713],{"class":556},[550,746,747],{"class":716}," apiKey",[550,749,720],{"class":556},[550,751,752],{"class":560}," process.env.",[550,754,755],{"class":716},"MTO_API_KEY",[550,757,758],{"class":560},";\n",[550,760,762,764,767,769,771,774],{"class":552,"line":761},5,[550,763,713],{"class":556},[550,765,766],{"class":716}," apiSecret",[550,768,720],{"class":556},[550,770,752],{"class":560},[550,772,773],{"class":716},"MTO_API_SECRET",[550,775,758],{"class":560},[550,777,779],{"class":552,"line":778},6,[550,780,739],{"emptyLinePlaceholder":738},[550,782,784,786,789,791,794,797,800,803,806,809,812,815],{"class":552,"line":783},7,[550,785,713],{"class":556},[550,787,788],{"class":716}," iat",[550,790,720],{"class":556},[550,792,793],{"class":560}," Math.",[550,795,796],{"class":723},"floor",[550,798,799],{"class":560},"(Date.",[550,801,802],{"class":723},"now",[550,804,805],{"class":560},"() ",[550,807,808],{"class":556},"\u002F",[550,810,811],{"class":716}," 1000",[550,813,814],{"class":560},"); ",[550,816,817],{"class":584},"\u002F\u002F seconds, not milliseconds\n",[550,819,821,823,826,828,831,834],{"class":552,"line":820},8,[550,822,713],{"class":556},[550,824,825],{"class":716}," token",[550,827,720],{"class":556},[550,829,830],{"class":560}," jwt.",[550,832,833],{"class":723},"sign",[550,835,836],{"class":560},"(\n",[550,838,840,843,846,849],{"class":552,"line":839},9,[550,841,842],{"class":560},"  { sub: apiKey, iat, exp: iat ",[550,844,845],{"class":556},"+",[550,847,848],{"class":716}," 3600",[550,850,851],{"class":560}," },\n",[550,853,855],{"class":552,"line":854},10,[550,856,857],{"class":560},"  apiSecret,\n",[550,859,861,864,867,870],{"class":552,"line":860},11,[550,862,863],{"class":560},"  { algorithm: ",[550,865,866],{"class":567},"'HS256'",[550,868,869],{"class":560},", keyid: apiKey }, ",[550,871,872],{"class":584},"\u002F\u002F keyid becomes the \"kid\" header\n",[550,874,876],{"class":552,"line":875},12,[550,877,733],{"class":560},[550,879,881],{"class":552,"line":880},13,[550,882,739],{"emptyLinePlaceholder":738},[550,884,886,889,892],{"class":552,"line":885},14,[550,887,888],{"class":560},"console.",[550,890,891],{"class":723},"log",[550,893,894],{"class":560},"(token);\n",[541,896,898],{"className":543,"code":897,"language":545,"meta":546,"style":546},"export TOKEN=$(node mint-token.js)\n",[374,899,900],{"__ignoreMap":546},[550,901,902,904,907,909,912,915,918],{"class":552,"line":553},[550,903,557],{"class":556},[550,905,906],{"class":560}," TOKEN",[550,908,564],{"class":556},[550,910,911],{"class":560},"$(",[550,913,914],{"class":689},"node",[550,916,917],{"class":567}," mint-token.js",[550,919,920],{"class":560},")\n",[677,922,311],{"id":923},"php",[541,925,927],{"className":543,"code":926,"language":545,"meta":546,"style":546},"composer require firebase\u002Fphp-jwt\n",[374,928,929],{"__ignoreMap":546},[550,930,931,934,936],{"class":552,"line":553},[550,932,933],{"class":689},"composer",[550,935,724],{"class":567},[550,937,938],{"class":567}," firebase\u002Fphp-jwt\n",[541,940,943],{"className":941,"code":942,"language":923,"meta":546,"style":546},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\n\u002F\u002F mint-token.php\nrequire __DIR__ . '\u002Fvendor\u002Fautoload.php';\n\nuse Firebase\\JWT\\JWT;\n\n$apiKey = getenv('MTO_API_KEY');\n$apiSecret = getenv('MTO_API_SECRET');\n\n$iat = time();\n$token = JWT::encode(\n    ['sub' => $apiKey, 'iat' => $iat, 'exp' => $iat + 3600],\n    $apiSecret,\n    'HS256',\n    $apiKey \u002F\u002F the fourth argument becomes the \"kid\" header\n);\n\necho $token, PHP_EOL;\n",[374,944,945,953,958,974,978,988,992,1009,1025,1029,1042,1060,1097,1102,1110,1119,1124,1129],{"__ignoreMap":546},[550,946,947,950],{"class":552,"line":553},[550,948,949],{"class":556},"\u003C?",[550,951,952],{"class":716},"php\n",[550,954,955],{"class":552,"line":571},[550,956,957],{"class":584},"\u002F\u002F mint-token.php\n",[550,959,960,963,966,969,972],{"class":552,"line":588},[550,961,962],{"class":556},"require",[550,964,965],{"class":716}," __DIR__",[550,967,968],{"class":556}," .",[550,970,971],{"class":567}," '\u002Fvendor\u002Fautoload.php'",[550,973,758],{"class":560},[550,975,976],{"class":552,"line":742},[550,977,739],{"emptyLinePlaceholder":738},[550,979,980,983,986],{"class":552,"line":761},[550,981,982],{"class":556},"use",[550,984,985],{"class":716}," Firebase\\JWT\\JWT",[550,987,758],{"class":560},[550,989,990],{"class":552,"line":778},[550,991,739],{"emptyLinePlaceholder":738},[550,993,994,997,999,1002,1004,1007],{"class":552,"line":783},[550,995,996],{"class":560},"$apiKey ",[550,998,564],{"class":556},[550,1000,1001],{"class":716}," getenv",[550,1003,727],{"class":560},[550,1005,1006],{"class":567},"'MTO_API_KEY'",[550,1008,733],{"class":560},[550,1010,1011,1014,1016,1018,1020,1023],{"class":552,"line":820},[550,1012,1013],{"class":560},"$apiSecret ",[550,1015,564],{"class":556},[550,1017,1001],{"class":716},[550,1019,727],{"class":560},[550,1021,1022],{"class":567},"'MTO_API_SECRET'",[550,1024,733],{"class":560},[550,1026,1027],{"class":552,"line":839},[550,1028,739],{"emptyLinePlaceholder":738},[550,1030,1031,1034,1036,1039],{"class":552,"line":854},[550,1032,1033],{"class":560},"$iat ",[550,1035,564],{"class":556},[550,1037,1038],{"class":716}," time",[550,1040,1041],{"class":560},"();\n",[550,1043,1044,1047,1049,1052,1055,1058],{"class":552,"line":860},[550,1045,1046],{"class":560},"$token ",[550,1048,564],{"class":556},[550,1050,1051],{"class":716}," JWT",[550,1053,1054],{"class":556},"::",[550,1056,1057],{"class":723},"encode",[550,1059,836],{"class":560},[550,1061,1062,1065,1068,1071,1074,1077,1079,1082,1085,1087,1090,1092,1094],{"class":552,"line":875},[550,1063,1064],{"class":560},"    [",[550,1066,1067],{"class":567},"'sub'",[550,1069,1070],{"class":556}," =>",[550,1072,1073],{"class":560}," $apiKey, ",[550,1075,1076],{"class":567},"'iat'",[550,1078,1070],{"class":556},[550,1080,1081],{"class":560}," $iat, ",[550,1083,1084],{"class":567},"'exp'",[550,1086,1070],{"class":556},[550,1088,1089],{"class":560}," $iat ",[550,1091,845],{"class":556},[550,1093,848],{"class":716},[550,1095,1096],{"class":560},"],\n",[550,1098,1099],{"class":552,"line":880},[550,1100,1101],{"class":560},"    $apiSecret,\n",[550,1103,1104,1107],{"class":552,"line":885},[550,1105,1106],{"class":567},"    'HS256'",[550,1108,1109],{"class":560},",\n",[550,1111,1113,1116],{"class":552,"line":1112},15,[550,1114,1115],{"class":560},"    $apiKey ",[550,1117,1118],{"class":584},"\u002F\u002F the fourth argument becomes the \"kid\" header\n",[550,1120,1122],{"class":552,"line":1121},16,[550,1123,733],{"class":560},[550,1125,1127],{"class":552,"line":1126},17,[550,1128,739],{"emptyLinePlaceholder":738},[550,1130,1132,1135,1138,1141],{"class":552,"line":1131},18,[550,1133,1134],{"class":716},"echo",[550,1136,1137],{"class":560}," $token, ",[550,1139,1140],{"class":716},"PHP_EOL",[550,1142,758],{"class":560},[541,1144,1146],{"className":543,"code":1145,"language":545,"meta":546,"style":546},"export TOKEN=$(php mint-token.php)\n",[374,1147,1148],{"__ignoreMap":546},[550,1149,1150,1152,1154,1156,1158,1160,1163],{"class":552,"line":553},[550,1151,557],{"class":556},[550,1153,906],{"class":560},[550,1155,564],{"class":556},[550,1157,911],{"class":560},[550,1159,923],{"class":689},[550,1161,1162],{"class":567}," mint-token.php",[550,1164,920],{"class":560},[677,1166,1168],{"id":1167},"bash-and-openssl","bash and openssl",[357,1170,1171],{},"This is handy for a first test from a terminal. For production code, use a JWT library.",[541,1173,1175],{"className":543,"code":1174,"language":545,"meta":546,"style":546},"b64url() { openssl base64 -e -A | tr '+\u002F' '-_' | tr -d '='; }\n\nnow=$(date +%s)\nheader=$(printf '{\"alg\":\"HS256\",\"typ\":\"JWT\",\"kid\":\"%s\"}' \"$MTO_API_KEY\" | b64url)\npayload=$(printf '{\"sub\":\"%s\",\"iat\":%d,\"exp\":%d}' \"$MTO_API_KEY\" \"$now\" \"$((now + 3600))\" | b64url)\nsignature=$(printf '%s.%s' \"$header\" \"$payload\" \\\n  | openssl dgst -sha256 -hmac \"$MTO_API_SECRET\" -binary | b64url)\n\nexport TOKEN=\"$header.$payload.$signature\"\n",[374,1176,1177,1222,1226,1242,1273,1319,1350,1383,1387],{"__ignoreMap":546},[550,1178,1179,1182,1185,1188,1191,1194,1197,1200,1203,1206,1209,1211,1213,1216,1219],{"class":552,"line":553},[550,1180,1181],{"class":723},"b64url",[550,1183,1184],{"class":560},"() { ",[550,1186,1187],{"class":689},"openssl",[550,1189,1190],{"class":567}," base64",[550,1192,1193],{"class":716}," -e",[550,1195,1196],{"class":716}," -A",[550,1198,1199],{"class":556}," |",[550,1201,1202],{"class":689}," tr",[550,1204,1205],{"class":567}," '+\u002F'",[550,1207,1208],{"class":567}," '-_'",[550,1210,1199],{"class":556},[550,1212,1202],{"class":689},[550,1214,1215],{"class":716}," -d",[550,1217,1218],{"class":567}," '='",[550,1220,1221],{"class":560},"; }\n",[550,1223,1224],{"class":552,"line":571},[550,1225,739],{"emptyLinePlaceholder":738},[550,1227,1228,1230,1232,1234,1237,1240],{"class":552,"line":588},[550,1229,802],{"class":560},[550,1231,564],{"class":556},[550,1233,911],{"class":560},[550,1235,1236],{"class":689},"date",[550,1238,1239],{"class":567}," +%s",[550,1241,920],{"class":560},[550,1243,1244,1247,1249,1251,1254,1257,1260,1263,1266,1268,1271],{"class":552,"line":742},[550,1245,1246],{"class":560},"header",[550,1248,564],{"class":556},[550,1250,911],{"class":560},[550,1252,1253],{"class":716},"printf",[550,1255,1256],{"class":567}," '{\"alg\":\"HS256\",\"typ\":\"JWT\",\"kid\":\"%s\"}'",[550,1258,1259],{"class":567}," \"",[550,1261,1262],{"class":560},"$MTO_API_KEY",[550,1264,1265],{"class":567},"\"",[550,1267,1199],{"class":556},[550,1269,1270],{"class":689}," b64url",[550,1272,920],{"class":560},[550,1274,1275,1278,1280,1282,1284,1287,1289,1291,1293,1295,1298,1300,1303,1305,1308,1310,1313,1315,1317],{"class":552,"line":761},[550,1276,1277],{"class":560},"payload",[550,1279,564],{"class":556},[550,1281,911],{"class":560},[550,1283,1253],{"class":716},[550,1285,1286],{"class":567}," '{\"sub\":\"%s\",\"iat\":%d,\"exp\":%d}'",[550,1288,1259],{"class":567},[550,1290,1262],{"class":560},[550,1292,1265],{"class":567},[550,1294,1259],{"class":567},[550,1296,1297],{"class":560},"$now",[550,1299,1265],{"class":567},[550,1301,1302],{"class":567}," \"$((",[550,1304,802],{"class":689},[550,1306,1307],{"class":567}," + ",[550,1309,667],{"class":716},[550,1311,1312],{"class":567},"))\"",[550,1314,1199],{"class":556},[550,1316,1270],{"class":689},[550,1318,920],{"class":560},[550,1320,1321,1324,1326,1328,1330,1333,1335,1338,1340,1342,1345,1347],{"class":552,"line":778},[550,1322,1323],{"class":560},"signature",[550,1325,564],{"class":556},[550,1327,911],{"class":560},[550,1329,1253],{"class":716},[550,1331,1332],{"class":567}," '%s.%s'",[550,1334,1259],{"class":567},[550,1336,1337],{"class":560},"$header",[550,1339,1265],{"class":567},[550,1341,1259],{"class":567},[550,1343,1344],{"class":560},"$payload",[550,1346,1265],{"class":567},[550,1348,1349],{"class":556}," \\\n",[550,1351,1352,1355,1358,1361,1364,1367,1369,1372,1374,1377,1379,1381],{"class":552,"line":783},[550,1353,1354],{"class":556},"  |",[550,1356,1357],{"class":689}," openssl",[550,1359,1360],{"class":567}," dgst",[550,1362,1363],{"class":716}," -sha256",[550,1365,1366],{"class":716}," -hmac",[550,1368,1259],{"class":567},[550,1370,1371],{"class":560},"$MTO_API_SECRET",[550,1373,1265],{"class":567},[550,1375,1376],{"class":716}," -binary",[550,1378,1199],{"class":556},[550,1380,1270],{"class":689},[550,1382,920],{"class":560},[550,1384,1385],{"class":552,"line":820},[550,1386,739],{"emptyLinePlaceholder":738},[550,1388,1389,1391,1393,1395,1397,1399,1401,1403,1405,1408],{"class":552,"line":839},[550,1390,557],{"class":556},[550,1392,906],{"class":560},[550,1394,564],{"class":556},[550,1396,1265],{"class":567},[550,1398,1337],{"class":560},[550,1400,472],{"class":567},[550,1402,1344],{"class":560},[550,1404,472],{"class":567},[550,1406,1407],{"class":560},"$signature",[550,1409,1410],{"class":567},"\"\n",[396,1412,1414],{"id":1413},"step-3-check-your-token-with-validate-me","Step 3: Check your token with validate-me",[357,1416,1417,1419],{},[374,1418,376],{}," returns the account your token belongs to. It is the simplest way to prove that your key, your secret, your signing code and your clock all work.",[541,1421,1423],{"className":543,"code":1422,"language":545,"meta":546,"style":546},"curl -i \"$MTO_API_BASE\u002Fapi-account\u002Fvalidate-me\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[374,1424,1425,1443],{"__ignoreMap":546},[550,1426,1427,1430,1433,1435,1438,1441],{"class":552,"line":553},[550,1428,1429],{"class":689},"curl",[550,1431,1432],{"class":716}," -i",[550,1434,1259],{"class":567},[550,1436,1437],{"class":560},"$MTO_API_BASE",[550,1439,1440],{"class":567},"\u002Fapi-account\u002Fvalidate-me\"",[550,1442,1349],{"class":556},[550,1444,1445,1448,1451,1454],{"class":552,"line":571},[550,1446,1447],{"class":716},"  -H",[550,1449,1450],{"class":567}," \"Authorization: Bearer ",[550,1452,1453],{"class":560},"$TOKEN",[550,1455,1410],{"class":567},[357,1457,1458,1459,1462],{},"A working token gets ",[374,1460,1461],{},"200",":",[541,1464,1468],{"className":1465,"code":1466,"language":1467,"meta":546,"style":546},"language-http shiki shiki-themes github-light-high-contrast github-dark-high-contrast","HTTP\u002F2 200\ncontent-type: application\u002Fjson; charset=utf-8\nx-request-id: 3f2a9c1e-6b7d-4e8f-9a0b-1c2d3e4f5a6b\nx-ratelimit-limit: 100\nx-ratelimit-remaining: 99\nx-ratelimit-reset: 60\n","http",[374,1469,1470,1478,1489,1499,1509,1519],{"__ignoreMap":546},[550,1471,1472,1475],{"class":552,"line":553},[550,1473,1474],{"class":560},"HTTP\u002F2 ",[550,1476,1477],{"class":716},"200\n",[550,1479,1480,1484,1486],{"class":552,"line":571},[550,1481,1483],{"class":1482},"sne4z","content-type",[550,1485,1462],{"class":556},[550,1487,1488],{"class":567}," application\u002Fjson; charset=utf-8\n",[550,1490,1491,1494,1496],{"class":552,"line":588},[550,1492,1493],{"class":1482},"x-request-id",[550,1495,1462],{"class":556},[550,1497,1498],{"class":567}," 3f2a9c1e-6b7d-4e8f-9a0b-1c2d3e4f5a6b\n",[550,1500,1501,1504,1506],{"class":552,"line":742},[550,1502,1503],{"class":1482},"x-ratelimit-limit",[550,1505,1462],{"class":556},[550,1507,1508],{"class":567}," 100\n",[550,1510,1511,1514,1516],{"class":552,"line":761},[550,1512,1513],{"class":1482},"x-ratelimit-remaining",[550,1515,1462],{"class":556},[550,1517,1518],{"class":567}," 99\n",[550,1520,1521,1524,1526],{"class":552,"line":778},[550,1522,1523],{"class":1482},"x-ratelimit-reset",[550,1525,1462],{"class":556},[550,1527,1528],{"class":567}," 60\n",[541,1530,1534],{"className":1531,"code":1532,"language":1533,"meta":546,"style":546},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"_id\": \"66f1a2b3c4d5e6f7a8b9c0d1\",\n  \"apiKey\": \"key_7fQx2LmN9pRtVw3YzA1bC4dE\",\n  \"companyName\": \"Northwind Learning Ltd\",\n  \"scopes\": [],\n  \"roles\": [\n    { \"effect\": \"allow\", \"action\": \"api\u002F*\", \"target\": \"mto\" },\n    { \"effect\": \"allow\", \"action\": \"*\u002Fread\", \"target\": \"mto\" },\n    { \"effect\": \"allow\", \"action\": \"student\u002F*\", \"target\": \"mto\" },\n    { \"effect\": \"allow\", \"action\": \"*\u002Fread\", \"target\": \"stem\" },\n    { \"effect\": \"allow\", \"action\": \"application\u002F*\", \"target\": \"stem\" },\n    { \"effect\": \"allow\", \"action\": \"auth\u002Fsignin\", \"target\": \"stem\" }\n  ],\n  \"isActive\": true\n}\n","json",[374,1535,1536,1541,1553,1565,1577,1585,1593,1629,1658,1687,1716,1745,1775,1780,1790],{"__ignoreMap":546},[550,1537,1538],{"class":552,"line":553},[550,1539,1540],{"class":560},"{\n",[550,1542,1543,1546,1548,1551],{"class":552,"line":571},[550,1544,1545],{"class":1482},"  \"_id\"",[550,1547,512],{"class":560},[550,1549,1550],{"class":567},"\"66f1a2b3c4d5e6f7a8b9c0d1\"",[550,1552,1109],{"class":560},[550,1554,1555,1558,1560,1563],{"class":552,"line":588},[550,1556,1557],{"class":1482},"  \"apiKey\"",[550,1559,512],{"class":560},[550,1561,1562],{"class":567},"\"key_7fQx2LmN9pRtVw3YzA1bC4dE\"",[550,1564,1109],{"class":560},[550,1566,1567,1570,1572,1575],{"class":552,"line":742},[550,1568,1569],{"class":1482},"  \"companyName\"",[550,1571,512],{"class":560},[550,1573,1574],{"class":567},"\"Northwind Learning Ltd\"",[550,1576,1109],{"class":560},[550,1578,1579,1582],{"class":552,"line":761},[550,1580,1581],{"class":1482},"  \"scopes\"",[550,1583,1584],{"class":560},": [],\n",[550,1586,1587,1590],{"class":552,"line":778},[550,1588,1589],{"class":1482},"  \"roles\"",[550,1591,1592],{"class":560},": [\n",[550,1594,1595,1598,1601,1603,1606,1609,1612,1614,1617,1619,1622,1624,1627],{"class":552,"line":783},[550,1596,1597],{"class":560},"    { ",[550,1599,1600],{"class":1482},"\"effect\"",[550,1602,512],{"class":560},[550,1604,1605],{"class":567},"\"allow\"",[550,1607,1608],{"class":560},", ",[550,1610,1611],{"class":1482},"\"action\"",[550,1613,512],{"class":560},[550,1615,1616],{"class":567},"\"api\u002F*\"",[550,1618,1608],{"class":560},[550,1620,1621],{"class":1482},"\"target\"",[550,1623,512],{"class":560},[550,1625,1626],{"class":567},"\"mto\"",[550,1628,851],{"class":560},[550,1630,1631,1633,1635,1637,1639,1641,1643,1645,1648,1650,1652,1654,1656],{"class":552,"line":820},[550,1632,1597],{"class":560},[550,1634,1600],{"class":1482},[550,1636,512],{"class":560},[550,1638,1605],{"class":567},[550,1640,1608],{"class":560},[550,1642,1611],{"class":1482},[550,1644,512],{"class":560},[550,1646,1647],{"class":567},"\"*\u002Fread\"",[550,1649,1608],{"class":560},[550,1651,1621],{"class":1482},[550,1653,512],{"class":560},[550,1655,1626],{"class":567},[550,1657,851],{"class":560},[550,1659,1660,1662,1664,1666,1668,1670,1672,1674,1677,1679,1681,1683,1685],{"class":552,"line":839},[550,1661,1597],{"class":560},[550,1663,1600],{"class":1482},[550,1665,512],{"class":560},[550,1667,1605],{"class":567},[550,1669,1608],{"class":560},[550,1671,1611],{"class":1482},[550,1673,512],{"class":560},[550,1675,1676],{"class":567},"\"student\u002F*\"",[550,1678,1608],{"class":560},[550,1680,1621],{"class":1482},[550,1682,512],{"class":560},[550,1684,1626],{"class":567},[550,1686,851],{"class":560},[550,1688,1689,1691,1693,1695,1697,1699,1701,1703,1705,1707,1709,1711,1714],{"class":552,"line":854},[550,1690,1597],{"class":560},[550,1692,1600],{"class":1482},[550,1694,512],{"class":560},[550,1696,1605],{"class":567},[550,1698,1608],{"class":560},[550,1700,1611],{"class":1482},[550,1702,512],{"class":560},[550,1704,1647],{"class":567},[550,1706,1608],{"class":560},[550,1708,1621],{"class":1482},[550,1710,512],{"class":560},[550,1712,1713],{"class":567},"\"stem\"",[550,1715,851],{"class":560},[550,1717,1718,1720,1722,1724,1726,1728,1730,1732,1735,1737,1739,1741,1743],{"class":552,"line":860},[550,1719,1597],{"class":560},[550,1721,1600],{"class":1482},[550,1723,512],{"class":560},[550,1725,1605],{"class":567},[550,1727,1608],{"class":560},[550,1729,1611],{"class":1482},[550,1731,512],{"class":560},[550,1733,1734],{"class":567},"\"application\u002F*\"",[550,1736,1608],{"class":560},[550,1738,1621],{"class":1482},[550,1740,512],{"class":560},[550,1742,1713],{"class":567},[550,1744,851],{"class":560},[550,1746,1747,1749,1751,1753,1755,1757,1759,1761,1764,1766,1768,1770,1772],{"class":552,"line":875},[550,1748,1597],{"class":560},[550,1750,1600],{"class":1482},[550,1752,512],{"class":560},[550,1754,1605],{"class":567},[550,1756,1608],{"class":560},[550,1758,1611],{"class":1482},[550,1760,512],{"class":560},[550,1762,1763],{"class":567},"\"auth\u002Fsignin\"",[550,1765,1608],{"class":560},[550,1767,1621],{"class":1482},[550,1769,512],{"class":560},[550,1771,1713],{"class":567},[550,1773,1774],{"class":560}," }\n",[550,1776,1777],{"class":552,"line":880},[550,1778,1779],{"class":560},"  ],\n",[550,1781,1782,1785,1787],{"class":552,"line":885},[550,1783,1784],{"class":1482},"  \"isActive\"",[550,1786,512],{"class":560},[550,1788,1789],{"class":716},"true\n",[550,1791,1792],{"class":552,"line":1112},[550,1793,1794],{"class":560},"}\n",[357,1796,1797],{},"Two things to notice:",[616,1799,1800,1816],{},[364,1801,1802,1805,1806,1809,1810,1813,1814,472],{},[493,1803,1804],{},"This response has no envelope."," ",[374,1807,1808],{},"validate-me"," is the one JSON route that returns the object on its own. Every other JSON route wraps its payload in ",[374,1811,1812],{},"{ \"success\", \"message\", \"data\" }",", which you will see in the next step. See ",[392,1815,33],{"href":34},[364,1817,1818,1824,1825,1828,1829,1831],{},[493,1819,1820,1823],{},[374,1821,1822],{},"roles"," is your permission list."," Read it now. If a later call answers ",[374,1826,1827],{},"403",", this list is where you find out why. ",[392,1830,25],{"href":26}," explains how to read it.",[357,1833,529,1834,1837,1838,1840,1841,1844,1845,472],{},[374,1835,1836],{},"X-Request-Id"," header is on every response, successful or not. Keep it in your logs: if you contact support, it is the value that lets us find your request. Treat it as an opaque string. You can also send your own ",[374,1839,1836],{}," (letters, digits and ",[374,1842,1843],{},"._:;=+\u002F@-",", at most 256 characters), and the API will use it. See ",[392,1846,16],{"href":1847},"\u002Fapi\u002Fenvironments#response-headers-to-know",[396,1849,1851],{"id":1850},"step-4-get-your-organization-ids","Step 4: Get your organization ids",[357,1853,1854,1855,1858,1859,1862,1863,1865,1866,1869,1870,1873],{},"Most routes act on one organization and take its id in the path: ",[374,1856,1857],{},"\u002Fv1\u002F{organizationId}\u002F...",". That id is the organization's ",[374,1860,1861],{},"_id"," from ",[374,1864,382],{},". ",[493,1867,1868],{},"It is never the slug",", so ",[374,1871,1872],{},"\u002Fv1\u002Fstem\u002Fexam"," does not work.",[541,1875,1877],{"className":543,"code":1876,"language":545,"meta":546,"style":546},"curl \"$MTO_API_BASE\u002Forganization\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[374,1878,1879,1892],{"__ignoreMap":546},[550,1880,1881,1883,1885,1887,1890],{"class":552,"line":553},[550,1882,1429],{"class":689},[550,1884,1259],{"class":567},[550,1886,1437],{"class":560},[550,1888,1889],{"class":567},"\u002Forganization\"",[550,1891,1349],{"class":556},[550,1893,1894,1896,1898,1900],{"class":552,"line":571},[550,1895,1447],{"class":716},[550,1897,1450],{"class":567},[550,1899,1453],{"class":560},[550,1901,1410],{"class":567},[541,1903,1905],{"className":1531,"code":1904,"language":1533,"meta":546,"style":546},"{\n  \"success\": true,\n  \"message\": \"Organizations fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"64b7f0c2a1e4d5f6a7b8c9d1\",\n      \"name\": \"STEM Olympiad\",\n      \"slug\": \"stem\",\n      \"logo\": \"https:\u002F\u002Fexample.org\u002Flogos\u002Fstem.png\",\n      \"desc\": \"International STEM olympiad.\",\n      \"defaultRedirect\": \"https:\u002F\u002Fmy.example-stem.org\"\n    },\n    {\n      \"_id\": \"64b7f0c2a1e4d5f6a7b8c9d2\",\n      \"name\": \"Hi-Lingua\",\n      \"slug\": \"hilingua\",\n      \"logo\": \"https:\u002F\u002Fexample.org\u002Flogos\u002Fhilingua.png\",\n      \"desc\": \"International language olympiad.\",\n      \"defaultRedirect\": \"https:\u002F\u002Fmy.example-hilingua.org\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 20, \"total\": 5, \"totalPages\": 1 }\n}\n",[374,1906,1907,1911,1923,1935,1942,1947,1959,1971,1982,1994,2006,2016,2021,2025,2036,2047,2058,2069,2080,2090,2096,2101,2149],{"__ignoreMap":546},[550,1908,1909],{"class":552,"line":553},[550,1910,1540],{"class":560},[550,1912,1913,1916,1918,1921],{"class":552,"line":571},[550,1914,1915],{"class":1482},"  \"success\"",[550,1917,512],{"class":560},[550,1919,1920],{"class":716},"true",[550,1922,1109],{"class":560},[550,1924,1925,1928,1930,1933],{"class":552,"line":588},[550,1926,1927],{"class":1482},"  \"message\"",[550,1929,512],{"class":560},[550,1931,1932],{"class":567},"\"Organizations fetched successfully.\"",[550,1934,1109],{"class":560},[550,1936,1937,1940],{"class":552,"line":742},[550,1938,1939],{"class":1482},"  \"data\"",[550,1941,1592],{"class":560},[550,1943,1944],{"class":552,"line":761},[550,1945,1946],{"class":560},"    {\n",[550,1948,1949,1952,1954,1957],{"class":552,"line":778},[550,1950,1951],{"class":1482},"      \"_id\"",[550,1953,512],{"class":560},[550,1955,1956],{"class":567},"\"64b7f0c2a1e4d5f6a7b8c9d1\"",[550,1958,1109],{"class":560},[550,1960,1961,1964,1966,1969],{"class":552,"line":783},[550,1962,1963],{"class":1482},"      \"name\"",[550,1965,512],{"class":560},[550,1967,1968],{"class":567},"\"STEM Olympiad\"",[550,1970,1109],{"class":560},[550,1972,1973,1976,1978,1980],{"class":552,"line":820},[550,1974,1975],{"class":1482},"      \"slug\"",[550,1977,512],{"class":560},[550,1979,1713],{"class":567},[550,1981,1109],{"class":560},[550,1983,1984,1987,1989,1992],{"class":552,"line":839},[550,1985,1986],{"class":1482},"      \"logo\"",[550,1988,512],{"class":560},[550,1990,1991],{"class":567},"\"https:\u002F\u002Fexample.org\u002Flogos\u002Fstem.png\"",[550,1993,1109],{"class":560},[550,1995,1996,1999,2001,2004],{"class":552,"line":854},[550,1997,1998],{"class":1482},"      \"desc\"",[550,2000,512],{"class":560},[550,2002,2003],{"class":567},"\"International STEM olympiad.\"",[550,2005,1109],{"class":560},[550,2007,2008,2011,2013],{"class":552,"line":860},[550,2009,2010],{"class":1482},"      \"defaultRedirect\"",[550,2012,512],{"class":560},[550,2014,2015],{"class":567},"\"https:\u002F\u002Fmy.example-stem.org\"\n",[550,2017,2018],{"class":552,"line":875},[550,2019,2020],{"class":560},"    },\n",[550,2022,2023],{"class":552,"line":880},[550,2024,1946],{"class":560},[550,2026,2027,2029,2031,2034],{"class":552,"line":885},[550,2028,1951],{"class":1482},[550,2030,512],{"class":560},[550,2032,2033],{"class":567},"\"64b7f0c2a1e4d5f6a7b8c9d2\"",[550,2035,1109],{"class":560},[550,2037,2038,2040,2042,2045],{"class":552,"line":1112},[550,2039,1963],{"class":1482},[550,2041,512],{"class":560},[550,2043,2044],{"class":567},"\"Hi-Lingua\"",[550,2046,1109],{"class":560},[550,2048,2049,2051,2053,2056],{"class":552,"line":1121},[550,2050,1975],{"class":1482},[550,2052,512],{"class":560},[550,2054,2055],{"class":567},"\"hilingua\"",[550,2057,1109],{"class":560},[550,2059,2060,2062,2064,2067],{"class":552,"line":1126},[550,2061,1986],{"class":1482},[550,2063,512],{"class":560},[550,2065,2066],{"class":567},"\"https:\u002F\u002Fexample.org\u002Flogos\u002Fhilingua.png\"",[550,2068,1109],{"class":560},[550,2070,2071,2073,2075,2078],{"class":552,"line":1131},[550,2072,1998],{"class":1482},[550,2074,512],{"class":560},[550,2076,2077],{"class":567},"\"International language olympiad.\"",[550,2079,1109],{"class":560},[550,2081,2083,2085,2087],{"class":552,"line":2082},19,[550,2084,2010],{"class":1482},[550,2086,512],{"class":560},[550,2088,2089],{"class":567},"\"https:\u002F\u002Fmy.example-hilingua.org\"\n",[550,2091,2093],{"class":552,"line":2092},20,[550,2094,2095],{"class":560},"    }\n",[550,2097,2099],{"class":552,"line":2098},21,[550,2100,1779],{"class":560},[550,2102,2104,2107,2110,2113,2115,2118,2120,2123,2125,2128,2130,2133,2135,2138,2140,2143,2145,2147],{"class":552,"line":2103},22,[550,2105,2106],{"class":1482},"  \"pagination\"",[550,2108,2109],{"class":560},": { ",[550,2111,2112],{"class":1482},"\"page\"",[550,2114,512],{"class":560},[550,2116,2117],{"class":716},"1",[550,2119,1608],{"class":560},[550,2121,2122],{"class":1482},"\"limit\"",[550,2124,512],{"class":560},[550,2126,2127],{"class":716},"20",[550,2129,1608],{"class":560},[550,2131,2132],{"class":1482},"\"total\"",[550,2134,512],{"class":560},[550,2136,2137],{"class":716},"5",[550,2139,1608],{"class":560},[550,2141,2142],{"class":1482},"\"totalPages\"",[550,2144,512],{"class":560},[550,2146,2117],{"class":716},[550,2148,1774],{"class":560},[550,2150,2152],{"class":552,"line":2151},23,[550,2153,1794],{"class":560},[357,2155,2156,2157,2159],{},"(Example data, shortened to two of the five organizations. ",[374,2158,471],{},", the core record, is not listed:\nthe routes without an organization id act on it.)",[357,2161,2162],{},"Build a slug-to-id map once and keep it. Organizations rarely change, so caching the map for a day is fine. The list is not filtered by your roles, so it can include organizations you cannot act on; use the ones you agreed with the operator.",[541,2164,2166],{"className":699,"code":2165,"language":701,"meta":546,"style":546},"const res = await fetch(`${process.env.MTO_API_BASE}\u002Forganization?limit=100`, {\n  headers: { Authorization: `Bearer ${token}` },\n});\nconst { data } = await res.json();\nconst orgIds = Object.fromEntries(data.map((o) => [o.slug, o._id]));\n\u002F\u002F orgIds.stem === '64b7f0c2a1e4d5f6a7b8c9d1'\n",[374,2167,2168,2207,2223,2228,2252,2288],{"__ignoreMap":546},[550,2169,2170,2172,2175,2177,2180,2183,2185,2188,2191,2193,2196,2198,2201,2204],{"class":552,"line":553},[550,2171,713],{"class":556},[550,2173,2174],{"class":716}," res",[550,2176,720],{"class":556},[550,2178,2179],{"class":556}," await",[550,2181,2182],{"class":723}," fetch",[550,2184,727],{"class":560},[550,2186,2187],{"class":567},"`${",[550,2189,2190],{"class":560},"process",[550,2192,472],{"class":567},[550,2194,2195],{"class":560},"env",[550,2197,472],{"class":567},[550,2199,2200],{"class":716},"MTO_API_BASE",[550,2202,2203],{"class":567},"}\u002Forganization?limit=100`",[550,2205,2206],{"class":560},", {\n",[550,2208,2209,2212,2215,2218,2221],{"class":552,"line":571},[550,2210,2211],{"class":560},"  headers: { Authorization: ",[550,2213,2214],{"class":567},"`Bearer ${",[550,2216,2217],{"class":560},"token",[550,2219,2220],{"class":567},"}`",[550,2222,851],{"class":560},[550,2224,2225],{"class":552,"line":588},[550,2226,2227],{"class":560},"});\n",[550,2229,2230,2232,2235,2238,2241,2243,2245,2248,2250],{"class":552,"line":742},[550,2231,713],{"class":556},[550,2233,2234],{"class":560}," { ",[550,2236,2237],{"class":716},"data",[550,2239,2240],{"class":560}," } ",[550,2242,564],{"class":556},[550,2244,2179],{"class":556},[550,2246,2247],{"class":560}," res.",[550,2249,1533],{"class":723},[550,2251,1041],{"class":560},[550,2253,2254,2256,2259,2261,2264,2267,2270,2273,2276,2279,2282,2285],{"class":552,"line":761},[550,2255,713],{"class":556},[550,2257,2258],{"class":716}," orgIds",[550,2260,720],{"class":556},[550,2262,2263],{"class":560}," Object.",[550,2265,2266],{"class":723},"fromEntries",[550,2268,2269],{"class":560},"(data.",[550,2271,2272],{"class":723},"map",[550,2274,2275],{"class":560},"((",[550,2277,2278],{"class":689},"o",[550,2280,2281],{"class":560},") ",[550,2283,2284],{"class":556},"=>",[550,2286,2287],{"class":560}," [o.slug, o._id]));\n",[550,2289,2290],{"class":552,"line":778},[550,2291,2292],{"class":584},"\u002F\u002F orgIds.stem === '64b7f0c2a1e4d5f6a7b8c9d1'\n",[541,2294,2296],{"className":941,"code":2295,"language":923,"meta":546,"style":546},"$ch = curl_init(getenv('MTO_API_BASE') . '\u002Forganization?limit=100');\ncurl_setopt_array($ch, [\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_HTTPHEADER => [\"Authorization: Bearer $token\"],\n]);\n$body = json_decode(curl_exec($ch), true);\n$orgIds = array_column($body['data'], '_id', 'slug');\n\u002F\u002F $orgIds['stem'] === '64b7f0c2a1e4d5f6a7b8c9d1'\n",[374,2297,2298,2327,2335,2347,2367,2372,2394,2423],{"__ignoreMap":546},[550,2299,2300,2303,2305,2308,2310,2313,2315,2318,2320,2322,2325],{"class":552,"line":553},[550,2301,2302],{"class":560},"$ch ",[550,2304,564],{"class":556},[550,2306,2307],{"class":716}," curl_init",[550,2309,727],{"class":560},[550,2311,2312],{"class":716},"getenv",[550,2314,727],{"class":560},[550,2316,2317],{"class":567},"'MTO_API_BASE'",[550,2319,2281],{"class":560},[550,2321,472],{"class":556},[550,2323,2324],{"class":567}," '\u002Forganization?limit=100'",[550,2326,733],{"class":560},[550,2328,2329,2332],{"class":552,"line":571},[550,2330,2331],{"class":716},"curl_setopt_array",[550,2333,2334],{"class":560},"($ch, [\n",[550,2336,2337,2340,2342,2345],{"class":552,"line":588},[550,2338,2339],{"class":716},"    CURLOPT_RETURNTRANSFER",[550,2341,1070],{"class":556},[550,2343,2344],{"class":716}," true",[550,2346,1109],{"class":560},[550,2348,2349,2352,2354,2357,2360,2363,2365],{"class":552,"line":742},[550,2350,2351],{"class":716},"    CURLOPT_HTTPHEADER",[550,2353,1070],{"class":556},[550,2355,2356],{"class":560}," [",[550,2358,2359],{"class":567},"\"Authorization: Bearer ",[550,2361,2362],{"class":560},"$token",[550,2364,1265],{"class":567},[550,2366,1096],{"class":560},[550,2368,2369],{"class":552,"line":761},[550,2370,2371],{"class":560},"]);\n",[550,2373,2374,2377,2379,2382,2384,2387,2390,2392],{"class":552,"line":778},[550,2375,2376],{"class":560},"$body ",[550,2378,564],{"class":556},[550,2380,2381],{"class":716}," json_decode",[550,2383,727],{"class":560},[550,2385,2386],{"class":716},"curl_exec",[550,2388,2389],{"class":560},"($ch), ",[550,2391,1920],{"class":716},[550,2393,733],{"class":560},[550,2395,2396,2399,2401,2404,2407,2410,2413,2416,2418,2421],{"class":552,"line":783},[550,2397,2398],{"class":560},"$orgIds ",[550,2400,564],{"class":556},[550,2402,2403],{"class":716}," array_column",[550,2405,2406],{"class":560},"($body[",[550,2408,2409],{"class":567},"'data'",[550,2411,2412],{"class":560},"], ",[550,2414,2415],{"class":567},"'_id'",[550,2417,1608],{"class":560},[550,2419,2420],{"class":567},"'slug'",[550,2422,733],{"class":560},[550,2424,2425],{"class":552,"line":820},[550,2426,2427],{"class":584},"\u002F\u002F $orgIds['stem'] === '64b7f0c2a1e4d5f6a7b8c9d1'\n",[357,2429,2430,2432,2433,2435],{},[392,2431,22],{"href":23}," explains which data lives on the core record (",[374,2434,471],{},") and which lives in each organization, and why most routes need this id.",[677,2437,2439],{"id":2438},"a-mistake-worth-seeing-once","A mistake worth seeing once",[357,2441,2442],{},"Using the slug where the id belongs is the most common first mistake. The API answers it like an organization that does not exist:",[541,2444,2446],{"className":543,"code":2445,"language":545,"meta":546,"style":546},"curl \"$MTO_API_BASE\u002Fstem\u002Fexam\" -H \"Authorization: Bearer $TOKEN\"\n",[374,2447,2448],{"__ignoreMap":546},[550,2449,2450,2452,2454,2456,2459,2462,2464,2466],{"class":552,"line":553},[550,2451,1429],{"class":689},[550,2453,1259],{"class":567},[550,2455,1437],{"class":560},[550,2457,2458],{"class":567},"\u002Fstem\u002Fexam\"",[550,2460,2461],{"class":716}," -H",[550,2463,1450],{"class":567},[550,2465,1453],{"class":560},[550,2467,1410],{"class":567},[541,2469,2471],{"className":1531,"code":2470,"language":1533,"meta":546,"style":546},"{\n  \"error\": {\n    \"code\": \"not_found\",\n    \"message\": \"Organization not found!\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\",\n    \"request_id\": \"8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f\"\n  }\n}\n",[374,2472,2473,2477,2485,2497,2509,2521,2531,2536],{"__ignoreMap":546},[550,2474,2475],{"class":552,"line":553},[550,2476,1540],{"class":560},[550,2478,2479,2482],{"class":552,"line":571},[550,2480,2481],{"class":1482},"  \"error\"",[550,2483,2484],{"class":560},": {\n",[550,2486,2487,2490,2492,2495],{"class":552,"line":588},[550,2488,2489],{"class":1482},"    \"code\"",[550,2491,512],{"class":560},[550,2493,2494],{"class":567},"\"not_found\"",[550,2496,1109],{"class":560},[550,2498,2499,2502,2504,2507],{"class":552,"line":742},[550,2500,2501],{"class":1482},"    \"message\"",[550,2503,512],{"class":560},[550,2505,2506],{"class":567},"\"Organization not found!\"",[550,2508,1109],{"class":560},[550,2510,2511,2514,2516,2519],{"class":552,"line":761},[550,2512,2513],{"class":1482},"    \"documentation_url\"",[550,2515,512],{"class":560},[550,2517,2518],{"class":567},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\"",[550,2520,1109],{"class":560},[550,2522,2523,2526,2528],{"class":552,"line":778},[550,2524,2525],{"class":1482},"    \"request_id\"",[550,2527,512],{"class":560},[550,2529,2530],{"class":567},"\"8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f\"\n",[550,2532,2533],{"class":552,"line":783},[550,2534,2535],{"class":560},"  }\n",[550,2537,2538],{"class":552,"line":820},[550,2539,1794],{"class":560},[357,2541,2542,2543,2546,2547,2549,2550,2553],{},"Put ",[374,2544,2545],{},"64b7f0c2a1e4d5f6a7b8c9d1"," (the ",[374,2548,1861],{},") where ",[374,2551,2552],{},"stem"," is and the same request reaches the stem organization.",[396,2555,2557],{"id":2556},"if-your-first-call-fails","If your first call fails",[357,2559,2560,2561,2564,2565,2568],{},"Every error has the same shape: ",[374,2562,2563],{},"{ \"error\": { \"code\", \"message\", \"documentation_url\", \"request_id\" } }",". Base your code on the HTTP status and ",[374,2566,2567],{},"error.code",", not on the message text.",[677,2570,2572],{"id":2571},"status-401-unauthorized","Status 401: unauthorized",[541,2574,2576],{"className":1531,"code":2575,"language":1533,"meta":546,"style":546},"{\n  \"error\": {\n    \"code\": \"unauthorized\",\n    \"message\": \"Authentication is required or the provided credentials are invalid.\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#unauthorized\",\n    \"request_id\": \"0b5c6d0e-8f7a-4b1c-9d2e-3f4a5b6c7d8e\"\n  }\n}\n",[374,2577,2578,2582,2588,2599,2610,2621,2630,2634],{"__ignoreMap":546},[550,2579,2580],{"class":552,"line":553},[550,2581,1540],{"class":560},[550,2583,2584,2586],{"class":552,"line":571},[550,2585,2481],{"class":1482},[550,2587,2484],{"class":560},[550,2589,2590,2592,2594,2597],{"class":552,"line":588},[550,2591,2489],{"class":1482},[550,2593,512],{"class":560},[550,2595,2596],{"class":567},"\"unauthorized\"",[550,2598,1109],{"class":560},[550,2600,2601,2603,2605,2608],{"class":552,"line":742},[550,2602,2501],{"class":1482},[550,2604,512],{"class":560},[550,2606,2607],{"class":567},"\"Authentication is required or the provided credentials are invalid.\"",[550,2609,1109],{"class":560},[550,2611,2612,2614,2616,2619],{"class":552,"line":761},[550,2613,2513],{"class":1482},[550,2615,512],{"class":560},[550,2617,2618],{"class":567},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#unauthorized\"",[550,2620,1109],{"class":560},[550,2622,2623,2625,2627],{"class":552,"line":778},[550,2624,2525],{"class":1482},[550,2626,512],{"class":560},[550,2628,2629],{"class":567},"\"0b5c6d0e-8f7a-4b1c-9d2e-3f4a5b6c7d8e\"\n",[550,2631,2632],{"class":552,"line":783},[550,2633,2535],{"class":560},[550,2635,2636],{"class":552,"line":820},[550,2637,1794],{"class":560},[357,2639,2640],{},"Every authentication failure gets this exact response, whatever the cause. That is deliberate: someone holding a stolen key or token learns nothing from it. So work through the list yourself:",[361,2642,2643,2654,2667,2676,2690,2698,2701,2707],{},[364,2644,2645,2646,2649,2650,2653],{},"The header is exactly ",[374,2647,2648],{},"Authorization: Bearer \u003Ctoken>",": capital ",[374,2651,2652],{},"B",", one space, no quotes.",[364,2655,2656,2657,464,2660,2663,2664,2666],{},"The token's header has ",[374,2658,2659],{},"\"alg\": \"HS256\"",[374,2661,2662],{},"\"kid\""," equal to your ",[374,2665,433],{},", character for character.",[364,2668,2669,2670,2673,2674,472],{},"The payload has ",[374,2671,2672],{},"\"sub\""," equal to the same ",[374,2675,433],{},[364,2677,2678,464,2680,2682,2683,2685,2686,2689],{},[374,2679,652],{},[374,2681,656],{}," are both present and are whole ",[493,2684,660],{},". Milliseconds (",[374,2687,2688],{},"Date.now()"," in JavaScript) are the classic mistake.",[364,2691,2692,2694,2695,2697],{},[374,2693,656],{}," is later than ",[374,2696,652],{},", and at most 3600 seconds later.",[364,2699,2700],{},"Your server clock is within 30 seconds of real time.",[364,2702,2703,2704,2706],{},"You signed with the full secret, ",[374,2705,522],{}," prefix included, with no trailing newline.",[364,2708,2709],{},"The token has not expired and was not revoked, and your account has not been deactivated.",[357,2711,2712,2715],{},[392,2713,19],{"href":2714},"\u002Fapi\u002Fauthentication#the-401-checklist"," goes through each item in detail, with a way to decode your token locally.",[677,2717,2719],{"id":2718},"status-403-forbidden","Status 403: forbidden",[541,2721,2723],{"className":1531,"code":2722,"language":1533,"meta":546,"style":546},"{\n  \"error\": {\n    \"code\": \"forbidden\",\n    \"message\": \"Insufficient role permissions\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#forbidden\",\n    \"request_id\": \"5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9\"\n  }\n}\n",[374,2724,2725,2729,2735,2746,2757,2768,2777,2781],{"__ignoreMap":546},[550,2726,2727],{"class":552,"line":553},[550,2728,1540],{"class":560},[550,2730,2731,2733],{"class":552,"line":571},[550,2732,2481],{"class":1482},[550,2734,2484],{"class":560},[550,2736,2737,2739,2741,2744],{"class":552,"line":588},[550,2738,2489],{"class":1482},[550,2740,512],{"class":560},[550,2742,2743],{"class":567},"\"forbidden\"",[550,2745,1109],{"class":560},[550,2747,2748,2750,2752,2755],{"class":552,"line":742},[550,2749,2501],{"class":1482},[550,2751,512],{"class":560},[550,2753,2754],{"class":567},"\"Insufficient role permissions\"",[550,2756,1109],{"class":560},[550,2758,2759,2761,2763,2766],{"class":552,"line":761},[550,2760,2513],{"class":1482},[550,2762,512],{"class":560},[550,2764,2765],{"class":567},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#forbidden\"",[550,2767,1109],{"class":560},[550,2769,2770,2772,2774],{"class":552,"line":778},[550,2771,2525],{"class":1482},[550,2773,512],{"class":560},[550,2775,2776],{"class":567},"\"5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9\"\n",[550,2778,2779],{"class":552,"line":783},[550,2780,2535],{"class":560},[550,2782,2783],{"class":552,"line":820},[550,2784,1794],{"class":560},[357,2786,2787],{},"Your token is fine, but your account has no role for this route. On this page that means one of these is missing:",[404,2789,2790,2803],{},[407,2791,2792],{},[410,2793,2794,2797,2800],{},[413,2795,2796],{},"Call",[413,2798,2799],{},"Needs",[413,2801,2802],{},"On",[423,2804,2805,2836],{},[410,2806,2807,2811,2830],{},[428,2808,2809],{},[374,2810,376],{},[428,2812,2813,2815,2816,1608,2818,2821,2822,2825,2826,2829],{},[374,2814,463],{}," (only ",[374,2817,463],{},[374,2819,2820],{},"*\u002F*"," or ",[374,2823,2824],{},"*"," grant it; ",[374,2827,2828],{},"*\u002Fread"," does not)",[428,2831,2832,2821,2834],{},[374,2833,471],{},[374,2835,2824],{},[410,2837,2838,2842,2857],{},[428,2839,2840],{},[374,2841,382],{},[428,2843,2844,2846,2847,1608,2849,1608,2852,2821,2854,2856],{},[374,2845,467],{}," (also granted by ",[374,2848,2828],{},[374,2850,2851],{},"organization\u002F*",[374,2853,2820],{},[374,2855,2824],{},")",[428,2858,2859,2821,2861],{},[374,2860,471],{},[374,2862,2824],{},[357,2864,2865,2866,2868],{},"A new token or a retry does not help. Ask the operator for the role, and see ",[392,2867,25],{"href":26}," for what to ask for.",[677,2870,2872],{"id":2871},"other-answers","Other answers",[404,2874,2875,2888],{},[407,2876,2877],{},[410,2878,2879,2882,2885],{},[413,2880,2881],{},"Status",[413,2883,2884],{},"Code",[413,2886,2887],{},"What it means here",[423,2889,2890,2909,2928],{},[410,2891,2892,2895,2900],{},[428,2893,2894],{},"404",[428,2896,2897],{},[374,2898,2899],{},"not_found",[428,2901,2902,2905,2906,2908],{},[374,2903,2904],{},"Organization not found!",": the path has a slug or an unknown id where the organization ",[374,2907,1861],{}," belongs",[410,2910,2911,2914,2919],{},[428,2912,2913],{},"429",[428,2915,2916],{},[374,2917,2918],{},"too_many_requests",[428,2920,2921,2922,2925,2926],{},"You sent more than 100 requests to one route within 60 seconds. Wait the number of seconds in the ",[374,2923,2924],{},"Retry-After"," header. See ",[392,2927,45],{"href":46},[410,2929,2930,2933,2938],{},[428,2931,2932],{},"5xx",[428,2934,2935],{},[374,2936,2937],{},"internal_error",[428,2939,2940,2941,2944],{},"A problem on our side. Retry later, and quote the ",[374,2942,2943],{},"request_id"," if it persists",[396,2946,2948],{"id":2947},"next-steps","Next steps",[616,2950,2951,2960,2965,2970,2975],{},[364,2952,2953,2954,2956,2957,472],{},"Build token handling properly: ",[392,2955,19],{"href":20}," and the ",[392,2958,2959],{"href":113},"token handling tutorial",[364,2961,2962,2963,472],{},"Learn where data lives: ",[392,2964,22],{"href":23},[364,2966,2967,2968,472],{},"Check what your roles allow: ",[392,2969,25],{"href":26},[364,2971,2972,2973,472],{},"Register a student and enter them for an exam, end to end: ",[392,2974,100],{"href":101},[364,2976,2977,2978,472],{},"Prefer a ready-made client? See ",[392,2979,2980],{"href":306},"Client libraries",[2982,2983,2984],"style",{},"html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}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 .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sKwhi, html code.shiki .sKwhi{--shiki-default:#622CBC;--shiki-dark:#DBB7FF}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}",{"title":546,"searchDepth":571,"depth":588,"links":2986},[2987,2988,2989,2994,2995,2998,3003],{"id":398,"depth":571,"text":399},{"id":535,"depth":571,"text":536},{"id":607,"depth":571,"text":608,"children":2990},[2991,2992,2993],{"id":679,"depth":588,"text":308},{"id":923,"depth":588,"text":311},{"id":1167,"depth":588,"text":1168},{"id":1413,"depth":571,"text":1414},{"id":1850,"depth":571,"text":1851,"children":2996},[2997],{"id":2438,"depth":588,"text":2439},{"id":2556,"depth":571,"text":2557,"children":2999},[3000,3001,3002],{"id":2571,"depth":588,"text":2572},{"id":2718,"depth":588,"text":2719},{"id":2871,"depth":588,"text":2872},{"id":2947,"depth":571,"text":2948},"Make your first authenticated call to the Main Team API in about ten minutes, from credentials to a signed token to your organization ids.","md",{},[3008,3009],"getCurrentApiAccount","listOrganizations","10",{"title":12,"description":3004},"api\u002Fquickstart","CBl12epxXeKzNuPOTykpcveTu45nlFVAezjnb-IZQGA",[3015,3020],{"operationId":3008,"slug":3016,"method":133,"path":3017,"tag":77,"summary":143,"deprecated":134,"public":134,"permission":3018,"scope":3019,"order":588},"get-current-api-account","\u002Fv1\u002Fapi-account\u002Fvalidate-me","api\u002F*:$org:$ID","flat",{"operationId":3009,"slug":3021,"method":133,"path":3022,"tag":74,"summary":161,"deprecated":134,"public":134,"permission":3023,"scope":3019,"order":820},"list-organizations","\u002Fv1\u002Forganization","organization\u002Fread:$org:$ID",1791554614883]