[{"data":1,"prerenderedAt":11637},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Ftutorials\u002Fregister-and-apply":351,"api-spec:guide:\u002Fapi\u002Ftutorials\u002Fregister-and-apply":11594},[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":353,"body":354,"description":11580,"extension":11581,"meta":11582,"navTitle":100,"navigation":926,"operations":11583,"order":11590,"path":101,"section":96,"seo":11591,"status":14,"stem":11592,"__hash__":11593},"apiGuides\u002Fapi\u002Ftutorials\u002Fregister-and-apply.md","Register a student and enter them for an exam",{"type":355,"value":356,"toc":11547},"minimark",[357,361,364,393,398,532,542,546,551,593,596,606,739,754,758,761,803,817,821,824,890,2262,4036,4040,4047,4265,4269,4272,4303,4541,4552,4555,4589,4595,4604,4630,4861,4867,4888,4892,4902,4928,5076,5079,5139,5145,5149,5152,5253,5487,5497,5734,5737,5794,5798,5892,5910,5914,5921,5924,5985,6073,6091,6094,6098,6103,6129,6200,6210,6214,6282,6286,6292,6328,6671,6674,6717,6720,6737,6750,6754,6760,6817,6935,6938,6971,6986,6990,6996,7080,7093,7096,7165,7174,7178,7181,7217,7486,7511,7515,7518,7521,9382,9384,11315,11319,11326,11333,11336,11342,11346,11489,11498,11502,11543],[358,359,360],"p",{},"In this tutorial you take one student from nothing to a confirmed exam entry. You sign a token, find\nthe organization, register the student, send them into the organization once, choose an exam from the\nlist the platform would offer them, and create the application. At the end you have one script in\nNode.js and one in PHP that do the whole run, with the output you should expect at each step.",[358,362,363],{},"Plan on about 20 minutes. Every step shows the raw request with curl first, so you can follow along\nin a terminal before you run the scripts.",[365,366,368],"callout",{"type":367},"warn",[358,369,370,374,375,379,380,383,384,387,388,392],{},[371,372,373],"strong",{},"Run it in the sandbox first."," Against production, every write in this tutorial creates real\nrecords: a real student, a real sign-in and a real application, and no route deletes a student. Use\nyour sandbox credentials and ",[376,377,378],"code",{},"https:\u002F\u002Fapisnd.main-team.org\u002Fv1"," in place of\n",[376,381,382],{},"https:\u002F\u002Fapi.main-team.org\u002Fv1"," in the commands and in ",[376,385,386],{},"BASE_URL","; see\n",[389,390,16],"a",{"href":391},"\u002Fapi\u002Fenvironments#sandbox",". In production, run it only for a student you actually\nmean to enter, or agree a test student with your contact first.",[394,395,397],"h2",{"id":396},"what-you-will-build","What you will build",[399,400,401,417],"table",{},[402,403,404],"thead",{},[405,406,407,411,414],"tr",{},[408,409,410],"th",{},"Step",[408,412,413],{},"Request",[408,415,416],{},"Why",[418,419,420,434,451,467,480,493,506,519],"tbody",{},[405,421,422,426,431],{},[423,424,425],"td",{},"1",[423,427,428],{},[376,429,430],{},"GET \u002Fv1\u002Fapi-account\u002Fvalidate-me",[423,432,433],{},"Prove that your token is accepted",[405,435,436,439,444],{},[423,437,438],{},"2",[423,440,441],{},[376,442,443],{},"GET \u002Fv1\u002Forganization",[423,445,446,447,450],{},"Get the organization's ",[376,448,449],{},"_id",", which every organization route takes",[405,452,453,456,461],{},[423,454,455],{},"3",[423,457,458],{},[376,459,460],{},"GET \u002Fv1\u002Fcountry",[423,462,463,464,466],{},"Get the country's ",[376,465,449],{},", which registration needs",[405,468,469,472,477],{},[423,470,471],{},"4",[423,473,474],{},[376,475,476],{},"POST \u002Fv1\u002Fstudent",[423,478,479],{},"Register the student on the core record",[405,481,482,485,490],{},[423,483,484],{},"5",[423,486,487],{},[376,488,489],{},"POST \u002Fv1\u002F\u003CorganizationId>\u002Fauth\u002Fsignin",[423,491,492],{},"The first sign-in creates the organization's own copy of the student",[405,494,495,498,503],{},[423,496,497],{},"6",[423,499,500],{},[376,501,502],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fexam\u002Favailable\u002F\u003CstudentId>",[423,504,505],{},"The exams this student can sit, as a tree",[405,507,508,511,516],{},[423,509,510],{},"7",[423,512,513],{},[376,514,515],{},"POST \u002Fv1\u002F\u003CorganizationId>\u002Fapplication",[423,517,518],{},"Enter the student for one of them",[405,520,521,524,529],{},[423,522,523],{},"8",[423,525,526],{},[376,527,528],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fstudent-applications\u002F\u003CstudentId>",[423,530,531],{},"Confirm the entry and its payment",[358,533,534,535,538,539,541],{},"The example uses the ",[376,536,537],{},"stem"," organization. Any organization works the same way: only its ",[376,540,449],{},"\nchanges.",[394,543,545],{"id":544},"before-you-start","Before you start",[547,548,550],"h3",{"id":549},"what-you-need","What you need",[552,553,554,576,587,590],"ul",{},[555,556,557,558,561,562,565,566,561,569,572,573,575],"li",{},"Your ",[376,559,560],{},"apiKey"," (starts with ",[376,563,564],{},"key_",") and ",[376,567,568],{},"apiSecret",[376,570,571],{},"secret_","), issued by an operator.\nSee ",[389,574,19],{"href":20}," if you do not have them yet.",[555,577,578,579,582,583,586],{},"Node.js 20 or newer, or PHP 8.1 or newer with the ",[376,580,581],{},"curl"," and ",[376,584,585],{},"json"," extensions.",[555,588,589],{},"A browser, for step 5.",[555,591,592],{},"The student's details: name, email address, date of birth, sex, country, city, school and grade.",[547,594,25],{"id":595},"permissions",[358,597,598,599,602,603,605],{},"Each request needs a permission on the organization it acts on. Routes without an organization in the\npath act on ",[376,600,601],{},"mto",", the core record. Ask your operator for these roles if you do not hold them already;\nsee ",[389,604,25],{"href":26}," for how roles are written.",[399,607,608,621],{},[402,609,610],{},[405,611,612,615,618],{},[408,613,614],{},"Permission",[408,616,617],{},"On",[408,619,620],{},"Used in",[418,622,623,637,651,669,683,697,711,725],{},[405,624,625,630,634],{},[423,626,627],{},[376,628,629],{},"api\u002F*",[423,631,632],{},[376,633,601],{},[423,635,636],{},"Step 1",[405,638,639,644,648],{},[423,640,641],{},[376,642,643],{},"organization\u002Fread",[423,645,646],{},[376,647,601],{},[423,649,650],{},"Step 2",[405,652,653,658,662],{},[423,654,655],{},[376,656,657],{},"country\u002Fread",[423,659,660],{},[376,661,601],{},[423,663,664,665,668],{},"Step 3 (and ",[376,666,667],{},"grade\u002Fread"," if you look grades up)",[405,670,671,676,680],{},[423,672,673],{},[376,674,675],{},"student\u002Fcreate",[423,677,678],{},[376,679,601],{},[423,681,682],{},"Step 4",[405,684,685,690,694],{},[423,686,687],{},[376,688,689],{},"auth\u002Fsignin",[423,691,692],{},[376,693,537],{},[423,695,696],{},"Step 5",[405,698,699,704,708],{},[423,700,701],{},[376,702,703],{},"exam\u002Fread",[423,705,706],{},[376,707,537],{},[423,709,710],{},"Step 6",[405,712,713,718,722],{},[423,714,715],{},[376,716,717],{},"application\u002Fcreate",[423,719,720],{},[376,721,537],{},[423,723,724],{},"Step 7",[405,726,727,732,736],{},[423,728,729],{},[376,730,731],{},"application\u002Fread",[423,733,734],{},[376,735,537],{},[423,737,738],{},"Steps 5 and 8",[358,740,741,742,745,746,749,750,753],{},"A missing permission answers ",[376,743,744],{},"403"," with the code ",[376,747,748],{},"forbidden"," and the message\n",[376,751,752],{},"Insufficient role permissions",". Retrying or signing a new token does not help; only an operator can\nadd the role.",[547,755,757],{"id":756},"set-your-credentials","Set your credentials",[358,759,760],{},"Keep both values out of source control. The scripts below read them from the environment:",[762,763,768],"pre",{"className":764,"code":765,"language":766,"meta":767,"style":767},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","export MTO_API_KEY='key_Q2xpZW50RXhhbXBsZUtleTAx'\nexport MTO_API_SECRET='secret_…'\n","bash","",[376,769,770,790],{"__ignoreMap":767},[771,772,775,779,783,786],"span",{"class":773,"line":774},"line",1,[771,776,778],{"class":777},"sHUrx","export",[771,780,782],{"class":781},"suds8"," MTO_API_KEY",[771,784,785],{"class":777},"=",[771,787,789],{"class":788},"sT6z2","'key_Q2xpZW50RXhhbXBsZUtleTAx'\n",[771,791,793,795,798,800],{"class":773,"line":792},2,[771,794,778],{"class":777},[771,796,797],{"class":781}," MTO_API_SECRET",[771,799,785],{"class":777},[771,801,802],{"class":788},"'secret_…'\n",[365,804,806],{"type":805},"security",[358,807,808,809,811,812,816],{},"The ",[376,810,568],{}," signs tokens that act as your whole account. Keep it on your server. Never put it in a\nbrowser, a mobile app, a log line or a support ticket. If it leaks, contact your operator at once:\nsee ",[389,813,815],{"href":814},"\u002Fapi\u002Ftutorials\u002Ftoken-handling#when-the-secret-itself-leaks","Handle tokens in production",".",[547,818,820],{"id":819},"the-helper-file","The helper file",[358,822,823],{},"Both scripts use a small helper that signs tokens and sends requests. Save it next to the script. It\ndoes five things, each explained in more depth elsewhere in these docs:",[552,825,826,849,858,871,877],{},[555,827,828,829,831,832,835,836,839,840,582,843,846,847,816],{},"It signs an HS256 token with your secret, puts your ",[376,830,560],{}," in the ",[376,833,834],{},"kid"," header and in ",[376,837,838],{},"sub",", and\nsets ",[376,841,842],{},"iat",[376,844,845],{},"exp"," 15 minutes apart. It reuses the token until a minute before it expires. See\n",[389,848,815],{"href":113},[555,850,851,852,855,856,816],{},"It sends an ",[376,853,854],{},"X-Request-Id"," with every request, so an error can be traced. See\n",[389,857,33],{"href":34},[555,859,860,861,864,865,868,869,816],{},"On ",[376,862,863],{},"429 too_many_requests"," it waits for the number of seconds in ",[376,866,867],{},"Retry-After",", then retries up to\nthree times. See ",[389,870,45],{"href":46},[555,872,860,873,876],{},[376,874,875],{},"401 unauthorized"," it signs a fresh token and retries once.",[555,878,879,880,883,884,886,887,816],{},"Anything else that is not a success becomes an ",[376,881,882],{},"ApiError"," carrying the status, the ",[376,885,376],{},", the\nmessage and the ",[376,888,889],{},"request_id",[762,891,896],{"className":892,"code":893,"filename":894,"language":895,"meta":767,"style":767},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u002F\u002F mainteam.mjs: a minimal Main Team API client. Node.js 20 or newer, no dependencies.\nimport { createHmac, randomUUID } from 'node:crypto';\n\nexport const BASE_URL = 'https:\u002F\u002Fapi.main-team.org\u002Fv1'; \u002F\u002F sandbox: 'https:\u002F\u002Fapisnd.main-team.org\u002Fv1'\n\nconst API_KEY = process.env.MTO_API_KEY;\nconst API_SECRET = process.env.MTO_API_SECRET;\nif (!API_KEY || !API_SECRET) {\n  throw new Error('Set MTO_API_KEY and MTO_API_SECRET first.');\n}\n\nconst TOKEN_LIFETIME = 900; \u002F\u002F seconds; the API accepts at most 3600\nconst RENEW_MARGIN = 60; \u002F\u002F mint a fresh token this long before exp\n\nconst b64url = (value) => Buffer.from(JSON.stringify(value)).toString('base64url');\nlet cached = null;\n\n\u002F** A signed token, reused until a minute before it expires. *\u002F\nexport function token() {\n  const now = Math.floor(Date.now() \u002F 1000);\n  if (cached && cached.exp - RENEW_MARGIN > now) return cached.token;\n  const header = b64url({ alg: 'HS256', typ: 'JWT', kid: API_KEY });\n  const payload = b64url({ sub: API_KEY, iat: now, exp: now + TOKEN_LIFETIME });\n  const signature = createHmac('sha256', API_SECRET)\n    .update(`${header}.${payload}`)\n    .digest('base64url');\n  cached = { token: `${header}.${payload}.${signature}`, exp: now + TOKEN_LIFETIME };\n  return cached.token;\n}\n\nexport class ApiError extends Error {\n  constructor(status, body, requestId) {\n    super(body?.error?.message ?? `HTTP ${status}`);\n    this.name = 'ApiError';\n    this.status = status;\n    this.code = body?.error?.code ?? 'unknown';\n    this.requestId = body?.error?.request_id ?? requestId;\n  }\n}\n\nconst sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n\u002F**\n * Sends one request. Returns the parsed JSON body, or the raw Response when\n * `raw` is set (for file downloads). A 429 is retried after Retry-After, up to\n * three times; a 401 is retried once with a fresh token. Anything else that is\n * not 2xx throws ApiError.\n *\u002F\nexport async function api(method, path, body, { raw = false, timeoutMs = 30_000 } = {}) {\n  const requestId = randomUUID();\n  let renewed = false;\n  for (let attempt = 1; ; attempt++) {\n    const res = await fetch(BASE_URL + path, {\n      method,\n      headers: {\n        Authorization: `Bearer ${token()}`,\n        'X-Request-Id': requestId,\n        ...(body === undefined ? {} : { 'Content-Type': 'application\u002Fjson' }),\n      },\n      body: body === undefined ? undefined : JSON.stringify(body),\n      signal: AbortSignal.timeout(timeoutMs),\n    });\n    if (res.status === 429 && attempt \u003C= 3) {\n      await res.text();\n      await sleep((Number(res.headers.get('retry-after')) || 1) * 1000);\n      continue;\n    }\n    if (res.status === 401 && !renewed) {\n      await res.text();\n      renewed = true;\n      cached = null;\n      continue;\n    }\n    if (raw && res.ok) return res;\n    const text = await res.text();\n    let json = null;\n    try {\n      json = text ? JSON.parse(text) : null;\n    } catch {\n      json = null; \u002F\u002F not JSON, for example an error page from a proxy\n    }\n    if (!res.ok) throw new ApiError(res.status, json, res.headers.get('x-request-id'));\n    return json;\n  }\n}\n","mainteam.mjs","js",[376,897,898,904,921,928,952,957,976,993,1020,1042,1048,1053,1071,1089,1094,1144,1160,1165,1171,1185,1219,1251,1283,1310,1336,1364,1378,1414,1422,1427,1432,1451,1474,1495,1511,1524,1544,1562,1568,1573,1578,1618,1623,1629,1635,1641,1647,1653,1659,1715,1731,1746,1772,1799,1805,1811,1831,1840,1879,1885,1912,1924,1930,1957,1971,2011,2019,2025,2044,2055,2068,2080,2087,2092,2110,2128,2143,2151,2181,2192,2206,2211,2243,2252,2257],{"__ignoreMap":767},[771,899,900],{"class":773,"line":774},[771,901,903],{"class":902},"sLBg1","\u002F\u002F mainteam.mjs: a minimal Main Team API client. Node.js 20 or newer, no dependencies.\n",[771,905,906,909,912,915,918],{"class":773,"line":792},[771,907,908],{"class":777},"import",[771,910,911],{"class":781}," { createHmac, randomUUID } ",[771,913,914],{"class":777},"from",[771,916,917],{"class":788}," 'node:crypto'",[771,919,920],{"class":781},";\n",[771,922,924],{"class":773,"line":923},3,[771,925,927],{"emptyLinePlaceholder":926},true,"\n",[771,929,931,933,936,940,943,946,949],{"class":773,"line":930},4,[771,932,778],{"class":777},[771,934,935],{"class":777}," const",[771,937,939],{"class":938},"s-5SL"," BASE_URL",[771,941,942],{"class":777}," =",[771,944,945],{"class":788}," 'https:\u002F\u002Fapi.main-team.org\u002Fv1'",[771,947,948],{"class":781},"; ",[771,950,951],{"class":902},"\u002F\u002F sandbox: 'https:\u002F\u002Fapisnd.main-team.org\u002Fv1'\n",[771,953,955],{"class":773,"line":954},5,[771,956,927],{"emptyLinePlaceholder":926},[771,958,960,963,966,968,971,974],{"class":773,"line":959},6,[771,961,962],{"class":777},"const",[771,964,965],{"class":938}," API_KEY",[771,967,942],{"class":777},[771,969,970],{"class":781}," process.env.",[771,972,973],{"class":938},"MTO_API_KEY",[771,975,920],{"class":781},[771,977,979,981,984,986,988,991],{"class":773,"line":978},7,[771,980,962],{"class":777},[771,982,983],{"class":938}," API_SECRET",[771,985,942],{"class":777},[771,987,970],{"class":781},[771,989,990],{"class":938},"MTO_API_SECRET",[771,992,920],{"class":781},[771,994,996,999,1002,1005,1008,1011,1014,1017],{"class":773,"line":995},8,[771,997,998],{"class":777},"if",[771,1000,1001],{"class":781}," (",[771,1003,1004],{"class":777},"!",[771,1006,1007],{"class":938},"API_KEY",[771,1009,1010],{"class":777}," ||",[771,1012,1013],{"class":777}," !",[771,1015,1016],{"class":938},"API_SECRET",[771,1018,1019],{"class":781},") {\n",[771,1021,1023,1026,1029,1033,1036,1039],{"class":773,"line":1022},9,[771,1024,1025],{"class":777},"  throw",[771,1027,1028],{"class":777}," new",[771,1030,1032],{"class":1031},"sKwhi"," Error",[771,1034,1035],{"class":781},"(",[771,1037,1038],{"class":788},"'Set MTO_API_KEY and MTO_API_SECRET first.'",[771,1040,1041],{"class":781},");\n",[771,1043,1045],{"class":773,"line":1044},10,[771,1046,1047],{"class":781},"}\n",[771,1049,1051],{"class":773,"line":1050},11,[771,1052,927],{"emptyLinePlaceholder":926},[771,1054,1056,1058,1061,1063,1066,1068],{"class":773,"line":1055},12,[771,1057,962],{"class":777},[771,1059,1060],{"class":938}," TOKEN_LIFETIME",[771,1062,942],{"class":777},[771,1064,1065],{"class":938}," 900",[771,1067,948],{"class":781},[771,1069,1070],{"class":902},"\u002F\u002F seconds; the API accepts at most 3600\n",[771,1072,1074,1076,1079,1081,1084,1086],{"class":773,"line":1073},13,[771,1075,962],{"class":777},[771,1077,1078],{"class":938}," RENEW_MARGIN",[771,1080,942],{"class":777},[771,1082,1083],{"class":938}," 60",[771,1085,948],{"class":781},[771,1087,1088],{"class":902},"\u002F\u002F mint a fresh token this long before exp\n",[771,1090,1092],{"class":773,"line":1091},14,[771,1093,927],{"emptyLinePlaceholder":926},[771,1095,1097,1099,1102,1104,1106,1110,1113,1116,1119,1121,1123,1126,1128,1131,1134,1137,1139,1142],{"class":773,"line":1096},15,[771,1098,962],{"class":777},[771,1100,1101],{"class":1031}," b64url",[771,1103,942],{"class":777},[771,1105,1001],{"class":781},[771,1107,1109],{"class":1108},"soyes","value",[771,1111,1112],{"class":781},") ",[771,1114,1115],{"class":777},"=>",[771,1117,1118],{"class":781}," Buffer.",[771,1120,914],{"class":1031},[771,1122,1035],{"class":781},[771,1124,1125],{"class":938},"JSON",[771,1127,816],{"class":781},[771,1129,1130],{"class":1031},"stringify",[771,1132,1133],{"class":781},"(value)).",[771,1135,1136],{"class":1031},"toString",[771,1138,1035],{"class":781},[771,1140,1141],{"class":788},"'base64url'",[771,1143,1041],{"class":781},[771,1145,1147,1150,1153,1155,1158],{"class":773,"line":1146},16,[771,1148,1149],{"class":777},"let",[771,1151,1152],{"class":781}," cached ",[771,1154,785],{"class":777},[771,1156,1157],{"class":938}," null",[771,1159,920],{"class":781},[771,1161,1163],{"class":773,"line":1162},17,[771,1164,927],{"emptyLinePlaceholder":926},[771,1166,1168],{"class":773,"line":1167},18,[771,1169,1170],{"class":902},"\u002F** A signed token, reused until a minute before it expires. *\u002F\n",[771,1172,1174,1176,1179,1182],{"class":773,"line":1173},19,[771,1175,778],{"class":777},[771,1177,1178],{"class":777}," function",[771,1180,1181],{"class":1031}," token",[771,1183,1184],{"class":781},"() {\n",[771,1186,1188,1191,1194,1196,1199,1202,1205,1208,1211,1214,1217],{"class":773,"line":1187},20,[771,1189,1190],{"class":777},"  const",[771,1192,1193],{"class":938}," now",[771,1195,942],{"class":777},[771,1197,1198],{"class":781}," Math.",[771,1200,1201],{"class":1031},"floor",[771,1203,1204],{"class":781},"(Date.",[771,1206,1207],{"class":1031},"now",[771,1209,1210],{"class":781},"() ",[771,1212,1213],{"class":777},"\u002F",[771,1215,1216],{"class":938}," 1000",[771,1218,1041],{"class":781},[771,1220,1222,1225,1228,1231,1234,1237,1239,1242,1245,1248],{"class":773,"line":1221},21,[771,1223,1224],{"class":777},"  if",[771,1226,1227],{"class":781}," (cached ",[771,1229,1230],{"class":777},"&&",[771,1232,1233],{"class":781}," cached.exp ",[771,1235,1236],{"class":777},"-",[771,1238,1078],{"class":938},[771,1240,1241],{"class":777}," >",[771,1243,1244],{"class":781}," now) ",[771,1246,1247],{"class":777},"return",[771,1249,1250],{"class":781}," cached.token;\n",[771,1252,1254,1256,1259,1261,1263,1266,1269,1272,1275,1278,1280],{"class":773,"line":1253},22,[771,1255,1190],{"class":777},[771,1257,1258],{"class":938}," header",[771,1260,942],{"class":777},[771,1262,1101],{"class":1031},[771,1264,1265],{"class":781},"({ alg: ",[771,1267,1268],{"class":788},"'HS256'",[771,1270,1271],{"class":781},", typ: ",[771,1273,1274],{"class":788},"'JWT'",[771,1276,1277],{"class":781},", kid: ",[771,1279,1007],{"class":938},[771,1281,1282],{"class":781}," });\n",[771,1284,1286,1288,1291,1293,1295,1298,1300,1303,1306,1308],{"class":773,"line":1285},23,[771,1287,1190],{"class":777},[771,1289,1290],{"class":938}," payload",[771,1292,942],{"class":777},[771,1294,1101],{"class":1031},[771,1296,1297],{"class":781},"({ sub: ",[771,1299,1007],{"class":938},[771,1301,1302],{"class":781},", iat: now, exp: now ",[771,1304,1305],{"class":777},"+",[771,1307,1060],{"class":938},[771,1309,1282],{"class":781},[771,1311,1313,1315,1318,1320,1323,1325,1328,1331,1333],{"class":773,"line":1312},24,[771,1314,1190],{"class":777},[771,1316,1317],{"class":938}," signature",[771,1319,942],{"class":777},[771,1321,1322],{"class":1031}," createHmac",[771,1324,1035],{"class":781},[771,1326,1327],{"class":788},"'sha256'",[771,1329,1330],{"class":781},", ",[771,1332,1016],{"class":938},[771,1334,1335],{"class":781},")\n",[771,1337,1339,1342,1345,1347,1350,1353,1356,1359,1362],{"class":773,"line":1338},25,[771,1340,1341],{"class":781},"    .",[771,1343,1344],{"class":1031},"update",[771,1346,1035],{"class":781},[771,1348,1349],{"class":788},"`${",[771,1351,1352],{"class":781},"header",[771,1354,1355],{"class":788},"}.${",[771,1357,1358],{"class":781},"payload",[771,1360,1361],{"class":788},"}`",[771,1363,1335],{"class":781},[771,1365,1367,1369,1372,1374,1376],{"class":773,"line":1366},26,[771,1368,1341],{"class":781},[771,1370,1371],{"class":1031},"digest",[771,1373,1035],{"class":781},[771,1375,1141],{"class":788},[771,1377,1041],{"class":781},[771,1379,1381,1384,1386,1389,1391,1393,1395,1397,1399,1402,1404,1407,1409,1411],{"class":773,"line":1380},27,[771,1382,1383],{"class":781},"  cached ",[771,1385,785],{"class":777},[771,1387,1388],{"class":781}," { token: ",[771,1390,1349],{"class":788},[771,1392,1352],{"class":781},[771,1394,1355],{"class":788},[771,1396,1358],{"class":781},[771,1398,1355],{"class":788},[771,1400,1401],{"class":781},"signature",[771,1403,1361],{"class":788},[771,1405,1406],{"class":781},", exp: now ",[771,1408,1305],{"class":777},[771,1410,1060],{"class":938},[771,1412,1413],{"class":781}," };\n",[771,1415,1417,1420],{"class":773,"line":1416},28,[771,1418,1419],{"class":777},"  return",[771,1421,1250],{"class":781},[771,1423,1425],{"class":773,"line":1424},29,[771,1426,1047],{"class":781},[771,1428,1430],{"class":773,"line":1429},30,[771,1431,927],{"emptyLinePlaceholder":926},[771,1433,1435,1437,1440,1443,1446,1448],{"class":773,"line":1434},31,[771,1436,778],{"class":777},[771,1438,1439],{"class":777}," class",[771,1441,1442],{"class":1108}," ApiError",[771,1444,1445],{"class":777}," extends",[771,1447,1032],{"class":938},[771,1449,1450],{"class":781}," {\n",[771,1452,1454,1457,1459,1462,1464,1467,1469,1472],{"class":773,"line":1453},32,[771,1455,1456],{"class":777},"  constructor",[771,1458,1035],{"class":781},[771,1460,1461],{"class":1108},"status",[771,1463,1330],{"class":781},[771,1465,1466],{"class":1108},"body",[771,1468,1330],{"class":781},[771,1470,1471],{"class":1108},"requestId",[771,1473,1019],{"class":781},[771,1475,1477,1480,1483,1486,1489,1491,1493],{"class":773,"line":1476},33,[771,1478,1479],{"class":938},"    super",[771,1481,1482],{"class":781},"(body?.error?.message ",[771,1484,1485],{"class":777},"??",[771,1487,1488],{"class":788}," `HTTP ${",[771,1490,1461],{"class":781},[771,1492,1361],{"class":788},[771,1494,1041],{"class":781},[771,1496,1498,1501,1504,1506,1509],{"class":773,"line":1497},34,[771,1499,1500],{"class":938},"    this",[771,1502,1503],{"class":781},".name ",[771,1505,785],{"class":777},[771,1507,1508],{"class":788}," 'ApiError'",[771,1510,920],{"class":781},[771,1512,1514,1516,1519,1521],{"class":773,"line":1513},35,[771,1515,1500],{"class":938},[771,1517,1518],{"class":781},".status ",[771,1520,785],{"class":777},[771,1522,1523],{"class":781}," status;\n",[771,1525,1527,1529,1532,1534,1537,1539,1542],{"class":773,"line":1526},36,[771,1528,1500],{"class":938},[771,1530,1531],{"class":781},".code ",[771,1533,785],{"class":777},[771,1535,1536],{"class":781}," body?.error?.code ",[771,1538,1485],{"class":777},[771,1540,1541],{"class":788}," 'unknown'",[771,1543,920],{"class":781},[771,1545,1547,1549,1552,1554,1557,1559],{"class":773,"line":1546},37,[771,1548,1500],{"class":938},[771,1550,1551],{"class":781},".requestId ",[771,1553,785],{"class":777},[771,1555,1556],{"class":781}," body?.error?.request_id ",[771,1558,1485],{"class":777},[771,1560,1561],{"class":781}," requestId;\n",[771,1563,1565],{"class":773,"line":1564},38,[771,1566,1567],{"class":781},"  }\n",[771,1569,1571],{"class":773,"line":1570},39,[771,1572,1047],{"class":781},[771,1574,1576],{"class":773,"line":1575},40,[771,1577,927],{"emptyLinePlaceholder":926},[771,1579,1581,1583,1586,1588,1590,1593,1595,1597,1599,1602,1605,1608,1610,1612,1615],{"class":773,"line":1580},41,[771,1582,962],{"class":777},[771,1584,1585],{"class":1031}," sleep",[771,1587,942],{"class":777},[771,1589,1001],{"class":781},[771,1591,1592],{"class":1108},"ms",[771,1594,1112],{"class":781},[771,1596,1115],{"class":777},[771,1598,1028],{"class":777},[771,1600,1601],{"class":938}," Promise",[771,1603,1604],{"class":781},"((",[771,1606,1607],{"class":1108},"resolve",[771,1609,1112],{"class":781},[771,1611,1115],{"class":777},[771,1613,1614],{"class":1031}," setTimeout",[771,1616,1617],{"class":781},"(resolve, ms));\n",[771,1619,1621],{"class":773,"line":1620},42,[771,1622,927],{"emptyLinePlaceholder":926},[771,1624,1626],{"class":773,"line":1625},43,[771,1627,1628],{"class":902},"\u002F**\n",[771,1630,1632],{"class":773,"line":1631},44,[771,1633,1634],{"class":902}," * Sends one request. Returns the parsed JSON body, or the raw Response when\n",[771,1636,1638],{"class":773,"line":1637},45,[771,1639,1640],{"class":902}," * `raw` is set (for file downloads). A 429 is retried after Retry-After, up to\n",[771,1642,1644],{"class":773,"line":1643},46,[771,1645,1646],{"class":902}," * three times; a 401 is retried once with a fresh token. Anything else that is\n",[771,1648,1650],{"class":773,"line":1649},47,[771,1651,1652],{"class":902}," * not 2xx throws ApiError.\n",[771,1654,1656],{"class":773,"line":1655},48,[771,1657,1658],{"class":902}," *\u002F\n",[771,1660,1662,1664,1667,1669,1672,1674,1677,1679,1682,1684,1686,1689,1692,1694,1697,1699,1702,1704,1707,1710,1712],{"class":773,"line":1661},49,[771,1663,778],{"class":777},[771,1665,1666],{"class":777}," async",[771,1668,1178],{"class":777},[771,1670,1671],{"class":1031}," api",[771,1673,1035],{"class":781},[771,1675,1676],{"class":1108},"method",[771,1678,1330],{"class":781},[771,1680,1681],{"class":1108},"path",[771,1683,1330],{"class":781},[771,1685,1466],{"class":1108},[771,1687,1688],{"class":781},", { ",[771,1690,1691],{"class":1108},"raw",[771,1693,942],{"class":777},[771,1695,1696],{"class":938}," false",[771,1698,1330],{"class":781},[771,1700,1701],{"class":1108},"timeoutMs",[771,1703,942],{"class":777},[771,1705,1706],{"class":938}," 30_000",[771,1708,1709],{"class":781}," } ",[771,1711,785],{"class":777},[771,1713,1714],{"class":781}," {}) {\n",[771,1716,1718,1720,1723,1725,1728],{"class":773,"line":1717},50,[771,1719,1190],{"class":777},[771,1721,1722],{"class":938}," requestId",[771,1724,942],{"class":777},[771,1726,1727],{"class":1031}," randomUUID",[771,1729,1730],{"class":781},"();\n",[771,1732,1734,1737,1740,1742,1744],{"class":773,"line":1733},51,[771,1735,1736],{"class":777},"  let",[771,1738,1739],{"class":781}," renewed ",[771,1741,785],{"class":777},[771,1743,1696],{"class":938},[771,1745,920],{"class":781},[771,1747,1749,1752,1754,1756,1759,1761,1764,1767,1770],{"class":773,"line":1748},52,[771,1750,1751],{"class":777},"  for",[771,1753,1001],{"class":781},[771,1755,1149],{"class":777},[771,1757,1758],{"class":781}," attempt ",[771,1760,785],{"class":777},[771,1762,1763],{"class":938}," 1",[771,1765,1766],{"class":781},"; ; attempt",[771,1768,1769],{"class":777},"++",[771,1771,1019],{"class":781},[771,1773,1775,1778,1781,1783,1786,1789,1791,1793,1796],{"class":773,"line":1774},53,[771,1776,1777],{"class":777},"    const",[771,1779,1780],{"class":938}," res",[771,1782,942],{"class":777},[771,1784,1785],{"class":777}," await",[771,1787,1788],{"class":1031}," fetch",[771,1790,1035],{"class":781},[771,1792,386],{"class":938},[771,1794,1795],{"class":777}," +",[771,1797,1798],{"class":781}," path, {\n",[771,1800,1802],{"class":773,"line":1801},54,[771,1803,1804],{"class":781},"      method,\n",[771,1806,1808],{"class":773,"line":1807},55,[771,1809,1810],{"class":781},"      headers: {\n",[771,1812,1814,1817,1820,1823,1826,1828],{"class":773,"line":1813},56,[771,1815,1816],{"class":781},"        Authorization: ",[771,1818,1819],{"class":788},"`Bearer ${",[771,1821,1822],{"class":1031},"token",[771,1824,1825],{"class":788},"()",[771,1827,1361],{"class":788},[771,1829,1830],{"class":781},",\n",[771,1832,1834,1837],{"class":773,"line":1833},57,[771,1835,1836],{"class":788},"        'X-Request-Id'",[771,1838,1839],{"class":781},": requestId,\n",[771,1841,1843,1846,1849,1852,1855,1858,1861,1864,1867,1870,1873,1876],{"class":773,"line":1842},58,[771,1844,1845],{"class":777},"        ...",[771,1847,1848],{"class":781},"(body ",[771,1850,1851],{"class":777},"===",[771,1853,1854],{"class":938}," undefined",[771,1856,1857],{"class":777}," ?",[771,1859,1860],{"class":781}," {} ",[771,1862,1863],{"class":777},":",[771,1865,1866],{"class":781}," { ",[771,1868,1869],{"class":788},"'Content-Type'",[771,1871,1872],{"class":781},": ",[771,1874,1875],{"class":788},"'application\u002Fjson'",[771,1877,1878],{"class":781}," }),\n",[771,1880,1882],{"class":773,"line":1881},59,[771,1883,1884],{"class":781},"      },\n",[771,1886,1888,1891,1893,1895,1897,1899,1902,1905,1907,1909],{"class":773,"line":1887},60,[771,1889,1890],{"class":781},"      body: body ",[771,1892,1851],{"class":777},[771,1894,1854],{"class":938},[771,1896,1857],{"class":777},[771,1898,1854],{"class":938},[771,1900,1901],{"class":777}," :",[771,1903,1904],{"class":938}," JSON",[771,1906,816],{"class":781},[771,1908,1130],{"class":1031},[771,1910,1911],{"class":781},"(body),\n",[771,1913,1915,1918,1921],{"class":773,"line":1914},61,[771,1916,1917],{"class":781},"      signal: AbortSignal.",[771,1919,1920],{"class":1031},"timeout",[771,1922,1923],{"class":781},"(timeoutMs),\n",[771,1925,1927],{"class":773,"line":1926},62,[771,1928,1929],{"class":781},"    });\n",[771,1931,1933,1936,1939,1941,1944,1947,1949,1952,1955],{"class":773,"line":1932},63,[771,1934,1935],{"class":777},"    if",[771,1937,1938],{"class":781}," (res.status ",[771,1940,1851],{"class":777},[771,1942,1943],{"class":938}," 429",[771,1945,1946],{"class":777}," &&",[771,1948,1758],{"class":781},[771,1950,1951],{"class":777},"\u003C=",[771,1953,1954],{"class":938}," 3",[771,1956,1019],{"class":781},[771,1958,1960,1963,1966,1969],{"class":773,"line":1959},64,[771,1961,1962],{"class":777},"      await",[771,1964,1965],{"class":781}," res.",[771,1967,1968],{"class":1031},"text",[771,1970,1730],{"class":781},[771,1972,1974,1976,1978,1980,1983,1986,1989,1991,1994,1997,2000,2002,2004,2007,2009],{"class":773,"line":1973},65,[771,1975,1962],{"class":777},[771,1977,1585],{"class":1031},[771,1979,1604],{"class":781},[771,1981,1982],{"class":1031},"Number",[771,1984,1985],{"class":781},"(res.headers.",[771,1987,1988],{"class":1031},"get",[771,1990,1035],{"class":781},[771,1992,1993],{"class":788},"'retry-after'",[771,1995,1996],{"class":781},")) ",[771,1998,1999],{"class":777},"||",[771,2001,1763],{"class":938},[771,2003,1112],{"class":781},[771,2005,2006],{"class":777},"*",[771,2008,1216],{"class":938},[771,2010,1041],{"class":781},[771,2012,2014,2017],{"class":773,"line":2013},66,[771,2015,2016],{"class":777},"      continue",[771,2018,920],{"class":781},[771,2020,2022],{"class":773,"line":2021},67,[771,2023,2024],{"class":781},"    }\n",[771,2026,2028,2030,2032,2034,2037,2039,2041],{"class":773,"line":2027},68,[771,2029,1935],{"class":777},[771,2031,1938],{"class":781},[771,2033,1851],{"class":777},[771,2035,2036],{"class":938}," 401",[771,2038,1946],{"class":777},[771,2040,1013],{"class":777},[771,2042,2043],{"class":781},"renewed) {\n",[771,2045,2047,2049,2051,2053],{"class":773,"line":2046},69,[771,2048,1962],{"class":777},[771,2050,1965],{"class":781},[771,2052,1968],{"class":1031},[771,2054,1730],{"class":781},[771,2056,2058,2061,2063,2066],{"class":773,"line":2057},70,[771,2059,2060],{"class":781},"      renewed ",[771,2062,785],{"class":777},[771,2064,2065],{"class":938}," true",[771,2067,920],{"class":781},[771,2069,2071,2074,2076,2078],{"class":773,"line":2070},71,[771,2072,2073],{"class":781},"      cached ",[771,2075,785],{"class":777},[771,2077,1157],{"class":938},[771,2079,920],{"class":781},[771,2081,2083,2085],{"class":773,"line":2082},72,[771,2084,2016],{"class":777},[771,2086,920],{"class":781},[771,2088,2090],{"class":773,"line":2089},73,[771,2091,2024],{"class":781},[771,2093,2095,2097,2100,2102,2105,2107],{"class":773,"line":2094},74,[771,2096,1935],{"class":777},[771,2098,2099],{"class":781}," (raw ",[771,2101,1230],{"class":777},[771,2103,2104],{"class":781}," res.ok) ",[771,2106,1247],{"class":777},[771,2108,2109],{"class":781}," res;\n",[771,2111,2113,2115,2118,2120,2122,2124,2126],{"class":773,"line":2112},75,[771,2114,1777],{"class":777},[771,2116,2117],{"class":938}," text",[771,2119,942],{"class":777},[771,2121,1785],{"class":777},[771,2123,1965],{"class":781},[771,2125,1968],{"class":1031},[771,2127,1730],{"class":781},[771,2129,2131,2134,2137,2139,2141],{"class":773,"line":2130},76,[771,2132,2133],{"class":777},"    let",[771,2135,2136],{"class":781}," json ",[771,2138,785],{"class":777},[771,2140,1157],{"class":938},[771,2142,920],{"class":781},[771,2144,2146,2149],{"class":773,"line":2145},77,[771,2147,2148],{"class":777},"    try",[771,2150,1450],{"class":781},[771,2152,2154,2157,2159,2162,2165,2167,2169,2172,2175,2177,2179],{"class":773,"line":2153},78,[771,2155,2156],{"class":781},"      json ",[771,2158,785],{"class":777},[771,2160,2161],{"class":781}," text ",[771,2163,2164],{"class":777},"?",[771,2166,1904],{"class":938},[771,2168,816],{"class":781},[771,2170,2171],{"class":1031},"parse",[771,2173,2174],{"class":781},"(text) ",[771,2176,1863],{"class":777},[771,2178,1157],{"class":938},[771,2180,920],{"class":781},[771,2182,2184,2187,2190],{"class":773,"line":2183},79,[771,2185,2186],{"class":781},"    } ",[771,2188,2189],{"class":777},"catch",[771,2191,1450],{"class":781},[771,2193,2195,2197,2199,2201,2203],{"class":773,"line":2194},80,[771,2196,2156],{"class":781},[771,2198,785],{"class":777},[771,2200,1157],{"class":938},[771,2202,948],{"class":781},[771,2204,2205],{"class":902},"\u002F\u002F not JSON, for example an error page from a proxy\n",[771,2207,2209],{"class":773,"line":2208},81,[771,2210,2024],{"class":781},[771,2212,2214,2216,2218,2220,2223,2226,2228,2230,2233,2235,2237,2240],{"class":773,"line":2213},82,[771,2215,1935],{"class":777},[771,2217,1001],{"class":781},[771,2219,1004],{"class":777},[771,2221,2222],{"class":781},"res.ok) ",[771,2224,2225],{"class":777},"throw",[771,2227,1028],{"class":777},[771,2229,1442],{"class":1031},[771,2231,2232],{"class":781},"(res.status, json, res.headers.",[771,2234,1988],{"class":1031},[771,2236,1035],{"class":781},[771,2238,2239],{"class":788},"'x-request-id'",[771,2241,2242],{"class":781},"));\n",[771,2244,2246,2249],{"class":773,"line":2245},83,[771,2247,2248],{"class":777},"    return",[771,2250,2251],{"class":781}," json;\n",[771,2253,2255],{"class":773,"line":2254},84,[771,2256,1567],{"class":781},[771,2258,2260],{"class":773,"line":2259},85,[771,2261,1047],{"class":781},[762,2263,2268],{"className":2264,"code":2265,"filename":2266,"language":2267,"meta":767,"style":767},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\n\u002F\u002F mainteam.php: a minimal Main Team API client. PHP 8.1 or newer with ext-curl and ext-json.\ndeclare(strict_types=1);\n\nfinal class ApiError extends RuntimeException\n{\n    public function __construct(\n        public readonly int $status,\n        public readonly string $errorCode,\n        string $message,\n        public readonly ?string $requestId,\n    ) {\n        parent::__construct($message);\n    }\n}\n\nfinal class MainTeam\n{\n    public const BASE_URL = 'https:\u002F\u002Fapi.main-team.org\u002Fv1'; \u002F\u002F sandbox: 'https:\u002F\u002Fapisnd.main-team.org\u002Fv1'\n    private const TOKEN_LIFETIME = 900; \u002F\u002F seconds; the API accepts at most 3600\n    private const RENEW_MARGIN = 60;    \u002F\u002F mint a fresh token this long before exp\n\n    private ?string $token = null;\n    private int $tokenExp = 0;\n\n    public function __construct(private string $apiKey, private string $apiSecret)\n    {\n    }\n\n    public static function fromEnv(): self\n    {\n        $key = getenv('MTO_API_KEY');\n        $secret = getenv('MTO_API_SECRET');\n        if (!$key || !$secret) {\n            throw new RuntimeException('Set MTO_API_KEY and MTO_API_SECRET first.');\n        }\n        return new self($key, $secret);\n    }\n\n    public static function b64url(string $bytes): string\n    {\n        return rtrim(strtr(base64_encode($bytes), '+\u002F', '-_'), '=');\n    }\n\n    \u002F** A signed token, reused until a minute before it expires. *\u002F\n    public function token(): string\n    {\n        $now = time();\n        if ($this->token !== null && $this->tokenExp - self::RENEW_MARGIN > $now) {\n            return $this->token;\n        }\n        $header = self::b64url(json_encode(['alg' => 'HS256', 'typ' => 'JWT', 'kid' => $this->apiKey]));\n        $payload = self::b64url(json_encode(['sub' => $this->apiKey, 'iat' => $now, 'exp' => $now + self::TOKEN_LIFETIME]));\n        $signature = self::b64url(hash_hmac('sha256', \"$header.$payload\", $this->apiSecret, true));\n        $this->token = \"$header.$payload.$signature\";\n        $this->tokenExp = $now + self::TOKEN_LIFETIME;\n        return $this->token;\n    }\n\n    \u002F**\n     * Sends one request and returns the decoded JSON body. A 429 is retried\n     * after Retry-After, up to three times; a 401 is retried once with a fresh\n     * token. Anything else that is not 2xx throws ApiError.\n     *\u002F\n    public function call(string $method, string $path, ?array $body = null): ?array\n    {\n        $requestId = bin2hex(random_bytes(16));\n        $renewed = false;\n        for ($attempt = 1; ; $attempt++) {\n            [$status, $headers, $text] = $this->send($method, $path, $body, $requestId);\n            if ($status === 429 && $attempt \u003C= 3) {\n                sleep(max(1, (int) ($headers['retry-after'] ?? '1')));\n                continue;\n            }\n            if ($status === 401 && !$renewed) {\n                $renewed = true;\n                $this->token = null;\n                continue;\n            }\n            $json = json_decode($text, true);\n            if ($status \u003C 200 || $status >= 300) {\n                $error = is_array($json) ? ($json['error'] ?? []) : [];\n                throw new ApiError(\n                    $status,\n                    $error['code'] ?? 'unknown',\n                    $error['message'] ?? \"HTTP $status\",\n                    $error['request_id'] ?? ($headers['x-request-id'] ?? null),\n                );\n            }\n            return is_array($json) ? $json : null;\n        }\n    }\n\n    \u002F** @return array{0: int, 1: array\u003Cstring, string>, 2: string} *\u002F\n    private function send(string $method, string $path, ?array $body, string $requestId): array\n    {\n        $headers = [];\n        $httpHeaders = ['Authorization: Bearer ' . $this->token(), 'X-Request-Id: ' . $requestId];\n        $ch = curl_init(self::BASE_URL . $path);\n        if ($body !== null) {\n            $httpHeaders[] = 'Content-Type: application\u002Fjson';\n            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES));\n        }\n        curl_setopt_array($ch, [\n            CURLOPT_CUSTOMREQUEST => $method,\n            CURLOPT_HTTPHEADER => $httpHeaders,\n            CURLOPT_RETURNTRANSFER => true,\n            CURLOPT_CONNECTTIMEOUT => 5,\n            CURLOPT_TIMEOUT => 30,\n            CURLOPT_HEADERFUNCTION => function ($ch, string $line) use (&$headers): int {\n                $parts = explode(':', $line, 2);\n                if (count($parts) === 2) {\n                    $headers[strtolower(trim($parts[0]))] = trim($parts[1]);\n                }\n                return strlen($line);\n            },\n        ]);\n        $text = curl_exec($ch);\n        $status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n        $error = curl_error($ch);\n        curl_close($ch);\n        if ($text === false) {\n            throw new RuntimeException(\"Network error: $error\");\n        }\n        return [$status, $headers, (string) $text];\n    }\n}\n","mainteam.php","php",[376,2269,2270,2278,2283,2299,2303,2317,2322,2335,2349,2361,2369,2381,2386,2397,2401,2405,2409,2418,2422,2438,2455,2472,2476,2491,2507,2511,2536,2541,2545,2549,2568,2572,2589,2605,2624,2640,2645,2658,2662,2666,2689,2693,2729,2733,2737,2742,2756,2760,2772,2815,2827,2831,2884,2939,2988,3017,3037,3047,3051,3055,3060,3065,3070,3075,3080,3119,3123,3145,3156,3175,3192,3215,3251,3258,3263,3280,3291,3306,3312,3316,3333,3358,3391,3402,3407,3423,3445,3471,3477,3482,3502,3507,3512,3517,3532,3567,3572,3582,3616,3639,3653,3666,3696,3701,3710,3721,3732,3744,3757,3770,3805,3828,3849,3884,3890,3902,3908,3914,3928,3952,3965,3973,3987,4008,4013,4026,4031],{"__ignoreMap":767},[771,2271,2272,2275],{"class":773,"line":774},[771,2273,2274],{"class":777},"\u003C?",[771,2276,2277],{"class":938},"php\n",[771,2279,2280],{"class":773,"line":792},[771,2281,2282],{"class":902},"\u002F\u002F mainteam.php: a minimal Main Team API client. PHP 8.1 or newer with ext-curl and ext-json.\n",[771,2284,2285,2288,2290,2293,2295,2297],{"class":773,"line":923},[771,2286,2287],{"class":777},"declare",[771,2289,1035],{"class":781},[771,2291,2292],{"class":938},"strict_types",[771,2294,785],{"class":777},[771,2296,425],{"class":938},[771,2298,1041],{"class":781},[771,2300,2301],{"class":773,"line":930},[771,2302,927],{"emptyLinePlaceholder":926},[771,2304,2305,2308,2310,2312,2314],{"class":773,"line":954},[771,2306,2307],{"class":777},"final",[771,2309,1439],{"class":777},[771,2311,1442],{"class":1108},[771,2313,1445],{"class":777},[771,2315,2316],{"class":938}," RuntimeException\n",[771,2318,2319],{"class":773,"line":959},[771,2320,2321],{"class":781},"{\n",[771,2323,2324,2327,2329,2332],{"class":773,"line":978},[771,2325,2326],{"class":777},"    public",[771,2328,1178],{"class":777},[771,2330,2331],{"class":938}," __construct",[771,2333,2334],{"class":781},"(\n",[771,2336,2337,2340,2343,2346],{"class":773,"line":995},[771,2338,2339],{"class":777},"        public",[771,2341,2342],{"class":777}," readonly",[771,2344,2345],{"class":777}," int",[771,2347,2348],{"class":781}," $status,\n",[771,2350,2351,2353,2355,2358],{"class":773,"line":1022},[771,2352,2339],{"class":777},[771,2354,2342],{"class":777},[771,2356,2357],{"class":777}," string",[771,2359,2360],{"class":781}," $errorCode,\n",[771,2362,2363,2366],{"class":773,"line":1044},[771,2364,2365],{"class":777},"        string",[771,2367,2368],{"class":781}," $message,\n",[771,2370,2371,2373,2375,2378],{"class":773,"line":1050},[771,2372,2339],{"class":777},[771,2374,2342],{"class":777},[771,2376,2377],{"class":777}," ?string",[771,2379,2380],{"class":781}," $requestId,\n",[771,2382,2383],{"class":773,"line":1055},[771,2384,2385],{"class":781},"    ) {\n",[771,2387,2388,2391,2394],{"class":773,"line":1073},[771,2389,2390],{"class":777},"        parent::",[771,2392,2393],{"class":1031},"__construct",[771,2395,2396],{"class":781},"($message);\n",[771,2398,2399],{"class":773,"line":1091},[771,2400,2024],{"class":781},[771,2402,2403],{"class":773,"line":1096},[771,2404,1047],{"class":781},[771,2406,2407],{"class":773,"line":1146},[771,2408,927],{"emptyLinePlaceholder":926},[771,2410,2411,2413,2415],{"class":773,"line":1162},[771,2412,2307],{"class":777},[771,2414,1439],{"class":777},[771,2416,2417],{"class":1108}," MainTeam\n",[771,2419,2420],{"class":773,"line":1167},[771,2421,2321],{"class":781},[771,2423,2424,2426,2428,2430,2432,2434,2436],{"class":773,"line":1173},[771,2425,2326],{"class":777},[771,2427,935],{"class":777},[771,2429,939],{"class":938},[771,2431,942],{"class":777},[771,2433,945],{"class":788},[771,2435,948],{"class":781},[771,2437,951],{"class":902},[771,2439,2440,2443,2445,2447,2449,2451,2453],{"class":773,"line":1187},[771,2441,2442],{"class":777},"    private",[771,2444,935],{"class":777},[771,2446,1060],{"class":938},[771,2448,942],{"class":777},[771,2450,1065],{"class":938},[771,2452,948],{"class":781},[771,2454,1070],{"class":902},[771,2456,2457,2459,2461,2463,2465,2467,2470],{"class":773,"line":1221},[771,2458,2442],{"class":777},[771,2460,935],{"class":777},[771,2462,1078],{"class":938},[771,2464,942],{"class":777},[771,2466,1083],{"class":938},[771,2468,2469],{"class":781},";    ",[771,2471,1088],{"class":902},[771,2473,2474],{"class":773,"line":1253},[771,2475,927],{"emptyLinePlaceholder":926},[771,2477,2478,2480,2482,2485,2487,2489],{"class":773,"line":1285},[771,2479,2442],{"class":777},[771,2481,2377],{"class":777},[771,2483,2484],{"class":781}," $token ",[771,2486,785],{"class":777},[771,2488,1157],{"class":938},[771,2490,920],{"class":781},[771,2492,2493,2495,2497,2500,2502,2505],{"class":773,"line":1312},[771,2494,2442],{"class":777},[771,2496,2345],{"class":777},[771,2498,2499],{"class":781}," $tokenExp ",[771,2501,785],{"class":777},[771,2503,2504],{"class":938}," 0",[771,2506,920],{"class":781},[771,2508,2509],{"class":773,"line":1338},[771,2510,927],{"emptyLinePlaceholder":926},[771,2512,2513,2515,2517,2519,2521,2524,2526,2529,2531,2533],{"class":773,"line":1366},[771,2514,2326],{"class":777},[771,2516,1178],{"class":777},[771,2518,2331],{"class":938},[771,2520,1035],{"class":781},[771,2522,2523],{"class":777},"private",[771,2525,2357],{"class":777},[771,2527,2528],{"class":781}," $apiKey, ",[771,2530,2523],{"class":777},[771,2532,2357],{"class":777},[771,2534,2535],{"class":781}," $apiSecret)\n",[771,2537,2538],{"class":773,"line":1380},[771,2539,2540],{"class":781},"    {\n",[771,2542,2543],{"class":773,"line":1416},[771,2544,2024],{"class":781},[771,2546,2547],{"class":773,"line":1424},[771,2548,927],{"emptyLinePlaceholder":926},[771,2550,2551,2553,2556,2558,2561,2563,2565],{"class":773,"line":1429},[771,2552,2326],{"class":777},[771,2554,2555],{"class":777}," static",[771,2557,1178],{"class":777},[771,2559,2560],{"class":1031}," fromEnv",[771,2562,1825],{"class":781},[771,2564,1863],{"class":777},[771,2566,2567],{"class":777}," self\n",[771,2569,2570],{"class":773,"line":1434},[771,2571,2540],{"class":781},[771,2573,2574,2577,2579,2582,2584,2587],{"class":773,"line":1453},[771,2575,2576],{"class":781},"        $key ",[771,2578,785],{"class":777},[771,2580,2581],{"class":938}," getenv",[771,2583,1035],{"class":781},[771,2585,2586],{"class":788},"'MTO_API_KEY'",[771,2588,1041],{"class":781},[771,2590,2591,2594,2596,2598,2600,2603],{"class":773,"line":1476},[771,2592,2593],{"class":781},"        $secret ",[771,2595,785],{"class":777},[771,2597,2581],{"class":938},[771,2599,1035],{"class":781},[771,2601,2602],{"class":788},"'MTO_API_SECRET'",[771,2604,1041],{"class":781},[771,2606,2607,2610,2612,2614,2617,2619,2621],{"class":773,"line":1497},[771,2608,2609],{"class":777},"        if",[771,2611,1001],{"class":781},[771,2613,1004],{"class":777},[771,2615,2616],{"class":781},"$key ",[771,2618,1999],{"class":777},[771,2620,1013],{"class":777},[771,2622,2623],{"class":781},"$secret) {\n",[771,2625,2626,2629,2631,2634,2636,2638],{"class":773,"line":1513},[771,2627,2628],{"class":777},"            throw",[771,2630,1028],{"class":777},[771,2632,2633],{"class":938}," RuntimeException",[771,2635,1035],{"class":781},[771,2637,1038],{"class":788},[771,2639,1041],{"class":781},[771,2641,2642],{"class":773,"line":1526},[771,2643,2644],{"class":781},"        }\n",[771,2646,2647,2650,2652,2655],{"class":773,"line":1546},[771,2648,2649],{"class":777},"        return",[771,2651,1028],{"class":777},[771,2653,2654],{"class":777}," self",[771,2656,2657],{"class":781},"($key, $secret);\n",[771,2659,2660],{"class":773,"line":1564},[771,2661,2024],{"class":781},[771,2663,2664],{"class":773,"line":1570},[771,2665,927],{"emptyLinePlaceholder":926},[771,2667,2668,2670,2672,2674,2676,2678,2681,2684,2686],{"class":773,"line":1575},[771,2669,2326],{"class":777},[771,2671,2555],{"class":777},[771,2673,1178],{"class":777},[771,2675,1101],{"class":1031},[771,2677,1035],{"class":781},[771,2679,2680],{"class":777},"string",[771,2682,2683],{"class":781}," $bytes)",[771,2685,1863],{"class":777},[771,2687,2688],{"class":777}," string\n",[771,2690,2691],{"class":773,"line":1580},[771,2692,2540],{"class":781},[771,2694,2695,2697,2700,2702,2705,2707,2710,2713,2716,2718,2721,2724,2727],{"class":773,"line":1620},[771,2696,2649],{"class":777},[771,2698,2699],{"class":938}," rtrim",[771,2701,1035],{"class":781},[771,2703,2704],{"class":938},"strtr",[771,2706,1035],{"class":781},[771,2708,2709],{"class":938},"base64_encode",[771,2711,2712],{"class":781},"($bytes), ",[771,2714,2715],{"class":788},"'+\u002F'",[771,2717,1330],{"class":781},[771,2719,2720],{"class":788},"'-_'",[771,2722,2723],{"class":781},"), ",[771,2725,2726],{"class":788},"'='",[771,2728,1041],{"class":781},[771,2730,2731],{"class":773,"line":1625},[771,2732,2024],{"class":781},[771,2734,2735],{"class":773,"line":1631},[771,2736,927],{"emptyLinePlaceholder":926},[771,2738,2739],{"class":773,"line":1637},[771,2740,2741],{"class":902},"    \u002F** A signed token, reused until a minute before it expires. *\u002F\n",[771,2743,2744,2746,2748,2750,2752,2754],{"class":773,"line":1643},[771,2745,2326],{"class":777},[771,2747,1178],{"class":777},[771,2749,1181],{"class":1031},[771,2751,1825],{"class":781},[771,2753,1863],{"class":777},[771,2755,2688],{"class":777},[771,2757,2758],{"class":773,"line":1649},[771,2759,2540],{"class":781},[771,2761,2762,2765,2767,2770],{"class":773,"line":1655},[771,2763,2764],{"class":781},"        $now ",[771,2766,785],{"class":777},[771,2768,2769],{"class":938}," time",[771,2771,1730],{"class":781},[771,2773,2774,2776,2778,2781,2784,2787,2790,2792,2794,2797,2799,2802,2804,2807,2810,2812],{"class":773,"line":1661},[771,2775,2609],{"class":777},[771,2777,1001],{"class":781},[771,2779,2780],{"class":938},"$this",[771,2782,2783],{"class":777},"->",[771,2785,2786],{"class":781},"token ",[771,2788,2789],{"class":777},"!==",[771,2791,1157],{"class":938},[771,2793,1946],{"class":777},[771,2795,2796],{"class":938}," $this",[771,2798,2783],{"class":777},[771,2800,2801],{"class":781},"tokenExp ",[771,2803,1236],{"class":777},[771,2805,2806],{"class":777}," self::",[771,2808,2809],{"class":938},"RENEW_MARGIN",[771,2811,1241],{"class":777},[771,2813,2814],{"class":781}," $now) {\n",[771,2816,2817,2820,2822,2824],{"class":773,"line":1717},[771,2818,2819],{"class":777},"            return",[771,2821,2796],{"class":938},[771,2823,2783],{"class":777},[771,2825,2826],{"class":781},"token;\n",[771,2828,2829],{"class":773,"line":1733},[771,2830,2644],{"class":781},[771,2832,2833,2836,2838,2840,2843,2845,2848,2851,2854,2857,2860,2862,2865,2867,2870,2872,2875,2877,2879,2881],{"class":773,"line":1748},[771,2834,2835],{"class":781},"        $header ",[771,2837,785],{"class":777},[771,2839,2806],{"class":777},[771,2841,2842],{"class":1031},"b64url",[771,2844,1035],{"class":781},[771,2846,2847],{"class":938},"json_encode",[771,2849,2850],{"class":781},"([",[771,2852,2853],{"class":788},"'alg'",[771,2855,2856],{"class":777}," =>",[771,2858,2859],{"class":788}," 'HS256'",[771,2861,1330],{"class":781},[771,2863,2864],{"class":788},"'typ'",[771,2866,2856],{"class":777},[771,2868,2869],{"class":788}," 'JWT'",[771,2871,1330],{"class":781},[771,2873,2874],{"class":788},"'kid'",[771,2876,2856],{"class":777},[771,2878,2796],{"class":938},[771,2880,2783],{"class":777},[771,2882,2883],{"class":781},"apiKey]));\n",[771,2885,2886,2889,2891,2893,2895,2897,2899,2901,2904,2906,2908,2910,2913,2916,2918,2921,2924,2926,2929,2931,2933,2936],{"class":773,"line":1774},[771,2887,2888],{"class":781},"        $payload ",[771,2890,785],{"class":777},[771,2892,2806],{"class":777},[771,2894,2842],{"class":1031},[771,2896,1035],{"class":781},[771,2898,2847],{"class":938},[771,2900,2850],{"class":781},[771,2902,2903],{"class":788},"'sub'",[771,2905,2856],{"class":777},[771,2907,2796],{"class":938},[771,2909,2783],{"class":777},[771,2911,2912],{"class":781},"apiKey, ",[771,2914,2915],{"class":788},"'iat'",[771,2917,2856],{"class":777},[771,2919,2920],{"class":781}," $now, ",[771,2922,2923],{"class":788},"'exp'",[771,2925,2856],{"class":777},[771,2927,2928],{"class":781}," $now ",[771,2930,1305],{"class":777},[771,2932,2806],{"class":777},[771,2934,2935],{"class":938},"TOKEN_LIFETIME",[771,2937,2938],{"class":781},"]));\n",[771,2940,2941,2944,2946,2948,2950,2952,2955,2957,2959,2961,2964,2967,2969,2972,2974,2976,2978,2980,2983,2986],{"class":773,"line":1801},[771,2942,2943],{"class":781},"        $signature ",[771,2945,785],{"class":777},[771,2947,2806],{"class":777},[771,2949,2842],{"class":1031},[771,2951,1035],{"class":781},[771,2953,2954],{"class":938},"hash_hmac",[771,2956,1035],{"class":781},[771,2958,1327],{"class":788},[771,2960,1330],{"class":781},[771,2962,2963],{"class":788},"\"",[771,2965,2966],{"class":781},"$header",[771,2968,816],{"class":788},[771,2970,2971],{"class":781},"$payload",[771,2973,2963],{"class":788},[771,2975,1330],{"class":781},[771,2977,2780],{"class":938},[771,2979,2783],{"class":777},[771,2981,2982],{"class":781},"apiSecret, ",[771,2984,2985],{"class":938},"true",[771,2987,2242],{"class":781},[771,2989,2990,2993,2995,2997,2999,3002,3004,3006,3008,3010,3013,3015],{"class":773,"line":1807},[771,2991,2992],{"class":938},"        $this",[771,2994,2783],{"class":777},[771,2996,2786],{"class":781},[771,2998,785],{"class":777},[771,3000,3001],{"class":788}," \"",[771,3003,2966],{"class":781},[771,3005,816],{"class":788},[771,3007,2971],{"class":781},[771,3009,816],{"class":788},[771,3011,3012],{"class":781},"$signature",[771,3014,2963],{"class":788},[771,3016,920],{"class":781},[771,3018,3019,3021,3023,3025,3027,3029,3031,3033,3035],{"class":773,"line":1813},[771,3020,2992],{"class":938},[771,3022,2783],{"class":777},[771,3024,2801],{"class":781},[771,3026,785],{"class":777},[771,3028,2928],{"class":781},[771,3030,1305],{"class":777},[771,3032,2806],{"class":777},[771,3034,2935],{"class":938},[771,3036,920],{"class":781},[771,3038,3039,3041,3043,3045],{"class":773,"line":1833},[771,3040,2649],{"class":777},[771,3042,2796],{"class":938},[771,3044,2783],{"class":777},[771,3046,2826],{"class":781},[771,3048,3049],{"class":773,"line":1842},[771,3050,2024],{"class":781},[771,3052,3053],{"class":773,"line":1881},[771,3054,927],{"emptyLinePlaceholder":926},[771,3056,3057],{"class":773,"line":1887},[771,3058,3059],{"class":902},"    \u002F**\n",[771,3061,3062],{"class":773,"line":1914},[771,3063,3064],{"class":902},"     * Sends one request and returns the decoded JSON body. A 429 is retried\n",[771,3066,3067],{"class":773,"line":1926},[771,3068,3069],{"class":902},"     * after Retry-After, up to three times; a 401 is retried once with a fresh\n",[771,3071,3072],{"class":773,"line":1932},[771,3073,3074],{"class":902},"     * token. Anything else that is not 2xx throws ApiError.\n",[771,3076,3077],{"class":773,"line":1959},[771,3078,3079],{"class":902},"     *\u002F\n",[771,3081,3082,3084,3086,3089,3091,3093,3096,3098,3101,3104,3107,3109,3111,3114,3116],{"class":773,"line":1973},[771,3083,2326],{"class":777},[771,3085,1178],{"class":777},[771,3087,3088],{"class":1031}," call",[771,3090,1035],{"class":781},[771,3092,2680],{"class":777},[771,3094,3095],{"class":781}," $method, ",[771,3097,2680],{"class":777},[771,3099,3100],{"class":781}," $path, ",[771,3102,3103],{"class":777},"?array",[771,3105,3106],{"class":781}," $body ",[771,3108,785],{"class":777},[771,3110,1157],{"class":938},[771,3112,3113],{"class":781},")",[771,3115,1863],{"class":777},[771,3117,3118],{"class":777}," ?array\n",[771,3120,3121],{"class":773,"line":2013},[771,3122,2540],{"class":781},[771,3124,3125,3128,3130,3133,3135,3138,3140,3143],{"class":773,"line":2021},[771,3126,3127],{"class":781},"        $requestId ",[771,3129,785],{"class":777},[771,3131,3132],{"class":938}," bin2hex",[771,3134,1035],{"class":781},[771,3136,3137],{"class":1031},"random_bytes",[771,3139,1035],{"class":781},[771,3141,3142],{"class":938},"16",[771,3144,2242],{"class":781},[771,3146,3147,3150,3152,3154],{"class":773,"line":2027},[771,3148,3149],{"class":781},"        $renewed ",[771,3151,785],{"class":777},[771,3153,1696],{"class":938},[771,3155,920],{"class":781},[771,3157,3158,3161,3164,3166,3168,3171,3173],{"class":773,"line":2046},[771,3159,3160],{"class":777},"        for",[771,3162,3163],{"class":781}," ($attempt ",[771,3165,785],{"class":777},[771,3167,1763],{"class":938},[771,3169,3170],{"class":781},"; ; $attempt",[771,3172,1769],{"class":777},[771,3174,1019],{"class":781},[771,3176,3177,3180,3182,3184,3186,3189],{"class":773,"line":2057},[771,3178,3179],{"class":781},"            [$status, $headers, $text] ",[771,3181,785],{"class":777},[771,3183,2796],{"class":938},[771,3185,2783],{"class":777},[771,3187,3188],{"class":1031},"send",[771,3190,3191],{"class":781},"($method, $path, $body, $requestId);\n",[771,3193,3194,3197,3200,3202,3204,3206,3209,3211,3213],{"class":773,"line":2070},[771,3195,3196],{"class":777},"            if",[771,3198,3199],{"class":781}," ($status ",[771,3201,1851],{"class":777},[771,3203,1943],{"class":938},[771,3205,1946],{"class":777},[771,3207,3208],{"class":781}," $attempt ",[771,3210,1951],{"class":777},[771,3212,1954],{"class":938},[771,3214,1019],{"class":781},[771,3216,3217,3220,3222,3225,3227,3229,3232,3235,3238,3240,3243,3245,3248],{"class":773,"line":2082},[771,3218,3219],{"class":938},"                sleep",[771,3221,1035],{"class":781},[771,3223,3224],{"class":938},"max",[771,3226,1035],{"class":781},[771,3228,425],{"class":938},[771,3230,3231],{"class":781},", (",[771,3233,3234],{"class":777},"int",[771,3236,3237],{"class":781},") ($headers[",[771,3239,1993],{"class":788},[771,3241,3242],{"class":781},"] ",[771,3244,1485],{"class":777},[771,3246,3247],{"class":788}," '1'",[771,3249,3250],{"class":781},")));\n",[771,3252,3253,3256],{"class":773,"line":2089},[771,3254,3255],{"class":777},"                continue",[771,3257,920],{"class":781},[771,3259,3260],{"class":773,"line":2094},[771,3261,3262],{"class":781},"            }\n",[771,3264,3265,3267,3269,3271,3273,3275,3277],{"class":773,"line":2112},[771,3266,3196],{"class":777},[771,3268,3199],{"class":781},[771,3270,1851],{"class":777},[771,3272,2036],{"class":938},[771,3274,1946],{"class":777},[771,3276,1013],{"class":777},[771,3278,3279],{"class":781},"$renewed) {\n",[771,3281,3282,3285,3287,3289],{"class":773,"line":2130},[771,3283,3284],{"class":781},"                $renewed ",[771,3286,785],{"class":777},[771,3288,2065],{"class":938},[771,3290,920],{"class":781},[771,3292,3293,3296,3298,3300,3302,3304],{"class":773,"line":2145},[771,3294,3295],{"class":938},"                $this",[771,3297,2783],{"class":777},[771,3299,2786],{"class":781},[771,3301,785],{"class":777},[771,3303,1157],{"class":938},[771,3305,920],{"class":781},[771,3307,3308,3310],{"class":773,"line":2153},[771,3309,3255],{"class":777},[771,3311,920],{"class":781},[771,3313,3314],{"class":773,"line":2183},[771,3315,3262],{"class":781},[771,3317,3318,3321,3323,3326,3329,3331],{"class":773,"line":2194},[771,3319,3320],{"class":781},"            $json ",[771,3322,785],{"class":777},[771,3324,3325],{"class":938}," json_decode",[771,3327,3328],{"class":781},"($text, ",[771,3330,2985],{"class":938},[771,3332,1041],{"class":781},[771,3334,3335,3337,3339,3342,3345,3347,3350,3353,3356],{"class":773,"line":2208},[771,3336,3196],{"class":777},[771,3338,3199],{"class":781},[771,3340,3341],{"class":777},"\u003C",[771,3343,3344],{"class":938}," 200",[771,3346,1010],{"class":777},[771,3348,3349],{"class":781}," $status ",[771,3351,3352],{"class":777},">=",[771,3354,3355],{"class":938}," 300",[771,3357,1019],{"class":781},[771,3359,3360,3363,3365,3368,3371,3373,3376,3379,3381,3383,3386,3388],{"class":773,"line":2213},[771,3361,3362],{"class":781},"                $error ",[771,3364,785],{"class":777},[771,3366,3367],{"class":938}," is_array",[771,3369,3370],{"class":781},"($json) ",[771,3372,2164],{"class":777},[771,3374,3375],{"class":781}," ($json[",[771,3377,3378],{"class":788},"'error'",[771,3380,3242],{"class":781},[771,3382,1485],{"class":777},[771,3384,3385],{"class":781}," []) ",[771,3387,1863],{"class":777},[771,3389,3390],{"class":781}," [];\n",[771,3392,3393,3396,3398,3400],{"class":773,"line":2245},[771,3394,3395],{"class":777},"                throw",[771,3397,1028],{"class":777},[771,3399,1442],{"class":938},[771,3401,2334],{"class":781},[771,3403,3404],{"class":773,"line":2254},[771,3405,3406],{"class":781},"                    $status,\n",[771,3408,3409,3412,3415,3417,3419,3421],{"class":773,"line":2259},[771,3410,3411],{"class":781},"                    $error[",[771,3413,3414],{"class":788},"'code'",[771,3416,3242],{"class":781},[771,3418,1485],{"class":777},[771,3420,1541],{"class":788},[771,3422,1830],{"class":781},[771,3424,3426,3428,3431,3433,3435,3438,3441,3443],{"class":773,"line":3425},86,[771,3427,3411],{"class":781},[771,3429,3430],{"class":788},"'message'",[771,3432,3242],{"class":781},[771,3434,1485],{"class":777},[771,3436,3437],{"class":788}," \"HTTP ",[771,3439,3440],{"class":781},"$status",[771,3442,2963],{"class":788},[771,3444,1830],{"class":781},[771,3446,3448,3450,3453,3455,3457,3460,3462,3464,3466,3468],{"class":773,"line":3447},87,[771,3449,3411],{"class":781},[771,3451,3452],{"class":788},"'request_id'",[771,3454,3242],{"class":781},[771,3456,1485],{"class":777},[771,3458,3459],{"class":781}," ($headers[",[771,3461,2239],{"class":788},[771,3463,3242],{"class":781},[771,3465,1485],{"class":777},[771,3467,1157],{"class":938},[771,3469,3470],{"class":781},"),\n",[771,3472,3474],{"class":773,"line":3473},88,[771,3475,3476],{"class":781},"                );\n",[771,3478,3480],{"class":773,"line":3479},89,[771,3481,3262],{"class":781},[771,3483,3485,3487,3489,3491,3493,3496,3498,3500],{"class":773,"line":3484},90,[771,3486,2819],{"class":777},[771,3488,3367],{"class":938},[771,3490,3370],{"class":781},[771,3492,2164],{"class":777},[771,3494,3495],{"class":781}," $json ",[771,3497,1863],{"class":777},[771,3499,1157],{"class":938},[771,3501,920],{"class":781},[771,3503,3505],{"class":773,"line":3504},91,[771,3506,2644],{"class":781},[771,3508,3510],{"class":773,"line":3509},92,[771,3511,2024],{"class":781},[771,3513,3515],{"class":773,"line":3514},93,[771,3516,927],{"emptyLinePlaceholder":926},[771,3518,3520,3523,3526,3529],{"class":773,"line":3519},94,[771,3521,3522],{"class":902},"    \u002F** ",[771,3524,3525],{"class":777},"@return",[771,3527,3528],{"class":777}," array",[771,3530,3531],{"class":902},"{0: int, 1: array\u003Cstring, string>, 2: string} *\u002F\n",[771,3533,3535,3537,3539,3542,3544,3546,3548,3550,3552,3554,3557,3559,3562,3564],{"class":773,"line":3534},95,[771,3536,2442],{"class":777},[771,3538,1178],{"class":777},[771,3540,3541],{"class":1031}," send",[771,3543,1035],{"class":781},[771,3545,2680],{"class":777},[771,3547,3095],{"class":781},[771,3549,2680],{"class":777},[771,3551,3100],{"class":781},[771,3553,3103],{"class":777},[771,3555,3556],{"class":781}," $body, ",[771,3558,2680],{"class":777},[771,3560,3561],{"class":781}," $requestId)",[771,3563,1863],{"class":777},[771,3565,3566],{"class":777}," array\n",[771,3568,3570],{"class":773,"line":3569},96,[771,3571,2540],{"class":781},[771,3573,3575,3578,3580],{"class":773,"line":3574},97,[771,3576,3577],{"class":781},"        $headers ",[771,3579,785],{"class":777},[771,3581,3390],{"class":781},[771,3583,3585,3588,3590,3593,3596,3599,3601,3603,3605,3608,3611,3613],{"class":773,"line":3584},98,[771,3586,3587],{"class":781},"        $httpHeaders ",[771,3589,785],{"class":777},[771,3591,3592],{"class":781}," [",[771,3594,3595],{"class":788},"'Authorization: Bearer '",[771,3597,3598],{"class":777}," .",[771,3600,2796],{"class":938},[771,3602,2783],{"class":777},[771,3604,1822],{"class":1031},[771,3606,3607],{"class":781},"(), ",[771,3609,3610],{"class":788},"'X-Request-Id: '",[771,3612,3598],{"class":777},[771,3614,3615],{"class":781}," $requestId];\n",[771,3617,3619,3622,3624,3627,3629,3632,3634,3636],{"class":773,"line":3618},99,[771,3620,3621],{"class":781},"        $ch ",[771,3623,785],{"class":777},[771,3625,3626],{"class":938}," curl_init",[771,3628,1035],{"class":781},[771,3630,3631],{"class":777},"self::",[771,3633,386],{"class":938},[771,3635,3598],{"class":777},[771,3637,3638],{"class":781}," $path);\n",[771,3640,3642,3644,3647,3649,3651],{"class":773,"line":3641},100,[771,3643,2609],{"class":777},[771,3645,3646],{"class":781}," ($body ",[771,3648,2789],{"class":777},[771,3650,1157],{"class":938},[771,3652,1019],{"class":781},[771,3654,3656,3659,3661,3664],{"class":773,"line":3655},101,[771,3657,3658],{"class":781},"            $httpHeaders[] ",[771,3660,785],{"class":777},[771,3662,3663],{"class":788}," 'Content-Type: application\u002Fjson'",[771,3665,920],{"class":781},[771,3667,3669,3672,3675,3678,3680,3682,3685,3688,3691,3694],{"class":773,"line":3668},102,[771,3670,3671],{"class":938},"            curl_setopt",[771,3673,3674],{"class":781},"($ch, ",[771,3676,3677],{"class":938},"CURLOPT_POSTFIELDS",[771,3679,1330],{"class":781},[771,3681,2847],{"class":938},[771,3683,3684],{"class":781},"($body, ",[771,3686,3687],{"class":938},"JSON_THROW_ON_ERROR",[771,3689,3690],{"class":777}," |",[771,3692,3693],{"class":938}," JSON_UNESCAPED_SLASHES",[771,3695,2242],{"class":781},[771,3697,3699],{"class":773,"line":3698},103,[771,3700,2644],{"class":781},[771,3702,3704,3707],{"class":773,"line":3703},104,[771,3705,3706],{"class":938},"        curl_setopt_array",[771,3708,3709],{"class":781},"($ch, [\n",[771,3711,3713,3716,3718],{"class":773,"line":3712},105,[771,3714,3715],{"class":938},"            CURLOPT_CUSTOMREQUEST",[771,3717,2856],{"class":777},[771,3719,3720],{"class":781}," $method,\n",[771,3722,3724,3727,3729],{"class":773,"line":3723},106,[771,3725,3726],{"class":938},"            CURLOPT_HTTPHEADER",[771,3728,2856],{"class":777},[771,3730,3731],{"class":781}," $httpHeaders,\n",[771,3733,3735,3738,3740,3742],{"class":773,"line":3734},107,[771,3736,3737],{"class":938},"            CURLOPT_RETURNTRANSFER",[771,3739,2856],{"class":777},[771,3741,2065],{"class":938},[771,3743,1830],{"class":781},[771,3745,3747,3750,3752,3755],{"class":773,"line":3746},108,[771,3748,3749],{"class":938},"            CURLOPT_CONNECTTIMEOUT",[771,3751,2856],{"class":777},[771,3753,3754],{"class":938}," 5",[771,3756,1830],{"class":781},[771,3758,3760,3763,3765,3768],{"class":773,"line":3759},109,[771,3761,3762],{"class":938},"            CURLOPT_TIMEOUT",[771,3764,2856],{"class":777},[771,3766,3767],{"class":938}," 30",[771,3769,1830],{"class":781},[771,3771,3773,3776,3778,3780,3783,3785,3788,3791,3793,3796,3799,3801,3803],{"class":773,"line":3772},110,[771,3774,3775],{"class":938},"            CURLOPT_HEADERFUNCTION",[771,3777,2856],{"class":777},[771,3779,1178],{"class":777},[771,3781,3782],{"class":781}," ($ch, ",[771,3784,2680],{"class":777},[771,3786,3787],{"class":781}," $line) ",[771,3789,3790],{"class":777},"use",[771,3792,1001],{"class":781},[771,3794,3795],{"class":777},"&",[771,3797,3798],{"class":781},"$headers)",[771,3800,1863],{"class":777},[771,3802,2345],{"class":777},[771,3804,1450],{"class":781},[771,3806,3808,3811,3813,3816,3818,3821,3824,3826],{"class":773,"line":3807},111,[771,3809,3810],{"class":781},"                $parts ",[771,3812,785],{"class":777},[771,3814,3815],{"class":938}," explode",[771,3817,1035],{"class":781},[771,3819,3820],{"class":788},"':'",[771,3822,3823],{"class":781},", $line, ",[771,3825,438],{"class":938},[771,3827,1041],{"class":781},[771,3829,3831,3834,3836,3839,3842,3844,3847],{"class":773,"line":3830},112,[771,3832,3833],{"class":777},"                if",[771,3835,1001],{"class":781},[771,3837,3838],{"class":938},"count",[771,3840,3841],{"class":781},"($parts) ",[771,3843,1851],{"class":777},[771,3845,3846],{"class":938}," 2",[771,3848,1019],{"class":781},[771,3850,3852,3855,3858,3860,3863,3866,3869,3872,3874,3877,3879,3881],{"class":773,"line":3851},113,[771,3853,3854],{"class":781},"                    $headers[",[771,3856,3857],{"class":938},"strtolower",[771,3859,1035],{"class":781},[771,3861,3862],{"class":938},"trim",[771,3864,3865],{"class":781},"($parts[",[771,3867,3868],{"class":938},"0",[771,3870,3871],{"class":781},"]))] ",[771,3873,785],{"class":777},[771,3875,3876],{"class":938}," trim",[771,3878,3865],{"class":781},[771,3880,425],{"class":938},[771,3882,3883],{"class":781},"]);\n",[771,3885,3887],{"class":773,"line":3886},114,[771,3888,3889],{"class":781},"                }\n",[771,3891,3893,3896,3899],{"class":773,"line":3892},115,[771,3894,3895],{"class":777},"                return",[771,3897,3898],{"class":938}," strlen",[771,3900,3901],{"class":781},"($line);\n",[771,3903,3905],{"class":773,"line":3904},116,[771,3906,3907],{"class":781},"            },\n",[771,3909,3911],{"class":773,"line":3910},117,[771,3912,3913],{"class":781},"        ]);\n",[771,3915,3917,3920,3922,3925],{"class":773,"line":3916},118,[771,3918,3919],{"class":781},"        $text ",[771,3921,785],{"class":777},[771,3923,3924],{"class":938}," curl_exec",[771,3926,3927],{"class":781},"($ch);\n",[771,3929,3931,3934,3936,3938,3940,3942,3945,3947,3950],{"class":773,"line":3930},119,[771,3932,3933],{"class":781},"        $status ",[771,3935,785],{"class":777},[771,3937,1001],{"class":781},[771,3939,3234],{"class":777},[771,3941,1112],{"class":781},[771,3943,3944],{"class":938},"curl_getinfo",[771,3946,3674],{"class":781},[771,3948,3949],{"class":938},"CURLINFO_RESPONSE_CODE",[771,3951,1041],{"class":781},[771,3953,3955,3958,3960,3963],{"class":773,"line":3954},120,[771,3956,3957],{"class":781},"        $error ",[771,3959,785],{"class":777},[771,3961,3962],{"class":938}," curl_error",[771,3964,3927],{"class":781},[771,3966,3968,3971],{"class":773,"line":3967},121,[771,3969,3970],{"class":938},"        curl_close",[771,3972,3927],{"class":781},[771,3974,3976,3978,3981,3983,3985],{"class":773,"line":3975},122,[771,3977,2609],{"class":777},[771,3979,3980],{"class":781}," ($text ",[771,3982,1851],{"class":777},[771,3984,1696],{"class":938},[771,3986,1019],{"class":781},[771,3988,3990,3992,3994,3996,3998,4001,4004,4006],{"class":773,"line":3989},123,[771,3991,2628],{"class":777},[771,3993,1028],{"class":777},[771,3995,2633],{"class":938},[771,3997,1035],{"class":781},[771,3999,4000],{"class":788},"\"Network error: ",[771,4002,4003],{"class":781},"$error",[771,4005,2963],{"class":788},[771,4007,1041],{"class":781},[771,4009,4011],{"class":773,"line":4010},124,[771,4012,2644],{"class":781},[771,4014,4016,4018,4021,4023],{"class":773,"line":4015},125,[771,4017,2649],{"class":777},[771,4019,4020],{"class":781}," [$status, $headers, (",[771,4022,2680],{"class":777},[771,4024,4025],{"class":781},") $text];\n",[771,4027,4029],{"class":773,"line":4028},126,[771,4030,2024],{"class":781},[771,4032,4034],{"class":773,"line":4033},127,[771,4035,1047],{"class":781},[547,4037,4039],{"id":4038},"a-token-for-curl","A token for curl",[358,4041,4042,4043,4046],{},"To follow the curl examples, sign a token in your shell. This needs only ",[376,4044,4045],{},"openssl",", and the token\nlasts 15 minutes:",[762,4048,4050],{"className":764,"code":4049,"language":766,"meta":767,"style":767},"b64url() { openssl base64 -A | tr '+\u002F' '-_' | tr -d '='; }\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 + 900)) | b64url)\nSIG=$(printf '%s.%s' \"$HEADER\" \"$PAYLOAD\" | openssl dgst -sha256 -hmac \"$MTO_API_SECRET\" -binary | b64url)\nexport TOKEN=\"$HEADER.$PAYLOAD.$SIG\"\n",[376,4051,4052,4091,4109,4137,4182,4240],{"__ignoreMap":767},[771,4053,4054,4056,4059,4061,4064,4067,4069,4072,4075,4078,4080,4082,4085,4088],{"class":773,"line":774},[771,4055,2842],{"class":1031},[771,4057,4058],{"class":781},"() { ",[771,4060,4045],{"class":1108},[771,4062,4063],{"class":788}," base64",[771,4065,4066],{"class":938}," -A",[771,4068,3690],{"class":777},[771,4070,4071],{"class":1108}," tr",[771,4073,4074],{"class":788}," '+\u002F'",[771,4076,4077],{"class":788}," '-_'",[771,4079,3690],{"class":777},[771,4081,4071],{"class":1108},[771,4083,4084],{"class":938}," -d",[771,4086,4087],{"class":788}," '='",[771,4089,4090],{"class":781},"; }\n",[771,4092,4093,4096,4098,4101,4104,4107],{"class":773,"line":792},[771,4094,4095],{"class":781},"NOW",[771,4097,785],{"class":777},[771,4099,4100],{"class":781},"$(",[771,4102,4103],{"class":1108},"date",[771,4105,4106],{"class":788}," +%s",[771,4108,1335],{"class":781},[771,4110,4111,4114,4116,4118,4121,4124,4126,4129,4131,4133,4135],{"class":773,"line":923},[771,4112,4113],{"class":781},"HEADER",[771,4115,785],{"class":777},[771,4117,4100],{"class":781},[771,4119,4120],{"class":938},"printf",[771,4122,4123],{"class":788}," '{\"alg\":\"HS256\",\"typ\":\"JWT\",\"kid\":\"%s\"}'",[771,4125,3001],{"class":788},[771,4127,4128],{"class":781},"$MTO_API_KEY",[771,4130,2963],{"class":788},[771,4132,3690],{"class":777},[771,4134,1101],{"class":1108},[771,4136,1335],{"class":781},[771,4138,4139,4142,4144,4146,4148,4151,4153,4155,4157,4159,4162,4164,4167,4169,4171,4173,4175,4178,4180],{"class":773,"line":930},[771,4140,4141],{"class":781},"PAYLOAD",[771,4143,785],{"class":777},[771,4145,4100],{"class":781},[771,4147,4120],{"class":938},[771,4149,4150],{"class":788}," '{\"sub\":\"%s\",\"iat\":%d,\"exp\":%d}'",[771,4152,3001],{"class":788},[771,4154,4128],{"class":781},[771,4156,2963],{"class":788},[771,4158,3001],{"class":788},[771,4160,4161],{"class":781},"$NOW",[771,4163,2963],{"class":788},[771,4165,4166],{"class":781}," $((",[771,4168,4095],{"class":1108},[771,4170,1795],{"class":788},[771,4172,1065],{"class":938},[771,4174,1996],{"class":781},[771,4176,4177],{"class":777},"|",[771,4179,1101],{"class":1108},[771,4181,1335],{"class":781},[771,4183,4184,4187,4189,4191,4193,4196,4198,4201,4203,4205,4208,4210,4212,4215,4218,4221,4224,4226,4229,4231,4234,4236,4238],{"class":773,"line":954},[771,4185,4186],{"class":781},"SIG",[771,4188,785],{"class":777},[771,4190,4100],{"class":781},[771,4192,4120],{"class":938},[771,4194,4195],{"class":788}," '%s.%s'",[771,4197,3001],{"class":788},[771,4199,4200],{"class":781},"$HEADER",[771,4202,2963],{"class":788},[771,4204,3001],{"class":788},[771,4206,4207],{"class":781},"$PAYLOAD",[771,4209,2963],{"class":788},[771,4211,3690],{"class":777},[771,4213,4214],{"class":1108}," openssl",[771,4216,4217],{"class":788}," dgst",[771,4219,4220],{"class":938}," -sha256",[771,4222,4223],{"class":938}," -hmac",[771,4225,3001],{"class":788},[771,4227,4228],{"class":781},"$MTO_API_SECRET",[771,4230,2963],{"class":788},[771,4232,4233],{"class":938}," -binary",[771,4235,3690],{"class":777},[771,4237,1101],{"class":1108},[771,4239,1335],{"class":781},[771,4241,4242,4244,4247,4249,4251,4253,4255,4257,4259,4262],{"class":773,"line":959},[771,4243,778],{"class":777},[771,4245,4246],{"class":781}," TOKEN",[771,4248,785],{"class":777},[771,4250,2963],{"class":788},[771,4252,4200],{"class":781},[771,4254,816],{"class":788},[771,4256,4207],{"class":781},[771,4258,816],{"class":788},[771,4260,4261],{"class":781},"$SIG",[771,4263,4264],{"class":788},"\"\n",[394,4266,4268],{"id":4267},"step-1-check-your-credentials","Step 1: check your credentials",[358,4270,4271],{},"Start with the one request that tells you whether your token works and which roles your account holds.",[762,4273,4275],{"className":764,"code":4274,"filename":581,"language":766,"meta":767,"style":767},"curl -s https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fapi-account\u002Fvalidate-me \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,4276,4277,4290],{"__ignoreMap":767},[771,4278,4279,4281,4284,4287],{"class":773,"line":774},[771,4280,581],{"class":1108},[771,4282,4283],{"class":938}," -s",[771,4285,4286],{"class":788}," https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fapi-account\u002Fvalidate-me",[771,4288,4289],{"class":777}," \\\n",[771,4291,4292,4295,4298,4301],{"class":773,"line":792},[771,4293,4294],{"class":938},"  -H",[771,4296,4297],{"class":788}," \"Authorization: Bearer ",[771,4299,4300],{"class":781},"$TOKEN",[771,4302,4264],{"class":788},[762,4304,4308],{"className":4305,"code":4306,"filename":4307,"language":585,"meta":767,"style":767},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"_id\": \"66d0c2f4a1b2c3d4e5f60718\",\n  \"apiKey\": \"key_Q2xpZW50RXhhbXBsZUtleTAx\",\n  \"companyName\": \"Example Schools Ltd\",\n  \"scopes\": [],\n  \"roles\": [\n    { \"effect\": \"allow\", \"action\": \"api\u002F*\", \"target\": \"mto\" },\n    { \"effect\": \"allow\", \"action\": \"*\u002Fread\", \"target\": \"*\" },\n    { \"effect\": \"allow\", \"action\": \"student\u002F*\", \"target\": \"mto\" },\n    { \"effect\": \"allow\", \"action\": \"auth\u002Fsignin\", \"target\": \"stem\" },\n    { \"effect\": \"allow\", \"action\": \"application\u002F*\", \"target\": \"stem\" }\n  ],\n  \"isActive\": true\n}\n","Response 200",[376,4309,4310,4314,4327,4339,4351,4359,4367,4403,4433,4462,4492,4522,4527,4537],{"__ignoreMap":767},[771,4311,4312],{"class":773,"line":774},[771,4313,2321],{"class":781},[771,4315,4316,4320,4322,4325],{"class":773,"line":792},[771,4317,4319],{"class":4318},"sne4z","  \"_id\"",[771,4321,1872],{"class":781},[771,4323,4324],{"class":788},"\"66d0c2f4a1b2c3d4e5f60718\"",[771,4326,1830],{"class":781},[771,4328,4329,4332,4334,4337],{"class":773,"line":923},[771,4330,4331],{"class":4318},"  \"apiKey\"",[771,4333,1872],{"class":781},[771,4335,4336],{"class":788},"\"key_Q2xpZW50RXhhbXBsZUtleTAx\"",[771,4338,1830],{"class":781},[771,4340,4341,4344,4346,4349],{"class":773,"line":930},[771,4342,4343],{"class":4318},"  \"companyName\"",[771,4345,1872],{"class":781},[771,4347,4348],{"class":788},"\"Example Schools Ltd\"",[771,4350,1830],{"class":781},[771,4352,4353,4356],{"class":773,"line":954},[771,4354,4355],{"class":4318},"  \"scopes\"",[771,4357,4358],{"class":781},": [],\n",[771,4360,4361,4364],{"class":773,"line":959},[771,4362,4363],{"class":4318},"  \"roles\"",[771,4365,4366],{"class":781},": [\n",[771,4368,4369,4372,4375,4377,4380,4382,4385,4387,4390,4392,4395,4397,4400],{"class":773,"line":978},[771,4370,4371],{"class":781},"    { ",[771,4373,4374],{"class":4318},"\"effect\"",[771,4376,1872],{"class":781},[771,4378,4379],{"class":788},"\"allow\"",[771,4381,1330],{"class":781},[771,4383,4384],{"class":4318},"\"action\"",[771,4386,1872],{"class":781},[771,4388,4389],{"class":788},"\"api\u002F*\"",[771,4391,1330],{"class":781},[771,4393,4394],{"class":4318},"\"target\"",[771,4396,1872],{"class":781},[771,4398,4399],{"class":788},"\"mto\"",[771,4401,4402],{"class":781}," },\n",[771,4404,4405,4407,4409,4411,4413,4415,4417,4419,4422,4424,4426,4428,4431],{"class":773,"line":995},[771,4406,4371],{"class":781},[771,4408,4374],{"class":4318},[771,4410,1872],{"class":781},[771,4412,4379],{"class":788},[771,4414,1330],{"class":781},[771,4416,4384],{"class":4318},[771,4418,1872],{"class":781},[771,4420,4421],{"class":788},"\"*\u002Fread\"",[771,4423,1330],{"class":781},[771,4425,4394],{"class":4318},[771,4427,1872],{"class":781},[771,4429,4430],{"class":788},"\"*\"",[771,4432,4402],{"class":781},[771,4434,4435,4437,4439,4441,4443,4445,4447,4449,4452,4454,4456,4458,4460],{"class":773,"line":1022},[771,4436,4371],{"class":781},[771,4438,4374],{"class":4318},[771,4440,1872],{"class":781},[771,4442,4379],{"class":788},[771,4444,1330],{"class":781},[771,4446,4384],{"class":4318},[771,4448,1872],{"class":781},[771,4450,4451],{"class":788},"\"student\u002F*\"",[771,4453,1330],{"class":781},[771,4455,4394],{"class":4318},[771,4457,1872],{"class":781},[771,4459,4399],{"class":788},[771,4461,4402],{"class":781},[771,4463,4464,4466,4468,4470,4472,4474,4476,4478,4481,4483,4485,4487,4490],{"class":773,"line":1044},[771,4465,4371],{"class":781},[771,4467,4374],{"class":4318},[771,4469,1872],{"class":781},[771,4471,4379],{"class":788},[771,4473,1330],{"class":781},[771,4475,4384],{"class":4318},[771,4477,1872],{"class":781},[771,4479,4480],{"class":788},"\"auth\u002Fsignin\"",[771,4482,1330],{"class":781},[771,4484,4394],{"class":4318},[771,4486,1872],{"class":781},[771,4488,4489],{"class":788},"\"stem\"",[771,4491,4402],{"class":781},[771,4493,4494,4496,4498,4500,4502,4504,4506,4508,4511,4513,4515,4517,4519],{"class":773,"line":1050},[771,4495,4371],{"class":781},[771,4497,4374],{"class":4318},[771,4499,1872],{"class":781},[771,4501,4379],{"class":788},[771,4503,1330],{"class":781},[771,4505,4384],{"class":4318},[771,4507,1872],{"class":781},[771,4509,4510],{"class":788},"\"application\u002F*\"",[771,4512,1330],{"class":781},[771,4514,4394],{"class":4318},[771,4516,1872],{"class":781},[771,4518,4489],{"class":788},[771,4520,4521],{"class":781}," }\n",[771,4523,4524],{"class":773,"line":1055},[771,4525,4526],{"class":781},"  ],\n",[771,4528,4529,4532,4534],{"class":773,"line":1073},[771,4530,4531],{"class":4318},"  \"isActive\"",[771,4533,1872],{"class":781},[771,4535,4536],{"class":938},"true\n",[771,4538,4539],{"class":773,"line":1091},[771,4540,1047],{"class":781},[358,4542,4543,4544,4547,4548,4551],{},"This is the one JSON response that is ",[371,4545,4546],{},"not"," wrapped in the usual ",[376,4549,4550],{},"{ success, message, data }","\nenvelope: the account comes back bare. Your secret is never part of it.",[358,4553,4554],{},"If this fails:",[552,4556,4557,4577],{},[555,4558,4559,4561,4562,4564,4565,582,4567,4569,4570,1330,4572,582,4574,4576],{},[376,4560,875],{}," means the token was refused. Every reason gets the same message on purpose, so\nwork through the checklist in ",[389,4563,19],{"href":20},": key and secret the right way\nround, ",[376,4566,834],{},[376,4568,838],{}," both equal to your ",[376,4571,560],{},[376,4573,842],{},[376,4575,845],{}," in seconds and at most 3600 apart,\nand your clock within 30 seconds of real time.",[555,4578,4579,4582,4583,4585,4586,4588],{},[376,4580,4581],{},"403 forbidden"," means the token is fine but your account lacks ",[376,4584,629],{}," on ",[376,4587,601],{},". The rest of this\ntutorial can still work; ask your operator to add the role anyway, because it is also what lets you\nrevoke tokens.",[394,4590,4592,4593],{"id":4591},"step-2-find-the-organizations-_id","Step 2: find the organization's ",[376,4594,449],{},[358,4596,4597,4598,4600,4601,1863],{},"Every organization route takes the organization's ",[376,4599,449],{}," in the path, never its slug. List the\norganizations and pick the one you want by ",[376,4602,4603],{},"slug",[762,4605,4607],{"className":764,"code":4606,"filename":581,"language":766,"meta":767,"style":767},"curl -s \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization?limit=100\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,4608,4609,4620],{"__ignoreMap":767},[771,4610,4611,4613,4615,4618],{"class":773,"line":774},[771,4612,581],{"class":1108},[771,4614,4283],{"class":938},[771,4616,4617],{"class":788}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization?limit=100\"",[771,4619,4289],{"class":777},[771,4621,4622,4624,4626,4628],{"class":773,"line":792},[771,4623,4294],{"class":938},[771,4625,4297],{"class":788},[771,4627,4300],{"class":781},[771,4629,4264],{"class":788},[762,4631,4633],{"className":4305,"code":4632,"filename":4307,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Organizations fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"64b7f1c2a9e3d45f10c2b7a1\",\n      \"name\": \"STEM Olympiad\",\n      \"slug\": \"stem\",\n      \"logo\": \"https:\u002F\u002F…\u002Fstem.svg\",\n      \"desc\": \"…\",\n      \"defaultRedirect\": \"https:\u002F\u002Fmy.stemolympiad.org\"\n    },\n    {\n      \"_id\": \"64b7f1c2a9e3d45f10c2b7a2\",\n      \"name\": \"Hi-Lingua\",\n      \"slug\": \"hilingua\",\n      \"logo\": \"https:\u002F\u002F…\u002Fhilingua.svg\",\n      \"desc\": \"…\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 100, \"total\": 5, \"totalPages\": 1 }\n}\n",[376,4634,4635,4639,4650,4662,4669,4673,4685,4697,4708,4720,4732,4742,4747,4751,4762,4773,4784,4795,4804,4808,4812,4857],{"__ignoreMap":767},[771,4636,4637],{"class":773,"line":774},[771,4638,2321],{"class":781},[771,4640,4641,4644,4646,4648],{"class":773,"line":792},[771,4642,4643],{"class":4318},"  \"success\"",[771,4645,1872],{"class":781},[771,4647,2985],{"class":938},[771,4649,1830],{"class":781},[771,4651,4652,4655,4657,4660],{"class":773,"line":923},[771,4653,4654],{"class":4318},"  \"message\"",[771,4656,1872],{"class":781},[771,4658,4659],{"class":788},"\"Organizations fetched successfully.\"",[771,4661,1830],{"class":781},[771,4663,4664,4667],{"class":773,"line":930},[771,4665,4666],{"class":4318},"  \"data\"",[771,4668,4366],{"class":781},[771,4670,4671],{"class":773,"line":954},[771,4672,2540],{"class":781},[771,4674,4675,4678,4680,4683],{"class":773,"line":959},[771,4676,4677],{"class":4318},"      \"_id\"",[771,4679,1872],{"class":781},[771,4681,4682],{"class":788},"\"64b7f1c2a9e3d45f10c2b7a1\"",[771,4684,1830],{"class":781},[771,4686,4687,4690,4692,4695],{"class":773,"line":978},[771,4688,4689],{"class":4318},"      \"name\"",[771,4691,1872],{"class":781},[771,4693,4694],{"class":788},"\"STEM Olympiad\"",[771,4696,1830],{"class":781},[771,4698,4699,4702,4704,4706],{"class":773,"line":995},[771,4700,4701],{"class":4318},"      \"slug\"",[771,4703,1872],{"class":781},[771,4705,4489],{"class":788},[771,4707,1830],{"class":781},[771,4709,4710,4713,4715,4718],{"class":773,"line":1022},[771,4711,4712],{"class":4318},"      \"logo\"",[771,4714,1872],{"class":781},[771,4716,4717],{"class":788},"\"https:\u002F\u002F…\u002Fstem.svg\"",[771,4719,1830],{"class":781},[771,4721,4722,4725,4727,4730],{"class":773,"line":1044},[771,4723,4724],{"class":4318},"      \"desc\"",[771,4726,1872],{"class":781},[771,4728,4729],{"class":788},"\"…\"",[771,4731,1830],{"class":781},[771,4733,4734,4737,4739],{"class":773,"line":1050},[771,4735,4736],{"class":4318},"      \"defaultRedirect\"",[771,4738,1872],{"class":781},[771,4740,4741],{"class":788},"\"https:\u002F\u002Fmy.stemolympiad.org\"\n",[771,4743,4744],{"class":773,"line":1055},[771,4745,4746],{"class":781},"    },\n",[771,4748,4749],{"class":773,"line":1073},[771,4750,2540],{"class":781},[771,4752,4753,4755,4757,4760],{"class":773,"line":1091},[771,4754,4677],{"class":4318},[771,4756,1872],{"class":781},[771,4758,4759],{"class":788},"\"64b7f1c2a9e3d45f10c2b7a2\"",[771,4761,1830],{"class":781},[771,4763,4764,4766,4768,4771],{"class":773,"line":1096},[771,4765,4689],{"class":4318},[771,4767,1872],{"class":781},[771,4769,4770],{"class":788},"\"Hi-Lingua\"",[771,4772,1830],{"class":781},[771,4774,4775,4777,4779,4782],{"class":773,"line":1146},[771,4776,4701],{"class":4318},[771,4778,1872],{"class":781},[771,4780,4781],{"class":788},"\"hilingua\"",[771,4783,1830],{"class":781},[771,4785,4786,4788,4790,4793],{"class":773,"line":1162},[771,4787,4712],{"class":4318},[771,4789,1872],{"class":781},[771,4791,4792],{"class":788},"\"https:\u002F\u002F…\u002Fhilingua.svg\"",[771,4794,1830],{"class":781},[771,4796,4797,4799,4801],{"class":773,"line":1167},[771,4798,4724],{"class":4318},[771,4800,1872],{"class":781},[771,4802,4803],{"class":788},"\"…\"\n",[771,4805,4806],{"class":773,"line":1173},[771,4807,2024],{"class":781},[771,4809,4810],{"class":773,"line":1187},[771,4811,4526],{"class":781},[771,4813,4814,4817,4820,4823,4825,4827,4829,4832,4834,4837,4839,4842,4844,4846,4848,4851,4853,4855],{"class":773,"line":1221},[771,4815,4816],{"class":4318},"  \"pagination\"",[771,4818,4819],{"class":781},": { ",[771,4821,4822],{"class":4318},"\"page\"",[771,4824,1872],{"class":781},[771,4826,425],{"class":938},[771,4828,1330],{"class":781},[771,4830,4831],{"class":4318},"\"limit\"",[771,4833,1872],{"class":781},[771,4835,4836],{"class":938},"100",[771,4838,1330],{"class":781},[771,4840,4841],{"class":4318},"\"total\"",[771,4843,1872],{"class":781},[771,4845,484],{"class":938},[771,4847,1330],{"class":781},[771,4849,4850],{"class":4318},"\"totalPages\"",[771,4852,1872],{"class":781},[771,4854,425],{"class":938},[771,4856,4521],{"class":781},[771,4858,4859],{"class":773,"line":1253},[771,4860,1047],{"class":781},[358,4862,4863,4864,4866],{},"The list holds the five organizations that run exams (abridged above). ",[376,4865,601],{},", the core record, is not\nin it: the routes without an organization id, such as registration in step 4, act on it.",[358,4868,4869,4870,4872,4873,4876,4877,4880,4881,4884,4885,4887],{},"An organization's ",[376,4871,449],{}," does not change, so look it up once and keep it in your configuration. If you\nput the slug in the path by mistake (",[376,4874,4875],{},"\u002Fv1\u002Fstem\u002Fexam","), the answer is ",[376,4878,4879],{},"404 not_found"," with the message\n",[376,4882,4883],{},"Organization not found!",". See ",[389,4886,22],{"href":23}," for the difference between the core\nrecord and the organizations.",[394,4889,4891],{"id":4890},"step-3-look-up-the-country","Step 3: look up the country",[358,4893,4894,4895,4897,4898,4901],{},"Registration takes the country as an ",[376,4896,449],{},". Countries are paginated like every list, at most 100 per\npage, so walk the pages until you find the one you want. Here the student lives in Germany (",[376,4899,4900],{},"DE","):",[762,4903,4905],{"className":764,"code":4904,"filename":581,"language":766,"meta":767,"style":767},"curl -s \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?page=1&limit=100\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,4906,4907,4918],{"__ignoreMap":767},[771,4908,4909,4911,4913,4916],{"class":773,"line":774},[771,4910,581],{"class":1108},[771,4912,4283],{"class":938},[771,4914,4915],{"class":788}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?page=1&limit=100\"",[771,4917,4289],{"class":777},[771,4919,4920,4922,4924,4926],{"class":773,"line":792},[771,4921,4294],{"class":938},[771,4923,4297],{"class":788},[771,4925,4300],{"class":781},[771,4927,4264],{"class":788},[762,4929,4932],{"className":4305,"code":4930,"filename":4931,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Countries fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"630e0182c53dc79a6836e67e\",\n      \"name\": \"GERMANY\",\n      \"iso2\": \"DE\",\n      \"iso3\": \"DEU\",\n      \"dialCode\": \"+49\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 100, \"total\": 247, \"totalPages\": 3 }\n}\n","Response 200 (abridged)",[376,4933,4934,4938,4948,4959,4965,4969,4980,4991,5003,5015,5025,5029,5033,5072],{"__ignoreMap":767},[771,4935,4936],{"class":773,"line":774},[771,4937,2321],{"class":781},[771,4939,4940,4942,4944,4946],{"class":773,"line":792},[771,4941,4643],{"class":4318},[771,4943,1872],{"class":781},[771,4945,2985],{"class":938},[771,4947,1830],{"class":781},[771,4949,4950,4952,4954,4957],{"class":773,"line":923},[771,4951,4654],{"class":4318},[771,4953,1872],{"class":781},[771,4955,4956],{"class":788},"\"Countries fetched successfully.\"",[771,4958,1830],{"class":781},[771,4960,4961,4963],{"class":773,"line":930},[771,4962,4666],{"class":4318},[771,4964,4366],{"class":781},[771,4966,4967],{"class":773,"line":954},[771,4968,2540],{"class":781},[771,4970,4971,4973,4975,4978],{"class":773,"line":959},[771,4972,4677],{"class":4318},[771,4974,1872],{"class":781},[771,4976,4977],{"class":788},"\"630e0182c53dc79a6836e67e\"",[771,4979,1830],{"class":781},[771,4981,4982,4984,4986,4989],{"class":773,"line":978},[771,4983,4689],{"class":4318},[771,4985,1872],{"class":781},[771,4987,4988],{"class":788},"\"GERMANY\"",[771,4990,1830],{"class":781},[771,4992,4993,4996,4998,5001],{"class":773,"line":995},[771,4994,4995],{"class":4318},"      \"iso2\"",[771,4997,1872],{"class":781},[771,4999,5000],{"class":788},"\"DE\"",[771,5002,1830],{"class":781},[771,5004,5005,5008,5010,5013],{"class":773,"line":1022},[771,5006,5007],{"class":4318},"      \"iso3\"",[771,5009,1872],{"class":781},[771,5011,5012],{"class":788},"\"DEU\"",[771,5014,1830],{"class":781},[771,5016,5017,5020,5022],{"class":773,"line":1044},[771,5018,5019],{"class":4318},"      \"dialCode\"",[771,5021,1872],{"class":781},[771,5023,5024],{"class":788},"\"+49\"\n",[771,5026,5027],{"class":773,"line":1050},[771,5028,2024],{"class":781},[771,5030,5031],{"class":773,"line":1055},[771,5032,4526],{"class":781},[771,5034,5035,5037,5039,5041,5043,5045,5047,5049,5051,5053,5055,5057,5059,5062,5064,5066,5068,5070],{"class":773,"line":1073},[771,5036,4816],{"class":4318},[771,5038,4819],{"class":781},[771,5040,4822],{"class":4318},[771,5042,1872],{"class":781},[771,5044,425],{"class":938},[771,5046,1330],{"class":781},[771,5048,4831],{"class":4318},[771,5050,1872],{"class":781},[771,5052,4836],{"class":938},[771,5054,1330],{"class":781},[771,5056,4841],{"class":4318},[771,5058,1872],{"class":781},[771,5060,5061],{"class":938},"247",[771,5063,1330],{"class":781},[771,5065,4850],{"class":4318},[771,5067,1872],{"class":781},[771,5069,455],{"class":938},[771,5071,4521],{"class":781},[771,5073,5074],{"class":773,"line":1091},[771,5075,1047],{"class":781},[358,5077,5078],{},"A few things about the other three location fields, so you know what you can skip:",[552,5080,5081,5094,5114,5126],{},[555,5082,5083,5086,5087,5090,5091],{},[371,5084,5085],{},"Some countries cannot be selected."," They are left out of this list, and registering a student\nwith one of their ids answers ",[376,5088,5089],{},"400"," with ",[376,5092,5093],{},"country is not a known country.",[555,5095,5096,5102,5103,5106,5107,5110,5111,5113],{},[371,5097,5098,5101],{},[376,5099,5100],{},"grade"," accepts a name."," Send ",[376,5104,5105],{},"\"10\""," rather than an id if that is what your records hold. The\nnames are the ones ",[376,5108,5109],{},"GET \u002Fv1\u002Fgrade"," lists; the ids are the same on every organization. An unknown\ngrade is a ",[376,5112,5089],{},", never a new grade.",[555,5115,5116,5125],{},[371,5117,5118,582,5121,5124],{},[376,5119,5120],{},"city",[376,5122,5123],{},"school"," accept names."," A city name is looked up inside the country you send, and a\nschool name inside that country and city. Names are matched without regard to case.",[555,5127,5128,5131,5132,5134,5135,5138],{},[371,5129,5130],{},"Nothing is ever created."," A city or school the platform does not know is a ",[376,5133,5089],{}," naming the field,\nfor example ",[376,5136,5137],{},"school is not a known school. This API does not create reference data."," Ask your\ncontact to add missing schools rather than guessing a spelling.",[358,5140,5141,5142,5144],{},"See ",[389,5143,74],{"href":75}," for caching advice.",[394,5146,5148],{"id":5147},"step-4-register-the-student","Step 4: register the student",[358,5150,5151],{},"Send the student's details to the core record:",[762,5153,5155],{"className":764,"code":5154,"filename":581,"language":766,"meta":767,"style":767},"curl -s -X POST https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"firstName\": \"Jane\",\n    \"lastName\": \"Doe\",\n    \"email\": \"jane.doe@example.com\",\n    \"birth\": \"14\u002F05\u002F2011\",\n    \"sex\": \"f\",\n    \"country\": \"630e0182c53dc79a6836e67e\",\n    \"grade\": \"10\",\n    \"city\": \"Berlin\",\n    \"school\": \"Berlin International School\"\n  }'\n",[376,5156,5157,5174,5186,5195,5203,5208,5213,5218,5223,5228,5233,5238,5243,5248],{"__ignoreMap":767},[771,5158,5159,5161,5163,5166,5169,5172],{"class":773,"line":774},[771,5160,581],{"class":1108},[771,5162,4283],{"class":938},[771,5164,5165],{"class":938}," -X",[771,5167,5168],{"class":788}," POST",[771,5170,5171],{"class":788}," https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent",[771,5173,4289],{"class":777},[771,5175,5176,5178,5180,5182,5184],{"class":773,"line":792},[771,5177,4294],{"class":938},[771,5179,4297],{"class":788},[771,5181,4300],{"class":781},[771,5183,2963],{"class":788},[771,5185,4289],{"class":777},[771,5187,5188,5190,5193],{"class":773,"line":923},[771,5189,4294],{"class":938},[771,5191,5192],{"class":788}," \"Content-Type: application\u002Fjson\"",[771,5194,4289],{"class":777},[771,5196,5197,5200],{"class":773,"line":930},[771,5198,5199],{"class":938},"  -d",[771,5201,5202],{"class":788}," '{\n",[771,5204,5205],{"class":773,"line":954},[771,5206,5207],{"class":788},"    \"firstName\": \"Jane\",\n",[771,5209,5210],{"class":773,"line":959},[771,5211,5212],{"class":788},"    \"lastName\": \"Doe\",\n",[771,5214,5215],{"class":773,"line":978},[771,5216,5217],{"class":788},"    \"email\": \"jane.doe@example.com\",\n",[771,5219,5220],{"class":773,"line":995},[771,5221,5222],{"class":788},"    \"birth\": \"14\u002F05\u002F2011\",\n",[771,5224,5225],{"class":773,"line":1022},[771,5226,5227],{"class":788},"    \"sex\": \"f\",\n",[771,5229,5230],{"class":773,"line":1044},[771,5231,5232],{"class":788},"    \"country\": \"630e0182c53dc79a6836e67e\",\n",[771,5234,5235],{"class":773,"line":1050},[771,5236,5237],{"class":788},"    \"grade\": \"10\",\n",[771,5239,5240],{"class":773,"line":1055},[771,5241,5242],{"class":788},"    \"city\": \"Berlin\",\n",[771,5244,5245],{"class":773,"line":1073},[771,5246,5247],{"class":788},"    \"school\": \"Berlin International School\"\n",[771,5249,5250],{"class":773,"line":1091},[771,5251,5252],{"class":788},"  }'\n",[399,5254,5255,5268],{},[402,5256,5257],{},[405,5258,5259,5262,5265],{},[408,5260,5261],{},"Field",[408,5263,5264],{},"Required",[408,5266,5267],{},"Rule",[418,5269,5270,5283,5294,5306,5332,5353,5368,5382,5398,5415,5428,5468],{},[405,5271,5272,5277,5280],{},[423,5273,5274],{},[376,5275,5276],{},"firstName",[423,5278,5279],{},"yes",[423,5281,5282],{},"A non-empty string",[405,5284,5285,5290,5292],{},[423,5286,5287],{},[376,5288,5289],{},"lastName",[423,5291,5279],{},[423,5293,5282],{},[405,5295,5296,5301,5303],{},[423,5297,5298],{},[376,5299,5300],{},"email",[423,5302,5279],{},[423,5304,5305],{},"A real email address, unused anywhere on the platform",[405,5307,5308,5313,5315],{},[423,5309,5310],{},[376,5311,5312],{},"birth",[423,5314,5279],{},[423,5316,5317,5320,5321,5324,5325,582,5328,5331],{},[376,5318,5319],{},"DD\u002FMM\u002FYYYY",", for example ",[376,5322,5323],{},"14\u002F05\u002F2011",", and a date that exists. ",[376,5326,5327],{},"2011-05-14",[376,5329,5330],{},"31\u002F02\u002F2011"," are refused",[405,5333,5334,5339,5341],{},[423,5335,5336],{},[376,5337,5338],{},"sex",[423,5340,5279],{},[423,5342,5343,1330,5346,5349,5350],{},[376,5344,5345],{},"m",[376,5347,5348],{},"f"," or ",[376,5351,5352],{},"n",[405,5354,5355,5360,5362],{},[423,5356,5357],{},[376,5358,5359],{},"country",[423,5361,5279],{},[423,5363,5364,5365,5367],{},"A country ",[376,5366,449],{}," from step 3",[405,5369,5370,5374,5376],{},[423,5371,5372],{},[376,5373,5100],{},[423,5375,5279],{},[423,5377,5378,5379,5381],{},"A grade ",[376,5380,449],{}," or name",[405,5383,5384,5388,5390],{},[423,5385,5386],{},[376,5387,5120],{},[423,5389,5279],{},[423,5391,5392,5393,5395,5396],{},"A city ",[376,5394,449],{},", or a name within ",[376,5397,5359],{},[405,5399,5400,5404,5406],{},[423,5401,5402],{},[376,5403,5123],{},[423,5405,5279],{},[423,5407,5408,5409,5395,5411,582,5413],{},"A school ",[376,5410,449],{},[376,5412,5359],{},[376,5414,5120],{},[405,5416,5417,5422,5425],{},[423,5418,5419],{},[376,5420,5421],{},"phone",[423,5423,5424],{},"no",[423,5426,5427],{},"A string",[405,5429,5430,5435,5437],{},[423,5431,5432],{},[376,5433,5434],{},"activatedPlatformsThisSeason",[423,5436,5424],{},[423,5438,5439,5440,5443,5444,1330,5446,1330,5449,1330,5452,582,5455,5458,5459,948,5462,5465,5466],{},"Which organizations the student may use: ",[376,5441,5442],{},"common"," for all of them, or the slugs ",[376,5445,537],{},[376,5447,5448],{},"hilingua",[376,5450,5451],{},"neo",[376,5453,5454],{},"gmath",[376,5456,5457],{},"coding",". Leave it out and it is ",[376,5460,5461],{},"[\"common\"]",[376,5463,5464],{},"null"," is refused with ",[376,5467,5089],{},[405,5469,5470,5475,5477],{},[423,5471,5472],{},[376,5473,5474],{},"password",[423,5476,5424],{},[423,5478,5479,5480,4585,5482,5484,5485],{},"Needs ",[376,5481,689],{},[376,5483,601],{}," as well. Leave it out: step 5 signs the student in without one. See ",[389,5486,68],{"href":69},[358,5488,5489,5490,5492,5493,5496],{},"Any other field is refused with ",[376,5491,5089],{},", naming it: ",[376,5494,5495],{},"property username should not exist",". Send only the\nfields above, not a whole record copied out of your own system.",[762,5498,5501],{"className":4305,"code":5499,"filename":5500,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"User registered successfully.\",\n  \"data\": {\n    \"_id\": \"66e6a3f5c1d2b30012a4f9c1\",\n    \"username\": \"XXB1045\",\n    \"firstName\": \"Jane\",\n    \"lastName\": \"Doe\",\n    \"fullName\": \"Jane Doe\",\n    \"email\": \"jane.doe@example.com\",\n    \"emailConfirmed\": false,\n    \"birth\": \"14\u002F05\u002F2011\",\n    \"sex\": \"f\",\n    \"country\": \"630e0182c53dc79a6836e67e\",\n    \"city\": \"63a1d9e0b4c5a6f700112233\",\n    \"school\": \"64f2e1d0c3b4a59600aabbcc\",\n    \"grade\": \"630e01826836e67ec53dc7a6\",\n    \"activatedPlatformsThisSeason\": [\"common\"],\n    \"createdAt\": \"2026-09-15T10:18:02.117Z\",\n    \"updatedAt\": \"2026-09-15T10:18:02.117Z\"\n  }\n}\n","Response 201",[376,5502,5503,5507,5517,5528,5535,5547,5559,5571,5583,5595,5607,5619,5631,5643,5654,5666,5678,5690,5704,5716,5726,5730],{"__ignoreMap":767},[771,5504,5505],{"class":773,"line":774},[771,5506,2321],{"class":781},[771,5508,5509,5511,5513,5515],{"class":773,"line":792},[771,5510,4643],{"class":4318},[771,5512,1872],{"class":781},[771,5514,2985],{"class":938},[771,5516,1830],{"class":781},[771,5518,5519,5521,5523,5526],{"class":773,"line":923},[771,5520,4654],{"class":4318},[771,5522,1872],{"class":781},[771,5524,5525],{"class":788},"\"User registered successfully.\"",[771,5527,1830],{"class":781},[771,5529,5530,5532],{"class":773,"line":930},[771,5531,4666],{"class":4318},[771,5533,5534],{"class":781},": {\n",[771,5536,5537,5540,5542,5545],{"class":773,"line":954},[771,5538,5539],{"class":4318},"    \"_id\"",[771,5541,1872],{"class":781},[771,5543,5544],{"class":788},"\"66e6a3f5c1d2b30012a4f9c1\"",[771,5546,1830],{"class":781},[771,5548,5549,5552,5554,5557],{"class":773,"line":959},[771,5550,5551],{"class":4318},"    \"username\"",[771,5553,1872],{"class":781},[771,5555,5556],{"class":788},"\"XXB1045\"",[771,5558,1830],{"class":781},[771,5560,5561,5564,5566,5569],{"class":773,"line":978},[771,5562,5563],{"class":4318},"    \"firstName\"",[771,5565,1872],{"class":781},[771,5567,5568],{"class":788},"\"Jane\"",[771,5570,1830],{"class":781},[771,5572,5573,5576,5578,5581],{"class":773,"line":995},[771,5574,5575],{"class":4318},"    \"lastName\"",[771,5577,1872],{"class":781},[771,5579,5580],{"class":788},"\"Doe\"",[771,5582,1830],{"class":781},[771,5584,5585,5588,5590,5593],{"class":773,"line":1022},[771,5586,5587],{"class":4318},"    \"fullName\"",[771,5589,1872],{"class":781},[771,5591,5592],{"class":788},"\"Jane Doe\"",[771,5594,1830],{"class":781},[771,5596,5597,5600,5602,5605],{"class":773,"line":1044},[771,5598,5599],{"class":4318},"    \"email\"",[771,5601,1872],{"class":781},[771,5603,5604],{"class":788},"\"jane.doe@example.com\"",[771,5606,1830],{"class":781},[771,5608,5609,5612,5614,5617],{"class":773,"line":1050},[771,5610,5611],{"class":4318},"    \"emailConfirmed\"",[771,5613,1872],{"class":781},[771,5615,5616],{"class":938},"false",[771,5618,1830],{"class":781},[771,5620,5621,5624,5626,5629],{"class":773,"line":1055},[771,5622,5623],{"class":4318},"    \"birth\"",[771,5625,1872],{"class":781},[771,5627,5628],{"class":788},"\"14\u002F05\u002F2011\"",[771,5630,1830],{"class":781},[771,5632,5633,5636,5638,5641],{"class":773,"line":1073},[771,5634,5635],{"class":4318},"    \"sex\"",[771,5637,1872],{"class":781},[771,5639,5640],{"class":788},"\"f\"",[771,5642,1830],{"class":781},[771,5644,5645,5648,5650,5652],{"class":773,"line":1091},[771,5646,5647],{"class":4318},"    \"country\"",[771,5649,1872],{"class":781},[771,5651,4977],{"class":788},[771,5653,1830],{"class":781},[771,5655,5656,5659,5661,5664],{"class":773,"line":1096},[771,5657,5658],{"class":4318},"    \"city\"",[771,5660,1872],{"class":781},[771,5662,5663],{"class":788},"\"63a1d9e0b4c5a6f700112233\"",[771,5665,1830],{"class":781},[771,5667,5668,5671,5673,5676],{"class":773,"line":1146},[771,5669,5670],{"class":4318},"    \"school\"",[771,5672,1872],{"class":781},[771,5674,5675],{"class":788},"\"64f2e1d0c3b4a59600aabbcc\"",[771,5677,1830],{"class":781},[771,5679,5680,5683,5685,5688],{"class":773,"line":1162},[771,5681,5682],{"class":4318},"    \"grade\"",[771,5684,1872],{"class":781},[771,5686,5687],{"class":788},"\"630e01826836e67ec53dc7a6\"",[771,5689,1830],{"class":781},[771,5691,5692,5695,5698,5701],{"class":773,"line":1167},[771,5693,5694],{"class":4318},"    \"activatedPlatformsThisSeason\"",[771,5696,5697],{"class":781},": [",[771,5699,5700],{"class":788},"\"common\"",[771,5702,5703],{"class":781},"],\n",[771,5705,5706,5709,5711,5714],{"class":773,"line":1173},[771,5707,5708],{"class":4318},"    \"createdAt\"",[771,5710,1872],{"class":781},[771,5712,5713],{"class":788},"\"2026-09-15T10:18:02.117Z\"",[771,5715,1830],{"class":781},[771,5717,5718,5721,5723],{"class":773,"line":1187},[771,5719,5720],{"class":4318},"    \"updatedAt\"",[771,5722,1872],{"class":781},[771,5724,5725],{"class":788},"\"2026-09-15T10:18:02.117Z\"\n",[771,5727,5728],{"class":773,"line":1221},[771,5729,1567],{"class":781},[771,5731,5732],{"class":773,"line":1253},[771,5733,1047],{"class":781},[358,5735,5736],{},"What the response tells you:",[552,5738,5739,5753,5762,5776,5787],{},[555,5740,5741,5746,5747,5750,5751,816],{},[371,5742,5743,5745],{},[376,5744,449],{}," is the student's core id."," Store it against your own record of the student. It is the\n",[376,5748,5749],{},"\u003CstudentId>"," every later request takes, on every organization. See ",[389,5752,36],{"href":37},[555,5754,5755,5761],{},[371,5756,5757,5760],{},[376,5758,5759],{},"username"," is minted for you"," and cannot be changed. It is what the student and support staff\nquote.",[555,5763,5764,5770,5771,582,5773,5775],{},[371,5765,5766,5769],{},[376,5767,5768],{},"fullName"," is derived"," from ",[376,5772,5276],{},[376,5774,5289],{},"; you never send it.",[555,5777,5778,5786],{},[371,5779,5780,5783,5784,816],{},[376,5781,5782],{},"emailConfirmed"," starts as ",[376,5785,5616],{}," That does not stop anything in this tutorial.",[555,5788,5789,5790,5793],{},"The four location fields come back as the ids they resolved to. ",[376,5791,5792],{},"GET \u002Fv1\u002Fstudent\u002F\u003CstudentId>","\nreturns them as full documents.",[547,5795,5797],{"id":5796},"when-registration-is-refused","When registration is refused",[399,5799,5800,5813],{},[402,5801,5802],{},[405,5803,5804,5807,5810],{},[408,5805,5806],{},"Status",[408,5808,5809],{},"Message",[408,5811,5812],{},"What to do",[418,5814,5815,5830,5844,5859,5875],{},[405,5816,5817,5822,5827],{},[423,5818,5819],{},[376,5820,5821],{},"409 conflict",[423,5823,5824],{},[376,5825,5826],{},"A student with that email is already registered to this account (66e6a3f5c1d2b30012a4f9c1).",[423,5828,5829],{},"You registered this student before. Use the id in the message.",[405,5831,5832,5836,5841],{},[423,5833,5834],{},[376,5835,5821],{},[423,5837,5838],{},[376,5839,5840],{},"That email address is already registered.",[423,5842,5843],{},"Another account holds the address. It cannot be used; ask the student for another.",[405,5845,5846,5851,5856],{},[423,5847,5848],{},[376,5849,5850],{},"400 bad_request",[423,5852,5853],{},[376,5854,5855],{},"birth must be a real date in DD\u002FMM\u002FYYYY format",[423,5857,5858],{},"Fix the named field and send again. The message names one problem at a time.",[405,5860,5861,5865,5870],{},[423,5862,5863],{},[376,5864,5850],{},[423,5866,5867],{},[376,5868,5869],{},"grade is not a known grade. This API does not create reference data.",[423,5871,5872,5873,816],{},"Use a name or id from ",[376,5874,5109],{},[405,5876,5877,5881,5886],{},[423,5878,5879],{},[376,5880,4581],{},[423,5882,5883],{},[376,5884,5885],{},"Setting a student's password needs the auth\u002Fsignin permission on mto, the same grant a sign-in link needs.",[423,5887,5888,5889,5891],{},"Leave ",[376,5890,5474],{}," out.",[365,5893,5894],{"type":367},[358,5895,5896,5899,5900,5903,5904,5906,5907,816],{},[371,5897,5898],{},"Registration is not idempotent."," A repeat is refused with ",[376,5901,5902],{},"409",", not answered with the first\nresult. If a registration times out and you do not know whether it went through, send the same request\nagain. A ",[376,5905,5902],{}," that names an id tells you it did, and which id it got. Do not put registration in a\nblind retry loop. See ",[389,5908,5909],{"href":49},"Retries and idempotency",[394,5911,5913],{"id":5912},"step-5-send-the-student-in-once","Step 5: send the student in once",[358,5915,5916,5917,5920],{},"The core record is the student's identity. Each organization also keeps ",[371,5918,5919],{},"its own copy"," of the\nstudent, and that copy is created the first time the student signs in to that organization.\nApplications, certificates, reports and supervisor links all hang off that copy, so the student has to\nsign in once before you can enter them for anything.",[358,5922,5923],{},"Ask for a sign-in link:",[762,5925,5927],{"className":764,"code":5926,"filename":581,"language":766,"meta":767,"style":767},"curl -s -X POST https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fauth\u002Fsignin \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"studentId\": \"66e6a3f5c1d2b30012a4f9c1\" }'\n",[376,5928,5929,5958,5970,5978],{"__ignoreMap":767},[771,5930,5931,5933,5935,5937,5939,5942,5944,5947,5950,5953,5956],{"class":773,"line":774},[771,5932,581],{"class":1108},[771,5934,4283],{"class":938},[771,5936,5165],{"class":938},[771,5938,5168],{"class":788},[771,5940,5941],{"class":788}," https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F",[771,5943,3341],{"class":777},[771,5945,5946],{"class":788},"organizationI",[771,5948,5949],{"class":781},"d",[771,5951,5952],{"class":777},">",[771,5954,5955],{"class":788},"\u002Fauth\u002Fsignin",[771,5957,4289],{"class":777},[771,5959,5960,5962,5964,5966,5968],{"class":773,"line":792},[771,5961,4294],{"class":938},[771,5963,4297],{"class":788},[771,5965,4300],{"class":781},[771,5967,2963],{"class":788},[771,5969,4289],{"class":777},[771,5971,5972,5974,5976],{"class":773,"line":923},[771,5973,4294],{"class":938},[771,5975,5192],{"class":788},[771,5977,4289],{"class":777},[771,5979,5980,5982],{"class":773,"line":930},[771,5981,5199],{"class":938},[771,5983,5984],{"class":788}," '{ \"studentId\": \"66e6a3f5c1d2b30012a4f9c1\" }'\n",[762,5986,5988],{"className":4305,"code":5987,"filename":4307,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Sign-in link generated successfully.\",\n  \"data\": {\n    \"url\": \"https:\u002F\u002Fauth.main-team.org\u002Fapi\u002Fuser\u002Foauth\u002Finvoke?accessToken=q8x2…&redirectUrl=…\",\n    \"organization\": \"stem\",\n    \"studentId\": \"66e6a3f5c1d2b30012a4f9c1\",\n    \"expiresIn\": 120\n  }\n}\n",[376,5989,5990,5994,6004,6015,6021,6033,6044,6055,6065,6069],{"__ignoreMap":767},[771,5991,5992],{"class":773,"line":774},[771,5993,2321],{"class":781},[771,5995,5996,5998,6000,6002],{"class":773,"line":792},[771,5997,4643],{"class":4318},[771,5999,1872],{"class":781},[771,6001,2985],{"class":938},[771,6003,1830],{"class":781},[771,6005,6006,6008,6010,6013],{"class":773,"line":923},[771,6007,4654],{"class":4318},[771,6009,1872],{"class":781},[771,6011,6012],{"class":788},"\"Sign-in link generated successfully.\"",[771,6014,1830],{"class":781},[771,6016,6017,6019],{"class":773,"line":930},[771,6018,4666],{"class":4318},[771,6020,5534],{"class":781},[771,6022,6023,6026,6028,6031],{"class":773,"line":954},[771,6024,6025],{"class":4318},"    \"url\"",[771,6027,1872],{"class":781},[771,6029,6030],{"class":788},"\"https:\u002F\u002Fauth.main-team.org\u002Fapi\u002Fuser\u002Foauth\u002Finvoke?accessToken=q8x2…&redirectUrl=…\"",[771,6032,1830],{"class":781},[771,6034,6035,6038,6040,6042],{"class":773,"line":959},[771,6036,6037],{"class":4318},"    \"organization\"",[771,6039,1872],{"class":781},[771,6041,4489],{"class":788},[771,6043,1830],{"class":781},[771,6045,6046,6049,6051,6053],{"class":773,"line":978},[771,6047,6048],{"class":4318},"    \"studentId\"",[771,6050,1872],{"class":781},[771,6052,5544],{"class":788},[771,6054,1830],{"class":781},[771,6056,6057,6060,6062],{"class":773,"line":995},[771,6058,6059],{"class":4318},"    \"expiresIn\"",[771,6061,1872],{"class":781},[771,6063,6064],{"class":938},"120\n",[771,6066,6067],{"class":773,"line":1022},[771,6068,1567],{"class":781},[771,6070,6071],{"class":773,"line":1044},[771,6072,1047],{"class":781},[358,6074,6075,6076,6079,6080,6083,6084,6087,6088,6090],{},"The URL signs whoever opens it in as the student. It is valid for ",[371,6077,6078],{},"120 seconds"," and works ",[371,6081,6082],{},"once",".\nFor this tutorial, open it in a private browser window straight away. In your product, the student\nopens it from your site: ",[389,6085,6086],{"href":104},"Send a student into the panel"," shows\nhow to do that safely, and ",[389,6089,80],{"href":81}," has the full rules.",[358,6092,6093],{},"The student does not need a password or a confirmed email address for the link to work.",[547,6095,6097],{"id":6096},"check-that-the-organization-has-its-copy","Check that the organization has its copy",[358,6099,6100,6101,1863],{},"The per-student application list is a convenient test. Until the organization holds a copy, it answers\n",[376,6102,5902],{},[762,6104,6106],{"className":764,"code":6105,"filename":581,"language":766,"meta":767,"style":767},"curl -s \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fstudent-applications\u002F66e6a3f5c1d2b30012a4f9c1?limit=1\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,6107,6108,6119],{"__ignoreMap":767},[771,6109,6110,6112,6114,6117],{"class":773,"line":774},[771,6111,581],{"class":1108},[771,6113,4283],{"class":938},[771,6115,6116],{"class":788}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fstudent-applications\u002F66e6a3f5c1d2b30012a4f9c1?limit=1\"",[771,6118,4289],{"class":777},[771,6120,6121,6123,6125,6127],{"class":773,"line":792},[771,6122,4294],{"class":938},[771,6124,4297],{"class":788},[771,6126,4300],{"class":781},[771,6128,4264],{"class":788},[762,6130,6133],{"className":4305,"code":6131,"filename":6132,"language":585,"meta":767,"style":767},"{\n  \"error\": {\n    \"code\": \"conflict\",\n    \"message\": \"Student has never signed in to stem, so stem holds no record for them. Generate a sign-in link first with POST \u002F:organizationId\u002Fauth\u002Fsignin.\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#conflict\",\n    \"request_id\": \"3f0c1f5e-8a0b-4c1e-9a53-0d6b1c2e7f41\"\n  }\n}\n","Response 409, before the first sign-in",[376,6134,6135,6139,6146,6158,6170,6182,6192,6196],{"__ignoreMap":767},[771,6136,6137],{"class":773,"line":774},[771,6138,2321],{"class":781},[771,6140,6141,6144],{"class":773,"line":792},[771,6142,6143],{"class":4318},"  \"error\"",[771,6145,5534],{"class":781},[771,6147,6148,6151,6153,6156],{"class":773,"line":923},[771,6149,6150],{"class":4318},"    \"code\"",[771,6152,1872],{"class":781},[771,6154,6155],{"class":788},"\"conflict\"",[771,6157,1830],{"class":781},[771,6159,6160,6163,6165,6168],{"class":773,"line":930},[771,6161,6162],{"class":4318},"    \"message\"",[771,6164,1872],{"class":781},[771,6166,6167],{"class":788},"\"Student has never signed in to stem, so stem holds no record for them. Generate a sign-in link first with POST \u002F:organizationId\u002Fauth\u002Fsignin.\"",[771,6169,1830],{"class":781},[771,6171,6172,6175,6177,6180],{"class":773,"line":954},[771,6173,6174],{"class":4318},"    \"documentation_url\"",[771,6176,1872],{"class":781},[771,6178,6179],{"class":788},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#conflict\"",[771,6181,1830],{"class":781},[771,6183,6184,6187,6189],{"class":773,"line":959},[771,6185,6186],{"class":4318},"    \"request_id\"",[771,6188,1872],{"class":781},[771,6190,6191],{"class":788},"\"3f0c1f5e-8a0b-4c1e-9a53-0d6b1c2e7f41\"\n",[771,6193,6194],{"class":773,"line":978},[771,6195,1567],{"class":781},[771,6197,6198],{"class":773,"line":995},[771,6199,1047],{"class":781},[358,6201,6202,6203,6206,6207,6209],{},"After the panel has loaded, the same request answers ",[376,6204,6205],{},"200"," with an empty list. If it still answers\n",[376,6208,5902],{},", the link was not followed in time or was already used. Ask for a new one.",[547,6211,6213],{"id":6212},"when-the-link-is-refused","When the link is refused",[399,6215,6216,6226],{},[402,6217,6218],{},[405,6219,6220,6222,6224],{},[408,6221,5806],{},[408,6223,5809],{},[408,6225,5812],{},[418,6227,6228,6252,6268],{},[405,6229,6230,6234,6239],{},[423,6231,6232],{},[376,6233,4581],{},[423,6235,6236],{},[376,6237,6238],{},"Student is not activated for organization stem.",[423,6240,6241,6242,6244,6245,5349,6247,4884,6249,816],{},"The student's ",[376,6243,5434],{}," does not include ",[376,6246,5442],{},[376,6248,537],{},[389,6250,6086],{"href":6251},"\u002Fapi\u002Ftutorials\u002Fsend-student-to-panel#when-the-link-is-refused",[405,6253,6254,6258,6262],{},[423,6255,6256],{},[376,6257,4581],{},[423,6259,6260],{},[376,6261,752],{},[423,6263,6264,6265,6267],{},"Your account lacks ",[376,6266,689],{}," on this organization.",[405,6269,6270,6274,6279],{},[423,6271,6272],{},[376,6273,4879],{},[423,6275,6276],{},[376,6277,6278],{},"Student not found!",[423,6280,6281],{},"The id is not one of your students. A student registered by another account answers exactly like one that does not exist.",[394,6283,6285],{"id":6284},"step-6-fetch-the-students-exam-picker","Step 6: fetch the student's exam picker",[358,6287,6288,6289,816],{},"Now ask which exams this student can sit. The answer is the same list the student would see in the\npanel's \"new application\" window, as one tree: ",[371,6290,6291],{},"category, then sitting, then language",[762,6293,6295],{"className":764,"code":6294,"filename":581,"language":766,"meta":767,"style":767},"curl -s https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fexam\u002Favailable\u002F66e6a3f5c1d2b30012a4f9c1 \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,6296,6297,6318],{"__ignoreMap":767},[771,6298,6299,6301,6303,6305,6307,6309,6311,6313,6316],{"class":773,"line":774},[771,6300,581],{"class":1108},[771,6302,4283],{"class":938},[771,6304,5941],{"class":788},[771,6306,3341],{"class":777},[771,6308,5946],{"class":788},[771,6310,5949],{"class":781},[771,6312,5952],{"class":777},[771,6314,6315],{"class":788},"\u002Fexam\u002Favailable\u002F66e6a3f5c1d2b30012a4f9c1",[771,6317,4289],{"class":777},[771,6319,6320,6322,6324,6326],{"class":773,"line":792},[771,6321,4294],{"class":938},[771,6323,4297],{"class":788},[771,6325,4300],{"class":781},[771,6327,4264],{"class":788},[762,6329,6331],{"className":4305,"code":6330,"filename":4931,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Available exams fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"64c0a1b2c3d4e5f601234501\",\n      \"name\": \"Mathematics\",\n      \"order\": 1,\n      \"isActive\": true,\n      \"sessions\": [\n        {\n          \"_id\": \"64c0a1b2c3d4e5f601234601\",\n          \"sessionName\": \"November sitting\",\n          \"date\": \"2026-11-14T09:00:00.000Z\",\n          \"sessionAlias\": \"Round 1\",\n          \"sessionNote\": \"Doors open 30 minutes before the start.\",\n          \"languages\": [\n            {\n              \"_id\": \"64c0a1b2c3d4e5f601234701\",\n              \"name\": \"English\",\n              \"code\": \"en\",\n              \"order\": 1,\n              \"matchedExam\": {\n                \"_id\": \"64c0a1b2c3d4e5f601234801\",\n                \"session\": \"64c0a1b2c3d4e5f601234601\",\n                \"category\": \"64c0a1b2c3d4e5f601234501\",\n                \"language\": \"64c0a1b2c3d4e5f601234701\",\n                \"grades\": [\"630e01826836e67ec53dc7a6\"],\n                \"countries\": [],\n                \"price\": 25,\n                \"examTime\": 75\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n",[376,6332,6333,6337,6347,6358,6364,6368,6379,6390,6401,6412,6419,6424,6436,6448,6460,6472,6484,6491,6496,6508,6520,6532,6543,6550,6562,6573,6584,6595,6606,6613,6625,6635,6640,6644,6649,6653,6658,6662,6667],{"__ignoreMap":767},[771,6334,6335],{"class":773,"line":774},[771,6336,2321],{"class":781},[771,6338,6339,6341,6343,6345],{"class":773,"line":792},[771,6340,4643],{"class":4318},[771,6342,1872],{"class":781},[771,6344,2985],{"class":938},[771,6346,1830],{"class":781},[771,6348,6349,6351,6353,6356],{"class":773,"line":923},[771,6350,4654],{"class":4318},[771,6352,1872],{"class":781},[771,6354,6355],{"class":788},"\"Available exams fetched successfully.\"",[771,6357,1830],{"class":781},[771,6359,6360,6362],{"class":773,"line":930},[771,6361,4666],{"class":4318},[771,6363,4366],{"class":781},[771,6365,6366],{"class":773,"line":954},[771,6367,2540],{"class":781},[771,6369,6370,6372,6374,6377],{"class":773,"line":959},[771,6371,4677],{"class":4318},[771,6373,1872],{"class":781},[771,6375,6376],{"class":788},"\"64c0a1b2c3d4e5f601234501\"",[771,6378,1830],{"class":781},[771,6380,6381,6383,6385,6388],{"class":773,"line":978},[771,6382,4689],{"class":4318},[771,6384,1872],{"class":781},[771,6386,6387],{"class":788},"\"Mathematics\"",[771,6389,1830],{"class":781},[771,6391,6392,6395,6397,6399],{"class":773,"line":995},[771,6393,6394],{"class":4318},"      \"order\"",[771,6396,1872],{"class":781},[771,6398,425],{"class":938},[771,6400,1830],{"class":781},[771,6402,6403,6406,6408,6410],{"class":773,"line":1022},[771,6404,6405],{"class":4318},"      \"isActive\"",[771,6407,1872],{"class":781},[771,6409,2985],{"class":938},[771,6411,1830],{"class":781},[771,6413,6414,6417],{"class":773,"line":1044},[771,6415,6416],{"class":4318},"      \"sessions\"",[771,6418,4366],{"class":781},[771,6420,6421],{"class":773,"line":1050},[771,6422,6423],{"class":781},"        {\n",[771,6425,6426,6429,6431,6434],{"class":773,"line":1055},[771,6427,6428],{"class":4318},"          \"_id\"",[771,6430,1872],{"class":781},[771,6432,6433],{"class":788},"\"64c0a1b2c3d4e5f601234601\"",[771,6435,1830],{"class":781},[771,6437,6438,6441,6443,6446],{"class":773,"line":1073},[771,6439,6440],{"class":4318},"          \"sessionName\"",[771,6442,1872],{"class":781},[771,6444,6445],{"class":788},"\"November sitting\"",[771,6447,1830],{"class":781},[771,6449,6450,6453,6455,6458],{"class":773,"line":1091},[771,6451,6452],{"class":4318},"          \"date\"",[771,6454,1872],{"class":781},[771,6456,6457],{"class":788},"\"2026-11-14T09:00:00.000Z\"",[771,6459,1830],{"class":781},[771,6461,6462,6465,6467,6470],{"class":773,"line":1096},[771,6463,6464],{"class":4318},"          \"sessionAlias\"",[771,6466,1872],{"class":781},[771,6468,6469],{"class":788},"\"Round 1\"",[771,6471,1830],{"class":781},[771,6473,6474,6477,6479,6482],{"class":773,"line":1146},[771,6475,6476],{"class":4318},"          \"sessionNote\"",[771,6478,1872],{"class":781},[771,6480,6481],{"class":788},"\"Doors open 30 minutes before the start.\"",[771,6483,1830],{"class":781},[771,6485,6486,6489],{"class":773,"line":1162},[771,6487,6488],{"class":4318},"          \"languages\"",[771,6490,4366],{"class":781},[771,6492,6493],{"class":773,"line":1167},[771,6494,6495],{"class":781},"            {\n",[771,6497,6498,6501,6503,6506],{"class":773,"line":1173},[771,6499,6500],{"class":4318},"              \"_id\"",[771,6502,1872],{"class":781},[771,6504,6505],{"class":788},"\"64c0a1b2c3d4e5f601234701\"",[771,6507,1830],{"class":781},[771,6509,6510,6513,6515,6518],{"class":773,"line":1187},[771,6511,6512],{"class":4318},"              \"name\"",[771,6514,1872],{"class":781},[771,6516,6517],{"class":788},"\"English\"",[771,6519,1830],{"class":781},[771,6521,6522,6525,6527,6530],{"class":773,"line":1221},[771,6523,6524],{"class":4318},"              \"code\"",[771,6526,1872],{"class":781},[771,6528,6529],{"class":788},"\"en\"",[771,6531,1830],{"class":781},[771,6533,6534,6537,6539,6541],{"class":773,"line":1253},[771,6535,6536],{"class":4318},"              \"order\"",[771,6538,1872],{"class":781},[771,6540,425],{"class":938},[771,6542,1830],{"class":781},[771,6544,6545,6548],{"class":773,"line":1285},[771,6546,6547],{"class":4318},"              \"matchedExam\"",[771,6549,5534],{"class":781},[771,6551,6552,6555,6557,6560],{"class":773,"line":1312},[771,6553,6554],{"class":4318},"                \"_id\"",[771,6556,1872],{"class":781},[771,6558,6559],{"class":788},"\"64c0a1b2c3d4e5f601234801\"",[771,6561,1830],{"class":781},[771,6563,6564,6567,6569,6571],{"class":773,"line":1338},[771,6565,6566],{"class":4318},"                \"session\"",[771,6568,1872],{"class":781},[771,6570,6433],{"class":788},[771,6572,1830],{"class":781},[771,6574,6575,6578,6580,6582],{"class":773,"line":1366},[771,6576,6577],{"class":4318},"                \"category\"",[771,6579,1872],{"class":781},[771,6581,6376],{"class":788},[771,6583,1830],{"class":781},[771,6585,6586,6589,6591,6593],{"class":773,"line":1380},[771,6587,6588],{"class":4318},"                \"language\"",[771,6590,1872],{"class":781},[771,6592,6505],{"class":788},[771,6594,1830],{"class":781},[771,6596,6597,6600,6602,6604],{"class":773,"line":1416},[771,6598,6599],{"class":4318},"                \"grades\"",[771,6601,5697],{"class":781},[771,6603,5687],{"class":788},[771,6605,5703],{"class":781},[771,6607,6608,6611],{"class":773,"line":1424},[771,6609,6610],{"class":4318},"                \"countries\"",[771,6612,4358],{"class":781},[771,6614,6615,6618,6620,6623],{"class":773,"line":1429},[771,6616,6617],{"class":4318},"                \"price\"",[771,6619,1872],{"class":781},[771,6621,6622],{"class":938},"25",[771,6624,1830],{"class":781},[771,6626,6627,6630,6632],{"class":773,"line":1434},[771,6628,6629],{"class":4318},"                \"examTime\"",[771,6631,1872],{"class":781},[771,6633,6634],{"class":938},"75\n",[771,6636,6637],{"class":773,"line":1453},[771,6638,6639],{"class":781},"              }\n",[771,6641,6642],{"class":773,"line":1476},[771,6643,3262],{"class":781},[771,6645,6646],{"class":773,"line":1497},[771,6647,6648],{"class":781},"          ]\n",[771,6650,6651],{"class":773,"line":1513},[771,6652,2644],{"class":781},[771,6654,6655],{"class":773,"line":1526},[771,6656,6657],{"class":781},"      ]\n",[771,6659,6660],{"class":773,"line":1546},[771,6661,2024],{"class":781},[771,6663,6664],{"class":773,"line":1564},[771,6665,6666],{"class":781},"  ]\n",[771,6668,6669],{"class":773,"line":1570},[771,6670,1047],{"class":781},[358,6672,6673],{},"How to read it:",[552,6675,6676,6679,6705],{},[555,6677,6678],{},"Each level is the full document it stands for (a category, a sitting, a language), plus the list of\nthe level below.",[555,6680,6681,6682,6687,6688,6691,6692,1330,6694,1330,6697,6700,6701,6704],{},"Each leaf carries ",[371,6683,6684],{},[376,6685,6686],{},"matchedExam",", the one exam that category, sitting and language add up to.\n",[376,6689,6690],{},"matchedExam._id"," is what you send in step 7. Inside ",[376,6693,6686],{},[376,6695,6696],{},"session",[376,6698,6699],{},"category"," and\n",[376,6702,6703],{},"language"," are ids, because the documents are the levels above it.",[555,6706,6707,6713,6714,816],{},[371,6708,6709,6712],{},[376,6710,6711],{},"price"," is absent when an exam has no price."," Such an application is created as free, so read the\nprice as ",[376,6715,6716],{},"price ?? 0",[358,6718,6719],{},"What the tree leaves out, so that nothing in it can be refused in step 7:",[552,6721,6722,6725,6728,6731,6734],{},[555,6723,6724],{},"exams that are not accepting applications, whose sitting has already started, or whose category is\nnot active;",[555,6726,6727],{},"exams not set for the student's grade. Grade is a hard filter;",[555,6729,6730],{},"exams restricted to countries other than the student's. An exam that names no countries is open\neverywhere;",[555,6732,6733],{},"exams with no language set;",[555,6735,6736],{},"any category and sitting the student already holds, in every language, because nobody can sit two\npapers in one category at once.",[358,6738,6739,6740,6743,6744,6746,6747,6749],{},"An empty ",[376,6741,6742],{},"data"," array means nothing is open to this student right now. A student with no grade gets\n",[376,6745,5850],{}," instead, because no exam could ever accept them. The tree works even before the\nstudent's first sign-in. See ",[389,6748,83],{"href":84}," for the full rules.",[394,6751,6753],{"id":6752},"step-7-create-the-application","Step 7: create the application",[358,6755,6756,6757,6759],{},"Send the student's core id and the ",[376,6758,6690],{}," you picked. That is the whole body:",[762,6761,6763],{"className":764,"code":6762,"filename":581,"language":766,"meta":767,"style":767},"curl -s -X POST https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"studentId\": \"66e6a3f5c1d2b30012a4f9c1\", \"examId\": \"64c0a1b2c3d4e5f601234801\" }'\n",[376,6764,6765,6790,6802,6810],{"__ignoreMap":767},[771,6766,6767,6769,6771,6773,6775,6777,6779,6781,6783,6785,6788],{"class":773,"line":774},[771,6768,581],{"class":1108},[771,6770,4283],{"class":938},[771,6772,5165],{"class":938},[771,6774,5168],{"class":788},[771,6776,5941],{"class":788},[771,6778,3341],{"class":777},[771,6780,5946],{"class":788},[771,6782,5949],{"class":781},[771,6784,5952],{"class":777},[771,6786,6787],{"class":788},"\u002Fapplication",[771,6789,4289],{"class":777},[771,6791,6792,6794,6796,6798,6800],{"class":773,"line":792},[771,6793,4294],{"class":938},[771,6795,4297],{"class":788},[771,6797,4300],{"class":781},[771,6799,2963],{"class":788},[771,6801,4289],{"class":777},[771,6803,6804,6806,6808],{"class":773,"line":923},[771,6805,4294],{"class":938},[771,6807,5192],{"class":788},[771,6809,4289],{"class":777},[771,6811,6812,6814],{"class":773,"line":930},[771,6813,5199],{"class":938},[771,6815,6816],{"class":788}," '{ \"studentId\": \"66e6a3f5c1d2b30012a4f9c1\", \"examId\": \"64c0a1b2c3d4e5f601234801\" }'\n",[762,6818,6821],{"className":4305,"code":6819,"filename":6820,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Application created successfully.\",\n  \"data\": {\n    \"_id\": \"66e6a4b1c1d2b30012a4fa07\",\n    \"exam\": \"64c0a1b2c3d4e5f601234801\",\n    \"user\": \"66e6a41fc1d2b30012a4f9f3\",\n    \"payment\": \"66e6a4b1c1d2b30012a4fa09\",\n    \"partners\": [],\n    \"createdAt\": \"2026-09-15T10:21:37.412Z\",\n    \"updatedAt\": \"2026-09-15T10:21:37.412Z\"\n  }\n}\n","Response 201 (abridged)",[376,6822,6823,6827,6837,6848,6854,6865,6876,6888,6900,6907,6918,6927,6931],{"__ignoreMap":767},[771,6824,6825],{"class":773,"line":774},[771,6826,2321],{"class":781},[771,6828,6829,6831,6833,6835],{"class":773,"line":792},[771,6830,4643],{"class":4318},[771,6832,1872],{"class":781},[771,6834,2985],{"class":938},[771,6836,1830],{"class":781},[771,6838,6839,6841,6843,6846],{"class":773,"line":923},[771,6840,4654],{"class":4318},[771,6842,1872],{"class":781},[771,6844,6845],{"class":788},"\"Application created successfully.\"",[771,6847,1830],{"class":781},[771,6849,6850,6852],{"class":773,"line":930},[771,6851,4666],{"class":4318},[771,6853,5534],{"class":781},[771,6855,6856,6858,6860,6863],{"class":773,"line":954},[771,6857,5539],{"class":4318},[771,6859,1872],{"class":781},[771,6861,6862],{"class":788},"\"66e6a4b1c1d2b30012a4fa07\"",[771,6864,1830],{"class":781},[771,6866,6867,6870,6872,6874],{"class":773,"line":959},[771,6868,6869],{"class":4318},"    \"exam\"",[771,6871,1872],{"class":781},[771,6873,6559],{"class":788},[771,6875,1830],{"class":781},[771,6877,6878,6881,6883,6886],{"class":773,"line":978},[771,6879,6880],{"class":4318},"    \"user\"",[771,6882,1872],{"class":781},[771,6884,6885],{"class":788},"\"66e6a41fc1d2b30012a4f9f3\"",[771,6887,1830],{"class":781},[771,6889,6890,6893,6895,6898],{"class":773,"line":995},[771,6891,6892],{"class":4318},"    \"payment\"",[771,6894,1872],{"class":781},[771,6896,6897],{"class":788},"\"66e6a4b1c1d2b30012a4fa09\"",[771,6899,1830],{"class":781},[771,6901,6902,6905],{"class":773,"line":1022},[771,6903,6904],{"class":4318},"    \"partners\"",[771,6906,4358],{"class":781},[771,6908,6909,6911,6913,6916],{"class":773,"line":1044},[771,6910,5708],{"class":4318},[771,6912,1872],{"class":781},[771,6914,6915],{"class":788},"\"2026-09-15T10:21:37.412Z\"",[771,6917,1830],{"class":781},[771,6919,6920,6922,6924],{"class":773,"line":1050},[771,6921,5720],{"class":4318},[771,6923,1872],{"class":781},[771,6925,6926],{"class":788},"\"2026-09-15T10:21:37.412Z\"\n",[771,6928,6929],{"class":773,"line":1055},[771,6930,1567],{"class":781},[771,6932,6933],{"class":773,"line":1073},[771,6934,1047],{"class":781},[358,6936,6937],{},"Two things to notice:",[552,6939,6940,6952],{},[555,6941,6942,6951],{},[371,6943,6944,6947,6948,816],{},[376,6945,6946],{},"user"," is not your ",[376,6949,6950],{},"studentId"," An application lives in the organization, so it points at the\norganization's copy of the student. Step 8 shows how to match it back.",[555,6953,6954,6957,6958,5090,6961,6964,6966,6967,6970],{},[371,6955,6956],{},"A payment comes with every application."," For a free exam it is created as ",[376,6959,6960],{},"paid",[376,6962,6963],{},"amount",[376,6965,3868],{},". For a priced exam it is ",[376,6968,6969],{},"pending"," for the exam's price. This API never charges or refunds.",[358,6972,6973,6976,6977,5090,6979,6982,6983,6985],{},[371,6974,6975],{},"Creating the same application again is safe."," A second request for the same student and the same\nexam answers ",[376,6978,6205],{},[376,6980,6981],{},"Application already exists."," and the application you already have. So if this\nrequest times out, send it again. The repeat is checked against the same rules as the first request,\nso once the exam has closed for applications, or the student's grade or country no longer fits it, a\nrepeat answers ",[376,6984,5902],{}," like any other refusal. Read the student's applications (step 8) to confirm an\nentry rather than creating it again weeks later.",[547,6987,6989],{"id":6988},"when-the-application-is-refused","When the application is refused",[358,6991,6992,6993,6995],{},"The exam you send has to be one the picker in step 6 would offer this student. If it is not, the\nanswer is ",[376,6994,5821],{}," and the message says which rule refused it:",[399,6997,6998,7008],{},[402,6999,7000],{},[405,7001,7002,7005],{},[408,7003,7004],{},"Message (starts with)",[408,7006,7007],{},"Meaning",[418,7009,7010,7020,7030,7040,7050,7060,7070],{},[405,7011,7012,7017],{},[423,7013,7014],{},[376,7015,7016],{},"Student has never signed in to stem…",[423,7018,7019],{},"Step 5 has not happened yet",[405,7021,7022,7027],{},[423,7023,7024],{},[376,7025,7026],{},"Exam is not open for application.",[423,7028,7029],{},"Applications are closed, the sitting has started, or the category is not active",[405,7031,7032,7037],{},[423,7033,7034],{},[376,7035,7036],{},"Exam is not available for grade 9. It accepts grade 10, 11.",[423,7038,7039],{},"The student's grade does not fit",[405,7041,7042,7047],{},[423,7043,7044],{},[376,7045,7046],{},"Exam is not available in this student’s country. It is offered in …",[423,7048,7049],{},"The exam is restricted to other countries",[405,7051,7052,7057],{},[423,7053,7054],{},[376,7055,7056],{},"Exam has no language set…",[423,7058,7059],{},"The exam cannot be sat, so it is not offered",[405,7061,7062,7067],{},[423,7063,7064],{},[376,7065,7066],{},"Exam is not available to this student.…",[423,7068,7069],{},"The exam fails the picker for another reason; choose one from step 6",[405,7071,7072,7077],{},[423,7073,7074],{},[376,7075,7076],{},"Student already has an application for Mathematics on this sitting.…",[423,7078,7079],{},"Another exam in the same category on the same sitting is already held",[358,7081,7082,7083,7086,7087,7089,7090,7092],{},"The checks run in a fixed order: the student (",[376,7084,7085],{},"404","), the organization's copy (",[376,7088,5902],{},"), the exam's\nexistence (",[376,7091,7085],{},"), then the rules above. A request that fails several rules reports the first.",[358,7094,7095],{},"Other answers:",[399,7097,7098,7108],{},[402,7099,7100],{},[405,7101,7102,7104,7106],{},[408,7103,5806],{},[408,7105,5809],{},[408,7107,7007],{},[418,7109,7110,7124,7138,7152],{},[405,7111,7112,7116,7121],{},[423,7113,7114],{},[376,7115,5850],{},[423,7117,7118],{},[376,7119,7120],{},"Student has no grade set…",[423,7122,7123],{},"Set a grade first",[405,7125,7126,7130,7135],{},[423,7127,7128],{},[376,7129,5850],{},[423,7131,7132],{},[376,7133,7134],{},"examId must be a mongodb id",[423,7136,7137],{},"The body is malformed",[405,7139,7140,7144,7149],{},[423,7141,7142],{},[376,7143,4879],{},[423,7145,7146],{},[376,7147,7148],{},"Exam not found!",[423,7150,7151],{},"No exam with this id exists on this organization",[405,7153,7154,7158,7162],{},[423,7155,7156],{},[376,7157,4879],{},[423,7159,7160],{},[376,7161,6278],{},[423,7163,7164],{},"Not one of your students",[358,7166,7167,7168,7170,7171,7173],{},"Branch on the status and the ",[376,7169,376],{},". The messages are there for people, and their wording may\nimprove. See ",[389,7172,86],{"href":87}," for every rule.",[394,7175,7177],{"id":7176},"step-8-confirm-the-entry","Step 8: confirm the entry",[358,7179,7180],{},"List the student's applications on this organization:",[762,7182,7184],{"className":764,"code":7183,"filename":581,"language":766,"meta":767,"style":767},"curl -s https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fstudent-applications\u002F66e6a3f5c1d2b30012a4f9c1 \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[376,7185,7186,7207],{"__ignoreMap":767},[771,7187,7188,7190,7192,7194,7196,7198,7200,7202,7205],{"class":773,"line":774},[771,7189,581],{"class":1108},[771,7191,4283],{"class":938},[771,7193,5941],{"class":788},[771,7195,3341],{"class":777},[771,7197,5946],{"class":788},[771,7199,5949],{"class":781},[771,7201,5952],{"class":777},[771,7203,7204],{"class":788},"\u002Fapplication\u002Fstudent-applications\u002F66e6a3f5c1d2b30012a4f9c1",[771,7206,4289],{"class":777},[771,7208,7209,7211,7213,7215],{"class":773,"line":792},[771,7210,4294],{"class":938},[771,7212,4297],{"class":788},[771,7214,4300],{"class":781},[771,7216,4264],{"class":788},[762,7218,7220],{"className":4305,"code":7219,"filename":4931,"language":585,"meta":767,"style":767},"{\n  \"success\": true,\n  \"message\": \"Applications fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"66e6a4b1c1d2b30012a4fa07\",\n      \"exam\": {\n        \"_id\": \"64c0a1b2c3d4e5f601234801\",\n        \"session\": \"64c0a1b2c3d4e5f601234601\",\n        \"category\": \"64c0a1b2c3d4e5f601234501\",\n        \"language\": \"64c0a1b2c3d4e5f601234701\",\n        \"price\": 25\n      },\n      \"user\": {\n        \"_id\": \"66e6a41fc1d2b30012a4f9f3\",\n        \"mainId\": \"66e6a3f5c1d2b30012a4f9c1\",\n        \"firstName\": \"Jane\",\n        \"lastName\": \"Doe\"\n      },\n      \"payment\": {\n        \"_id\": \"66e6a4b1c1d2b30012a4fa09\",\n        \"amount\": 25,\n        \"status\": \"pending\"\n      },\n      \"partners\": []\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 20, \"total\": 1, \"totalPages\": 1 }\n}\n",[376,7221,7222,7226,7236,7247,7253,7257,7267,7274,7285,7296,7307,7318,7328,7332,7339,7349,7360,7371,7381,7385,7392,7402,7413,7423,7427,7435,7439,7443,7482],{"__ignoreMap":767},[771,7223,7224],{"class":773,"line":774},[771,7225,2321],{"class":781},[771,7227,7228,7230,7232,7234],{"class":773,"line":792},[771,7229,4643],{"class":4318},[771,7231,1872],{"class":781},[771,7233,2985],{"class":938},[771,7235,1830],{"class":781},[771,7237,7238,7240,7242,7245],{"class":773,"line":923},[771,7239,4654],{"class":4318},[771,7241,1872],{"class":781},[771,7243,7244],{"class":788},"\"Applications fetched successfully.\"",[771,7246,1830],{"class":781},[771,7248,7249,7251],{"class":773,"line":930},[771,7250,4666],{"class":4318},[771,7252,4366],{"class":781},[771,7254,7255],{"class":773,"line":954},[771,7256,2540],{"class":781},[771,7258,7259,7261,7263,7265],{"class":773,"line":959},[771,7260,4677],{"class":4318},[771,7262,1872],{"class":781},[771,7264,6862],{"class":788},[771,7266,1830],{"class":781},[771,7268,7269,7272],{"class":773,"line":978},[771,7270,7271],{"class":4318},"      \"exam\"",[771,7273,5534],{"class":781},[771,7275,7276,7279,7281,7283],{"class":773,"line":995},[771,7277,7278],{"class":4318},"        \"_id\"",[771,7280,1872],{"class":781},[771,7282,6559],{"class":788},[771,7284,1830],{"class":781},[771,7286,7287,7290,7292,7294],{"class":773,"line":1022},[771,7288,7289],{"class":4318},"        \"session\"",[771,7291,1872],{"class":781},[771,7293,6433],{"class":788},[771,7295,1830],{"class":781},[771,7297,7298,7301,7303,7305],{"class":773,"line":1044},[771,7299,7300],{"class":4318},"        \"category\"",[771,7302,1872],{"class":781},[771,7304,6376],{"class":788},[771,7306,1830],{"class":781},[771,7308,7309,7312,7314,7316],{"class":773,"line":1050},[771,7310,7311],{"class":4318},"        \"language\"",[771,7313,1872],{"class":781},[771,7315,6505],{"class":788},[771,7317,1830],{"class":781},[771,7319,7320,7323,7325],{"class":773,"line":1055},[771,7321,7322],{"class":4318},"        \"price\"",[771,7324,1872],{"class":781},[771,7326,7327],{"class":938},"25\n",[771,7329,7330],{"class":773,"line":1073},[771,7331,1884],{"class":781},[771,7333,7334,7337],{"class":773,"line":1091},[771,7335,7336],{"class":4318},"      \"user\"",[771,7338,5534],{"class":781},[771,7340,7341,7343,7345,7347],{"class":773,"line":1096},[771,7342,7278],{"class":4318},[771,7344,1872],{"class":781},[771,7346,6885],{"class":788},[771,7348,1830],{"class":781},[771,7350,7351,7354,7356,7358],{"class":773,"line":1146},[771,7352,7353],{"class":4318},"        \"mainId\"",[771,7355,1872],{"class":781},[771,7357,5544],{"class":788},[771,7359,1830],{"class":781},[771,7361,7362,7365,7367,7369],{"class":773,"line":1162},[771,7363,7364],{"class":4318},"        \"firstName\"",[771,7366,1872],{"class":781},[771,7368,5568],{"class":788},[771,7370,1830],{"class":781},[771,7372,7373,7376,7378],{"class":773,"line":1167},[771,7374,7375],{"class":4318},"        \"lastName\"",[771,7377,1872],{"class":781},[771,7379,7380],{"class":788},"\"Doe\"\n",[771,7382,7383],{"class":773,"line":1173},[771,7384,1884],{"class":781},[771,7386,7387,7390],{"class":773,"line":1187},[771,7388,7389],{"class":4318},"      \"payment\"",[771,7391,5534],{"class":781},[771,7393,7394,7396,7398,7400],{"class":773,"line":1221},[771,7395,7278],{"class":4318},[771,7397,1872],{"class":781},[771,7399,6897],{"class":788},[771,7401,1830],{"class":781},[771,7403,7404,7407,7409,7411],{"class":773,"line":1253},[771,7405,7406],{"class":4318},"        \"amount\"",[771,7408,1872],{"class":781},[771,7410,6622],{"class":938},[771,7412,1830],{"class":781},[771,7414,7415,7418,7420],{"class":773,"line":1285},[771,7416,7417],{"class":4318},"        \"status\"",[771,7419,1872],{"class":781},[771,7421,7422],{"class":788},"\"pending\"\n",[771,7424,7425],{"class":773,"line":1312},[771,7426,1884],{"class":781},[771,7428,7429,7432],{"class":773,"line":1338},[771,7430,7431],{"class":4318},"      \"partners\"",[771,7433,7434],{"class":781},": []\n",[771,7436,7437],{"class":773,"line":1366},[771,7438,2024],{"class":781},[771,7440,7441],{"class":773,"line":1380},[771,7442,4526],{"class":781},[771,7444,7445,7447,7449,7451,7453,7455,7457,7459,7461,7464,7466,7468,7470,7472,7474,7476,7478,7480],{"class":773,"line":1416},[771,7446,4816],{"class":4318},[771,7448,4819],{"class":781},[771,7450,4822],{"class":4318},[771,7452,1872],{"class":781},[771,7454,425],{"class":938},[771,7456,1330],{"class":781},[771,7458,4831],{"class":4318},[771,7460,1872],{"class":781},[771,7462,7463],{"class":938},"20",[771,7465,1330],{"class":781},[771,7467,4841],{"class":4318},[771,7469,1872],{"class":781},[771,7471,425],{"class":938},[771,7473,1330],{"class":781},[771,7475,4850],{"class":4318},[771,7477,1872],{"class":781},[771,7479,425],{"class":938},[771,7481,4521],{"class":781},[771,7483,7484],{"class":773,"line":1424},[771,7485,1047],{"class":781},[358,7487,7488,1330,7491,582,7493,7496,7497,7500,7501,7507,7508,816],{},[376,7489,7490],{},"exam",[376,7492,6946],{},[376,7494,7495],{},"payment"," come back as documents. ",[376,7498,7499],{},"user._id"," is the organization's copy;\n",[371,7502,7503,7506],{},[376,7504,7505],{},"user.mainId"," is the core id you stored in step 4",", so always match rows to your records on\n",[376,7509,7510],{},"mainId",[394,7512,7514],{"id":7513},"the-complete-script","The complete script",[358,7516,7517],{},"Both scripts do steps 1 to 8 in order and stop at the first error, printing its status, code, message\nand request id. Edit the student's details at the top, then run the script with the organization slug.\nThe script registers the student, or reuses them if this account registered them before. It prints a\nsign-in link and waits for you to open it, then applies for the first exam in the student's picker.",[547,7519,308],{"id":7520},"nodejs",[762,7522,7525],{"className":892,"code":7523,"filename":7524,"language":895,"meta":767,"style":767},"\u002F\u002F register-and-apply.mjs: register a student, send them in once, enter them for an exam.\n\u002F\u002F Usage: node register-and-apply.mjs stem\nimport readline from 'node:readline\u002Fpromises';\nimport { api, ApiError } from '.\u002Fmainteam.mjs';\n\nconst slug = process.argv[2] ?? 'stem';\n\n\u002F\u002F The student to register. Replace with real data from your own records.\nconst countryIso2 = 'AL';\nconst newStudent = {\n  firstName: 'Jane',\n  lastName: 'Doe',\n  email: 'jane.doe@example.com',\n  birth: '14\u002F05\u002F2011',\n  sex: 'f',\n  grade: '10',\n  city: 'Berlin',\n  school: 'Berlin International School',\n};\n\nasync function findCountryId(iso2) {\n  for (let page = 1; ; page++) {\n    const res = await api('GET', `\u002Fcountry?page=${page}&limit=100`);\n    const hit = res.data.find((country) => country.iso2 === iso2);\n    if (hit) return hit._id;\n    if (page >= res.pagination.totalPages) throw new Error(`Country ${iso2} cannot be selected.`);\n  }\n}\n\nasync function registerStudent(fields) {\n  try {\n    const res = await api('POST', '\u002Fstudent', fields);\n    console.log(`   registered as ${res.data.username}`);\n    return res.data._id;\n  } catch (error) {\n    \u002F\u002F Already registered to this account: the message names the existing _id.\n    const id =\n      error instanceof ApiError && error.status === 409\n        ? error.message.match(\u002F\\(([0-9a-f]{24})\\)\u002F)?.[1]\n        : undefined;\n    if (id) {\n      console.log('   already registered to this account; reusing it');\n      return id;\n    }\n    throw error;\n  }\n}\n\n\u002F\u002F The per-student list answers 409 until the organization holds a copy of the student.\nasync function hasOrgCopy(orgId, studentId) {\n  try {\n    await api('GET', `\u002F${orgId}\u002Fapplication\u002Fstudent-applications\u002F${studentId}?limit=1`);\n    return true;\n  } catch (error) {\n    if (error instanceof ApiError && error.status === 409) return false;\n    throw error;\n  }\n}\n\nasync function ensureSignedInOnce(orgId, studentId) {\n  if (await hasOrgCopy(orgId, studentId)) {\n    console.log('5. The student has signed in to this organization before');\n    return;\n  }\n  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n  try {\n    for (;;) {\n      const link = await api('POST', `\u002F${orgId}\u002Fauth\u002Fsignin`, { studentId });\n      console.log(`5. Open this link in a browser within ${link.data.expiresIn} s. It works once:`);\n      console.log(`   ${link.data.url}`);\n      await rl.question('   Press Enter after the panel has loaded... ');\n      if (await hasOrgCopy(orgId, studentId)) return;\n      console.log('   The organization has no record of the student yet. Minting a fresh link.');\n    }\n  } finally {\n    rl.close();\n  }\n}\n\nfunction firstLeaf(tree) {\n  for (const category of tree) {\n    for (const session of category.sessions) {\n      for (const language of session.languages) {\n        return { category, session, language, exam: language.matchedExam };\n      }\n    }\n  }\n  return null;\n}\n\nasync function main() {\n  const account = await api('GET', '\u002Fapi-account\u002Fvalidate-me');\n  console.log(`1. Signed in as ${account.companyName} (${account.apiKey})`);\n\n  const orgs = await api('GET', '\u002Forganization?limit=100');\n  const org = orgs.data.find((candidate) => candidate.slug === slug);\n  if (!org) throw new Error(`No organization with slug ${slug}.`);\n  console.log(`2. ${slug} is ${org._id}`);\n\n  const countryId = await findCountryId(countryIso2);\n  console.log(`3. Country ${countryIso2} is ${countryId}`);\n\n  const studentId = await registerStudent({ ...newStudent, country: countryId });\n  console.log(`4. Student ${studentId}`);\n\n  await ensureSignedInOnce(org._id, studentId);\n\n  const tree = (await api('GET', `\u002F${org._id}\u002Fexam\u002Favailable\u002F${studentId}`)).data;\n  const leaf = firstLeaf(tree);\n  if (!leaf) {\n    console.log('6. No exam is open to this student right now.');\n    return;\n  }\n  const price = leaf.exam.price ?? 0;\n  console.log(\n    `6. Picked ${leaf.category.name} on ${leaf.session.date} in ${leaf.language.name} ` +\n      `(exam ${leaf.exam._id}, price ${price})`,\n  );\n\n  const created = await api('POST', `\u002F${org._id}\u002Fapplication`, { studentId, examId: leaf.exam._id });\n  console.log(`7. ${created.message} Application ${created.data._id}`);\n\n  const list = await api('GET', `\u002F${org._id}\u002Fapplication\u002Fstudent-applications\u002F${studentId}`);\n  for (const application of list.data) {\n    const payment = application.payment ?? {};\n    console.log(`8. ${application._id}: payment ${payment.status}, amount ${payment.amount}`);\n  }\n}\n\nmain().catch((error) => {\n  if (error instanceof ApiError) {\n    console.error(`${error.status} ${error.code}: ${error.message} (request ${error.requestId})`);\n  } else {\n    console.error(error);\n  }\n  process.exitCode = 1;\n});\n","register-and-apply.mjs",[376,7526,7527,7532,7537,7551,7565,7569,7592,7596,7601,7615,7626,7636,7646,7656,7666,7676,7686,7696,7706,7711,7715,7732,7754,7784,7815,7827,7857,7861,7865,7869,7885,7892,7917,7945,7952,7962,7967,7977,7997,8039,8048,8055,8069,8077,8081,8089,8093,8097,8101,8106,8126,8132,8160,8168,8176,8204,8210,8214,8218,8222,8241,8255,8268,8274,8278,8296,8302,8310,8340,8368,8394,8411,8429,8442,8446,8455,8465,8469,8473,8477,8492,8509,8525,8542,8549,8554,8558,8562,8570,8574,8578,8589,8613,8647,8651,8675,8706,8735,8762,8766,8782,8805,8809,8831,8848,8852,8862,8866,8905,8919,8930,8943,8949,8953,8971,8979,9028,9052,9057,9061,9094,9130,9134,9169,9185,9202,9242,9246,9251,9256,9278,9291,9339,9349,9359,9364,9376],{"__ignoreMap":767},[771,7528,7529],{"class":773,"line":774},[771,7530,7531],{"class":902},"\u002F\u002F register-and-apply.mjs: register a student, send them in once, enter them for an exam.\n",[771,7533,7534],{"class":773,"line":792},[771,7535,7536],{"class":902},"\u002F\u002F Usage: node register-and-apply.mjs stem\n",[771,7538,7539,7541,7544,7546,7549],{"class":773,"line":923},[771,7540,908],{"class":777},[771,7542,7543],{"class":781}," readline ",[771,7545,914],{"class":777},[771,7547,7548],{"class":788}," 'node:readline\u002Fpromises'",[771,7550,920],{"class":781},[771,7552,7553,7555,7558,7560,7563],{"class":773,"line":930},[771,7554,908],{"class":777},[771,7556,7557],{"class":781}," { api, ApiError } ",[771,7559,914],{"class":777},[771,7561,7562],{"class":788}," '.\u002Fmainteam.mjs'",[771,7564,920],{"class":781},[771,7566,7567],{"class":773,"line":954},[771,7568,927],{"emptyLinePlaceholder":926},[771,7570,7571,7573,7576,7578,7581,7583,7585,7587,7590],{"class":773,"line":959},[771,7572,962],{"class":777},[771,7574,7575],{"class":938}," slug",[771,7577,942],{"class":777},[771,7579,7580],{"class":781}," process.argv[",[771,7582,438],{"class":938},[771,7584,3242],{"class":781},[771,7586,1485],{"class":777},[771,7588,7589],{"class":788}," 'stem'",[771,7591,920],{"class":781},[771,7593,7594],{"class":773,"line":978},[771,7595,927],{"emptyLinePlaceholder":926},[771,7597,7598],{"class":773,"line":995},[771,7599,7600],{"class":902},"\u002F\u002F The student to register. Replace with real data from your own records.\n",[771,7602,7603,7605,7608,7610,7613],{"class":773,"line":1022},[771,7604,962],{"class":777},[771,7606,7607],{"class":938}," countryIso2",[771,7609,942],{"class":777},[771,7611,7612],{"class":788}," 'AL'",[771,7614,920],{"class":781},[771,7616,7617,7619,7622,7624],{"class":773,"line":1044},[771,7618,962],{"class":777},[771,7620,7621],{"class":938}," newStudent",[771,7623,942],{"class":777},[771,7625,1450],{"class":781},[771,7627,7628,7631,7634],{"class":773,"line":1050},[771,7629,7630],{"class":781},"  firstName: ",[771,7632,7633],{"class":788},"'Jane'",[771,7635,1830],{"class":781},[771,7637,7638,7641,7644],{"class":773,"line":1055},[771,7639,7640],{"class":781},"  lastName: ",[771,7642,7643],{"class":788},"'Doe'",[771,7645,1830],{"class":781},[771,7647,7648,7651,7654],{"class":773,"line":1073},[771,7649,7650],{"class":781},"  email: ",[771,7652,7653],{"class":788},"'jane.doe@example.com'",[771,7655,1830],{"class":781},[771,7657,7658,7661,7664],{"class":773,"line":1091},[771,7659,7660],{"class":781},"  birth: ",[771,7662,7663],{"class":788},"'14\u002F05\u002F2011'",[771,7665,1830],{"class":781},[771,7667,7668,7671,7674],{"class":773,"line":1096},[771,7669,7670],{"class":781},"  sex: ",[771,7672,7673],{"class":788},"'f'",[771,7675,1830],{"class":781},[771,7677,7678,7681,7684],{"class":773,"line":1146},[771,7679,7680],{"class":781},"  grade: ",[771,7682,7683],{"class":788},"'10'",[771,7685,1830],{"class":781},[771,7687,7688,7691,7694],{"class":773,"line":1162},[771,7689,7690],{"class":781},"  city: ",[771,7692,7693],{"class":788},"'Berlin'",[771,7695,1830],{"class":781},[771,7697,7698,7701,7704],{"class":773,"line":1167},[771,7699,7700],{"class":781},"  school: ",[771,7702,7703],{"class":788},"'Berlin International School'",[771,7705,1830],{"class":781},[771,7707,7708],{"class":773,"line":1173},[771,7709,7710],{"class":781},"};\n",[771,7712,7713],{"class":773,"line":1187},[771,7714,927],{"emptyLinePlaceholder":926},[771,7716,7717,7720,7722,7725,7727,7730],{"class":773,"line":1221},[771,7718,7719],{"class":777},"async",[771,7721,1178],{"class":777},[771,7723,7724],{"class":1031}," findCountryId",[771,7726,1035],{"class":781},[771,7728,7729],{"class":1108},"iso2",[771,7731,1019],{"class":781},[771,7733,7734,7736,7738,7740,7743,7745,7747,7750,7752],{"class":773,"line":1253},[771,7735,1751],{"class":777},[771,7737,1001],{"class":781},[771,7739,1149],{"class":777},[771,7741,7742],{"class":781}," page ",[771,7744,785],{"class":777},[771,7746,1763],{"class":938},[771,7748,7749],{"class":781},"; ; page",[771,7751,1769],{"class":777},[771,7753,1019],{"class":781},[771,7755,7756,7758,7760,7762,7764,7766,7768,7771,7773,7776,7779,7782],{"class":773,"line":1285},[771,7757,1777],{"class":777},[771,7759,1780],{"class":938},[771,7761,942],{"class":777},[771,7763,1785],{"class":777},[771,7765,1671],{"class":1031},[771,7767,1035],{"class":781},[771,7769,7770],{"class":788},"'GET'",[771,7772,1330],{"class":781},[771,7774,7775],{"class":788},"`\u002Fcountry?page=${",[771,7777,7778],{"class":781},"page",[771,7780,7781],{"class":788},"}&limit=100`",[771,7783,1041],{"class":781},[771,7785,7786,7788,7791,7793,7796,7799,7801,7803,7805,7807,7810,7812],{"class":773,"line":1312},[771,7787,1777],{"class":777},[771,7789,7790],{"class":938}," hit",[771,7792,942],{"class":777},[771,7794,7795],{"class":781}," res.data.",[771,7797,7798],{"class":1031},"find",[771,7800,1604],{"class":781},[771,7802,5359],{"class":1108},[771,7804,1112],{"class":781},[771,7806,1115],{"class":777},[771,7808,7809],{"class":781}," country.iso2 ",[771,7811,1851],{"class":777},[771,7813,7814],{"class":781}," iso2);\n",[771,7816,7817,7819,7822,7824],{"class":773,"line":1338},[771,7818,1935],{"class":777},[771,7820,7821],{"class":781}," (hit) ",[771,7823,1247],{"class":777},[771,7825,7826],{"class":781}," hit._id;\n",[771,7828,7829,7831,7834,7836,7839,7841,7843,7845,7847,7850,7852,7855],{"class":773,"line":1366},[771,7830,1935],{"class":777},[771,7832,7833],{"class":781}," (page ",[771,7835,3352],{"class":777},[771,7837,7838],{"class":781}," res.pagination.totalPages) ",[771,7840,2225],{"class":777},[771,7842,1028],{"class":777},[771,7844,1032],{"class":1031},[771,7846,1035],{"class":781},[771,7848,7849],{"class":788},"`Country ${",[771,7851,7729],{"class":781},[771,7853,7854],{"class":788},"} cannot be selected.`",[771,7856,1041],{"class":781},[771,7858,7859],{"class":773,"line":1380},[771,7860,1567],{"class":781},[771,7862,7863],{"class":773,"line":1416},[771,7864,1047],{"class":781},[771,7866,7867],{"class":773,"line":1424},[771,7868,927],{"emptyLinePlaceholder":926},[771,7870,7871,7873,7875,7878,7880,7883],{"class":773,"line":1429},[771,7872,7719],{"class":777},[771,7874,1178],{"class":777},[771,7876,7877],{"class":1031}," registerStudent",[771,7879,1035],{"class":781},[771,7881,7882],{"class":1108},"fields",[771,7884,1019],{"class":781},[771,7886,7887,7890],{"class":773,"line":1434},[771,7888,7889],{"class":777},"  try",[771,7891,1450],{"class":781},[771,7893,7894,7896,7898,7900,7902,7904,7906,7909,7911,7914],{"class":773,"line":1453},[771,7895,1777],{"class":777},[771,7897,1780],{"class":938},[771,7899,942],{"class":777},[771,7901,1785],{"class":777},[771,7903,1671],{"class":1031},[771,7905,1035],{"class":781},[771,7907,7908],{"class":788},"'POST'",[771,7910,1330],{"class":781},[771,7912,7913],{"class":788},"'\u002Fstudent'",[771,7915,7916],{"class":781},", fields);\n",[771,7918,7919,7922,7925,7927,7930,7933,7935,7937,7939,7941,7943],{"class":773,"line":1476},[771,7920,7921],{"class":781},"    console.",[771,7923,7924],{"class":1031},"log",[771,7926,1035],{"class":781},[771,7928,7929],{"class":788},"`   registered as ${",[771,7931,7932],{"class":781},"res",[771,7934,816],{"class":788},[771,7936,6742],{"class":781},[771,7938,816],{"class":788},[771,7940,5759],{"class":781},[771,7942,1361],{"class":788},[771,7944,1041],{"class":781},[771,7946,7947,7949],{"class":773,"line":1497},[771,7948,2248],{"class":777},[771,7950,7951],{"class":781}," res.data._id;\n",[771,7953,7954,7957,7959],{"class":773,"line":1513},[771,7955,7956],{"class":781},"  } ",[771,7958,2189],{"class":777},[771,7960,7961],{"class":781}," (error) {\n",[771,7963,7964],{"class":773,"line":1526},[771,7965,7966],{"class":902},"    \u002F\u002F Already registered to this account: the message names the existing _id.\n",[771,7968,7969,7971,7974],{"class":773,"line":1546},[771,7970,1777],{"class":777},[771,7972,7973],{"class":938}," id",[771,7975,7976],{"class":777}," =\n",[771,7978,7979,7982,7985,7987,7989,7992,7994],{"class":773,"line":1564},[771,7980,7981],{"class":781},"      error ",[771,7983,7984],{"class":777},"instanceof",[771,7986,1442],{"class":1108},[771,7988,1946],{"class":777},[771,7990,7991],{"class":781}," error.status ",[771,7993,1851],{"class":777},[771,7995,7996],{"class":938}," 409\n",[771,7998,7999,8002,8005,8008,8010,8012,8016,8018,8021,8024,8026,8029,8031,8034,8036],{"class":773,"line":1570},[771,8000,8001],{"class":777},"        ?",[771,8003,8004],{"class":781}," error.message.",[771,8006,8007],{"class":1031},"match",[771,8009,1035],{"class":781},[771,8011,1213],{"class":788},[771,8013,8015],{"class":8014},"sJaa3","\\(",[771,8017,1035],{"class":788},[771,8019,8020],{"class":938},"[0-9a-f]",[771,8022,8023],{"class":777},"{24}",[771,8025,3113],{"class":788},[771,8027,8028],{"class":8014},"\\)",[771,8030,1213],{"class":788},[771,8032,8033],{"class":781},")?.[",[771,8035,425],{"class":938},[771,8037,8038],{"class":781},"]\n",[771,8040,8041,8044,8046],{"class":773,"line":1575},[771,8042,8043],{"class":777},"        :",[771,8045,1854],{"class":938},[771,8047,920],{"class":781},[771,8049,8050,8052],{"class":773,"line":1580},[771,8051,1935],{"class":777},[771,8053,8054],{"class":781}," (id) {\n",[771,8056,8057,8060,8062,8064,8067],{"class":773,"line":1620},[771,8058,8059],{"class":781},"      console.",[771,8061,7924],{"class":1031},[771,8063,1035],{"class":781},[771,8065,8066],{"class":788},"'   already registered to this account; reusing it'",[771,8068,1041],{"class":781},[771,8070,8071,8074],{"class":773,"line":1625},[771,8072,8073],{"class":777},"      return",[771,8075,8076],{"class":781}," id;\n",[771,8078,8079],{"class":773,"line":1631},[771,8080,2024],{"class":781},[771,8082,8083,8086],{"class":773,"line":1637},[771,8084,8085],{"class":777},"    throw",[771,8087,8088],{"class":781}," error;\n",[771,8090,8091],{"class":773,"line":1643},[771,8092,1567],{"class":781},[771,8094,8095],{"class":773,"line":1649},[771,8096,1047],{"class":781},[771,8098,8099],{"class":773,"line":1655},[771,8100,927],{"emptyLinePlaceholder":926},[771,8102,8103],{"class":773,"line":1661},[771,8104,8105],{"class":902},"\u002F\u002F The per-student list answers 409 until the organization holds a copy of the student.\n",[771,8107,8108,8110,8112,8115,8117,8120,8122,8124],{"class":773,"line":1717},[771,8109,7719],{"class":777},[771,8111,1178],{"class":777},[771,8113,8114],{"class":1031}," hasOrgCopy",[771,8116,1035],{"class":781},[771,8118,8119],{"class":1108},"orgId",[771,8121,1330],{"class":781},[771,8123,6950],{"class":1108},[771,8125,1019],{"class":781},[771,8127,8128,8130],{"class":773,"line":1733},[771,8129,7889],{"class":777},[771,8131,1450],{"class":781},[771,8133,8134,8137,8139,8141,8143,8145,8148,8150,8153,8155,8158],{"class":773,"line":1748},[771,8135,8136],{"class":777},"    await",[771,8138,1671],{"class":1031},[771,8140,1035],{"class":781},[771,8142,7770],{"class":788},[771,8144,1330],{"class":781},[771,8146,8147],{"class":788},"`\u002F${",[771,8149,8119],{"class":781},[771,8151,8152],{"class":788},"}\u002Fapplication\u002Fstudent-applications\u002F${",[771,8154,6950],{"class":781},[771,8156,8157],{"class":788},"}?limit=1`",[771,8159,1041],{"class":781},[771,8161,8162,8164,8166],{"class":773,"line":1774},[771,8163,2248],{"class":777},[771,8165,2065],{"class":938},[771,8167,920],{"class":781},[771,8169,8170,8172,8174],{"class":773,"line":1801},[771,8171,7956],{"class":781},[771,8173,2189],{"class":777},[771,8175,7961],{"class":781},[771,8177,8178,8180,8183,8185,8187,8189,8191,8193,8196,8198,8200,8202],{"class":773,"line":1807},[771,8179,1935],{"class":777},[771,8181,8182],{"class":781}," (error ",[771,8184,7984],{"class":777},[771,8186,1442],{"class":1108},[771,8188,1946],{"class":777},[771,8190,7991],{"class":781},[771,8192,1851],{"class":777},[771,8194,8195],{"class":938}," 409",[771,8197,1112],{"class":781},[771,8199,1247],{"class":777},[771,8201,1696],{"class":938},[771,8203,920],{"class":781},[771,8205,8206,8208],{"class":773,"line":1813},[771,8207,8085],{"class":777},[771,8209,8088],{"class":781},[771,8211,8212],{"class":773,"line":1833},[771,8213,1567],{"class":781},[771,8215,8216],{"class":773,"line":1842},[771,8217,1047],{"class":781},[771,8219,8220],{"class":773,"line":1881},[771,8221,927],{"emptyLinePlaceholder":926},[771,8223,8224,8226,8228,8231,8233,8235,8237,8239],{"class":773,"line":1887},[771,8225,7719],{"class":777},[771,8227,1178],{"class":777},[771,8229,8230],{"class":1031}," ensureSignedInOnce",[771,8232,1035],{"class":781},[771,8234,8119],{"class":1108},[771,8236,1330],{"class":781},[771,8238,6950],{"class":1108},[771,8240,1019],{"class":781},[771,8242,8243,8245,8247,8250,8252],{"class":773,"line":1914},[771,8244,1224],{"class":777},[771,8246,1001],{"class":781},[771,8248,8249],{"class":777},"await",[771,8251,8114],{"class":1031},[771,8253,8254],{"class":781},"(orgId, studentId)) {\n",[771,8256,8257,8259,8261,8263,8266],{"class":773,"line":1926},[771,8258,7921],{"class":781},[771,8260,7924],{"class":1031},[771,8262,1035],{"class":781},[771,8264,8265],{"class":788},"'5. The student has signed in to this organization before'",[771,8267,1041],{"class":781},[771,8269,8270,8272],{"class":773,"line":1932},[771,8271,2248],{"class":777},[771,8273,920],{"class":781},[771,8275,8276],{"class":773,"line":1959},[771,8277,1567],{"class":781},[771,8279,8280,8282,8285,8287,8290,8293],{"class":773,"line":1973},[771,8281,1190],{"class":777},[771,8283,8284],{"class":938}," rl",[771,8286,942],{"class":777},[771,8288,8289],{"class":781}," readline.",[771,8291,8292],{"class":1031},"createInterface",[771,8294,8295],{"class":781},"({ input: process.stdin, output: process.stdout });\n",[771,8297,8298,8300],{"class":773,"line":2013},[771,8299,7889],{"class":777},[771,8301,1450],{"class":781},[771,8303,8304,8307],{"class":773,"line":2021},[771,8305,8306],{"class":777},"    for",[771,8308,8309],{"class":781}," (;;) {\n",[771,8311,8312,8315,8318,8320,8322,8324,8326,8328,8330,8332,8334,8337],{"class":773,"line":2027},[771,8313,8314],{"class":777},"      const",[771,8316,8317],{"class":938}," link",[771,8319,942],{"class":777},[771,8321,1785],{"class":777},[771,8323,1671],{"class":1031},[771,8325,1035],{"class":781},[771,8327,7908],{"class":788},[771,8329,1330],{"class":781},[771,8331,8147],{"class":788},[771,8333,8119],{"class":781},[771,8335,8336],{"class":788},"}\u002Fauth\u002Fsignin`",[771,8338,8339],{"class":781},", { studentId });\n",[771,8341,8342,8344,8346,8348,8351,8354,8356,8358,8360,8363,8366],{"class":773,"line":2046},[771,8343,8059],{"class":781},[771,8345,7924],{"class":1031},[771,8347,1035],{"class":781},[771,8349,8350],{"class":788},"`5. Open this link in a browser within ${",[771,8352,8353],{"class":781},"link",[771,8355,816],{"class":788},[771,8357,6742],{"class":781},[771,8359,816],{"class":788},[771,8361,8362],{"class":781},"expiresIn",[771,8364,8365],{"class":788},"} s. It works once:`",[771,8367,1041],{"class":781},[771,8369,8370,8372,8374,8376,8379,8381,8383,8385,8387,8390,8392],{"class":773,"line":2057},[771,8371,8059],{"class":781},[771,8373,7924],{"class":1031},[771,8375,1035],{"class":781},[771,8377,8378],{"class":788},"`   ${",[771,8380,8353],{"class":781},[771,8382,816],{"class":788},[771,8384,6742],{"class":781},[771,8386,816],{"class":788},[771,8388,8389],{"class":781},"url",[771,8391,1361],{"class":788},[771,8393,1041],{"class":781},[771,8395,8396,8398,8401,8404,8406,8409],{"class":773,"line":2070},[771,8397,1962],{"class":777},[771,8399,8400],{"class":781}," rl.",[771,8402,8403],{"class":1031},"question",[771,8405,1035],{"class":781},[771,8407,8408],{"class":788},"'   Press Enter after the panel has loaded... '",[771,8410,1041],{"class":781},[771,8412,8413,8416,8418,8420,8422,8425,8427],{"class":773,"line":2082},[771,8414,8415],{"class":777},"      if",[771,8417,1001],{"class":781},[771,8419,8249],{"class":777},[771,8421,8114],{"class":1031},[771,8423,8424],{"class":781},"(orgId, studentId)) ",[771,8426,1247],{"class":777},[771,8428,920],{"class":781},[771,8430,8431,8433,8435,8437,8440],{"class":773,"line":2089},[771,8432,8059],{"class":781},[771,8434,7924],{"class":1031},[771,8436,1035],{"class":781},[771,8438,8439],{"class":788},"'   The organization has no record of the student yet. Minting a fresh link.'",[771,8441,1041],{"class":781},[771,8443,8444],{"class":773,"line":2094},[771,8445,2024],{"class":781},[771,8447,8448,8450,8453],{"class":773,"line":2112},[771,8449,7956],{"class":781},[771,8451,8452],{"class":777},"finally",[771,8454,1450],{"class":781},[771,8456,8457,8460,8463],{"class":773,"line":2130},[771,8458,8459],{"class":781},"    rl.",[771,8461,8462],{"class":1031},"close",[771,8464,1730],{"class":781},[771,8466,8467],{"class":773,"line":2145},[771,8468,1567],{"class":781},[771,8470,8471],{"class":773,"line":2153},[771,8472,1047],{"class":781},[771,8474,8475],{"class":773,"line":2183},[771,8476,927],{"emptyLinePlaceholder":926},[771,8478,8479,8482,8485,8487,8490],{"class":773,"line":2194},[771,8480,8481],{"class":777},"function",[771,8483,8484],{"class":1031}," firstLeaf",[771,8486,1035],{"class":781},[771,8488,8489],{"class":1108},"tree",[771,8491,1019],{"class":781},[771,8493,8494,8496,8498,8500,8503,8506],{"class":773,"line":2208},[771,8495,1751],{"class":777},[771,8497,1001],{"class":781},[771,8499,962],{"class":777},[771,8501,8502],{"class":938}," category",[771,8504,8505],{"class":777}," of",[771,8507,8508],{"class":781}," tree) {\n",[771,8510,8511,8513,8515,8517,8520,8522],{"class":773,"line":2213},[771,8512,8306],{"class":777},[771,8514,1001],{"class":781},[771,8516,962],{"class":777},[771,8518,8519],{"class":938}," session",[771,8521,8505],{"class":777},[771,8523,8524],{"class":781}," category.sessions) {\n",[771,8526,8527,8530,8532,8534,8537,8539],{"class":773,"line":2245},[771,8528,8529],{"class":777},"      for",[771,8531,1001],{"class":781},[771,8533,962],{"class":777},[771,8535,8536],{"class":938}," language",[771,8538,8505],{"class":777},[771,8540,8541],{"class":781}," session.languages) {\n",[771,8543,8544,8546],{"class":773,"line":2254},[771,8545,2649],{"class":777},[771,8547,8548],{"class":781}," { category, session, language, exam: language.matchedExam };\n",[771,8550,8551],{"class":773,"line":2259},[771,8552,8553],{"class":781},"      }\n",[771,8555,8556],{"class":773,"line":3425},[771,8557,2024],{"class":781},[771,8559,8560],{"class":773,"line":3447},[771,8561,1567],{"class":781},[771,8563,8564,8566,8568],{"class":773,"line":3473},[771,8565,1419],{"class":777},[771,8567,1157],{"class":938},[771,8569,920],{"class":781},[771,8571,8572],{"class":773,"line":3479},[771,8573,1047],{"class":781},[771,8575,8576],{"class":773,"line":3484},[771,8577,927],{"emptyLinePlaceholder":926},[771,8579,8580,8582,8584,8587],{"class":773,"line":3504},[771,8581,7719],{"class":777},[771,8583,1178],{"class":777},[771,8585,8586],{"class":1031}," main",[771,8588,1184],{"class":781},[771,8590,8591,8593,8596,8598,8600,8602,8604,8606,8608,8611],{"class":773,"line":3509},[771,8592,1190],{"class":777},[771,8594,8595],{"class":938}," account",[771,8597,942],{"class":777},[771,8599,1785],{"class":777},[771,8601,1671],{"class":1031},[771,8603,1035],{"class":781},[771,8605,7770],{"class":788},[771,8607,1330],{"class":781},[771,8609,8610],{"class":788},"'\u002Fapi-account\u002Fvalidate-me'",[771,8612,1041],{"class":781},[771,8614,8615,8618,8620,8622,8625,8628,8630,8633,8636,8638,8640,8642,8645],{"class":773,"line":3514},[771,8616,8617],{"class":781},"  console.",[771,8619,7924],{"class":1031},[771,8621,1035],{"class":781},[771,8623,8624],{"class":788},"`1. Signed in as ${",[771,8626,8627],{"class":781},"account",[771,8629,816],{"class":788},[771,8631,8632],{"class":781},"companyName",[771,8634,8635],{"class":788},"} (${",[771,8637,8627],{"class":781},[771,8639,816],{"class":788},[771,8641,560],{"class":781},[771,8643,8644],{"class":788},"})`",[771,8646,1041],{"class":781},[771,8648,8649],{"class":773,"line":3519},[771,8650,927],{"emptyLinePlaceholder":926},[771,8652,8653,8655,8658,8660,8662,8664,8666,8668,8670,8673],{"class":773,"line":3534},[771,8654,1190],{"class":777},[771,8656,8657],{"class":938}," orgs",[771,8659,942],{"class":777},[771,8661,1785],{"class":777},[771,8663,1671],{"class":1031},[771,8665,1035],{"class":781},[771,8667,7770],{"class":788},[771,8669,1330],{"class":781},[771,8671,8672],{"class":788},"'\u002Forganization?limit=100'",[771,8674,1041],{"class":781},[771,8676,8677,8679,8682,8684,8687,8689,8691,8694,8696,8698,8701,8703],{"class":773,"line":3569},[771,8678,1190],{"class":777},[771,8680,8681],{"class":938}," org",[771,8683,942],{"class":777},[771,8685,8686],{"class":781}," orgs.data.",[771,8688,7798],{"class":1031},[771,8690,1604],{"class":781},[771,8692,8693],{"class":1108},"candidate",[771,8695,1112],{"class":781},[771,8697,1115],{"class":777},[771,8699,8700],{"class":781}," candidate.slug ",[771,8702,1851],{"class":777},[771,8704,8705],{"class":781}," slug);\n",[771,8707,8708,8710,8712,8714,8717,8719,8721,8723,8725,8728,8730,8733],{"class":773,"line":3574},[771,8709,1224],{"class":777},[771,8711,1001],{"class":781},[771,8713,1004],{"class":777},[771,8715,8716],{"class":781},"org) ",[771,8718,2225],{"class":777},[771,8720,1028],{"class":777},[771,8722,1032],{"class":1031},[771,8724,1035],{"class":781},[771,8726,8727],{"class":788},"`No organization with slug ${",[771,8729,4603],{"class":781},[771,8731,8732],{"class":788},"}.`",[771,8734,1041],{"class":781},[771,8736,8737,8739,8741,8743,8746,8748,8751,8754,8756,8758,8760],{"class":773,"line":3584},[771,8738,8617],{"class":781},[771,8740,7924],{"class":1031},[771,8742,1035],{"class":781},[771,8744,8745],{"class":788},"`2. ${",[771,8747,4603],{"class":781},[771,8749,8750],{"class":788},"} is ${",[771,8752,8753],{"class":781},"org",[771,8755,816],{"class":788},[771,8757,449],{"class":781},[771,8759,1361],{"class":788},[771,8761,1041],{"class":781},[771,8763,8764],{"class":773,"line":3618},[771,8765,927],{"emptyLinePlaceholder":926},[771,8767,8768,8770,8773,8775,8777,8779],{"class":773,"line":3641},[771,8769,1190],{"class":777},[771,8771,8772],{"class":938}," countryId",[771,8774,942],{"class":777},[771,8776,1785],{"class":777},[771,8778,7724],{"class":1031},[771,8780,8781],{"class":781},"(countryIso2);\n",[771,8783,8784,8786,8788,8790,8793,8796,8798,8801,8803],{"class":773,"line":3655},[771,8785,8617],{"class":781},[771,8787,7924],{"class":1031},[771,8789,1035],{"class":781},[771,8791,8792],{"class":788},"`3. Country ${",[771,8794,8795],{"class":781},"countryIso2",[771,8797,8750],{"class":788},[771,8799,8800],{"class":781},"countryId",[771,8802,1361],{"class":788},[771,8804,1041],{"class":781},[771,8806,8807],{"class":773,"line":3668},[771,8808,927],{"emptyLinePlaceholder":926},[771,8810,8811,8813,8816,8818,8820,8822,8825,8828],{"class":773,"line":3698},[771,8812,1190],{"class":777},[771,8814,8815],{"class":938}," studentId",[771,8817,942],{"class":777},[771,8819,1785],{"class":777},[771,8821,7877],{"class":1031},[771,8823,8824],{"class":781},"({ ",[771,8826,8827],{"class":777},"...",[771,8829,8830],{"class":781},"newStudent, country: countryId });\n",[771,8832,8833,8835,8837,8839,8842,8844,8846],{"class":773,"line":3703},[771,8834,8617],{"class":781},[771,8836,7924],{"class":1031},[771,8838,1035],{"class":781},[771,8840,8841],{"class":788},"`4. Student ${",[771,8843,6950],{"class":781},[771,8845,1361],{"class":788},[771,8847,1041],{"class":781},[771,8849,8850],{"class":773,"line":3712},[771,8851,927],{"emptyLinePlaceholder":926},[771,8853,8854,8857,8859],{"class":773,"line":3723},[771,8855,8856],{"class":777},"  await",[771,8858,8230],{"class":1031},[771,8860,8861],{"class":781},"(org._id, studentId);\n",[771,8863,8864],{"class":773,"line":3734},[771,8865,927],{"emptyLinePlaceholder":926},[771,8867,8868,8870,8873,8875,8877,8879,8881,8883,8885,8887,8889,8891,8893,8895,8898,8900,8902],{"class":773,"line":3746},[771,8869,1190],{"class":777},[771,8871,8872],{"class":938}," tree",[771,8874,942],{"class":777},[771,8876,1001],{"class":781},[771,8878,8249],{"class":777},[771,8880,1671],{"class":1031},[771,8882,1035],{"class":781},[771,8884,7770],{"class":788},[771,8886,1330],{"class":781},[771,8888,8147],{"class":788},[771,8890,8753],{"class":781},[771,8892,816],{"class":788},[771,8894,449],{"class":781},[771,8896,8897],{"class":788},"}\u002Fexam\u002Favailable\u002F${",[771,8899,6950],{"class":781},[771,8901,1361],{"class":788},[771,8903,8904],{"class":781},")).data;\n",[771,8906,8907,8909,8912,8914,8916],{"class":773,"line":3759},[771,8908,1190],{"class":777},[771,8910,8911],{"class":938}," leaf",[771,8913,942],{"class":777},[771,8915,8484],{"class":1031},[771,8917,8918],{"class":781},"(tree);\n",[771,8920,8921,8923,8925,8927],{"class":773,"line":3772},[771,8922,1224],{"class":777},[771,8924,1001],{"class":781},[771,8926,1004],{"class":777},[771,8928,8929],{"class":781},"leaf) {\n",[771,8931,8932,8934,8936,8938,8941],{"class":773,"line":3807},[771,8933,7921],{"class":781},[771,8935,7924],{"class":1031},[771,8937,1035],{"class":781},[771,8939,8940],{"class":788},"'6. No exam is open to this student right now.'",[771,8942,1041],{"class":781},[771,8944,8945,8947],{"class":773,"line":3830},[771,8946,2248],{"class":777},[771,8948,920],{"class":781},[771,8950,8951],{"class":773,"line":3851},[771,8952,1567],{"class":781},[771,8954,8955,8957,8960,8962,8965,8967,8969],{"class":773,"line":3886},[771,8956,1190],{"class":777},[771,8958,8959],{"class":938}," price",[771,8961,942],{"class":777},[771,8963,8964],{"class":781}," leaf.exam.price ",[771,8966,1485],{"class":777},[771,8968,2504],{"class":938},[771,8970,920],{"class":781},[771,8972,8973,8975,8977],{"class":773,"line":3892},[771,8974,8617],{"class":781},[771,8976,7924],{"class":1031},[771,8978,2334],{"class":781},[771,8980,8981,8984,8987,8989,8991,8993,8996,8999,9001,9003,9005,9007,9009,9012,9014,9016,9018,9020,9022,9025],{"class":773,"line":3904},[771,8982,8983],{"class":788},"    `6. Picked ${",[771,8985,8986],{"class":781},"leaf",[771,8988,816],{"class":788},[771,8990,6699],{"class":781},[771,8992,816],{"class":788},[771,8994,8995],{"class":781},"name",[771,8997,8998],{"class":788},"} on ${",[771,9000,8986],{"class":781},[771,9002,816],{"class":788},[771,9004,6696],{"class":781},[771,9006,816],{"class":788},[771,9008,4103],{"class":781},[771,9010,9011],{"class":788},"} in ${",[771,9013,8986],{"class":781},[771,9015,816],{"class":788},[771,9017,6703],{"class":781},[771,9019,816],{"class":788},[771,9021,8995],{"class":781},[771,9023,9024],{"class":788},"} `",[771,9026,9027],{"class":777}," +\n",[771,9029,9030,9033,9035,9037,9039,9041,9043,9046,9048,9050],{"class":773,"line":3910},[771,9031,9032],{"class":788},"      `(exam ${",[771,9034,8986],{"class":781},[771,9036,816],{"class":788},[771,9038,7490],{"class":781},[771,9040,816],{"class":788},[771,9042,449],{"class":781},[771,9044,9045],{"class":788},"}, price ${",[771,9047,6711],{"class":781},[771,9049,8644],{"class":788},[771,9051,1830],{"class":781},[771,9053,9054],{"class":773,"line":3916},[771,9055,9056],{"class":781},"  );\n",[771,9058,9059],{"class":773,"line":3930},[771,9060,927],{"emptyLinePlaceholder":926},[771,9062,9063,9065,9068,9070,9072,9074,9076,9078,9080,9082,9084,9086,9088,9091],{"class":773,"line":3954},[771,9064,1190],{"class":777},[771,9066,9067],{"class":938}," created",[771,9069,942],{"class":777},[771,9071,1785],{"class":777},[771,9073,1671],{"class":1031},[771,9075,1035],{"class":781},[771,9077,7908],{"class":788},[771,9079,1330],{"class":781},[771,9081,8147],{"class":788},[771,9083,8753],{"class":781},[771,9085,816],{"class":788},[771,9087,449],{"class":781},[771,9089,9090],{"class":788},"}\u002Fapplication`",[771,9092,9093],{"class":781},", { studentId, examId: leaf.exam._id });\n",[771,9095,9096,9098,9100,9102,9105,9108,9110,9113,9116,9118,9120,9122,9124,9126,9128],{"class":773,"line":3967},[771,9097,8617],{"class":781},[771,9099,7924],{"class":1031},[771,9101,1035],{"class":781},[771,9103,9104],{"class":788},"`7. ${",[771,9106,9107],{"class":781},"created",[771,9109,816],{"class":788},[771,9111,9112],{"class":781},"message",[771,9114,9115],{"class":788},"} Application ${",[771,9117,9107],{"class":781},[771,9119,816],{"class":788},[771,9121,6742],{"class":781},[771,9123,816],{"class":788},[771,9125,449],{"class":781},[771,9127,1361],{"class":788},[771,9129,1041],{"class":781},[771,9131,9132],{"class":773,"line":3975},[771,9133,927],{"emptyLinePlaceholder":926},[771,9135,9136,9138,9141,9143,9145,9147,9149,9151,9153,9155,9157,9159,9161,9163,9165,9167],{"class":773,"line":3989},[771,9137,1190],{"class":777},[771,9139,9140],{"class":938}," list",[771,9142,942],{"class":777},[771,9144,1785],{"class":777},[771,9146,1671],{"class":1031},[771,9148,1035],{"class":781},[771,9150,7770],{"class":788},[771,9152,1330],{"class":781},[771,9154,8147],{"class":788},[771,9156,8753],{"class":781},[771,9158,816],{"class":788},[771,9160,449],{"class":781},[771,9162,8152],{"class":788},[771,9164,6950],{"class":781},[771,9166,1361],{"class":788},[771,9168,1041],{"class":781},[771,9170,9171,9173,9175,9177,9180,9182],{"class":773,"line":4010},[771,9172,1751],{"class":777},[771,9174,1001],{"class":781},[771,9176,962],{"class":777},[771,9178,9179],{"class":938}," application",[771,9181,8505],{"class":777},[771,9183,9184],{"class":781}," list.data) {\n",[771,9186,9187,9189,9192,9194,9197,9199],{"class":773,"line":4015},[771,9188,1777],{"class":777},[771,9190,9191],{"class":938}," payment",[771,9193,942],{"class":777},[771,9195,9196],{"class":781}," application.payment ",[771,9198,1485],{"class":777},[771,9200,9201],{"class":781}," {};\n",[771,9203,9204,9206,9208,9210,9213,9216,9218,9220,9223,9225,9227,9229,9232,9234,9236,9238,9240],{"class":773,"line":4028},[771,9205,7921],{"class":781},[771,9207,7924],{"class":1031},[771,9209,1035],{"class":781},[771,9211,9212],{"class":788},"`8. ${",[771,9214,9215],{"class":781},"application",[771,9217,816],{"class":788},[771,9219,449],{"class":781},[771,9221,9222],{"class":788},"}: payment ${",[771,9224,7495],{"class":781},[771,9226,816],{"class":788},[771,9228,1461],{"class":781},[771,9230,9231],{"class":788},"}, amount ${",[771,9233,7495],{"class":781},[771,9235,816],{"class":788},[771,9237,6963],{"class":781},[771,9239,1361],{"class":788},[771,9241,1041],{"class":781},[771,9243,9244],{"class":773,"line":4033},[771,9245,1567],{"class":781},[771,9247,9249],{"class":773,"line":9248},128,[771,9250,1047],{"class":781},[771,9252,9254],{"class":773,"line":9253},129,[771,9255,927],{"emptyLinePlaceholder":926},[771,9257,9259,9262,9265,9267,9269,9272,9274,9276],{"class":773,"line":9258},130,[771,9260,9261],{"class":1031},"main",[771,9263,9264],{"class":781},"().",[771,9266,2189],{"class":1031},[771,9268,1604],{"class":781},[771,9270,9271],{"class":1108},"error",[771,9273,1112],{"class":781},[771,9275,1115],{"class":777},[771,9277,1450],{"class":781},[771,9279,9281,9283,9285,9287,9289],{"class":773,"line":9280},131,[771,9282,1224],{"class":777},[771,9284,8182],{"class":781},[771,9286,7984],{"class":777},[771,9288,1442],{"class":1108},[771,9290,1019],{"class":781},[771,9292,9294,9296,9298,9300,9302,9304,9306,9308,9311,9313,9315,9317,9320,9322,9324,9326,9329,9331,9333,9335,9337],{"class":773,"line":9293},132,[771,9295,7921],{"class":781},[771,9297,9271],{"class":1031},[771,9299,1035],{"class":781},[771,9301,1349],{"class":788},[771,9303,9271],{"class":781},[771,9305,816],{"class":788},[771,9307,1461],{"class":781},[771,9309,9310],{"class":788},"} ${",[771,9312,9271],{"class":781},[771,9314,816],{"class":788},[771,9316,376],{"class":781},[771,9318,9319],{"class":788},"}: ${",[771,9321,9271],{"class":781},[771,9323,816],{"class":788},[771,9325,9112],{"class":781},[771,9327,9328],{"class":788},"} (request ${",[771,9330,9271],{"class":781},[771,9332,816],{"class":788},[771,9334,1471],{"class":781},[771,9336,8644],{"class":788},[771,9338,1041],{"class":781},[771,9340,9342,9344,9347],{"class":773,"line":9341},133,[771,9343,7956],{"class":781},[771,9345,9346],{"class":777},"else",[771,9348,1450],{"class":781},[771,9350,9352,9354,9356],{"class":773,"line":9351},134,[771,9353,7921],{"class":781},[771,9355,9271],{"class":1031},[771,9357,9358],{"class":781},"(error);\n",[771,9360,9362],{"class":773,"line":9361},135,[771,9363,1567],{"class":781},[771,9365,9367,9370,9372,9374],{"class":773,"line":9366},136,[771,9368,9369],{"class":781},"  process.exitCode ",[771,9371,785],{"class":777},[771,9373,1763],{"class":938},[771,9375,920],{"class":781},[771,9377,9379],{"class":773,"line":9378},137,[771,9380,9381],{"class":781},"});\n",[547,9383,311],{"id":2267},[762,9385,9388],{"className":2264,"code":9386,"filename":9387,"language":2267,"meta":767,"style":767},"\u003C?php\n\u002F\u002F register-and-apply.php: register a student, send them in once, enter them for an exam.\n\u002F\u002F Usage: php register-and-apply.php stem\ndeclare(strict_types=1);\nrequire __DIR__ . '\u002Fmainteam.php';\n\n$slug = $argv[1] ?? 'stem';\n\n\u002F\u002F The student to register. Replace with real data from your own records.\n$countryIso2 = 'AL';\n$newStudent = [\n    'firstName' => 'Jane',\n    'lastName' => 'Doe',\n    'email' => 'jane.doe@example.com',\n    'birth' => '14\u002F05\u002F2011',\n    'sex' => 'f',\n    'grade' => '10',\n    'city' => 'Berlin',\n    'school' => 'Berlin International School',\n];\n\nfunction findCountryId(MainTeam $api, string $iso2): string\n{\n    for ($page = 1; ; $page++) {\n        $res = $api->call('GET', \"\u002Fcountry?page=$page&limit=100\");\n        foreach ($res['data'] as $country) {\n            if (($country['iso2'] ?? null) === $iso2) {\n                return $country['_id'];\n            }\n        }\n        if ($page >= $res['pagination']['totalPages']) {\n            throw new RuntimeException(\"Country $iso2 cannot be selected.\");\n        }\n    }\n}\n\nfunction registerStudent(MainTeam $api, array $fields): string\n{\n    try {\n        $res = $api->call('POST', '\u002Fstudent', $fields);\n        echo \"   registered as {$res['data']['username']}\\n\";\n        return $res['data']['_id'];\n    } catch (ApiError $e) {\n        \u002F\u002F Already registered to this account: the message names the existing _id.\n        if ($e->status === 409 && preg_match('\u002F\\(([0-9a-f]{24})\\)\u002F', $e->getMessage(), $m)) {\n            echo \"   already registered to this account; reusing it\\n\";\n            return $m[1];\n        }\n        throw $e;\n    }\n}\n\n\u002F\u002F The per-student list answers 409 until the organization holds a copy of the student.\nfunction hasOrgCopy(MainTeam $api, string $orgId, string $studentId): bool\n{\n    try {\n        $api->call('GET', \"\u002F$orgId\u002Fapplication\u002Fstudent-applications\u002F$studentId?limit=1\");\n        return true;\n    } catch (ApiError $e) {\n        if ($e->status === 409) {\n            return false;\n        }\n        throw $e;\n    }\n}\n\nfunction ensureSignedInOnce(MainTeam $api, string $orgId, string $studentId): void\n{\n    if (hasOrgCopy($api, $orgId, $studentId)) {\n        echo \"5. The student has signed in to this organization before\\n\";\n        return;\n    }\n    while (true) {\n        $link = $api->call('POST', \"\u002F$orgId\u002Fauth\u002Fsignin\", ['studentId' => $studentId]);\n        echo \"5. Open this link in a browser within {$link['data']['expiresIn']} s. It works once:\\n\";\n        echo \"   {$link['data']['url']}\\n\";\n        echo '   Press Enter after the panel has loaded... ';\n        fgets(STDIN);\n        if (hasOrgCopy($api, $orgId, $studentId)) {\n            return;\n        }\n        echo \"   The organization has no record of the student yet. Minting a fresh link.\\n\";\n    }\n}\n\nfunction firstLeaf(array $tree): ?array\n{\n    foreach ($tree as $category) {\n        foreach ($category['sessions'] as $session) {\n            foreach ($session['languages'] as $language) {\n                return [\n                    'category' => $category,\n                    'session' => $session,\n                    'language' => $language,\n                    'exam' => $language['matchedExam'],\n                ];\n            }\n        }\n    }\n    return null;\n}\n\n$api = MainTeam::fromEnv();\n\ntry {\n    $account = $api->call('GET', '\u002Fapi-account\u002Fvalidate-me');\n    echo \"1. Signed in as {$account['companyName']} ({$account['apiKey']})\\n\";\n\n    $orgs = $api->call('GET', '\u002Forganization?limit=100');\n    $orgId = null;\n    foreach ($orgs['data'] as $candidate) {\n        if ($candidate['slug'] === $slug) {\n            $orgId = $candidate['_id'];\n        }\n    }\n    if ($orgId === null) {\n        throw new RuntimeException(\"No organization with slug $slug.\");\n    }\n    echo \"2. $slug is $orgId\\n\";\n\n    $countryId = findCountryId($api, $countryIso2);\n    echo \"3. Country $countryIso2 is $countryId\\n\";\n\n    $studentId = registerStudent($api, $newStudent + ['country' => $countryId]);\n    echo \"4. Student $studentId\\n\";\n\n    ensureSignedInOnce($api, $orgId, $studentId);\n\n    $tree = $api->call('GET', \"\u002F$orgId\u002Fexam\u002Favailable\u002F$studentId\")['data'];\n    $leaf = firstLeaf($tree);\n    if ($leaf === null) {\n        echo \"6. No exam is open to this student right now.\\n\";\n        exit(0);\n    }\n    $price = $leaf['exam']['price'] ?? 0;\n    echo \"6. Picked {$leaf['category']['name']} on {$leaf['session']['date']} in {$leaf['language']['name']}\"\n        . \" (exam {$leaf['exam']['_id']}, price $price)\\n\";\n\n    $created = $api->call('POST', \"\u002F$orgId\u002Fapplication\", [\n        'studentId' => $studentId,\n        'examId' => $leaf['exam']['_id'],\n    ]);\n    echo \"7. {$created['message']} Application {$created['data']['_id']}\\n\";\n\n    $list = $api->call('GET', \"\u002F$orgId\u002Fapplication\u002Fstudent-applications\u002F$studentId\");\n    foreach ($list['data'] as $application) {\n        $status = $application['payment']['status'] ?? '-';\n        $amount = $application['payment']['amount'] ?? '-';\n        echo \"8. {$application['_id']}: payment $status, amount $amount\\n\";\n    }\n} catch (ApiError $e) {\n    fwrite(STDERR, \"{$e->status} {$e->errorCode}: {$e->getMessage()} (request {$e->requestId})\\n\");\n    exit(1);\n}\n","register-and-apply.php",[376,9389,9390,9396,9401,9406,9420,9435,9439,9459,9463,9467,9478,9488,9500,9512,9524,9536,9548,9560,9572,9584,9589,9593,9616,9620,9638,9670,9689,9712,9724,9728,9732,9755,9776,9780,9784,9788,9792,9814,9818,9824,9847,9868,9882,9895,9900,9947,9961,9972,9976,9984,9988,9992,9996,10000,10027,10031,10037,10069,10077,10089,10105,10113,10117,10123,10127,10131,10135,10160,10164,10176,10189,10195,10199,10210,10247,10266,10284,10293,10305,10315,10321,10325,10338,10342,10346,10350,10367,10371,10384,10401,10419,10425,10435,10445,10455,10470,10475,10479,10483,10487,10495,10499,10503,10521,10525,10532,10555,10580,10584,10607,10618,10634,10651,10665,10669,10673,10686,10707,10711,10731,10735,10747,10768,10772,10796,10811,10815,10823,10827,10864,10876,10889,10902,10913,10917,10943,10966,10990,10995,11025,11036,11054,11060,11085,11090,11122,11139,11166,11191,11219,11224,11238,11298,11310],{"__ignoreMap":767},[771,9391,9392,9394],{"class":773,"line":774},[771,9393,2274],{"class":777},[771,9395,2277],{"class":938},[771,9397,9398],{"class":773,"line":792},[771,9399,9400],{"class":902},"\u002F\u002F register-and-apply.php: register a student, send them in once, enter them for an exam.\n",[771,9402,9403],{"class":773,"line":923},[771,9404,9405],{"class":902},"\u002F\u002F Usage: php register-and-apply.php stem\n",[771,9407,9408,9410,9412,9414,9416,9418],{"class":773,"line":930},[771,9409,2287],{"class":777},[771,9411,1035],{"class":781},[771,9413,2292],{"class":938},[771,9415,785],{"class":777},[771,9417,425],{"class":938},[771,9419,1041],{"class":781},[771,9421,9422,9425,9428,9430,9433],{"class":773,"line":954},[771,9423,9424],{"class":777},"require",[771,9426,9427],{"class":938}," __DIR__",[771,9429,3598],{"class":777},[771,9431,9432],{"class":788}," '\u002Fmainteam.php'",[771,9434,920],{"class":781},[771,9436,9437],{"class":773,"line":959},[771,9438,927],{"emptyLinePlaceholder":926},[771,9440,9441,9444,9446,9449,9451,9453,9455,9457],{"class":773,"line":978},[771,9442,9443],{"class":781},"$slug ",[771,9445,785],{"class":777},[771,9447,9448],{"class":781}," $argv[",[771,9450,425],{"class":938},[771,9452,3242],{"class":781},[771,9454,1485],{"class":777},[771,9456,7589],{"class":788},[771,9458,920],{"class":781},[771,9460,9461],{"class":773,"line":995},[771,9462,927],{"emptyLinePlaceholder":926},[771,9464,9465],{"class":773,"line":1022},[771,9466,7600],{"class":902},[771,9468,9469,9472,9474,9476],{"class":773,"line":1044},[771,9470,9471],{"class":781},"$countryIso2 ",[771,9473,785],{"class":777},[771,9475,7612],{"class":788},[771,9477,920],{"class":781},[771,9479,9480,9483,9485],{"class":773,"line":1050},[771,9481,9482],{"class":781},"$newStudent ",[771,9484,785],{"class":777},[771,9486,9487],{"class":781}," [\n",[771,9489,9490,9493,9495,9498],{"class":773,"line":1055},[771,9491,9492],{"class":788},"    'firstName'",[771,9494,2856],{"class":777},[771,9496,9497],{"class":788}," 'Jane'",[771,9499,1830],{"class":781},[771,9501,9502,9505,9507,9510],{"class":773,"line":1073},[771,9503,9504],{"class":788},"    'lastName'",[771,9506,2856],{"class":777},[771,9508,9509],{"class":788}," 'Doe'",[771,9511,1830],{"class":781},[771,9513,9514,9517,9519,9522],{"class":773,"line":1091},[771,9515,9516],{"class":788},"    'email'",[771,9518,2856],{"class":777},[771,9520,9521],{"class":788}," 'jane.doe@example.com'",[771,9523,1830],{"class":781},[771,9525,9526,9529,9531,9534],{"class":773,"line":1096},[771,9527,9528],{"class":788},"    'birth'",[771,9530,2856],{"class":777},[771,9532,9533],{"class":788}," '14\u002F05\u002F2011'",[771,9535,1830],{"class":781},[771,9537,9538,9541,9543,9546],{"class":773,"line":1146},[771,9539,9540],{"class":788},"    'sex'",[771,9542,2856],{"class":777},[771,9544,9545],{"class":788}," 'f'",[771,9547,1830],{"class":781},[771,9549,9550,9553,9555,9558],{"class":773,"line":1162},[771,9551,9552],{"class":788},"    'grade'",[771,9554,2856],{"class":777},[771,9556,9557],{"class":788}," '10'",[771,9559,1830],{"class":781},[771,9561,9562,9565,9567,9570],{"class":773,"line":1167},[771,9563,9564],{"class":788},"    'city'",[771,9566,2856],{"class":777},[771,9568,9569],{"class":788}," 'Berlin'",[771,9571,1830],{"class":781},[771,9573,9574,9577,9579,9582],{"class":773,"line":1173},[771,9575,9576],{"class":788},"    'school'",[771,9578,2856],{"class":777},[771,9580,9581],{"class":788}," 'Berlin International School'",[771,9583,1830],{"class":781},[771,9585,9586],{"class":773,"line":1187},[771,9587,9588],{"class":781},"];\n",[771,9590,9591],{"class":773,"line":1221},[771,9592,927],{"emptyLinePlaceholder":926},[771,9594,9595,9597,9599,9601,9604,9607,9609,9612,9614],{"class":773,"line":1253},[771,9596,8481],{"class":777},[771,9598,7724],{"class":1031},[771,9600,1035],{"class":781},[771,9602,9603],{"class":938},"MainTeam",[771,9605,9606],{"class":781}," $api, ",[771,9608,2680],{"class":777},[771,9610,9611],{"class":781}," $iso2)",[771,9613,1863],{"class":777},[771,9615,2688],{"class":777},[771,9617,9618],{"class":773,"line":1285},[771,9619,2321],{"class":781},[771,9621,9622,9624,9627,9629,9631,9634,9636],{"class":773,"line":1312},[771,9623,8306],{"class":777},[771,9625,9626],{"class":781}," ($page ",[771,9628,785],{"class":777},[771,9630,1763],{"class":938},[771,9632,9633],{"class":781},"; ; $page",[771,9635,1769],{"class":777},[771,9637,1019],{"class":781},[771,9639,9640,9643,9645,9648,9650,9653,9655,9657,9659,9662,9665,9668],{"class":773,"line":1338},[771,9641,9642],{"class":781},"        $res ",[771,9644,785],{"class":777},[771,9646,9647],{"class":781}," $api",[771,9649,2783],{"class":777},[771,9651,9652],{"class":1031},"call",[771,9654,1035],{"class":781},[771,9656,7770],{"class":788},[771,9658,1330],{"class":781},[771,9660,9661],{"class":788},"\"\u002Fcountry?page=",[771,9663,9664],{"class":781},"$page",[771,9666,9667],{"class":788},"&limit=100\"",[771,9669,1041],{"class":781},[771,9671,9672,9675,9678,9681,9683,9686],{"class":773,"line":1366},[771,9673,9674],{"class":777},"        foreach",[771,9676,9677],{"class":781}," ($res[",[771,9679,9680],{"class":788},"'data'",[771,9682,3242],{"class":781},[771,9684,9685],{"class":777},"as",[771,9687,9688],{"class":781}," $country) {\n",[771,9690,9691,9693,9696,9699,9701,9703,9705,9707,9709],{"class":773,"line":1380},[771,9692,3196],{"class":777},[771,9694,9695],{"class":781}," (($country[",[771,9697,9698],{"class":788},"'iso2'",[771,9700,3242],{"class":781},[771,9702,1485],{"class":777},[771,9704,1157],{"class":938},[771,9706,1112],{"class":781},[771,9708,1851],{"class":777},[771,9710,9711],{"class":781}," $iso2) {\n",[771,9713,9714,9716,9719,9722],{"class":773,"line":1416},[771,9715,3895],{"class":777},[771,9717,9718],{"class":781}," $country[",[771,9720,9721],{"class":788},"'_id'",[771,9723,9588],{"class":781},[771,9725,9726],{"class":773,"line":1424},[771,9727,3262],{"class":781},[771,9729,9730],{"class":773,"line":1429},[771,9731,2644],{"class":781},[771,9733,9734,9736,9738,9740,9743,9746,9749,9752],{"class":773,"line":1434},[771,9735,2609],{"class":777},[771,9737,9626],{"class":781},[771,9739,3352],{"class":777},[771,9741,9742],{"class":781}," $res[",[771,9744,9745],{"class":788},"'pagination'",[771,9747,9748],{"class":781},"][",[771,9750,9751],{"class":788},"'totalPages'",[771,9753,9754],{"class":781},"]) {\n",[771,9756,9757,9759,9761,9763,9765,9768,9771,9774],{"class":773,"line":1453},[771,9758,2628],{"class":777},[771,9760,1028],{"class":777},[771,9762,2633],{"class":938},[771,9764,1035],{"class":781},[771,9766,9767],{"class":788},"\"Country ",[771,9769,9770],{"class":781},"$iso2",[771,9772,9773],{"class":788}," cannot be selected.\"",[771,9775,1041],{"class":781},[771,9777,9778],{"class":773,"line":1476},[771,9779,2644],{"class":781},[771,9781,9782],{"class":773,"line":1497},[771,9783,2024],{"class":781},[771,9785,9786],{"class":773,"line":1513},[771,9787,1047],{"class":781},[771,9789,9790],{"class":773,"line":1526},[771,9791,927],{"emptyLinePlaceholder":926},[771,9793,9794,9796,9798,9800,9802,9804,9807,9810,9812],{"class":773,"line":1546},[771,9795,8481],{"class":777},[771,9797,7877],{"class":1031},[771,9799,1035],{"class":781},[771,9801,9603],{"class":938},[771,9803,9606],{"class":781},[771,9805,9806],{"class":777},"array",[771,9808,9809],{"class":781}," $fields)",[771,9811,1863],{"class":777},[771,9813,2688],{"class":777},[771,9815,9816],{"class":773,"line":1564},[771,9817,2321],{"class":781},[771,9819,9820,9822],{"class":773,"line":1570},[771,9821,2148],{"class":777},[771,9823,1450],{"class":781},[771,9825,9826,9828,9830,9832,9834,9836,9838,9840,9842,9844],{"class":773,"line":1575},[771,9827,9642],{"class":781},[771,9829,785],{"class":777},[771,9831,9647],{"class":781},[771,9833,2783],{"class":777},[771,9835,9652],{"class":1031},[771,9837,1035],{"class":781},[771,9839,7908],{"class":788},[771,9841,1330],{"class":781},[771,9843,7913],{"class":788},[771,9845,9846],{"class":781},", $fields);\n",[771,9848,9849,9852,9855,9858,9861,9864,9866],{"class":773,"line":1580},[771,9850,9851],{"class":938},"        echo",[771,9853,9854],{"class":788}," \"   registered as {",[771,9856,9857],{"class":781},"$res",[771,9859,9860],{"class":788},"['data']['username']}",[771,9862,9863],{"class":777},"\\n",[771,9865,2963],{"class":788},[771,9867,920],{"class":781},[771,9869,9870,9872,9874,9876,9878,9880],{"class":773,"line":1620},[771,9871,2649],{"class":777},[771,9873,9742],{"class":781},[771,9875,9680],{"class":788},[771,9877,9748],{"class":781},[771,9879,9721],{"class":788},[771,9881,9588],{"class":781},[771,9883,9884,9886,9888,9890,9892],{"class":773,"line":1625},[771,9885,2186],{"class":781},[771,9887,2189],{"class":777},[771,9889,1001],{"class":781},[771,9891,882],{"class":938},[771,9893,9894],{"class":781}," $e) {\n",[771,9896,9897],{"class":773,"line":1631},[771,9898,9899],{"class":902},"        \u002F\u002F Already registered to this account: the message names the existing _id.\n",[771,9901,9902,9904,9907,9909,9912,9914,9916,9918,9921,9923,9926,9928,9931,9933,9936,9939,9941,9944],{"class":773,"line":1637},[771,9903,2609],{"class":777},[771,9905,9906],{"class":781}," ($e",[771,9908,2783],{"class":777},[771,9910,9911],{"class":781},"status ",[771,9913,1851],{"class":777},[771,9915,8195],{"class":938},[771,9917,1946],{"class":777},[771,9919,9920],{"class":938}," preg_match",[771,9922,1035],{"class":781},[771,9924,9925],{"class":788},"'\u002F",[771,9927,8015],{"class":8014},[771,9929,9930],{"class":788},"([0-9a-f]{24})",[771,9932,8028],{"class":8014},[771,9934,9935],{"class":788},"\u002F'",[771,9937,9938],{"class":781},", $e",[771,9940,2783],{"class":777},[771,9942,9943],{"class":1031},"getMessage",[771,9945,9946],{"class":781},"(), $m)) {\n",[771,9948,9949,9952,9955,9957,9959],{"class":773,"line":1643},[771,9950,9951],{"class":938},"            echo",[771,9953,9954],{"class":788}," \"   already registered to this account; reusing it",[771,9956,9863],{"class":777},[771,9958,2963],{"class":788},[771,9960,920],{"class":781},[771,9962,9963,9965,9968,9970],{"class":773,"line":1649},[771,9964,2819],{"class":777},[771,9966,9967],{"class":781}," $m[",[771,9969,425],{"class":938},[771,9971,9588],{"class":781},[771,9973,9974],{"class":773,"line":1655},[771,9975,2644],{"class":781},[771,9977,9978,9981],{"class":773,"line":1661},[771,9979,9980],{"class":777},"        throw",[771,9982,9983],{"class":781}," $e;\n",[771,9985,9986],{"class":773,"line":1717},[771,9987,2024],{"class":781},[771,9989,9990],{"class":773,"line":1733},[771,9991,1047],{"class":781},[771,9993,9994],{"class":773,"line":1748},[771,9995,927],{"emptyLinePlaceholder":926},[771,9997,9998],{"class":773,"line":1774},[771,9999,8105],{"class":902},[771,10001,10002,10004,10006,10008,10010,10012,10014,10017,10019,10022,10024],{"class":773,"line":1801},[771,10003,8481],{"class":777},[771,10005,8114],{"class":1031},[771,10007,1035],{"class":781},[771,10009,9603],{"class":938},[771,10011,9606],{"class":781},[771,10013,2680],{"class":777},[771,10015,10016],{"class":781}," $orgId, ",[771,10018,2680],{"class":777},[771,10020,10021],{"class":781}," $studentId)",[771,10023,1863],{"class":777},[771,10025,10026],{"class":777}," bool\n",[771,10028,10029],{"class":773,"line":1807},[771,10030,2321],{"class":781},[771,10032,10033,10035],{"class":773,"line":1813},[771,10034,2148],{"class":777},[771,10036,1450],{"class":781},[771,10038,10039,10042,10044,10046,10048,10050,10052,10055,10058,10061,10064,10067],{"class":773,"line":1833},[771,10040,10041],{"class":781},"        $api",[771,10043,2783],{"class":777},[771,10045,9652],{"class":1031},[771,10047,1035],{"class":781},[771,10049,7770],{"class":788},[771,10051,1330],{"class":781},[771,10053,10054],{"class":788},"\"\u002F",[771,10056,10057],{"class":781},"$orgId",[771,10059,10060],{"class":788},"\u002Fapplication\u002Fstudent-applications\u002F",[771,10062,10063],{"class":781},"$studentId",[771,10065,10066],{"class":788},"?limit=1\"",[771,10068,1041],{"class":781},[771,10070,10071,10073,10075],{"class":773,"line":1842},[771,10072,2649],{"class":777},[771,10074,2065],{"class":938},[771,10076,920],{"class":781},[771,10078,10079,10081,10083,10085,10087],{"class":773,"line":1881},[771,10080,2186],{"class":781},[771,10082,2189],{"class":777},[771,10084,1001],{"class":781},[771,10086,882],{"class":938},[771,10088,9894],{"class":781},[771,10090,10091,10093,10095,10097,10099,10101,10103],{"class":773,"line":1887},[771,10092,2609],{"class":777},[771,10094,9906],{"class":781},[771,10096,2783],{"class":777},[771,10098,9911],{"class":781},[771,10100,1851],{"class":777},[771,10102,8195],{"class":938},[771,10104,1019],{"class":781},[771,10106,10107,10109,10111],{"class":773,"line":1914},[771,10108,2819],{"class":777},[771,10110,1696],{"class":938},[771,10112,920],{"class":781},[771,10114,10115],{"class":773,"line":1926},[771,10116,2644],{"class":781},[771,10118,10119,10121],{"class":773,"line":1932},[771,10120,9980],{"class":777},[771,10122,9983],{"class":781},[771,10124,10125],{"class":773,"line":1959},[771,10126,2024],{"class":781},[771,10128,10129],{"class":773,"line":1973},[771,10130,1047],{"class":781},[771,10132,10133],{"class":773,"line":2013},[771,10134,927],{"emptyLinePlaceholder":926},[771,10136,10137,10139,10141,10143,10145,10147,10149,10151,10153,10155,10157],{"class":773,"line":2021},[771,10138,8481],{"class":777},[771,10140,8230],{"class":1031},[771,10142,1035],{"class":781},[771,10144,9603],{"class":938},[771,10146,9606],{"class":781},[771,10148,2680],{"class":777},[771,10150,10016],{"class":781},[771,10152,2680],{"class":777},[771,10154,10021],{"class":781},[771,10156,1863],{"class":777},[771,10158,10159],{"class":777}," void\n",[771,10161,10162],{"class":773,"line":2027},[771,10163,2321],{"class":781},[771,10165,10166,10168,10170,10173],{"class":773,"line":2046},[771,10167,1935],{"class":777},[771,10169,1001],{"class":781},[771,10171,10172],{"class":1031},"hasOrgCopy",[771,10174,10175],{"class":781},"($api, $orgId, $studentId)) {\n",[771,10177,10178,10180,10183,10185,10187],{"class":773,"line":2057},[771,10179,9851],{"class":938},[771,10181,10182],{"class":788}," \"5. The student has signed in to this organization before",[771,10184,9863],{"class":777},[771,10186,2963],{"class":788},[771,10188,920],{"class":781},[771,10190,10191,10193],{"class":773,"line":2070},[771,10192,2649],{"class":777},[771,10194,920],{"class":781},[771,10196,10197],{"class":773,"line":2082},[771,10198,2024],{"class":781},[771,10200,10201,10204,10206,10208],{"class":773,"line":2089},[771,10202,10203],{"class":777},"    while",[771,10205,1001],{"class":781},[771,10207,2985],{"class":938},[771,10209,1019],{"class":781},[771,10211,10212,10215,10217,10219,10221,10223,10225,10227,10229,10231,10233,10236,10239,10242,10244],{"class":773,"line":2094},[771,10213,10214],{"class":781},"        $link ",[771,10216,785],{"class":777},[771,10218,9647],{"class":781},[771,10220,2783],{"class":777},[771,10222,9652],{"class":1031},[771,10224,1035],{"class":781},[771,10226,7908],{"class":788},[771,10228,1330],{"class":781},[771,10230,10054],{"class":788},[771,10232,10057],{"class":781},[771,10234,10235],{"class":788},"\u002Fauth\u002Fsignin\"",[771,10237,10238],{"class":781},", [",[771,10240,10241],{"class":788},"'studentId'",[771,10243,2856],{"class":777},[771,10245,10246],{"class":781}," $studentId]);\n",[771,10248,10249,10251,10254,10257,10260,10262,10264],{"class":773,"line":2112},[771,10250,9851],{"class":938},[771,10252,10253],{"class":788}," \"5. Open this link in a browser within {",[771,10255,10256],{"class":781},"$link",[771,10258,10259],{"class":788},"['data']['expiresIn']} s. It works once:",[771,10261,9863],{"class":777},[771,10263,2963],{"class":788},[771,10265,920],{"class":781},[771,10267,10268,10270,10273,10275,10278,10280,10282],{"class":773,"line":2130},[771,10269,9851],{"class":938},[771,10271,10272],{"class":788}," \"   {",[771,10274,10256],{"class":781},[771,10276,10277],{"class":788},"['data']['url']}",[771,10279,9863],{"class":777},[771,10281,2963],{"class":788},[771,10283,920],{"class":781},[771,10285,10286,10288,10291],{"class":773,"line":2145},[771,10287,9851],{"class":938},[771,10289,10290],{"class":788}," '   Press Enter after the panel has loaded... '",[771,10292,920],{"class":781},[771,10294,10295,10298,10300,10303],{"class":773,"line":2153},[771,10296,10297],{"class":938},"        fgets",[771,10299,1035],{"class":781},[771,10301,10302],{"class":938},"STDIN",[771,10304,1041],{"class":781},[771,10306,10307,10309,10311,10313],{"class":773,"line":2183},[771,10308,2609],{"class":777},[771,10310,1001],{"class":781},[771,10312,10172],{"class":1031},[771,10314,10175],{"class":781},[771,10316,10317,10319],{"class":773,"line":2194},[771,10318,2819],{"class":777},[771,10320,920],{"class":781},[771,10322,10323],{"class":773,"line":2208},[771,10324,2644],{"class":781},[771,10326,10327,10329,10332,10334,10336],{"class":773,"line":2213},[771,10328,9851],{"class":938},[771,10330,10331],{"class":788}," \"   The organization has no record of the student yet. Minting a fresh link.",[771,10333,9863],{"class":777},[771,10335,2963],{"class":788},[771,10337,920],{"class":781},[771,10339,10340],{"class":773,"line":2245},[771,10341,2024],{"class":781},[771,10343,10344],{"class":773,"line":2254},[771,10345,1047],{"class":781},[771,10347,10348],{"class":773,"line":2259},[771,10349,927],{"emptyLinePlaceholder":926},[771,10351,10352,10354,10356,10358,10360,10363,10365],{"class":773,"line":3425},[771,10353,8481],{"class":777},[771,10355,8484],{"class":1031},[771,10357,1035],{"class":781},[771,10359,9806],{"class":777},[771,10361,10362],{"class":781}," $tree)",[771,10364,1863],{"class":777},[771,10366,3118],{"class":777},[771,10368,10369],{"class":773,"line":3447},[771,10370,2321],{"class":781},[771,10372,10373,10376,10379,10381],{"class":773,"line":3473},[771,10374,10375],{"class":777},"    foreach",[771,10377,10378],{"class":781}," ($tree ",[771,10380,9685],{"class":777},[771,10382,10383],{"class":781}," $category) {\n",[771,10385,10386,10388,10391,10394,10396,10398],{"class":773,"line":3479},[771,10387,9674],{"class":777},[771,10389,10390],{"class":781}," ($category[",[771,10392,10393],{"class":788},"'sessions'",[771,10395,3242],{"class":781},[771,10397,9685],{"class":777},[771,10399,10400],{"class":781}," $session) {\n",[771,10402,10403,10406,10409,10412,10414,10416],{"class":773,"line":3484},[771,10404,10405],{"class":777},"            foreach",[771,10407,10408],{"class":781}," ($session[",[771,10410,10411],{"class":788},"'languages'",[771,10413,3242],{"class":781},[771,10415,9685],{"class":777},[771,10417,10418],{"class":781}," $language) {\n",[771,10420,10421,10423],{"class":773,"line":3504},[771,10422,3895],{"class":777},[771,10424,9487],{"class":781},[771,10426,10427,10430,10432],{"class":773,"line":3509},[771,10428,10429],{"class":788},"                    'category'",[771,10431,2856],{"class":777},[771,10433,10434],{"class":781}," $category,\n",[771,10436,10437,10440,10442],{"class":773,"line":3514},[771,10438,10439],{"class":788},"                    'session'",[771,10441,2856],{"class":777},[771,10443,10444],{"class":781}," $session,\n",[771,10446,10447,10450,10452],{"class":773,"line":3519},[771,10448,10449],{"class":788},"                    'language'",[771,10451,2856],{"class":777},[771,10453,10454],{"class":781}," $language,\n",[771,10456,10457,10460,10462,10465,10468],{"class":773,"line":3534},[771,10458,10459],{"class":788},"                    'exam'",[771,10461,2856],{"class":777},[771,10463,10464],{"class":781}," $language[",[771,10466,10467],{"class":788},"'matchedExam'",[771,10469,5703],{"class":781},[771,10471,10472],{"class":773,"line":3569},[771,10473,10474],{"class":781},"                ];\n",[771,10476,10477],{"class":773,"line":3574},[771,10478,3262],{"class":781},[771,10480,10481],{"class":773,"line":3584},[771,10482,2644],{"class":781},[771,10484,10485],{"class":773,"line":3618},[771,10486,2024],{"class":781},[771,10488,10489,10491,10493],{"class":773,"line":3641},[771,10490,2248],{"class":777},[771,10492,1157],{"class":938},[771,10494,920],{"class":781},[771,10496,10497],{"class":773,"line":3655},[771,10498,1047],{"class":781},[771,10500,10501],{"class":773,"line":3668},[771,10502,927],{"emptyLinePlaceholder":926},[771,10504,10505,10508,10510,10513,10516,10519],{"class":773,"line":3698},[771,10506,10507],{"class":781},"$api ",[771,10509,785],{"class":777},[771,10511,10512],{"class":938}," MainTeam",[771,10514,10515],{"class":777},"::",[771,10517,10518],{"class":1031},"fromEnv",[771,10520,1730],{"class":781},[771,10522,10523],{"class":773,"line":3703},[771,10524,927],{"emptyLinePlaceholder":926},[771,10526,10527,10530],{"class":773,"line":3712},[771,10528,10529],{"class":777},"try",[771,10531,1450],{"class":781},[771,10533,10534,10537,10539,10541,10543,10545,10547,10549,10551,10553],{"class":773,"line":3723},[771,10535,10536],{"class":781},"    $account ",[771,10538,785],{"class":777},[771,10540,9647],{"class":781},[771,10542,2783],{"class":777},[771,10544,9652],{"class":1031},[771,10546,1035],{"class":781},[771,10548,7770],{"class":788},[771,10550,1330],{"class":781},[771,10552,8610],{"class":788},[771,10554,1041],{"class":781},[771,10556,10557,10560,10563,10566,10569,10571,10574,10576,10578],{"class":773,"line":3734},[771,10558,10559],{"class":938},"    echo",[771,10561,10562],{"class":788}," \"1. Signed in as {",[771,10564,10565],{"class":781},"$account",[771,10567,10568],{"class":788},"['companyName']} ({",[771,10570,10565],{"class":781},[771,10572,10573],{"class":788},"['apiKey']})",[771,10575,9863],{"class":777},[771,10577,2963],{"class":788},[771,10579,920],{"class":781},[771,10581,10582],{"class":773,"line":3746},[771,10583,927],{"emptyLinePlaceholder":926},[771,10585,10586,10589,10591,10593,10595,10597,10599,10601,10603,10605],{"class":773,"line":3759},[771,10587,10588],{"class":781},"    $orgs ",[771,10590,785],{"class":777},[771,10592,9647],{"class":781},[771,10594,2783],{"class":777},[771,10596,9652],{"class":1031},[771,10598,1035],{"class":781},[771,10600,7770],{"class":788},[771,10602,1330],{"class":781},[771,10604,8672],{"class":788},[771,10606,1041],{"class":781},[771,10608,10609,10612,10614,10616],{"class":773,"line":3772},[771,10610,10611],{"class":781},"    $orgId ",[771,10613,785],{"class":777},[771,10615,1157],{"class":938},[771,10617,920],{"class":781},[771,10619,10620,10622,10625,10627,10629,10631],{"class":773,"line":3807},[771,10621,10375],{"class":777},[771,10623,10624],{"class":781}," ($orgs[",[771,10626,9680],{"class":788},[771,10628,3242],{"class":781},[771,10630,9685],{"class":777},[771,10632,10633],{"class":781}," $candidate) {\n",[771,10635,10636,10638,10641,10644,10646,10648],{"class":773,"line":3830},[771,10637,2609],{"class":777},[771,10639,10640],{"class":781}," ($candidate[",[771,10642,10643],{"class":788},"'slug'",[771,10645,3242],{"class":781},[771,10647,1851],{"class":777},[771,10649,10650],{"class":781}," $slug) {\n",[771,10652,10653,10656,10658,10661,10663],{"class":773,"line":3851},[771,10654,10655],{"class":781},"            $orgId ",[771,10657,785],{"class":777},[771,10659,10660],{"class":781}," $candidate[",[771,10662,9721],{"class":788},[771,10664,9588],{"class":781},[771,10666,10667],{"class":773,"line":3886},[771,10668,2644],{"class":781},[771,10670,10671],{"class":773,"line":3892},[771,10672,2024],{"class":781},[771,10674,10675,10677,10680,10682,10684],{"class":773,"line":3904},[771,10676,1935],{"class":777},[771,10678,10679],{"class":781}," ($orgId ",[771,10681,1851],{"class":777},[771,10683,1157],{"class":938},[771,10685,1019],{"class":781},[771,10687,10688,10690,10692,10694,10696,10699,10702,10705],{"class":773,"line":3910},[771,10689,9980],{"class":777},[771,10691,1028],{"class":777},[771,10693,2633],{"class":938},[771,10695,1035],{"class":781},[771,10697,10698],{"class":788},"\"No organization with slug ",[771,10700,10701],{"class":781},"$slug",[771,10703,10704],{"class":788},".\"",[771,10706,1041],{"class":781},[771,10708,10709],{"class":773,"line":3916},[771,10710,2024],{"class":781},[771,10712,10713,10715,10718,10720,10723,10725,10727,10729],{"class":773,"line":3930},[771,10714,10559],{"class":938},[771,10716,10717],{"class":788}," \"2. ",[771,10719,10701],{"class":781},[771,10721,10722],{"class":788}," is ",[771,10724,10057],{"class":781},[771,10726,9863],{"class":777},[771,10728,2963],{"class":788},[771,10730,920],{"class":781},[771,10732,10733],{"class":773,"line":3954},[771,10734,927],{"emptyLinePlaceholder":926},[771,10736,10737,10740,10742,10744],{"class":773,"line":3967},[771,10738,10739],{"class":781},"    $countryId ",[771,10741,785],{"class":777},[771,10743,7724],{"class":1031},[771,10745,10746],{"class":781},"($api, $countryIso2);\n",[771,10748,10749,10751,10754,10757,10759,10762,10764,10766],{"class":773,"line":3975},[771,10750,10559],{"class":938},[771,10752,10753],{"class":788}," \"3. Country ",[771,10755,10756],{"class":781},"$countryIso2",[771,10758,10722],{"class":788},[771,10760,10761],{"class":781},"$countryId",[771,10763,9863],{"class":777},[771,10765,2963],{"class":788},[771,10767,920],{"class":781},[771,10769,10770],{"class":773,"line":3989},[771,10771,927],{"emptyLinePlaceholder":926},[771,10773,10774,10777,10779,10781,10784,10786,10788,10791,10793],{"class":773,"line":4010},[771,10775,10776],{"class":781},"    $studentId ",[771,10778,785],{"class":777},[771,10780,7877],{"class":1031},[771,10782,10783],{"class":781},"($api, $newStudent ",[771,10785,1305],{"class":777},[771,10787,3592],{"class":781},[771,10789,10790],{"class":788},"'country'",[771,10792,2856],{"class":777},[771,10794,10795],{"class":781}," $countryId]);\n",[771,10797,10798,10800,10803,10805,10807,10809],{"class":773,"line":4015},[771,10799,10559],{"class":938},[771,10801,10802],{"class":788}," \"4. Student ",[771,10804,10063],{"class":781},[771,10806,9863],{"class":777},[771,10808,2963],{"class":788},[771,10810,920],{"class":781},[771,10812,10813],{"class":773,"line":4028},[771,10814,927],{"emptyLinePlaceholder":926},[771,10816,10817,10820],{"class":773,"line":4033},[771,10818,10819],{"class":1031},"    ensureSignedInOnce",[771,10821,10822],{"class":781},"($api, $orgId, $studentId);\n",[771,10824,10825],{"class":773,"line":9248},[771,10826,927],{"emptyLinePlaceholder":926},[771,10828,10829,10832,10834,10836,10838,10840,10842,10844,10846,10848,10850,10853,10855,10857,10860,10862],{"class":773,"line":9253},[771,10830,10831],{"class":781},"    $tree ",[771,10833,785],{"class":777},[771,10835,9647],{"class":781},[771,10837,2783],{"class":777},[771,10839,9652],{"class":1031},[771,10841,1035],{"class":781},[771,10843,7770],{"class":788},[771,10845,1330],{"class":781},[771,10847,10054],{"class":788},[771,10849,10057],{"class":781},[771,10851,10852],{"class":788},"\u002Fexam\u002Favailable\u002F",[771,10854,10063],{"class":781},[771,10856,2963],{"class":788},[771,10858,10859],{"class":781},")[",[771,10861,9680],{"class":788},[771,10863,9588],{"class":781},[771,10865,10866,10869,10871,10873],{"class":773,"line":9258},[771,10867,10868],{"class":781},"    $leaf ",[771,10870,785],{"class":777},[771,10872,8484],{"class":1031},[771,10874,10875],{"class":781},"($tree);\n",[771,10877,10878,10880,10883,10885,10887],{"class":773,"line":9280},[771,10879,1935],{"class":777},[771,10881,10882],{"class":781}," ($leaf ",[771,10884,1851],{"class":777},[771,10886,1157],{"class":938},[771,10888,1019],{"class":781},[771,10890,10891,10893,10896,10898,10900],{"class":773,"line":9293},[771,10892,9851],{"class":938},[771,10894,10895],{"class":788}," \"6. No exam is open to this student right now.",[771,10897,9863],{"class":777},[771,10899,2963],{"class":788},[771,10901,920],{"class":781},[771,10903,10904,10907,10909,10911],{"class":773,"line":9341},[771,10905,10906],{"class":777},"        exit",[771,10908,1035],{"class":781},[771,10910,3868],{"class":938},[771,10912,1041],{"class":781},[771,10914,10915],{"class":773,"line":9351},[771,10916,2024],{"class":781},[771,10918,10919,10922,10924,10927,10930,10932,10935,10937,10939,10941],{"class":773,"line":9361},[771,10920,10921],{"class":781},"    $price ",[771,10923,785],{"class":777},[771,10925,10926],{"class":781}," $leaf[",[771,10928,10929],{"class":788},"'exam'",[771,10931,9748],{"class":781},[771,10933,10934],{"class":788},"'price'",[771,10936,3242],{"class":781},[771,10938,1485],{"class":777},[771,10940,2504],{"class":938},[771,10942,920],{"class":781},[771,10944,10945,10947,10950,10953,10956,10958,10961,10963],{"class":773,"line":9366},[771,10946,10559],{"class":938},[771,10948,10949],{"class":788}," \"6. Picked {",[771,10951,10952],{"class":781},"$leaf",[771,10954,10955],{"class":788},"['category']['name']} on {",[771,10957,10952],{"class":781},[771,10959,10960],{"class":788},"['session']['date']} in {",[771,10962,10952],{"class":781},[771,10964,10965],{"class":788},"['language']['name']}\"\n",[771,10967,10968,10971,10974,10976,10979,10982,10984,10986,10988],{"class":773,"line":9378},[771,10969,10970],{"class":777},"        .",[771,10972,10973],{"class":788}," \" (exam {",[771,10975,10952],{"class":781},[771,10977,10978],{"class":788},"['exam']['_id']}, price ",[771,10980,10981],{"class":781},"$price",[771,10983,3113],{"class":788},[771,10985,9863],{"class":777},[771,10987,2963],{"class":788},[771,10989,920],{"class":781},[771,10991,10993],{"class":773,"line":10992},138,[771,10994,927],{"emptyLinePlaceholder":926},[771,10996,10998,11001,11003,11005,11007,11009,11011,11013,11015,11017,11019,11022],{"class":773,"line":10997},139,[771,10999,11000],{"class":781},"    $created ",[771,11002,785],{"class":777},[771,11004,9647],{"class":781},[771,11006,2783],{"class":777},[771,11008,9652],{"class":1031},[771,11010,1035],{"class":781},[771,11012,7908],{"class":788},[771,11014,1330],{"class":781},[771,11016,10054],{"class":788},[771,11018,10057],{"class":781},[771,11020,11021],{"class":788},"\u002Fapplication\"",[771,11023,11024],{"class":781},", [\n",[771,11026,11028,11031,11033],{"class":773,"line":11027},140,[771,11029,11030],{"class":788},"        'studentId'",[771,11032,2856],{"class":777},[771,11034,11035],{"class":781}," $studentId,\n",[771,11037,11039,11042,11044,11046,11048,11050,11052],{"class":773,"line":11038},141,[771,11040,11041],{"class":788},"        'examId'",[771,11043,2856],{"class":777},[771,11045,10926],{"class":781},[771,11047,10929],{"class":788},[771,11049,9748],{"class":781},[771,11051,9721],{"class":788},[771,11053,5703],{"class":781},[771,11055,11057],{"class":773,"line":11056},142,[771,11058,11059],{"class":781},"    ]);\n",[771,11061,11063,11065,11068,11071,11074,11076,11079,11081,11083],{"class":773,"line":11062},143,[771,11064,10559],{"class":938},[771,11066,11067],{"class":788}," \"7. {",[771,11069,11070],{"class":781},"$created",[771,11072,11073],{"class":788},"['message']} Application {",[771,11075,11070],{"class":781},[771,11077,11078],{"class":788},"['data']['_id']}",[771,11080,9863],{"class":777},[771,11082,2963],{"class":788},[771,11084,920],{"class":781},[771,11086,11088],{"class":773,"line":11087},144,[771,11089,927],{"emptyLinePlaceholder":926},[771,11091,11093,11096,11098,11100,11102,11104,11106,11108,11110,11112,11114,11116,11118,11120],{"class":773,"line":11092},145,[771,11094,11095],{"class":781},"    $list ",[771,11097,785],{"class":777},[771,11099,9647],{"class":781},[771,11101,2783],{"class":777},[771,11103,9652],{"class":1031},[771,11105,1035],{"class":781},[771,11107,7770],{"class":788},[771,11109,1330],{"class":781},[771,11111,10054],{"class":788},[771,11113,10057],{"class":781},[771,11115,10060],{"class":788},[771,11117,10063],{"class":781},[771,11119,2963],{"class":788},[771,11121,1041],{"class":781},[771,11123,11125,11127,11130,11132,11134,11136],{"class":773,"line":11124},146,[771,11126,10375],{"class":777},[771,11128,11129],{"class":781}," ($list[",[771,11131,9680],{"class":788},[771,11133,3242],{"class":781},[771,11135,9685],{"class":777},[771,11137,11138],{"class":781}," $application) {\n",[771,11140,11142,11144,11146,11149,11152,11154,11157,11159,11161,11164],{"class":773,"line":11141},147,[771,11143,3933],{"class":781},[771,11145,785],{"class":777},[771,11147,11148],{"class":781}," $application[",[771,11150,11151],{"class":788},"'payment'",[771,11153,9748],{"class":781},[771,11155,11156],{"class":788},"'status'",[771,11158,3242],{"class":781},[771,11160,1485],{"class":777},[771,11162,11163],{"class":788}," '-'",[771,11165,920],{"class":781},[771,11167,11169,11172,11174,11176,11178,11180,11183,11185,11187,11189],{"class":773,"line":11168},148,[771,11170,11171],{"class":781},"        $amount ",[771,11173,785],{"class":777},[771,11175,11148],{"class":781},[771,11177,11151],{"class":788},[771,11179,9748],{"class":781},[771,11181,11182],{"class":788},"'amount'",[771,11184,3242],{"class":781},[771,11186,1485],{"class":777},[771,11188,11163],{"class":788},[771,11190,920],{"class":781},[771,11192,11194,11196,11199,11202,11205,11207,11210,11213,11215,11217],{"class":773,"line":11193},149,[771,11195,9851],{"class":938},[771,11197,11198],{"class":788}," \"8. {",[771,11200,11201],{"class":781},"$application",[771,11203,11204],{"class":788},"['_id']}: payment ",[771,11206,3440],{"class":781},[771,11208,11209],{"class":788},", amount ",[771,11211,11212],{"class":781},"$amount",[771,11214,9863],{"class":777},[771,11216,2963],{"class":788},[771,11218,920],{"class":781},[771,11220,11222],{"class":773,"line":11221},150,[771,11223,2024],{"class":781},[771,11225,11227,11230,11232,11234,11236],{"class":773,"line":11226},151,[771,11228,11229],{"class":781},"} ",[771,11231,2189],{"class":777},[771,11233,1001],{"class":781},[771,11235,882],{"class":938},[771,11237,9894],{"class":781},[771,11239,11241,11244,11246,11249,11251,11254,11257,11259,11261,11264,11266,11268,11271,11274,11276,11278,11280,11283,11285,11287,11289,11292,11294,11296],{"class":773,"line":11240},152,[771,11242,11243],{"class":938},"    fwrite",[771,11245,1035],{"class":781},[771,11247,11248],{"class":938},"STDERR",[771,11250,1330],{"class":781},[771,11252,11253],{"class":788},"\"{",[771,11255,11256],{"class":781},"$e",[771,11258,2783],{"class":777},[771,11260,1461],{"class":781},[771,11262,11263],{"class":788},"} {",[771,11265,11256],{"class":781},[771,11267,2783],{"class":777},[771,11269,11270],{"class":781},"errorCode",[771,11272,11273],{"class":788},"}: {",[771,11275,11256],{"class":781},[771,11277,2783],{"class":777},[771,11279,9943],{"class":1031},[771,11281,11282],{"class":788},"()} (request {",[771,11284,11256],{"class":781},[771,11286,2783],{"class":777},[771,11288,1471],{"class":781},[771,11290,11291],{"class":788},"})",[771,11293,9863],{"class":777},[771,11295,2963],{"class":788},[771,11297,1041],{"class":781},[771,11299,11301,11304,11306,11308],{"class":773,"line":11300},153,[771,11302,11303],{"class":777},"    exit",[771,11305,1035],{"class":781},[771,11307,425],{"class":938},[771,11309,1041],{"class":781},[771,11311,11313],{"class":773,"line":11312},154,[771,11314,1047],{"class":781},[547,11316,11318],{"id":11317},"expected-output","Expected output",[358,11320,11321,11322,11325],{},"A first run for a new student looks like this (ids shortened, and the username written with ",[376,11323,11324],{},"XX"," in\nplace of the country's code):",[762,11327,11331],{"className":11328,"code":11330,"language":1968,"meta":767},[11329],"language-text","1. Signed in as Example Schools Ltd (key_Q2xpZW50RXhhbXBsZUtleTAx)\n2. stem is 64b7f1c2a9e3d45f10c2b7a1\n3. Country AL is 630e0182c53dc79a6836e67e\n   registered as XXB1045\n4. Student 66e6a3f5c1d2b30012a4f9c1\n5. Open this link in a browser within 120 s. It works once:\n   https:\u002F\u002Fauth.main-team.org\u002Fapi\u002Fuser\u002Foauth\u002Finvoke?accessToken=q8x2…&redirectUrl=…\n   Press Enter after the panel has loaded...\n6. Picked Mathematics on 2026-11-14T09:00:00.000Z in English (exam 64c0a1b2…801, price 25)\n7. Application created successfully. Application 66e6a4b1…fa07\n8. 66e6a4b1…fa07: payment pending, amount 25\n",[376,11332,11330],{"__ignoreMap":767},[358,11334,11335],{},"Run it a second time and it skips the work already done: step 4 reuses the student, step 5 reports\nthat the student has signed in before, and step 6 no longer offers Mathematics on the November\nsitting, because the student now holds it.",[762,11337,11340],{"className":11338,"code":11339,"language":1968,"meta":767},[11329],"   already registered to this account; reusing it\n4. Student 66e6a3f5c1d2b30012a4f9c1\n5. The student has signed in to this organization before\n6. No exam is open to this student right now.\n",[376,11341,11339],{"__ignoreMap":767},[394,11343,11345],{"id":11344},"when-something-goes-wrong","When something goes wrong",[399,11347,11348,11361],{},[402,11349,11350],{},[405,11351,11352,11355,11358],{},[408,11353,11354],{},"You see",[408,11356,11357],{},"Likely cause",[408,11359,11360],{},"Fix",[418,11362,11363,11378,11392,11409,11424,11437,11453,11470],{},[405,11364,11365,11370,11373],{},[423,11366,11367,11369],{},[376,11368,875],{}," on every request",[423,11371,11372],{},"The token is refused",[423,11374,11375,11376],{},"Check key and secret, and your clock. See ",[389,11377,19],{"href":20},[405,11379,11380,11386,11389],{},[423,11381,11382,1330,11384],{},[376,11383,4581],{},[376,11385,752],{},[423,11387,11388],{},"A role is missing",[423,11390,11391],{},"Compare the step with the permission table above; ask your operator",[405,11393,11394,11400,11403],{},[423,11395,11396,1330,11398],{},[376,11397,4879],{},[376,11399,4883],{},[423,11401,11402],{},"A slug or a wrong id in the path",[423,11404,11405,11406,11408],{},"Use the ",[376,11407,449],{}," from step 2",[405,11410,11411,11418,11421],{},[423,11412,11413,1330,11415],{},[376,11414,5850],{},[376,11416,11417],{},"property … should not exist",[423,11419,11420],{},"An extra field in the body",[423,11422,11423],{},"Send only the documented fields",[405,11425,11426,11431,11434],{},[423,11427,11428,11430],{},[376,11429,5821],{}," on step 4",[423,11432,11433],{},"The email is already registered",[423,11435,11436],{},"Use the id in the message, or another address",[405,11438,11439,11447,11450],{},[423,11440,11441,1330,11443,11446],{},[376,11442,5821],{},[376,11444,11445],{},"Student has never signed in…"," on step 7",[423,11448,11449],{},"The organization has no copy yet",[423,11451,11452],{},"Do step 5, and open the link within 120 s",[405,11454,11455,11459,11462],{},[423,11456,11457],{},[376,11458,863],{},[423,11460,11461],{},"More than 100 requests to one route in 60 s",[423,11463,11464,11465,11467,11468],{},"Wait for ",[376,11466,867],{}," seconds; the helper already does. See ",[389,11469,45],{"href":46},[405,11471,11472,11477,11480],{},[423,11473,11474],{},[376,11475,11476],{},"500 internal_error",[423,11478,11479],{},"A fault on our side",[423,11481,11482,11483,11485,11486],{},"Retry later. If it persists, send the ",[376,11484,889],{}," to ",[389,11487,11488],{"href":346},"support",[358,11490,11491,11492,11494,11495,11497],{},"Every error body carries a ",[376,11493,889],{},". Quote it when you ask for help; it lets us find the exact\nrequest. See ",[389,11496,342],{"href":343}," for more symptoms.",[394,11499,11501],{"id":11500},"next-steps","Next steps",[552,11503,11504,11509,11514,11519,11528],{},[555,11505,11506,11508],{},[389,11507,6086],{"href":104},": the production version of step 5.",[555,11510,11511,11513],{},[389,11512,106],{"href":107},": move this entry to another language or sitting.",[555,11515,11516,11518],{},[389,11517,109],{"href":110},": fetch certificates and reports once they are released.",[555,11520,11521,1330,11523,582,11525,11527],{},[389,11522,62],{"href":63},[389,11524,83],{"href":84},[389,11526,86],{"href":87},": every rule behind these steps.",[555,11529,11530,11531,1330,11534,1330,11537,1330,11540,816],{},"Reference: ",[389,11532,11533],{"href":174},"registerStudent",[389,11535,11536],{"href":211},"createSigninLink",[389,11538,11539],{"href":226},"listAvailableExams",[389,11541,11542],{"href":238},"createApplication",[11544,11545,11546],"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 .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 .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}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 .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .sJaa3, html code.shiki .sJaa3{--shiki-default:#024C1A;--shiki-default-font-weight:bold;--shiki-dark:#72F088;--shiki-dark-font-weight:bold}",{"title":767,"searchDepth":792,"depth":923,"links":11548},[11549,11550,11557,11558,11560,11561,11564,11568,11569,11572,11573,11578,11579],{"id":396,"depth":792,"text":397},{"id":544,"depth":792,"text":545,"children":11551},[11552,11553,11554,11555,11556],{"id":549,"depth":923,"text":550},{"id":595,"depth":923,"text":25},{"id":756,"depth":923,"text":757},{"id":819,"depth":923,"text":820},{"id":4038,"depth":923,"text":4039},{"id":4267,"depth":792,"text":4268},{"id":4591,"depth":792,"text":11559},"Step 2: find the organization's _id",{"id":4890,"depth":792,"text":4891},{"id":5147,"depth":792,"text":5148,"children":11562},[11563],{"id":5796,"depth":923,"text":5797},{"id":5912,"depth":792,"text":5913,"children":11565},[11566,11567],{"id":6096,"depth":923,"text":6097},{"id":6212,"depth":923,"text":6213},{"id":6284,"depth":792,"text":6285},{"id":6752,"depth":792,"text":6753,"children":11570},[11571],{"id":6988,"depth":923,"text":6989},{"id":7176,"depth":792,"text":7177},{"id":7513,"depth":792,"text":7514,"children":11574},[11575,11576,11577],{"id":7520,"depth":923,"text":308},{"id":2267,"depth":923,"text":311},{"id":11317,"depth":923,"text":11318},{"id":11344,"depth":792,"text":11345},{"id":11500,"depth":792,"text":11501},"A complete run from token to application. Register a student, send them in once, choose an exam from their picker and apply, in Node.js and PHP.","md",{},[11584,11585,11586,11587,11533,11588,11536,11539,11542,11589],"getCurrentApiAccount","listOrganizations","listCountries","listGrades","getStudent","listStudentApplications","10",{"title":353,"description":11580},"api\u002Ftutorials\u002Fregister-and-apply","j5zTDLkBGrYR6SJWZ1TbLlLwTGfRICm9DaHoMBkvK3M",[11595,11600,11604,11608,11612,11616,11620,11625,11629,11633],{"operationId":11584,"slug":11596,"method":133,"path":11597,"tag":77,"summary":143,"deprecated":134,"public":134,"permission":11598,"scope":11599,"order":923},"get-current-api-account","\u002Fv1\u002Fapi-account\u002Fvalidate-me","api\u002F*:$org:$ID","flat",{"operationId":11585,"slug":11601,"method":133,"path":11602,"tag":74,"summary":161,"deprecated":134,"public":134,"permission":11603,"scope":11599,"order":995},"list-organizations","\u002Fv1\u002Forganization","organization\u002Fread:$org:$ID",{"operationId":11586,"slug":11605,"method":133,"path":11606,"tag":74,"summary":149,"deprecated":134,"public":134,"permission":11607,"scope":11599,"order":930},"list-countries","\u002Fv1\u002Fcountry","country\u002Fread:$org:$ID",{"operationId":11587,"slug":11609,"method":133,"path":11610,"tag":74,"summary":155,"deprecated":134,"public":134,"permission":11611,"scope":11599,"order":959},"list-grades","\u002Fv1\u002Fgrade","grade\u002Fread:$org:$ID",{"operationId":11533,"slug":11613,"method":141,"path":11614,"tag":62,"summary":173,"deprecated":134,"public":134,"permission":11615,"scope":11599,"order":1050},"register-student","\u002Fv1\u002Fstudent","student\u002Fcreate:$org:$ID",{"operationId":11588,"slug":11617,"method":133,"path":11618,"tag":62,"summary":185,"deprecated":134,"public":134,"permission":11619,"scope":11599,"order":1096},"get-student","\u002Fv1\u002Fstudent\u002F{studentId}","student\u002Fread:$org:$ID",{"operationId":11536,"slug":11621,"method":141,"path":11622,"tag":80,"summary":210,"deprecated":134,"public":134,"permission":11623,"scope":11624,"order":1253},"create-signin-link","\u002Fv1\u002F{organizationId}\u002Fauth\u002Fsignin","auth\u002Fsignin:$org:$ID","organization",{"operationId":11539,"slug":11626,"method":133,"path":11627,"tag":83,"summary":225,"deprecated":134,"public":134,"permission":11628,"scope":11624,"order":1366},"list-available-exams","\u002Fv1\u002F{organizationId}\u002Fexam\u002Favailable\u002F{studentId}","exam\u002Fread:$org:$ID",{"operationId":11542,"slug":11630,"method":141,"path":11631,"tag":86,"summary":237,"deprecated":134,"public":134,"permission":11632,"scope":11624,"order":1424},"create-application","\u002Fv1\u002F{organizationId}\u002Fapplication","application\u002Fcreate:$org:$ID",{"operationId":11589,"slug":11634,"method":133,"path":11635,"tag":86,"summary":243,"deprecated":134,"public":134,"permission":11636,"scope":11624,"order":1434},"list-student-applications","\u002Fv1\u002F{organizationId}\u002Fapplication\u002Fstudent-applications\u002F{studentId}","application\u002Fread:$org:$ID",1791554615228]