[{"data":1,"prerenderedAt":6170},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Frequests-and-responses":351,"api-spec:guide:\u002Fapi\u002Frequests-and-responses":6146},[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":33,"body":353,"description":6132,"extension":6133,"meta":6134,"navTitle":33,"navigation":2658,"operations":6135,"order":6142,"path":34,"section":29,"seo":6143,"status":14,"stem":6144,"__hash__":6145},"apiGuides\u002Fapi\u002Frequests-and-responses.md",{"type":354,"value":355,"toc":6097},"minimark",[356,364,369,512,516,521,524,568,576,580,648,658,662,758,765,768,854,929,1120,1124,1128,1135,1237,1241,1252,1262,1266,1269,1317,1387,1396,1399,1403,1409,1463,1470,1473,1477,1511,1517,1521,1524,1600,1606,1610,1614,1617,1696,1699,1726,1813,1816,1842,2071,2075,2120,2132,2136,2143,2147,2157,2161,2166,2171,2197,2340,2380,2400,2404,2413,2464,2482,2496,2499,2525,2528,2576,2585,2588,3409,3416,4195,4198,4202,4205,4270,4370,4374,4592,4597,4601,4610,4614,4630,4633,4643,4673,4676,4697,4701,4817,4821,4826,4829,5407,5410,6085,6093],[357,358,359,360,363],"p",{},"Every operation follows the same conventions: how you address it, what a body may contain, what comes back when it works and when it does not. Learn them once and every endpoint in the ",[361,362,116],"a",{"href":121}," reads the same way. This page covers all of them, plus the two responses that break the pattern.",[365,366,368],"h2",{"id":367},"at-a-glance","At a glance",[370,371,372,385],"table",{},[373,374,375],"thead",{},[376,377,378,382],"tr",{},[379,380,381],"th",{},"Rule",[379,383,384],{},"Value",[386,387,388,404,412,424,435,445,455,466,477,487,498],"tbody",{},[376,389,390,394],{},[391,392,393],"td",{},"Base URL",[391,395,396,400,401,403],{},[397,398,399],"code",{},"https:\u002F\u002Fapi.main-team.org\u002Fv1"," (see ",[361,402,16],{"href":17},")",[376,405,406,409],{},[391,407,408],{},"Transport",[391,410,411],{},"HTTPS, from your own servers",[376,413,414,417],{},[391,415,416],{},"Request body",[391,418,419,420,423],{},"A JSON object, UTF-8, at most 100 kB — except ",[361,421,422],{"href":180},"createStudentImport",", which takes 1.5 MB",[376,425,426,429],{},[391,427,428],{},"Fields the operation does not declare",[391,430,431,432],{},"Refused with ",[397,433,434],{},"400 bad_request",[376,436,437,440],{},[391,438,439],{},"Success body",[391,441,442],{},[397,443,444],{},"{ success, message, data, pagination? }",[376,446,447,450],{},[391,448,449],{},"Error body",[391,451,452],{},[397,453,454],{},"{ error: { code, message, documentation_url, request_id } }",[376,456,457,460],{},[391,458,459],{},"Responses without that envelope",[391,461,462,465],{},[397,463,464],{},"GET \u002Fv1\u002Fapi-account\u002Fvalidate-me"," (the bare account) and the two file downloads (file bytes)",[376,467,468,471],{},[391,469,470],{},"Request id",[391,472,473,476],{},[397,474,475],{},"X-Request-Id"," header on every response",[376,478,479,482],{},[391,480,481],{},"Ids",[391,483,484,485,403],{},"24-character hexadecimal strings (see ",[361,486,36],{"href":37},[376,488,489,492],{},[391,490,491],{},"Timestamps",[391,493,494,495],{},"ISO 8601 in UTC, for example ",[397,496,497],{},"2026-09-15T08:30:12.345Z",[376,499,500,503],{},[391,501,502],{},"Date of birth",[391,504,505,508,509],{},[397,506,507],{},"DD\u002FMM\u002FYYYY",", for example ",[397,510,511],{},"14\u002F05\u002F2008",[365,513,515],{"id":514},"anatomy-of-a-request","Anatomy of a request",[517,518,520],"h3",{"id":519},"the-url","The URL",[357,522,523],{},"A URL is the base URL plus the operation's path. Paths come in two families:",[525,526,527,547],"ul",{},[528,529,530,534,535,538,539,542,543,546],"li",{},[531,532,533],"strong",{},"Flat paths"," such as ",[397,536,537],{},"\u002Fv1\u002Fstudent"," or ",[397,540,541],{},"\u002Fv1\u002Fcountry"," act on the core record, ",[397,544,545],{},"mto",". They take no organization id.",[528,548,549,534,552,555,556,559,560,563,564,567],{},[531,550,551],{},"Organization paths",[397,553,554],{},"\u002Fv1\u002F\u003CorganizationId>\u002Fexam"," act on one organization. ",[397,557,558],{},"\u003CorganizationId>"," is that organization's ",[397,561,562],{},"_id"," from ",[397,565,566],{},"GET \u002Fv1\u002Forganization",", never its slug.",[357,569,570,572,573,575],{},[361,571,22],{"href":23}," explains the difference, and ",[361,574,36],{"href":37}," explains which id goes where.",[517,577,579],{"id":578},"methods","Methods",[370,581,582,595],{},[373,583,584],{},[376,585,586,589,592],{},[379,587,588],{},"Method",[379,590,591],{},"Used for",[379,593,594],{},"Body",[386,596,597,609,625,637],{},[376,598,599,603,606],{},[391,600,601],{},[397,602,133],{},[391,604,605],{},"Reading a record, a list or a file",[391,607,608],{},"None",[376,610,611,615,618],{},[391,612,613],{},[397,614,141],{},[391,616,617],{},"Creating something: registering a student, applying for an exam, creating a sign-in link, revoking your token",[391,619,620,621,624],{},"JSON. ",[397,622,623],{},"revoke-token"," takes none",[376,626,627,631,634],{},[391,628,629],{},[397,630,190],{},[391,632,633],{},"Changing a record",[391,635,636],{},"JSON",[376,638,639,643,646],{},[391,640,641],{},[397,642,254],{},[391,644,645],{},"Deleting an application",[391,647,608],{},[357,649,650,651,654,655,657],{},"There is no ",[397,652,653],{},"PATCH",". On the student routes, ",[397,656,190],{}," changes only the fields you send and leaves the rest as they are.",[517,659,661],{"id":660},"headers","Headers",[370,663,664,676],{},[373,665,666],{},[376,667,668,671,674],{},[379,669,670],{},"Header",[379,672,673],{},"When",[379,675,384],{},[386,677,678,699,719,735],{},[376,679,680,685,691],{},[391,681,682],{},[397,683,684],{},"Authorization",[391,686,687,688],{},"Every call except ",[397,689,690],{},"GET \u002Fv1\u002Fhealth",[391,692,693,696,697],{},[397,694,695],{},"Bearer \u003Ctoken>",". See ",[361,698,19],{"href":20},[376,700,701,706,714],{},[391,702,703],{},[397,704,705],{},"Content-Type",[391,707,708,709,538,711,713],{},"Every ",[397,710,141],{},[397,712,190],{}," that carries a body",[391,715,716],{},[397,717,718],{},"application\u002Fjson",[376,720,721,725,728],{},[391,722,723],{},[397,724,475],{},[391,726,727],{},"Optional, recommended",[391,729,730,731],{},"Your own id for this request. See ",[361,732,734],{"href":733},"#request-ids","Request ids",[376,736,737,742,745],{},[391,738,739],{},[397,740,741],{},"Content-Encoding",[391,743,744],{},"Optional",[391,746,747,750,751,538,754,757],{},[397,748,749],{},"gzip",", ",[397,752,753],{},"deflate",[397,755,756],{},"br",", only if you compress the body",[357,759,760,761,764],{},"You do not need an ",[397,762,763],{},"Accept"," header. The API answers with JSON, or with the file on the two download routes, whatever you send.",[357,766,767],{},"A complete request, with realistic output (the application object is shortened to its main fields):",[769,770,775],"pre",{"className":771,"code":772,"language":773,"meta":774,"style":774},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","curl -sS -i -X POST \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"X-Request-Id: 7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\" \\\n  -d '{\"studentId\":\"\u003CstudentId>\",\"examId\":\"\u003CexamId>\"}'\n","bash","",[397,776,777,807,825,835,845],{"__ignoreMap":774},[778,779,782,786,790,793,796,800,803],"span",{"class":780,"line":781},"line",1,[778,783,785],{"class":784},"soyes","curl",[778,787,789],{"class":788},"s-5SL"," -sS",[778,791,792],{"class":788}," -i",[778,794,795],{"class":788}," -X",[778,797,799],{"class":798},"sT6z2"," POST",[778,801,802],{"class":798}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fapplication\"",[778,804,806],{"class":805},"sHUrx"," \\\n",[778,808,810,813,816,820,823],{"class":780,"line":809},2,[778,811,812],{"class":788},"  -H",[778,814,815],{"class":798}," \"Authorization: Bearer ",[778,817,819],{"class":818},"suds8","$TOKEN",[778,821,822],{"class":798},"\"",[778,824,806],{"class":805},[778,826,828,830,833],{"class":780,"line":827},3,[778,829,812],{"class":788},[778,831,832],{"class":798}," \"Content-Type: application\u002Fjson\"",[778,834,806],{"class":805},[778,836,838,840,843],{"class":780,"line":837},4,[778,839,812],{"class":788},[778,841,842],{"class":798}," \"X-Request-Id: 7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\"",[778,844,806],{"class":805},[778,846,848,851],{"class":780,"line":847},5,[778,849,850],{"class":788},"  -d",[778,852,853],{"class":798}," '{\"studentId\":\"\u003CstudentId>\",\"examId\":\"\u003CexamId>\"}'\n",[769,855,859],{"className":856,"code":857,"language":858,"meta":774,"style":774},"language-http shiki shiki-themes github-light-high-contrast github-dark-high-contrast","HTTP\u002F1.1 201 Created\nContent-Type: application\u002Fjson; charset=utf-8\nX-Request-Id: 7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\nX-RateLimit-Limit: 100\nX-RateLimit-Remaining: 99\nX-RateLimit-Reset: 60\n","http",[397,860,861,878,889,898,908,918],{"__ignoreMap":774},[778,862,863,866,869,872,875],{"class":780,"line":781},[778,864,865],{"class":805},"HTTP",[778,867,868],{"class":818},"\u002F",[778,870,871],{"class":788},"1.1",[778,873,874],{"class":788}," 201",[778,876,877],{"class":798}," Created\n",[778,879,880,883,886],{"class":780,"line":809},[778,881,705],{"class":882},"sne4z",[778,884,885],{"class":805},":",[778,887,888],{"class":798}," application\u002Fjson; charset=utf-8\n",[778,890,891,893,895],{"class":780,"line":827},[778,892,475],{"class":882},[778,894,885],{"class":805},[778,896,897],{"class":798}," 7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\n",[778,899,900,903,905],{"class":780,"line":837},[778,901,902],{"class":882},"X-RateLimit-Limit",[778,904,885],{"class":805},[778,906,907],{"class":798}," 100\n",[778,909,910,913,915],{"class":780,"line":847},[778,911,912],{"class":882},"X-RateLimit-Remaining",[778,914,885],{"class":805},[778,916,917],{"class":798}," 99\n",[778,919,921,924,926],{"class":780,"line":920},6,[778,922,923],{"class":882},"X-RateLimit-Reset",[778,925,885],{"class":805},[778,927,928],{"class":798}," 60\n",[769,930,934],{"className":931,"code":932,"language":933,"meta":774,"style":774},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"success\": true,\n  \"message\": \"Application created successfully.\",\n  \"data\": {\n    \"_id\": \"66b2c3d4e5f60718293a4b5c\",\n    \"exam\": \"64a1f0b2c9d8e7f600112233\",\n    \"user\": \"66a0b1c2d3e4f5061728394a\",\n    \"payment\": \"66b2c3d4e5f60718293a4b5d\",\n    \"partners\": [],\n    \"participated\": false,\n    \"simulationStarted\": false,\n    \"simulationSubmitted\": false,\n    \"uuid\": \"a3f-09c-7e1\",\n    \"createdAt\": \"2026-09-15T08:30:12.345Z\",\n    \"updatedAt\": \"2026-09-15T08:30:12.345Z\"\n  }\n}\n","json",[397,935,936,941,955,967,975,987,999,1012,1025,1034,1047,1059,1071,1084,1097,1108,1114],{"__ignoreMap":774},[778,937,938],{"class":780,"line":781},[778,939,940],{"class":818},"{\n",[778,942,943,946,949,952],{"class":780,"line":809},[778,944,945],{"class":882},"  \"success\"",[778,947,948],{"class":818},": ",[778,950,951],{"class":788},"true",[778,953,954],{"class":818},",\n",[778,956,957,960,962,965],{"class":780,"line":827},[778,958,959],{"class":882},"  \"message\"",[778,961,948],{"class":818},[778,963,964],{"class":798},"\"Application created successfully.\"",[778,966,954],{"class":818},[778,968,969,972],{"class":780,"line":837},[778,970,971],{"class":882},"  \"data\"",[778,973,974],{"class":818},": {\n",[778,976,977,980,982,985],{"class":780,"line":847},[778,978,979],{"class":882},"    \"_id\"",[778,981,948],{"class":818},[778,983,984],{"class":798},"\"66b2c3d4e5f60718293a4b5c\"",[778,986,954],{"class":818},[778,988,989,992,994,997],{"class":780,"line":920},[778,990,991],{"class":882},"    \"exam\"",[778,993,948],{"class":818},[778,995,996],{"class":798},"\"64a1f0b2c9d8e7f600112233\"",[778,998,954],{"class":818},[778,1000,1002,1005,1007,1010],{"class":780,"line":1001},7,[778,1003,1004],{"class":882},"    \"user\"",[778,1006,948],{"class":818},[778,1008,1009],{"class":798},"\"66a0b1c2d3e4f5061728394a\"",[778,1011,954],{"class":818},[778,1013,1015,1018,1020,1023],{"class":780,"line":1014},8,[778,1016,1017],{"class":882},"    \"payment\"",[778,1019,948],{"class":818},[778,1021,1022],{"class":798},"\"66b2c3d4e5f60718293a4b5d\"",[778,1024,954],{"class":818},[778,1026,1028,1031],{"class":780,"line":1027},9,[778,1029,1030],{"class":882},"    \"partners\"",[778,1032,1033],{"class":818},": [],\n",[778,1035,1037,1040,1042,1045],{"class":780,"line":1036},10,[778,1038,1039],{"class":882},"    \"participated\"",[778,1041,948],{"class":818},[778,1043,1044],{"class":788},"false",[778,1046,954],{"class":818},[778,1048,1050,1053,1055,1057],{"class":780,"line":1049},11,[778,1051,1052],{"class":882},"    \"simulationStarted\"",[778,1054,948],{"class":818},[778,1056,1044],{"class":788},[778,1058,954],{"class":818},[778,1060,1062,1065,1067,1069],{"class":780,"line":1061},12,[778,1063,1064],{"class":882},"    \"simulationSubmitted\"",[778,1066,948],{"class":818},[778,1068,1044],{"class":788},[778,1070,954],{"class":818},[778,1072,1074,1077,1079,1082],{"class":780,"line":1073},13,[778,1075,1076],{"class":882},"    \"uuid\"",[778,1078,948],{"class":818},[778,1080,1081],{"class":798},"\"a3f-09c-7e1\"",[778,1083,954],{"class":818},[778,1085,1087,1090,1092,1095],{"class":780,"line":1086},14,[778,1088,1089],{"class":882},"    \"createdAt\"",[778,1091,948],{"class":818},[778,1093,1094],{"class":798},"\"2026-09-15T08:30:12.345Z\"",[778,1096,954],{"class":818},[778,1098,1100,1103,1105],{"class":780,"line":1099},15,[778,1101,1102],{"class":882},"    \"updatedAt\"",[778,1104,948],{"class":818},[778,1106,1107],{"class":798},"\"2026-09-15T08:30:12.345Z\"\n",[778,1109,1111],{"class":780,"line":1110},16,[778,1112,1113],{"class":818},"  }\n",[778,1115,1117],{"class":780,"line":1116},17,[778,1118,1119],{"class":818},"}\n",[365,1121,1123],{"id":1122},"request-bodies","Request bodies",[517,1125,1127],{"id":1126},"always-a-json-object-sent-as-json","Always a JSON object, sent as JSON",[357,1129,1130,1131,1134],{},"Send every body as a JSON object with ",[397,1132,1133],{},"Content-Type: application\u002Fjson",", encoded as UTF-8.",[525,1136,1137,1193,1202,1219],{},[528,1138,1139,1145,1146,1190,1192],{},[531,1140,1141,1142,1144],{},"Wrong or missing ",[397,1143,705],{},"?"," The body is not read as JSON, and what happens next depends on what the header says:",[525,1147,1148,1171],{},[528,1149,1150,1155,1156,1159,1160,1163,1164,1166,1167,1170],{},[531,1151,1152],{},[397,1153,1154],{},"application\u002Fx-www-form-urlencoded",", which is what ",[397,1157,1158],{},"curl -d"," sends when you forget ",[397,1161,1162],{},"-H \"Content-Type: application\u002Fjson\"",": your JSON text is read as a form with a single, oddly named field, and the request is refused with ",[397,1165,434],{}," and a message such as ",[397,1168,1169],{},"property {\"firstName\":\"Jane\"} should not exist",".",[528,1172,1173,1182,1183,1185,1186,1189],{},[531,1174,1175,1176,1178,1179],{},"No ",[397,1177,705],{},", or a type such as ",[397,1180,1181],{},"text\u002Fplain",": the body is ignored and the request arrives as if it had no fields. An operation with required fields refuses it with ",[397,1184,434],{},", naming a missing one. An update, where every field is optional, answers ",[397,1187,1188],{},"200"," without making the changes you meant to send.",[756,1191],{},"If you get a 400 for a field you are sure you sent, a 400 naming a strange property, or an update seems to do nothing, check this header first.",[528,1194,1195,1198,1199,1201],{},[531,1196,1197],{},"Malformed JSON"," (a trailing comma, a missing quote) is refused with ",[397,1200,434],{},". The message describes where parsing failed.",[528,1203,1204,508,1207,1210,1211,1214,1215,1218],{},[531,1205,1206],{},"A character set that is not UTF-8",[397,1208,1209],{},"Content-Type: application\u002Fjson; charset=latin1",", is refused with ",[397,1212,1213],{},"415 unsupported_media_type",". Send ",[397,1216,1217],{},"charset=utf-8"," or no charset at all.",[528,1220,1221,1224,1225,750,1227,538,1229,1231,1232,1234,1235,1170],{},[531,1222,1223],{},"Compression is optional."," Bodies are small, so most integrations never compress. If you do, use ",[397,1226,749],{},[397,1228,753],{},[397,1230,756],{},". Any other ",[397,1233,741],{}," is refused with ",[397,1236,1213],{},[517,1238,1240],{"id":1239},"at-most-100-kb","At most 100 kB",[357,1242,1243,1244,1247,1248,1251],{},"A body larger than 100 kB is refused with ",[397,1245,1246],{},"413 payload_too_large",". The refusal happens before your token is even read, so nothing was read or written, and the request does not count against your ",[361,1249,1250],{"href":46},"rate limit",". No operation but one needs anywhere near that much: the largest body the rest of the API takes is one student registration.",[357,1253,1254,1255,1257,1258,1261],{},"The exception is ",[361,1256,422],{"href":180},", which takes a list of up to 1000 students and so accepts ",[531,1259,1260],{},"1.5 MB",". The limit belongs to that one operation and that one method: everything else, that path included, is still 100 kB.",[517,1263,1265],{"id":1264},"only-the-fields-the-operation-declares","Only the fields the operation declares",[357,1267,1268],{},"Every operation declares the fields its body may carry. A field it does not declare is refused, not ignored:",[769,1270,1272],{"className":771,"code":1271,"language":773,"meta":774,"style":774},"curl -sS -X PUT \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent\u002F\u003CstudentId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"firstName\":\"Jane\",\"password\":\"a new password\"}'\n",[397,1273,1274,1290,1302,1310],{"__ignoreMap":774},[778,1275,1276,1278,1280,1282,1285,1288],{"class":780,"line":781},[778,1277,785],{"class":784},[778,1279,789],{"class":788},[778,1281,795],{"class":788},[778,1283,1284],{"class":798}," PUT",[778,1286,1287],{"class":798}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent\u002F\u003CstudentId>\"",[778,1289,806],{"class":805},[778,1291,1292,1294,1296,1298,1300],{"class":780,"line":809},[778,1293,812],{"class":788},[778,1295,815],{"class":798},[778,1297,819],{"class":818},[778,1299,822],{"class":798},[778,1301,806],{"class":805},[778,1303,1304,1306,1308],{"class":780,"line":827},[778,1305,812],{"class":788},[778,1307,832],{"class":798},[778,1309,806],{"class":805},[778,1311,1312,1314],{"class":780,"line":837},[778,1313,850],{"class":788},[778,1315,1316],{"class":798}," '{\"firstName\":\"Jane\",\"password\":\"a new password\"}'\n",[769,1318,1320],{"className":931,"code":1319,"language":933,"meta":774,"style":774},"{\n  \"error\": {\n    \"code\": \"bad_request\",\n    \"message\": \"property password should not exist\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#bad_request\",\n    \"request_id\": \"0b5c6d0e-8f7a-4b1c-9d2e-3f4a5b6c7d8e\"\n  }\n}\n",[397,1321,1322,1326,1333,1345,1357,1369,1379,1383],{"__ignoreMap":774},[778,1323,1324],{"class":780,"line":781},[778,1325,940],{"class":818},[778,1327,1328,1331],{"class":780,"line":809},[778,1329,1330],{"class":882},"  \"error\"",[778,1332,974],{"class":818},[778,1334,1335,1338,1340,1343],{"class":780,"line":827},[778,1336,1337],{"class":882},"    \"code\"",[778,1339,948],{"class":818},[778,1341,1342],{"class":798},"\"bad_request\"",[778,1344,954],{"class":818},[778,1346,1347,1350,1352,1355],{"class":780,"line":837},[778,1348,1349],{"class":882},"    \"message\"",[778,1351,948],{"class":818},[778,1353,1354],{"class":798},"\"property password should not exist\"",[778,1356,954],{"class":818},[778,1358,1359,1362,1364,1367],{"class":780,"line":847},[778,1360,1361],{"class":882},"    \"documentation_url\"",[778,1363,948],{"class":818},[778,1365,1366],{"class":798},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#bad_request\"",[778,1368,954],{"class":818},[778,1370,1371,1374,1376],{"class":780,"line":920},[778,1372,1373],{"class":882},"    \"request_id\"",[778,1375,948],{"class":818},[778,1377,1378],{"class":798},"\"0b5c6d0e-8f7a-4b1c-9d2e-3f4a5b6c7d8e\"\n",[778,1380,1381],{"class":780,"line":1001},[778,1382,1113],{"class":818},[778,1384,1385],{"class":780,"line":1014},[778,1386,1119],{"class":818},[357,1388,1389,1390,1392,1393,1395],{},"This is deliberate. If an unknown field were silently dropped, you would get a ",[397,1391,1188],{}," for a request that did less than you asked, and you would not find out until something was missing later. In the example above, the password has its own operation (",[361,1394,68],{"href":69},"), and the refusal tells you so straight away.",[357,1397,1398],{},"In practice: build each body from the fields the reference lists for that operation. Never send a whole record copied out of your own system.",[517,1400,1402],{"id":1401},"values-are-checked-too","Values are checked too",[357,1404,1405,1406,1408],{},"Each declared field has rules: a type, a format, sometimes a list of allowed values. A value that breaks a rule is refused with ",[397,1407,434],{},", and the message names the field. Some messages you are likely to meet:",[370,1410,1411,1421],{},[373,1412,1413],{},[376,1414,1415,1418],{},[379,1416,1417],{},"Message",[379,1419,1420],{},"Meaning",[386,1422,1423,1433,1443,1453],{},[376,1424,1425,1430],{},[391,1426,1427],{},[397,1428,1429],{},"studentId must be a mongodb id",[391,1431,1432],{},"An id field that is not a 24-character hexadecimal string",[376,1434,1435,1440],{},[391,1436,1437],{},[397,1438,1439],{},"birth must be a real date in DD\u002FMM\u002FYYYY format",[391,1441,1442],{},"A date of birth in another format, or a date that does not exist",[376,1444,1445,1450],{},[391,1446,1447],{},[397,1448,1449],{},"email must be an email",[391,1451,1452],{},"An address that is not well formed",[376,1454,1455,1460],{},[391,1456,1457],{},[397,1458,1459],{},"property \u003Cname> should not exist",[391,1461,1462],{},"A field the operation does not declare",[357,1464,1465,1466,1469],{},"The message names the ",[531,1467,1468],{},"first"," rule the body broke, not all of them. Fix that one and send again; if another field is also wrong, the next response names it.",[357,1471,1472],{},"A request refused by these checks changed nothing. The checks run before the operation does any work.",[365,1474,1476],{"id":1475},"query-parameters","Query parameters",[357,1478,1479,1480,1483,1484,1487,1488,1490,1491,1494,1495,1498,1499,1483,1502,1498,1505,400,1508,1510],{},"Only list operations take query parameters. Every list takes ",[397,1481,1482],{},"page"," and ",[397,1485,1486],{},"limit",", which never cause an error: an out-of-range value is clamped to the nearest allowed one (see ",[361,1489,39],{"href":40},"). Two lists also take a filter, which is refused with ",[397,1492,1493],{},"400"," when it cannot be read rather than ignored, since a filter dropped in silence would answer with every student instead of a few: ",[397,1496,1497],{},"email"," on ",[361,1500,1501],{"href":171},"listStudents",[397,1503,1504],{},"signedIn",[361,1506,1507],{"href":196},"listOrgStudents",[361,1509,62],{"href":63},"). No operation reads any other query parameter, so anything else you add is ignored.",[357,1512,1513,1514,1516],{},"Keep personal data and tokens out of URLs. URLs are the part of a request most likely to be recorded along the way. The ",[397,1515,1497],{}," filter puts addresses in the URL, so use it only where that is acceptable to you.",[365,1518,1520],{"id":1519},"path-parameters","Path parameters",[357,1522,1523],{},"Ids in the path are 24-character hexadecimal strings. What happens when one is wrong depends on which id it is:",[370,1525,1526,1536],{},[373,1527,1528],{},[376,1529,1530,1533],{},[379,1531,1532],{},"Path parameter",[379,1534,1535],{},"Malformed or unknown",[386,1537,1538,1553,1566,1576],{},[376,1539,1540,1544],{},[391,1541,1542],{},[397,1543,558],{},[391,1545,1546,750,1549,1552],{},[397,1547,1548],{},"404 not_found",[397,1550,1551],{},"Organization not found!",", checked only after your token has been accepted",[376,1554,1555,1558],{},[391,1556,1557],{},"Any other id, malformed",[391,1559,1560,1561,508,1563],{},"Usually ",[397,1562,434],{},[397,1564,1565],{},"Invalid value for '_id': expected ObjectId.",[376,1567,1568,1571],{},[391,1569,1570],{},"Any other id, well formed but matching nothing you can see",[391,1572,1573,1575],{},[397,1574,1548],{},", on every single read and every write. The one exception is a list narrowed by an id, such as one exam's applications, which answers an empty page",[376,1577,1578,1587],{},[391,1579,1580,750,1583,1586],{},[397,1581,1582],{},"\u003CcertificateId>",[397,1584,1585],{},"\u003CreportId>"," on downloads",[391,1588,1589,1590,1593,1594,1597,1598],{},"Also accept a ",[397,1591,1592],{},"shortId",". Anything that is not a 24-character id is looked up as one, so a typo answers ",[397,1595,1596],{},"404",", not ",[397,1599,1493],{},[357,1601,1602,1605],{},[361,1603,36],{"href":1604},"\u002Fapi\u002Fidentifiers#when-an-id-is-wrong"," has the full table, operation by operation.",[365,1607,1609],{"id":1608},"successful-responses","Successful responses",[517,1611,1613],{"id":1612},"the-envelope","The envelope",[357,1615,1616],{},"Every successful JSON response, apart from the one exception below, has this shape:",[370,1618,1619,1631],{},[373,1620,1621],{},[376,1622,1623,1626,1629],{},[379,1624,1625],{},"Field",[379,1627,1628],{},"Type",[379,1630,1420],{},[386,1632,1633,1649,1665,1678],{},[376,1634,1635,1640,1643],{},[391,1636,1637],{},[397,1638,1639],{},"success",[391,1641,1642],{},"boolean",[391,1644,1645,1646,1648],{},"Always ",[397,1647,951],{}," on a successful response",[376,1650,1651,1656,1659],{},[391,1652,1653],{},[397,1654,1655],{},"message",[391,1657,1658],{},"string",[391,1660,1661,1662],{},"A short, human-readable summary, such as ",[397,1663,1664],{},"Countries fetched successfully.",[376,1666,1667,1672,1675],{},[391,1668,1669],{},[397,1670,1671],{},"data",[391,1673,1674],{},"object or array",[391,1676,1677],{},"The result",[376,1679,1680,1685,1688],{},[391,1681,1682],{},[397,1683,1684],{},"pagination",[391,1686,1687],{},"object",[391,1689,1690,1691,696,1694],{},"Only on list operations: ",[397,1692,1693],{},"{ page, limit, total, totalPages }",[361,1695,39],{"href":40},[357,1697,1698],{},"A single record:",[769,1700,1702],{"className":771,"code":1701,"language":773,"meta":774,"style":774},"curl -sS \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade\u002F\u003CgradeId>\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[397,1703,1704,1715],{"__ignoreMap":774},[778,1705,1706,1708,1710,1713],{"class":780,"line":781},[778,1707,785],{"class":784},[778,1709,789],{"class":788},[778,1711,1712],{"class":798}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade\u002F\u003CgradeId>\"",[778,1714,806],{"class":805},[778,1716,1717,1719,1721,1723],{"class":780,"line":809},[778,1718,812],{"class":788},[778,1720,815],{"class":798},[778,1722,819],{"class":818},[778,1724,1725],{"class":798},"\"\n",[769,1727,1729],{"className":931,"code":1728,"language":933,"meta":774,"style":774},"{\n  \"success\": true,\n  \"message\": \"Grade fetched successfully.\",\n  \"data\": {\n    \"_id\": \"5f1a2b3c4d5e6f7a8b9c0d1e\",\n    \"name\": \"10\",\n    \"createdAt\": \"2020-08-01T09:00:00.000Z\",\n    \"updatedAt\": \"2020-08-01T09:00:00.000Z\"\n  }\n}\n",[397,1730,1731,1735,1745,1756,1762,1773,1785,1796,1805,1809],{"__ignoreMap":774},[778,1732,1733],{"class":780,"line":781},[778,1734,940],{"class":818},[778,1736,1737,1739,1741,1743],{"class":780,"line":809},[778,1738,945],{"class":882},[778,1740,948],{"class":818},[778,1742,951],{"class":788},[778,1744,954],{"class":818},[778,1746,1747,1749,1751,1754],{"class":780,"line":827},[778,1748,959],{"class":882},[778,1750,948],{"class":818},[778,1752,1753],{"class":798},"\"Grade fetched successfully.\"",[778,1755,954],{"class":818},[778,1757,1758,1760],{"class":780,"line":837},[778,1759,971],{"class":882},[778,1761,974],{"class":818},[778,1763,1764,1766,1768,1771],{"class":780,"line":847},[778,1765,979],{"class":882},[778,1767,948],{"class":818},[778,1769,1770],{"class":798},"\"5f1a2b3c4d5e6f7a8b9c0d1e\"",[778,1772,954],{"class":818},[778,1774,1775,1778,1780,1783],{"class":780,"line":920},[778,1776,1777],{"class":882},"    \"name\"",[778,1779,948],{"class":818},[778,1781,1782],{"class":798},"\"10\"",[778,1784,954],{"class":818},[778,1786,1787,1789,1791,1794],{"class":780,"line":1001},[778,1788,1089],{"class":882},[778,1790,948],{"class":818},[778,1792,1793],{"class":798},"\"2020-08-01T09:00:00.000Z\"",[778,1795,954],{"class":818},[778,1797,1798,1800,1802],{"class":780,"line":1014},[778,1799,1102],{"class":882},[778,1801,948],{"class":818},[778,1803,1804],{"class":798},"\"2020-08-01T09:00:00.000Z\"\n",[778,1806,1807],{"class":780,"line":1027},[778,1808,1113],{"class":818},[778,1810,1811],{"class":780,"line":1036},[778,1812,1119],{"class":818},[357,1814,1815],{},"A list (each country shortened to a few of its fields):",[769,1817,1819],{"className":771,"code":1818,"language":773,"meta":774,"style":774},"curl -sS \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?limit=2\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[397,1820,1821,1832],{"__ignoreMap":774},[778,1822,1823,1825,1827,1830],{"class":780,"line":781},[778,1824,785],{"class":784},[778,1826,789],{"class":788},[778,1828,1829],{"class":798}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?limit=2\"",[778,1831,806],{"class":805},[778,1833,1834,1836,1838,1840],{"class":780,"line":809},[778,1835,812],{"class":788},[778,1837,815],{"class":798},[778,1839,819],{"class":818},[778,1841,1725],{"class":798},[769,1843,1845],{"className":931,"code":1844,"language":933,"meta":774,"style":774},"{\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      \"_id\": \"630e0182c53dc79a6836e67f\",\n      \"name\": \"AUSTRIA\",\n      \"iso2\": \"AT\",\n      \"iso3\": \"AUT\",\n      \"dialCode\": \"+43\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 2, \"total\": 196, \"totalPages\": 98 }\n}\n",[397,1846,1847,1851,1861,1872,1879,1884,1896,1908,1920,1932,1942,1947,1951,1962,1973,1984,1995,2004,2010,2016,2066],{"__ignoreMap":774},[778,1848,1849],{"class":780,"line":781},[778,1850,940],{"class":818},[778,1852,1853,1855,1857,1859],{"class":780,"line":809},[778,1854,945],{"class":882},[778,1856,948],{"class":818},[778,1858,951],{"class":788},[778,1860,954],{"class":818},[778,1862,1863,1865,1867,1870],{"class":780,"line":827},[778,1864,959],{"class":882},[778,1866,948],{"class":818},[778,1868,1869],{"class":798},"\"Countries fetched successfully.\"",[778,1871,954],{"class":818},[778,1873,1874,1876],{"class":780,"line":837},[778,1875,971],{"class":882},[778,1877,1878],{"class":818},": [\n",[778,1880,1881],{"class":780,"line":847},[778,1882,1883],{"class":818},"    {\n",[778,1885,1886,1889,1891,1894],{"class":780,"line":920},[778,1887,1888],{"class":882},"      \"_id\"",[778,1890,948],{"class":818},[778,1892,1893],{"class":798},"\"630e0182c53dc79a6836e67e\"",[778,1895,954],{"class":818},[778,1897,1898,1901,1903,1906],{"class":780,"line":1001},[778,1899,1900],{"class":882},"      \"name\"",[778,1902,948],{"class":818},[778,1904,1905],{"class":798},"\"GERMANY\"",[778,1907,954],{"class":818},[778,1909,1910,1913,1915,1918],{"class":780,"line":1014},[778,1911,1912],{"class":882},"      \"iso2\"",[778,1914,948],{"class":818},[778,1916,1917],{"class":798},"\"DE\"",[778,1919,954],{"class":818},[778,1921,1922,1925,1927,1930],{"class":780,"line":1027},[778,1923,1924],{"class":882},"      \"iso3\"",[778,1926,948],{"class":818},[778,1928,1929],{"class":798},"\"DEU\"",[778,1931,954],{"class":818},[778,1933,1934,1937,1939],{"class":780,"line":1036},[778,1935,1936],{"class":882},"      \"dialCode\"",[778,1938,948],{"class":818},[778,1940,1941],{"class":798},"\"+49\"\n",[778,1943,1944],{"class":780,"line":1049},[778,1945,1946],{"class":818},"    },\n",[778,1948,1949],{"class":780,"line":1061},[778,1950,1883],{"class":818},[778,1952,1953,1955,1957,1960],{"class":780,"line":1073},[778,1954,1888],{"class":882},[778,1956,948],{"class":818},[778,1958,1959],{"class":798},"\"630e0182c53dc79a6836e67f\"",[778,1961,954],{"class":818},[778,1963,1964,1966,1968,1971],{"class":780,"line":1086},[778,1965,1900],{"class":882},[778,1967,948],{"class":818},[778,1969,1970],{"class":798},"\"AUSTRIA\"",[778,1972,954],{"class":818},[778,1974,1975,1977,1979,1982],{"class":780,"line":1099},[778,1976,1912],{"class":882},[778,1978,948],{"class":818},[778,1980,1981],{"class":798},"\"AT\"",[778,1983,954],{"class":818},[778,1985,1986,1988,1990,1993],{"class":780,"line":1110},[778,1987,1924],{"class":882},[778,1989,948],{"class":818},[778,1991,1992],{"class":798},"\"AUT\"",[778,1994,954],{"class":818},[778,1996,1997,1999,2001],{"class":780,"line":1116},[778,1998,1936],{"class":882},[778,2000,948],{"class":818},[778,2002,2003],{"class":798},"\"+43\"\n",[778,2005,2007],{"class":780,"line":2006},18,[778,2008,2009],{"class":818},"    }\n",[778,2011,2013],{"class":780,"line":2012},19,[778,2014,2015],{"class":818},"  ],\n",[778,2017,2019,2022,2025,2028,2030,2033,2035,2038,2040,2043,2045,2048,2050,2053,2055,2058,2060,2063],{"class":780,"line":2018},20,[778,2020,2021],{"class":882},"  \"pagination\"",[778,2023,2024],{"class":818},": { ",[778,2026,2027],{"class":882},"\"page\"",[778,2029,948],{"class":818},[778,2031,2032],{"class":788},"1",[778,2034,750],{"class":818},[778,2036,2037],{"class":882},"\"limit\"",[778,2039,948],{"class":818},[778,2041,2042],{"class":788},"2",[778,2044,750],{"class":818},[778,2046,2047],{"class":882},"\"total\"",[778,2049,948],{"class":818},[778,2051,2052],{"class":788},"196",[778,2054,750],{"class":818},[778,2056,2057],{"class":882},"\"totalPages\"",[778,2059,948],{"class":818},[778,2061,2062],{"class":788},"98",[778,2064,2065],{"class":818}," }\n",[778,2067,2069],{"class":780,"line":2068},21,[778,2070,1119],{"class":818},[517,2072,2074],{"id":2073},"status-codes-on-success","Status codes on success",[370,2076,2077,2086],{},[373,2078,2079],{},[376,2080,2081,2084],{},[379,2082,2083],{},"Status",[379,2085,673],{},[386,2087,2088,2103],{},[376,2089,2090,2095],{},[391,2091,2092],{},[397,2093,2094],{},"200 OK",[391,2096,2097,2098,948,2100,403],{},"Every read, every update, deleting an application, revoking a token, creating a sign-in link, and applying for an exam the student already holds (",[397,2099,1655],{},[397,2101,2102],{},"Application already exists.",[376,2104,2105,2110],{},[391,2106,2107],{},[397,2108,2109],{},"201 Created",[391,2111,2112,2113,2116,2117,403],{},"A student was registered (",[397,2114,2115],{},"POST \u002Fv1\u002Fstudent",") or an application was created (",[397,2118,2119],{},"POST \u002Fv1\u002F\u003CorganizationId>\u002Fapplication",[357,2121,2122,2123,2125,2126,2128,2129,1170],{},"The difference matters on ",[397,2124,2119],{},". Sending the same student and exam twice does not create a second application: the second call answers ",[397,2127,1188],{}," with the application that already exists. The status tells you which happened. See ",[361,2130,2131],{"href":49},"Retries and idempotency",[517,2133,2135],{"id":2134},"read-the-data-not-the-message","Read the data, not the message",[357,2137,2138,2140,2141,1170],{},[397,2139,1655],{}," is for people and logs. Wording can change without notice, so never branch on it. Decide what happened from the status code and from ",[397,2142,1671],{},[517,2144,2146],{"id":2145},"expect-fields-you-did-not-ask-for","Expect fields you did not ask for",[357,2148,2149,2150,2153,2154,2156],{},"Objects can carry fields that no guide mentions, such as ",[397,2151,2152],{},"__v",", and new fields can be added within version 1 (see ",[361,2155,54],{"href":55},"). Parse leniently: read the fields you use and ignore the rest. A client that fails on an unexpected field will break on a change that is not a breaking change.",[365,2158,2160],{"id":2159},"two-responses-without-the-envelope","Two responses without the envelope",[517,2162,2164],{"id":2163},"get-v1api-accountvalidate-me",[397,2165,464],{},[357,2167,2168,2169,885],{},"This operation answers with your account object itself, not wrapped in ",[397,2170,1671],{},[769,2172,2174],{"className":771,"code":2173,"language":773,"meta":774,"style":774},"curl -sS \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fapi-account\u002Fvalidate-me\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[397,2175,2176,2187],{"__ignoreMap":774},[778,2177,2178,2180,2182,2185],{"class":780,"line":781},[778,2179,785],{"class":784},[778,2181,789],{"class":788},[778,2183,2184],{"class":798}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fapi-account\u002Fvalidate-me\"",[778,2186,806],{"class":805},[778,2188,2189,2191,2193,2195],{"class":780,"line":809},[778,2190,812],{"class":788},[778,2192,815],{"class":798},[778,2194,819],{"class":818},[778,2196,1725],{"class":798},[769,2198,2200],{"className":931,"code":2199,"language":933,"meta":774,"style":774},"{\n  \"_id\": \"665f0c1d2e3a4b5c6d7e8f90\",\n  \"apiKey\": \"key_Q2x9mT4vLp8sR1nW6yZ3aB7c\",\n  \"companyName\": \"Northbridge Learning\",\n  \"scopes\": [],\n  \"roles\": [\n    { \"effect\": \"allow\", \"action\": \"*\u002Fread\", \"target\": \"*\" },\n    { \"effect\": \"allow\", \"action\": \"api\u002F*\", \"target\": \"mto\" }\n  ],\n  \"isActive\": true\n}\n",[397,2201,2202,2206,2218,2230,2242,2249,2256,2292,2322,2326,2336],{"__ignoreMap":774},[778,2203,2204],{"class":780,"line":781},[778,2205,940],{"class":818},[778,2207,2208,2211,2213,2216],{"class":780,"line":809},[778,2209,2210],{"class":882},"  \"_id\"",[778,2212,948],{"class":818},[778,2214,2215],{"class":798},"\"665f0c1d2e3a4b5c6d7e8f90\"",[778,2217,954],{"class":818},[778,2219,2220,2223,2225,2228],{"class":780,"line":827},[778,2221,2222],{"class":882},"  \"apiKey\"",[778,2224,948],{"class":818},[778,2226,2227],{"class":798},"\"key_Q2x9mT4vLp8sR1nW6yZ3aB7c\"",[778,2229,954],{"class":818},[778,2231,2232,2235,2237,2240],{"class":780,"line":837},[778,2233,2234],{"class":882},"  \"companyName\"",[778,2236,948],{"class":818},[778,2238,2239],{"class":798},"\"Northbridge Learning\"",[778,2241,954],{"class":818},[778,2243,2244,2247],{"class":780,"line":847},[778,2245,2246],{"class":882},"  \"scopes\"",[778,2248,1033],{"class":818},[778,2250,2251,2254],{"class":780,"line":920},[778,2252,2253],{"class":882},"  \"roles\"",[778,2255,1878],{"class":818},[778,2257,2258,2261,2264,2266,2269,2271,2274,2276,2279,2281,2284,2286,2289],{"class":780,"line":1001},[778,2259,2260],{"class":818},"    { ",[778,2262,2263],{"class":882},"\"effect\"",[778,2265,948],{"class":818},[778,2267,2268],{"class":798},"\"allow\"",[778,2270,750],{"class":818},[778,2272,2273],{"class":882},"\"action\"",[778,2275,948],{"class":818},[778,2277,2278],{"class":798},"\"*\u002Fread\"",[778,2280,750],{"class":818},[778,2282,2283],{"class":882},"\"target\"",[778,2285,948],{"class":818},[778,2287,2288],{"class":798},"\"*\"",[778,2290,2291],{"class":818}," },\n",[778,2293,2294,2296,2298,2300,2302,2304,2306,2308,2311,2313,2315,2317,2320],{"class":780,"line":1014},[778,2295,2260],{"class":818},[778,2297,2263],{"class":882},[778,2299,948],{"class":818},[778,2301,2268],{"class":798},[778,2303,750],{"class":818},[778,2305,2273],{"class":882},[778,2307,948],{"class":818},[778,2309,2310],{"class":798},"\"api\u002F*\"",[778,2312,750],{"class":818},[778,2314,2283],{"class":882},[778,2316,948],{"class":818},[778,2318,2319],{"class":798},"\"mto\"",[778,2321,2065],{"class":818},[778,2323,2324],{"class":780,"line":1027},[778,2325,2015],{"class":818},[778,2327,2328,2331,2333],{"class":780,"line":1036},[778,2329,2330],{"class":882},"  \"isActive\"",[778,2332,948],{"class":818},[778,2334,2335],{"class":788},"true\n",[778,2337,2338],{"class":780,"line":1049},[778,2339,1119],{"class":818},[357,2341,2342,2343,750,2345,750,2348,750,2351,750,2354,1483,2357,2360,2361,2364,2365,2368,2369,2371,2372,2375,2376,2379],{},"The fields are ",[397,2344,562],{},[397,2346,2347],{},"apiKey",[397,2349,2350],{},"companyName",[397,2352,2353],{},"scopes",[397,2355,2356],{},"roles",[397,2358,2359],{},"isActive",". Each role is ",[397,2362,2363],{},"{ effect, action, target }",", plus ",[397,2366,2367],{},"authorized"," when the operator set one (see ",[361,2370,25],{"href":26},"). Your ",[397,2373,2374],{},"apiSecret"," is never returned, on this route or any other. If this call fails, the error still arrives in the normal error envelope. ",[361,2377,2378],{"href":78},"Your API account"," shows how to use this call as a health check for your integration.",[357,2381,2382,2385,2386,2389,2390,2385,2392,1483,2395,2385,2397,1170],{},[397,2383,2384],{},"POST \u002Fv1\u002Fapi-account\u002Frevoke-token"," is ",[531,2387,2388],{},"not"," an exception. It answers with the usual envelope: ",[397,2391,1655],{},[397,2393,2394],{},"Token revoked successfully",[397,2396,1671],{},[397,2398,2399],{},"{ \"expiresIn\": \u003Cseconds> }",[517,2401,2403],{"id":2402},"certificate-and-report-downloads","Certificate and report downloads",[357,2405,2406,1483,2409,2412],{},[397,2407,2408],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fcertificate\u002Fdownload\u002F\u003CcertificateId>",[397,2410,2411],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Freport\u002Fdownload\u002F\u003CreportId>"," answer with the file itself.",[370,2414,2415,2423],{},[373,2416,2417],{},[376,2418,2419,2421],{},[379,2420,670],{},[379,2422,384],{},[386,2424,2425,2442,2452],{},[376,2426,2427,2431],{},[391,2428,2429],{},[397,2430,705],{},[391,2432,2433,2434,2437,2438,2441],{},"The type the file was stored with. Usually ",[397,2435,2436],{},"application\u002Fpdf",", but it can be ",[397,2439,2440],{},"application\u002Foctet-stream",", so do not rely on it",[376,2443,2444,2449],{},[391,2445,2446],{},[397,2447,2448],{},"Content-Length",[391,2450,2451],{},"The size in bytes, when it is known",[376,2453,2454,2459],{},[391,2455,2456],{},[397,2457,2458],{},"Content-Disposition",[391,2460,2461],{},[397,2462,2463],{},"attachment; filename=\"\u003Cascii name>\"; filename*=UTF-8''\u003Cpercent-encoded name>",[357,2465,2466,2467,2470,2471,2474,2475,2477,2478,2481],{},"Take the file name from ",[397,2468,2469],{},"filename*",". It carries the real name, including letters outside ASCII. ",[397,2472,2473],{},"filename"," is an ASCII version for clients that cannot read ",[397,2476,2469],{},". For a file called ",[397,2479,2480],{},"Öğrenci Şükrü.pdf"," the header is:",[769,2483,2485],{"className":856,"code":2484,"language":858,"meta":774,"style":774},"Content-Disposition: attachment; filename=\"Ogrenci Sukru.pdf\"; filename*=UTF-8''%C3%96%C4%9Frenci%20%C5%9E%C3%BCkr%C3%BC.pdf\n",[397,2486,2487],{"__ignoreMap":774},[778,2488,2489,2491,2493],{"class":780,"line":781},[778,2490,2458],{"class":882},[778,2492,885],{"class":805},[778,2494,2495],{"class":798}," attachment; filename=\"Ogrenci Sukru.pdf\"; filename*=UTF-8''%C3%96%C4%9Frenci%20%C5%9E%C3%BCkr%C3%BC.pdf\n",[357,2497,2498],{},"Two rules keep downloads reliable:",[2500,2501,2502,2516],"ol",{},[528,2503,2504,2507,2508,750,2510,400,2513,2515],{},[531,2505,2506],{},"Check the status before you write a file."," Every refusal is sent before any file bytes, as the normal JSON error envelope. A missing, unreleased or foreign document all answer the same ",[397,2509,1548],{},[397,2511,2512],{},"Not found!",[361,2514,92],{"href":93},").",[528,2517,2518,2521,2522,2524],{},[531,2519,2520],{},"A transfer that stops early is a failed download."," If something fails after the first bytes have been sent, the connection is closed; you do not get a short file with a success status. When ",[397,2523,2448],{}," is present, compare it with the bytes you received and discard the file if they differ.",[357,2526,2527],{},"With curl, write to a file and print the status alongside it:",[769,2529,2531],{"className":771,"code":2530,"language":773,"meta":774,"style":774},"curl -sS -o certificate.pdf -w '%{http_code} %{content_type} %{size_download}\\n' \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fcertificate\u002Fdownload\u002F\u003CcertificateId>\"\n# 200 application\u002Fpdf 184213\n",[397,2532,2533,2553,2565,2570],{"__ignoreMap":774},[778,2534,2535,2537,2539,2542,2545,2548,2551],{"class":780,"line":781},[778,2536,785],{"class":784},[778,2538,789],{"class":788},[778,2540,2541],{"class":788}," -o",[778,2543,2544],{"class":798}," certificate.pdf",[778,2546,2547],{"class":788}," -w",[778,2549,2550],{"class":798}," '%{http_code} %{content_type} %{size_download}\\n'",[778,2552,806],{"class":805},[778,2554,2555,2557,2559,2561,2563],{"class":780,"line":809},[778,2556,812],{"class":788},[778,2558,815],{"class":798},[778,2560,819],{"class":818},[778,2562,822],{"class":798},[778,2564,806],{"class":805},[778,2566,2567],{"class":780,"line":827},[778,2568,2569],{"class":798},"  \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F\u003CorganizationId>\u002Fcertificate\u002Fdownload\u002F\u003CcertificateId>\"\n",[778,2571,2572],{"class":780,"line":837},[778,2573,2575],{"class":2574},"sLBg1","# 200 application\u002Fpdf 184213\n",[357,2577,2578,2579,750,2581,2584],{},"If the first number is not ",[397,2580,1188],{},[397,2582,2583],{},"certificate.pdf"," contains the JSON error, not a PDF.",[357,2586,2587],{},"In Node.js (18 or later):",[769,2589,2593],{"className":2590,"code":2591,"language":2592,"meta":774,"style":774},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","import { createWriteStream } from 'node:fs';\nimport { rename, stat, unlink } from 'node:fs\u002Fpromises';\nimport { Readable } from 'node:stream';\nimport { pipeline } from 'node:stream\u002Fpromises';\n\nfunction fileNameFrom(disposition, fallback) {\n  const star = \u002Ffilename\\*=UTF-8''([^;]+)\u002Fi.exec(disposition ?? '');\n  if (star) return decodeURIComponent(star[1]);\n  const plain = \u002Ffilename=\"([^\"]*)\"\u002Fi.exec(disposition ?? '');\n  return plain ? plain[1] : fallback;\n}\n\nexport async function downloadCertificate(token, organizationId, certificateId, dir) {\n  const res = await fetch(\n    `https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F${organizationId}\u002Fcertificate\u002Fdownload\u002F${certificateId}`,\n    { headers: { Authorization: `Bearer ${token}` } },\n  );\n  if (!res.ok) {\n    const body = await res.json().catch(() => null);\n    throw new Error(`${res.status} ${body?.error?.code}: ${body?.error?.message} (${body?.error?.request_id})`);\n  }\n\n  \u002F\u002F Keep only the last path segment, so a stored name can never leave `dir`.\n  const name = fileNameFrom(res.headers.get('content-disposition'), `${certificateId}.pdf`)\n    .split(\u002F[\\\\\u002F]\u002F)\n    .pop();\n  const partial = `${dir}\u002F${name}.part`;\n  try {\n    await pipeline(Readable.fromWeb(res.body), createWriteStream(partial));\n  } catch (error) {\n    await unlink(partial).catch(() => {}); \u002F\u002F the connection closed mid-file\n    throw error;\n  }\n\n  const expected = Number(res.headers.get('content-length') ?? NaN);\n  const { size } = await stat(partial);\n  if (Number.isFinite(expected) && size !== expected) {\n    await unlink(partial);\n    throw new Error(`Incomplete download: ${size} of ${expected} bytes`);\n  }\n  await rename(partial, `${dir}\u002F${name}`);\n  return `${dir}\u002F${name}`;\n}\n","js",[397,2594,2595,2612,2626,2640,2654,2660,2683,2739,2761,2800,2823,2827,2831,2867,2885,2902,2917,2922,2935,2969,3041,3045,3050,3056,3092,3117,3128,3154,3163,3187,3198,3221,3229,3234,3239,3271,3296,3322,3331,3358,3363,3387,3404],{"__ignoreMap":774},[778,2596,2597,2600,2603,2606,2609],{"class":780,"line":781},[778,2598,2599],{"class":805},"import",[778,2601,2602],{"class":818}," { createWriteStream } ",[778,2604,2605],{"class":805},"from",[778,2607,2608],{"class":798}," 'node:fs'",[778,2610,2611],{"class":818},";\n",[778,2613,2614,2616,2619,2621,2624],{"class":780,"line":809},[778,2615,2599],{"class":805},[778,2617,2618],{"class":818}," { rename, stat, unlink } ",[778,2620,2605],{"class":805},[778,2622,2623],{"class":798}," 'node:fs\u002Fpromises'",[778,2625,2611],{"class":818},[778,2627,2628,2630,2633,2635,2638],{"class":780,"line":827},[778,2629,2599],{"class":805},[778,2631,2632],{"class":818}," { Readable } ",[778,2634,2605],{"class":805},[778,2636,2637],{"class":798}," 'node:stream'",[778,2639,2611],{"class":818},[778,2641,2642,2644,2647,2649,2652],{"class":780,"line":837},[778,2643,2599],{"class":805},[778,2645,2646],{"class":818}," { pipeline } ",[778,2648,2605],{"class":805},[778,2650,2651],{"class":798}," 'node:stream\u002Fpromises'",[778,2653,2611],{"class":818},[778,2655,2656],{"class":780,"line":847},[778,2657,2659],{"emptyLinePlaceholder":2658},true,"\n",[778,2661,2662,2665,2669,2672,2675,2677,2680],{"class":780,"line":920},[778,2663,2664],{"class":805},"function",[778,2666,2668],{"class":2667},"sKwhi"," fileNameFrom",[778,2670,2671],{"class":818},"(",[778,2673,2674],{"class":784},"disposition",[778,2676,750],{"class":818},[778,2678,2679],{"class":784},"fallback",[778,2681,2682],{"class":818},") {\n",[778,2684,2685,2688,2691,2694,2697,2701,2704,2707,2710,2713,2716,2719,2722,2724,2727,2730,2733,2736],{"class":780,"line":1001},[778,2686,2687],{"class":805},"  const",[778,2689,2690],{"class":788}," star",[778,2692,2693],{"class":805}," =",[778,2695,2696],{"class":798}," \u002Ffilename",[778,2698,2700],{"class":2699},"sJaa3","\\*",[778,2702,2703],{"class":798},"=UTF-8''(",[778,2705,2706],{"class":788},"[",[778,2708,2709],{"class":805},"^",[778,2711,2712],{"class":788},";]",[778,2714,2715],{"class":805},"+",[778,2717,2718],{"class":798},")\u002F",[778,2720,2721],{"class":805},"i",[778,2723,1170],{"class":818},[778,2725,2726],{"class":2667},"exec",[778,2728,2729],{"class":818},"(disposition ",[778,2731,2732],{"class":805},"??",[778,2734,2735],{"class":798}," ''",[778,2737,2738],{"class":818},");\n",[778,2740,2741,2744,2747,2750,2753,2756,2758],{"class":780,"line":1014},[778,2742,2743],{"class":805},"  if",[778,2745,2746],{"class":818}," (star) ",[778,2748,2749],{"class":805},"return",[778,2751,2752],{"class":2667}," decodeURIComponent",[778,2754,2755],{"class":818},"(star[",[778,2757,2032],{"class":788},[778,2759,2760],{"class":818},"]);\n",[778,2762,2763,2765,2768,2770,2773,2775,2777,2780,2783,2786,2788,2790,2792,2794,2796,2798],{"class":780,"line":1027},[778,2764,2687],{"class":805},[778,2766,2767],{"class":788}," plain",[778,2769,2693],{"class":805},[778,2771,2772],{"class":798}," \u002Ffilename=\"(",[778,2774,2706],{"class":788},[778,2776,2709],{"class":805},[778,2778,2779],{"class":788},"\"]",[778,2781,2782],{"class":805},"*",[778,2784,2785],{"class":798},")\"\u002F",[778,2787,2721],{"class":805},[778,2789,1170],{"class":818},[778,2791,2726],{"class":2667},[778,2793,2729],{"class":818},[778,2795,2732],{"class":805},[778,2797,2735],{"class":798},[778,2799,2738],{"class":818},[778,2801,2802,2805,2808,2810,2813,2815,2818,2820],{"class":780,"line":1036},[778,2803,2804],{"class":805},"  return",[778,2806,2807],{"class":818}," plain ",[778,2809,1144],{"class":805},[778,2811,2812],{"class":818}," plain[",[778,2814,2032],{"class":788},[778,2816,2817],{"class":818},"] ",[778,2819,885],{"class":805},[778,2821,2822],{"class":818}," fallback;\n",[778,2824,2825],{"class":780,"line":1049},[778,2826,1119],{"class":818},[778,2828,2829],{"class":780,"line":1061},[778,2830,2659],{"emptyLinePlaceholder":2658},[778,2832,2833,2836,2839,2842,2845,2847,2850,2852,2855,2857,2860,2862,2865],{"class":780,"line":1073},[778,2834,2835],{"class":805},"export",[778,2837,2838],{"class":805}," async",[778,2840,2841],{"class":805}," function",[778,2843,2844],{"class":2667}," downloadCertificate",[778,2846,2671],{"class":818},[778,2848,2849],{"class":784},"token",[778,2851,750],{"class":818},[778,2853,2854],{"class":784},"organizationId",[778,2856,750],{"class":818},[778,2858,2859],{"class":784},"certificateId",[778,2861,750],{"class":818},[778,2863,2864],{"class":784},"dir",[778,2866,2682],{"class":818},[778,2868,2869,2871,2874,2876,2879,2882],{"class":780,"line":1086},[778,2870,2687],{"class":805},[778,2872,2873],{"class":788}," res",[778,2875,2693],{"class":805},[778,2877,2878],{"class":805}," await",[778,2880,2881],{"class":2667}," fetch",[778,2883,2884],{"class":818},"(\n",[778,2886,2887,2890,2892,2895,2897,2900],{"class":780,"line":1099},[778,2888,2889],{"class":798},"    `https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F${",[778,2891,2854],{"class":818},[778,2893,2894],{"class":798},"}\u002Fcertificate\u002Fdownload\u002F${",[778,2896,2859],{"class":818},[778,2898,2899],{"class":798},"}`",[778,2901,954],{"class":818},[778,2903,2904,2907,2910,2912,2914],{"class":780,"line":1110},[778,2905,2906],{"class":818},"    { headers: { Authorization: ",[778,2908,2909],{"class":798},"`Bearer ${",[778,2911,2849],{"class":818},[778,2913,2899],{"class":798},[778,2915,2916],{"class":818}," } },\n",[778,2918,2919],{"class":780,"line":1116},[778,2920,2921],{"class":818},"  );\n",[778,2923,2924,2926,2929,2932],{"class":780,"line":2006},[778,2925,2743],{"class":805},[778,2927,2928],{"class":818}," (",[778,2930,2931],{"class":805},"!",[778,2933,2934],{"class":818},"res.ok) {\n",[778,2936,2937,2940,2943,2945,2947,2950,2952,2955,2958,2961,2964,2967],{"class":780,"line":2012},[778,2938,2939],{"class":805},"    const",[778,2941,2942],{"class":788}," body",[778,2944,2693],{"class":805},[778,2946,2878],{"class":805},[778,2948,2949],{"class":818}," res.",[778,2951,933],{"class":2667},[778,2953,2954],{"class":818},"().",[778,2956,2957],{"class":2667},"catch",[778,2959,2960],{"class":818},"(() ",[778,2962,2963],{"class":805},"=>",[778,2965,2966],{"class":788}," null",[778,2968,2738],{"class":818},[778,2970,2971,2974,2977,2980,2982,2985,2988,2990,2993,2996,2999,3002,3005,3007,3009,3012,3014,3016,3018,3020,3022,3025,3027,3029,3031,3033,3036,3039],{"class":780,"line":2018},[778,2972,2973],{"class":805},"    throw",[778,2975,2976],{"class":805}," new",[778,2978,2979],{"class":2667}," Error",[778,2981,2671],{"class":818},[778,2983,2984],{"class":798},"`${",[778,2986,2987],{"class":818},"res",[778,2989,1170],{"class":798},[778,2991,2992],{"class":818},"status",[778,2994,2995],{"class":798},"} ${",[778,2997,2998],{"class":818},"body",[778,3000,3001],{"class":798},"?.",[778,3003,3004],{"class":818},"error",[778,3006,3001],{"class":798},[778,3008,397],{"class":818},[778,3010,3011],{"class":798},"}: ${",[778,3013,2998],{"class":818},[778,3015,3001],{"class":798},[778,3017,3004],{"class":818},[778,3019,3001],{"class":798},[778,3021,1655],{"class":818},[778,3023,3024],{"class":798},"} (${",[778,3026,2998],{"class":818},[778,3028,3001],{"class":798},[778,3030,3004],{"class":818},[778,3032,3001],{"class":798},[778,3034,3035],{"class":818},"request_id",[778,3037,3038],{"class":798},"})`",[778,3040,2738],{"class":818},[778,3042,3043],{"class":780,"line":2068},[778,3044,1113],{"class":818},[778,3046,3048],{"class":780,"line":3047},22,[778,3049,2659],{"emptyLinePlaceholder":2658},[778,3051,3053],{"class":780,"line":3052},23,[778,3054,3055],{"class":2574},"  \u002F\u002F Keep only the last path segment, so a stored name can never leave `dir`.\n",[778,3057,3059,3061,3064,3066,3068,3071,3074,3076,3079,3082,3084,3086,3089],{"class":780,"line":3058},24,[778,3060,2687],{"class":805},[778,3062,3063],{"class":788}," name",[778,3065,2693],{"class":805},[778,3067,2668],{"class":2667},[778,3069,3070],{"class":818},"(res.headers.",[778,3072,3073],{"class":2667},"get",[778,3075,2671],{"class":818},[778,3077,3078],{"class":798},"'content-disposition'",[778,3080,3081],{"class":818},"), ",[778,3083,2984],{"class":798},[778,3085,2859],{"class":818},[778,3087,3088],{"class":798},"}.pdf`",[778,3090,3091],{"class":818},")\n",[778,3093,3095,3098,3101,3103,3105,3107,3110,3113,3115],{"class":780,"line":3094},25,[778,3096,3097],{"class":818},"    .",[778,3099,3100],{"class":2667},"split",[778,3102,2671],{"class":818},[778,3104,868],{"class":798},[778,3106,2706],{"class":788},[778,3108,3109],{"class":2699},"\\\\",[778,3111,3112],{"class":788},"\u002F]",[778,3114,868],{"class":798},[778,3116,3091],{"class":818},[778,3118,3120,3122,3125],{"class":780,"line":3119},26,[778,3121,3097],{"class":818},[778,3123,3124],{"class":2667},"pop",[778,3126,3127],{"class":818},"();\n",[778,3129,3131,3133,3136,3138,3141,3143,3146,3149,3152],{"class":780,"line":3130},27,[778,3132,2687],{"class":805},[778,3134,3135],{"class":788}," partial",[778,3137,2693],{"class":805},[778,3139,3140],{"class":798}," `${",[778,3142,2864],{"class":818},[778,3144,3145],{"class":798},"}\u002F${",[778,3147,3148],{"class":818},"name",[778,3150,3151],{"class":798},"}.part`",[778,3153,2611],{"class":818},[778,3155,3157,3160],{"class":780,"line":3156},28,[778,3158,3159],{"class":805},"  try",[778,3161,3162],{"class":818}," {\n",[778,3164,3166,3169,3172,3175,3178,3181,3184],{"class":780,"line":3165},29,[778,3167,3168],{"class":805},"    await",[778,3170,3171],{"class":2667}," pipeline",[778,3173,3174],{"class":818},"(Readable.",[778,3176,3177],{"class":2667},"fromWeb",[778,3179,3180],{"class":818},"(res.body), ",[778,3182,3183],{"class":2667},"createWriteStream",[778,3185,3186],{"class":818},"(partial));\n",[778,3188,3190,3193,3195],{"class":780,"line":3189},30,[778,3191,3192],{"class":818},"  } ",[778,3194,2957],{"class":805},[778,3196,3197],{"class":818}," (error) {\n",[778,3199,3201,3203,3206,3209,3211,3213,3215,3218],{"class":780,"line":3200},31,[778,3202,3168],{"class":805},[778,3204,3205],{"class":2667}," unlink",[778,3207,3208],{"class":818},"(partial).",[778,3210,2957],{"class":2667},[778,3212,2960],{"class":818},[778,3214,2963],{"class":805},[778,3216,3217],{"class":818}," {}); ",[778,3219,3220],{"class":2574},"\u002F\u002F the connection closed mid-file\n",[778,3222,3224,3226],{"class":780,"line":3223},32,[778,3225,2973],{"class":805},[778,3227,3228],{"class":818}," error;\n",[778,3230,3232],{"class":780,"line":3231},33,[778,3233,1113],{"class":818},[778,3235,3237],{"class":780,"line":3236},34,[778,3238,2659],{"emptyLinePlaceholder":2658},[778,3240,3242,3244,3247,3249,3252,3254,3256,3258,3261,3264,3266,3269],{"class":780,"line":3241},35,[778,3243,2687],{"class":805},[778,3245,3246],{"class":788}," expected",[778,3248,2693],{"class":805},[778,3250,3251],{"class":2667}," Number",[778,3253,3070],{"class":818},[778,3255,3073],{"class":2667},[778,3257,2671],{"class":818},[778,3259,3260],{"class":798},"'content-length'",[778,3262,3263],{"class":818},") ",[778,3265,2732],{"class":805},[778,3267,3268],{"class":788}," NaN",[778,3270,2738],{"class":818},[778,3272,3274,3276,3279,3282,3285,3288,3290,3293],{"class":780,"line":3273},36,[778,3275,2687],{"class":805},[778,3277,3278],{"class":818}," { ",[778,3280,3281],{"class":788},"size",[778,3283,3284],{"class":818}," } ",[778,3286,3287],{"class":805},"=",[778,3289,2878],{"class":805},[778,3291,3292],{"class":2667}," stat",[778,3294,3295],{"class":818},"(partial);\n",[778,3297,3299,3301,3304,3307,3310,3313,3316,3319],{"class":780,"line":3298},37,[778,3300,2743],{"class":805},[778,3302,3303],{"class":818}," (Number.",[778,3305,3306],{"class":2667},"isFinite",[778,3308,3309],{"class":818},"(expected) ",[778,3311,3312],{"class":805},"&&",[778,3314,3315],{"class":818}," size ",[778,3317,3318],{"class":805},"!==",[778,3320,3321],{"class":818}," expected) {\n",[778,3323,3325,3327,3329],{"class":780,"line":3324},38,[778,3326,3168],{"class":805},[778,3328,3205],{"class":2667},[778,3330,3295],{"class":818},[778,3332,3334,3336,3338,3340,3342,3345,3347,3350,3353,3356],{"class":780,"line":3333},39,[778,3335,2973],{"class":805},[778,3337,2976],{"class":805},[778,3339,2979],{"class":2667},[778,3341,2671],{"class":818},[778,3343,3344],{"class":798},"`Incomplete download: ${",[778,3346,3281],{"class":818},[778,3348,3349],{"class":798},"} of ${",[778,3351,3352],{"class":818},"expected",[778,3354,3355],{"class":798},"} bytes`",[778,3357,2738],{"class":818},[778,3359,3361],{"class":780,"line":3360},40,[778,3362,1113],{"class":818},[778,3364,3366,3369,3372,3375,3377,3379,3381,3383,3385],{"class":780,"line":3365},41,[778,3367,3368],{"class":805},"  await",[778,3370,3371],{"class":2667}," rename",[778,3373,3374],{"class":818},"(partial, ",[778,3376,2984],{"class":798},[778,3378,2864],{"class":818},[778,3380,3145],{"class":798},[778,3382,3148],{"class":818},[778,3384,2899],{"class":798},[778,3386,2738],{"class":818},[778,3388,3390,3392,3394,3396,3398,3400,3402],{"class":780,"line":3389},42,[778,3391,2804],{"class":805},[778,3393,3140],{"class":798},[778,3395,2864],{"class":818},[778,3397,3145],{"class":798},[778,3399,3148],{"class":818},[778,3401,2899],{"class":798},[778,3403,2611],{"class":818},[778,3405,3407],{"class":780,"line":3406},43,[778,3408,1119],{"class":818},[357,3410,3411,3412,3415],{},"In PHP (8.1 or later, with ",[397,3413,3414],{},"ext-curl","):",[769,3417,3421],{"className":3418,"code":3419,"language":3420,"meta":774,"style":774},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\nfunction downloadCertificate(string $token, string $organizationId, string $certificateId, string $dir): string\n{\n    $headers = [];\n    $partial = tempnam($dir, 'dl_');\n    $fh = fopen($partial, 'wb');\n\n    $ch = curl_init(\"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F{$organizationId}\u002Fcertificate\u002Fdownload\u002F{$certificateId}\");\n    curl_setopt_array($ch, [\n        CURLOPT_HTTPHEADER => [\"Authorization: Bearer {$token}\"],\n        CURLOPT_FILE => $fh,\n        CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {\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    $ok = curl_exec($ch);\n    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n    $received = curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD);\n    curl_close($ch);\n    fclose($fh);\n\n    if ($ok === false || $status !== 200) {\n        $error = json_decode((string) file_get_contents($partial), true)['error'] ?? [];\n        unlink($partial);\n        throw new RuntimeException(\"{$status} \" . ($error['code'] ?? 'error') . ': ' . ($error['message'] ?? '') . ' (' . ($error['request_id'] ?? '-') . ')');\n    }\n    if (isset($headers['content-length']) && (int) $headers['content-length'] !== (int) $received) {\n        unlink($partial);\n        throw new RuntimeException(\"Incomplete download: {$received} of {$headers['content-length']} bytes\");\n    }\n\n    $name = \"{$certificateId}.pdf\";\n    $disposition = $headers['content-disposition'] ?? '';\n    if (preg_match(\"\u002Ffilename\\\\*=UTF-8''([^;]+)\u002Fi\", $disposition, $m)) {\n        $name = rawurldecode($m[1]);\n    } elseif (preg_match('\u002Ffilename=\"([^\"]*)\"\u002Fi', $disposition, $m)) {\n        $name = $m[1];\n    }\n    $target = $dir . '\u002F' . basename($name); \u002F\u002F basename: never let a stored name leave $dir\n    rename($partial, $target);\n    return $target;\n}\n","php",[397,3422,3423,3431,3464,3468,3478,3496,3514,3518,3547,3555,3577,3587,3610,3632,3653,3686,3691,3702,3707,3712,3725,3743,3759,3766,3774,3778,3804,3841,3849,3936,3940,3980,3986,4013,4017,4021,4038,4058,4087,4104,4128,4142,4146,4172,4181,4190],{"__ignoreMap":774},[778,3424,3425,3428],{"class":780,"line":781},[778,3426,3427],{"class":805},"\u003C?",[778,3429,3430],{"class":788},"php\n",[778,3432,3433,3435,3437,3439,3441,3444,3446,3449,3451,3454,3456,3459,3461],{"class":780,"line":809},[778,3434,2664],{"class":805},[778,3436,2844],{"class":2667},[778,3438,2671],{"class":818},[778,3440,1658],{"class":805},[778,3442,3443],{"class":818}," $token, ",[778,3445,1658],{"class":805},[778,3447,3448],{"class":818}," $organizationId, ",[778,3450,1658],{"class":805},[778,3452,3453],{"class":818}," $certificateId, ",[778,3455,1658],{"class":805},[778,3457,3458],{"class":818}," $dir)",[778,3460,885],{"class":805},[778,3462,3463],{"class":805}," string\n",[778,3465,3466],{"class":780,"line":827},[778,3467,940],{"class":818},[778,3469,3470,3473,3475],{"class":780,"line":837},[778,3471,3472],{"class":818},"    $headers ",[778,3474,3287],{"class":805},[778,3476,3477],{"class":818}," [];\n",[778,3479,3480,3483,3485,3488,3491,3494],{"class":780,"line":847},[778,3481,3482],{"class":818},"    $partial ",[778,3484,3287],{"class":805},[778,3486,3487],{"class":788}," tempnam",[778,3489,3490],{"class":818},"($dir, ",[778,3492,3493],{"class":798},"'dl_'",[778,3495,2738],{"class":818},[778,3497,3498,3501,3503,3506,3509,3512],{"class":780,"line":920},[778,3499,3500],{"class":818},"    $fh ",[778,3502,3287],{"class":805},[778,3504,3505],{"class":788}," fopen",[778,3507,3508],{"class":818},"($partial, ",[778,3510,3511],{"class":798},"'wb'",[778,3513,2738],{"class":818},[778,3515,3516],{"class":780,"line":1001},[778,3517,2659],{"emptyLinePlaceholder":2658},[778,3519,3520,3523,3525,3528,3530,3533,3536,3539,3542,3545],{"class":780,"line":1014},[778,3521,3522],{"class":818},"    $ch ",[778,3524,3287],{"class":805},[778,3526,3527],{"class":788}," curl_init",[778,3529,2671],{"class":818},[778,3531,3532],{"class":798},"\"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F{",[778,3534,3535],{"class":818},"$organizationId",[778,3537,3538],{"class":798},"}\u002Fcertificate\u002Fdownload\u002F{",[778,3540,3541],{"class":818},"$certificateId",[778,3543,3544],{"class":798},"}\"",[778,3546,2738],{"class":818},[778,3548,3549,3552],{"class":780,"line":1027},[778,3550,3551],{"class":788},"    curl_setopt_array",[778,3553,3554],{"class":818},"($ch, [\n",[778,3556,3557,3560,3563,3566,3569,3572,3574],{"class":780,"line":1036},[778,3558,3559],{"class":788},"        CURLOPT_HTTPHEADER",[778,3561,3562],{"class":805}," =>",[778,3564,3565],{"class":818}," [",[778,3567,3568],{"class":798},"\"Authorization: Bearer {",[778,3570,3571],{"class":818},"$token",[778,3573,3544],{"class":798},[778,3575,3576],{"class":818},"],\n",[778,3578,3579,3582,3584],{"class":780,"line":1049},[778,3580,3581],{"class":788},"        CURLOPT_FILE",[778,3583,3562],{"class":805},[778,3585,3586],{"class":818}," $fh,\n",[778,3588,3589,3592,3594,3596,3599,3602,3604,3607],{"class":780,"line":1061},[778,3590,3591],{"class":788},"        CURLOPT_HEADERFUNCTION",[778,3593,3562],{"class":805},[778,3595,2841],{"class":805},[778,3597,3598],{"class":818}," ($ch, $line) ",[778,3600,3601],{"class":805},"use",[778,3603,2928],{"class":818},[778,3605,3606],{"class":805},"&",[778,3608,3609],{"class":818},"$headers) {\n",[778,3611,3612,3615,3617,3620,3622,3625,3628,3630],{"class":780,"line":1073},[778,3613,3614],{"class":818},"            $parts ",[778,3616,3287],{"class":805},[778,3618,3619],{"class":788}," explode",[778,3621,2671],{"class":818},[778,3623,3624],{"class":798},"':'",[778,3626,3627],{"class":818},", $line, ",[778,3629,2042],{"class":788},[778,3631,2738],{"class":818},[778,3633,3634,3637,3639,3642,3645,3648,3651],{"class":780,"line":1086},[778,3635,3636],{"class":805},"            if",[778,3638,2928],{"class":818},[778,3640,3641],{"class":788},"count",[778,3643,3644],{"class":818},"($parts) ",[778,3646,3647],{"class":805},"===",[778,3649,3650],{"class":788}," 2",[778,3652,2682],{"class":818},[778,3654,3655,3658,3661,3663,3666,3669,3672,3675,3677,3680,3682,3684],{"class":780,"line":1099},[778,3656,3657],{"class":818},"                $headers[",[778,3659,3660],{"class":788},"strtolower",[778,3662,2671],{"class":818},[778,3664,3665],{"class":788},"trim",[778,3667,3668],{"class":818},"($parts[",[778,3670,3671],{"class":788},"0",[778,3673,3674],{"class":818},"]))] ",[778,3676,3287],{"class":805},[778,3678,3679],{"class":788}," trim",[778,3681,3668],{"class":818},[778,3683,2032],{"class":788},[778,3685,2760],{"class":818},[778,3687,3688],{"class":780,"line":1110},[778,3689,3690],{"class":818},"            }\n",[778,3692,3693,3696,3699],{"class":780,"line":1116},[778,3694,3695],{"class":805},"            return",[778,3697,3698],{"class":788}," strlen",[778,3700,3701],{"class":818},"($line);\n",[778,3703,3704],{"class":780,"line":2006},[778,3705,3706],{"class":818},"        },\n",[778,3708,3709],{"class":780,"line":2012},[778,3710,3711],{"class":818},"    ]);\n",[778,3713,3714,3717,3719,3722],{"class":780,"line":2018},[778,3715,3716],{"class":818},"    $ok ",[778,3718,3287],{"class":805},[778,3720,3721],{"class":788}," curl_exec",[778,3723,3724],{"class":818},"($ch);\n",[778,3726,3727,3730,3732,3735,3738,3741],{"class":780,"line":2068},[778,3728,3729],{"class":818},"    $status ",[778,3731,3287],{"class":805},[778,3733,3734],{"class":788}," curl_getinfo",[778,3736,3737],{"class":818},"($ch, ",[778,3739,3740],{"class":788},"CURLINFO_RESPONSE_CODE",[778,3742,2738],{"class":818},[778,3744,3745,3748,3750,3752,3754,3757],{"class":780,"line":3047},[778,3746,3747],{"class":818},"    $received ",[778,3749,3287],{"class":805},[778,3751,3734],{"class":788},[778,3753,3737],{"class":818},[778,3755,3756],{"class":788},"CURLINFO_SIZE_DOWNLOAD",[778,3758,2738],{"class":818},[778,3760,3761,3764],{"class":780,"line":3052},[778,3762,3763],{"class":788},"    curl_close",[778,3765,3724],{"class":818},[778,3767,3768,3771],{"class":780,"line":3058},[778,3769,3770],{"class":788},"    fclose",[778,3772,3773],{"class":818},"($fh);\n",[778,3775,3776],{"class":780,"line":3094},[778,3777,2659],{"emptyLinePlaceholder":2658},[778,3779,3780,3783,3786,3788,3791,3794,3797,3799,3802],{"class":780,"line":3119},[778,3781,3782],{"class":805},"    if",[778,3784,3785],{"class":818}," ($ok ",[778,3787,3647],{"class":805},[778,3789,3790],{"class":788}," false",[778,3792,3793],{"class":805}," ||",[778,3795,3796],{"class":818}," $status ",[778,3798,3318],{"class":805},[778,3800,3801],{"class":788}," 200",[778,3803,2682],{"class":818},[778,3805,3806,3809,3811,3814,3817,3819,3821,3824,3827,3829,3832,3835,3837,3839],{"class":780,"line":3130},[778,3807,3808],{"class":818},"        $error ",[778,3810,3287],{"class":805},[778,3812,3813],{"class":788}," json_decode",[778,3815,3816],{"class":818},"((",[778,3818,1658],{"class":805},[778,3820,3263],{"class":818},[778,3822,3823],{"class":788},"file_get_contents",[778,3825,3826],{"class":818},"($partial), ",[778,3828,951],{"class":788},[778,3830,3831],{"class":818},")[",[778,3833,3834],{"class":798},"'error'",[778,3836,2817],{"class":818},[778,3838,2732],{"class":805},[778,3840,3477],{"class":818},[778,3842,3843,3846],{"class":780,"line":3156},[778,3844,3845],{"class":788},"        unlink",[778,3847,3848],{"class":818},"($partial);\n",[778,3850,3851,3854,3856,3859,3861,3864,3867,3870,3873,3876,3879,3881,3883,3886,3888,3890,3893,3895,3897,3900,3902,3904,3906,3908,3910,3913,3915,3917,3920,3922,3924,3927,3929,3931,3934],{"class":780,"line":3165},[778,3852,3853],{"class":805},"        throw",[778,3855,2976],{"class":805},[778,3857,3858],{"class":788}," RuntimeException",[778,3860,2671],{"class":818},[778,3862,3863],{"class":798},"\"{",[778,3865,3866],{"class":818},"$status",[778,3868,3869],{"class":798},"} \"",[778,3871,3872],{"class":805}," .",[778,3874,3875],{"class":818}," ($error[",[778,3877,3878],{"class":798},"'code'",[778,3880,2817],{"class":818},[778,3882,2732],{"class":805},[778,3884,3885],{"class":798}," 'error'",[778,3887,3263],{"class":818},[778,3889,1170],{"class":805},[778,3891,3892],{"class":798}," ': '",[778,3894,3872],{"class":805},[778,3896,3875],{"class":818},[778,3898,3899],{"class":798},"'message'",[778,3901,2817],{"class":818},[778,3903,2732],{"class":805},[778,3905,2735],{"class":798},[778,3907,3263],{"class":818},[778,3909,1170],{"class":805},[778,3911,3912],{"class":798}," ' ('",[778,3914,3872],{"class":805},[778,3916,3875],{"class":818},[778,3918,3919],{"class":798},"'request_id'",[778,3921,2817],{"class":818},[778,3923,2732],{"class":805},[778,3925,3926],{"class":798}," '-'",[778,3928,3263],{"class":818},[778,3930,1170],{"class":805},[778,3932,3933],{"class":798}," ')'",[778,3935,2738],{"class":818},[778,3937,3938],{"class":780,"line":3189},[778,3939,2009],{"class":818},[778,3941,3942,3944,3946,3949,3952,3954,3957,3959,3961,3964,3967,3969,3971,3973,3975,3977],{"class":780,"line":3200},[778,3943,3782],{"class":805},[778,3945,2928],{"class":818},[778,3947,3948],{"class":788},"isset",[778,3950,3951],{"class":818},"($headers[",[778,3953,3260],{"class":798},[778,3955,3956],{"class":818},"]) ",[778,3958,3312],{"class":805},[778,3960,2928],{"class":818},[778,3962,3963],{"class":805},"int",[778,3965,3966],{"class":818},") $headers[",[778,3968,3260],{"class":798},[778,3970,2817],{"class":818},[778,3972,3318],{"class":805},[778,3974,2928],{"class":818},[778,3976,3963],{"class":805},[778,3978,3979],{"class":818},") $received) {\n",[778,3981,3982,3984],{"class":780,"line":3223},[778,3983,3845],{"class":788},[778,3985,3848],{"class":818},[778,3987,3988,3990,3992,3994,3996,3999,4002,4005,4008,4011],{"class":780,"line":3231},[778,3989,3853],{"class":805},[778,3991,2976],{"class":805},[778,3993,3858],{"class":788},[778,3995,2671],{"class":818},[778,3997,3998],{"class":798},"\"Incomplete download: {",[778,4000,4001],{"class":818},"$received",[778,4003,4004],{"class":798},"} of {",[778,4006,4007],{"class":818},"$headers",[778,4009,4010],{"class":798},"['content-length']} bytes\"",[778,4012,2738],{"class":818},[778,4014,4015],{"class":780,"line":3236},[778,4016,2009],{"class":818},[778,4018,4019],{"class":780,"line":3241},[778,4020,2659],{"emptyLinePlaceholder":2658},[778,4022,4023,4026,4028,4031,4033,4036],{"class":780,"line":3273},[778,4024,4025],{"class":818},"    $name ",[778,4027,3287],{"class":805},[778,4029,4030],{"class":798}," \"{",[778,4032,3541],{"class":818},[778,4034,4035],{"class":798},"}.pdf\"",[778,4037,2611],{"class":818},[778,4039,4040,4043,4045,4048,4050,4052,4054,4056],{"class":780,"line":3298},[778,4041,4042],{"class":818},"    $disposition ",[778,4044,3287],{"class":805},[778,4046,4047],{"class":818}," $headers[",[778,4049,3078],{"class":798},[778,4051,2817],{"class":818},[778,4053,2732],{"class":805},[778,4055,2735],{"class":798},[778,4057,2611],{"class":818},[778,4059,4060,4062,4064,4067,4069,4072,4074,4076,4079,4081,4084],{"class":780,"line":3324},[778,4061,3782],{"class":805},[778,4063,2928],{"class":818},[778,4065,4066],{"class":788},"preg_match",[778,4068,2671],{"class":818},[778,4070,4071],{"class":798},"\"\u002Ffilename",[778,4073,3109],{"class":2699},[778,4075,2782],{"class":805},[778,4077,4078],{"class":798},"=UTF-8''([^;]",[778,4080,2715],{"class":805},[778,4082,4083],{"class":798},")\u002Fi\"",[778,4085,4086],{"class":818},", $disposition, $m)) {\n",[778,4088,4089,4092,4094,4097,4100,4102],{"class":780,"line":3333},[778,4090,4091],{"class":818},"        $name ",[778,4093,3287],{"class":805},[778,4095,4096],{"class":788}," rawurldecode",[778,4098,4099],{"class":818},"($m[",[778,4101,2032],{"class":788},[778,4103,2760],{"class":818},[778,4105,4106,4109,4112,4114,4116,4118,4121,4123,4126],{"class":780,"line":3360},[778,4107,4108],{"class":818},"    } ",[778,4110,4111],{"class":805},"elseif",[778,4113,2928],{"class":818},[778,4115,4066],{"class":788},[778,4117,2671],{"class":818},[778,4119,4120],{"class":798},"'\u002Ffilename=\"([^\"]",[778,4122,2782],{"class":805},[778,4124,4125],{"class":798},")\"\u002Fi'",[778,4127,4086],{"class":818},[778,4129,4130,4132,4134,4137,4139],{"class":780,"line":3365},[778,4131,4091],{"class":818},[778,4133,3287],{"class":805},[778,4135,4136],{"class":818}," $m[",[778,4138,2032],{"class":788},[778,4140,4141],{"class":818},"];\n",[778,4143,4144],{"class":780,"line":3389},[778,4145,2009],{"class":818},[778,4147,4148,4151,4153,4156,4158,4161,4163,4166,4169],{"class":780,"line":3406},[778,4149,4150],{"class":818},"    $target ",[778,4152,3287],{"class":805},[778,4154,4155],{"class":818}," $dir ",[778,4157,1170],{"class":805},[778,4159,4160],{"class":798}," '\u002F'",[778,4162,3872],{"class":805},[778,4164,4165],{"class":788}," basename",[778,4167,4168],{"class":818},"($name); ",[778,4170,4171],{"class":2574},"\u002F\u002F basename: never let a stored name leave $dir\n",[778,4173,4175,4178],{"class":780,"line":4174},44,[778,4176,4177],{"class":788},"    rename",[778,4179,4180],{"class":818},"($partial, $target);\n",[778,4182,4184,4187],{"class":780,"line":4183},45,[778,4185,4186],{"class":805},"    return",[778,4188,4189],{"class":818}," $target;\n",[778,4191,4193],{"class":780,"line":4192},46,[778,4194,1119],{"class":818},[365,4196,42],{"id":4197},"errors",[517,4199,4201],{"id":4200},"the-error-envelope","The error envelope",[357,4203,4204],{},"Every error, from every operation, has this shape:",[769,4206,4208],{"className":931,"code":4207,"language":933,"meta":774,"style":774},"{\n  \"error\": {\n    \"code\": \"not_found\",\n    \"message\": \"Application not found!\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\",\n    \"request_id\": \"7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\"\n  }\n}\n",[397,4209,4210,4214,4220,4231,4242,4253,4262,4266],{"__ignoreMap":774},[778,4211,4212],{"class":780,"line":781},[778,4213,940],{"class":818},[778,4215,4216,4218],{"class":780,"line":809},[778,4217,1330],{"class":882},[778,4219,974],{"class":818},[778,4221,4222,4224,4226,4229],{"class":780,"line":827},[778,4223,1337],{"class":882},[778,4225,948],{"class":818},[778,4227,4228],{"class":798},"\"not_found\"",[778,4230,954],{"class":818},[778,4232,4233,4235,4237,4240],{"class":780,"line":837},[778,4234,1349],{"class":882},[778,4236,948],{"class":818},[778,4238,4239],{"class":798},"\"Application not found!\"",[778,4241,954],{"class":818},[778,4243,4244,4246,4248,4251],{"class":780,"line":847},[778,4245,1361],{"class":882},[778,4247,948],{"class":818},[778,4249,4250],{"class":798},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\"",[778,4252,954],{"class":818},[778,4254,4255,4257,4259],{"class":780,"line":920},[778,4256,1373],{"class":882},[778,4258,948],{"class":818},[778,4260,4261],{"class":798},"\"7d2f1c3a-9b8e-4f5a-a1b2-c3d4e5f60718\"\n",[778,4263,4264],{"class":780,"line":1001},[778,4265,1113],{"class":818},[778,4267,4268],{"class":780,"line":1014},[778,4269,1119],{"class":818},[370,4271,4272,4280],{},[373,4273,4274],{},[376,4275,4276,4278],{},[379,4277,1625],{},[379,4279,1420],{},[386,4281,4282,4298,4317,4330,4342],{},[376,4283,4284,4288],{},[391,4285,4286],{},[397,4287,397],{},[391,4289,4290,4291,538,4294,4297],{},"A stable, machine-readable code, such as ",[397,4292,4293],{},"not_found",[397,4295,4296],{},"conflict",". Branch on this together with the HTTP status",[376,4299,4300,4304],{},[391,4301,4302],{},[397,4303,1655],{},[391,4305,4306,4307,4310,4311,1483,4313,4316],{},"A human-readable explanation. On ",[397,4308,4309],{},"409"," and some ",[397,4312,1493],{},[397,4314,4315],{},"403"," responses it names exactly what blocked the request, so log it and show it to whoever has to fix the problem. Never parse it",[376,4318,4319,4324],{},[391,4320,4321],{},[397,4322,4323],{},"documentation_url",[391,4325,4326,4327],{},"A link to this code's entry on the ",[361,4328,4329],{"href":43},"errors page",[376,4331,4332,4336],{},[391,4333,4334],{},[397,4335,3035],{},[391,4337,4338,4339,4341],{},"The same value as the response's ",[397,4340,475],{}," header. Quote it when you ask for help",[376,4343,4344,4349],{},[391,4345,4346],{},[397,4347,4348],{},"details",[391,4350,4351,4352,4355,4356,4359,4360,4362,4363,2928,4366,4369],{},"Only where an operation says so, an object it cannot put in one sentence: the rows of a student import that cannot be registered (",[397,4353,4354],{},"422","), and on the two group challenge submits the ",[397,4357,4358],{},"reason"," of a ",[397,4361,4309],{}," or a ",[397,4364,4365],{},"503",[397,4367,4368],{},"details.reason","). Absent everywhere else; ignore it on an operation that does not document it",[517,4371,4373],{"id":4372},"status-codes","Status codes",[370,4375,4376,4392],{},[373,4377,4378],{},[376,4379,4380,4382,4386,4389],{},[379,4381,2083],{},[379,4383,4384],{},[397,4385,397],{},[379,4387,4388],{},"Typical cause",[379,4390,4391],{},"Retry automatically?",[386,4393,4394,4409,4427,4448,4462,4480,4497,4512,4531,4553,4574],{},[376,4395,4396,4398,4403,4406],{},[391,4397,1493],{},[391,4399,4400],{},[397,4401,4402],{},"bad_request",[391,4404,4405],{},"A body or id that breaks a rule, malformed JSON, an undeclared field",[391,4407,4408],{},"No. Fix the request",[376,4410,4411,4414,4419,4422],{},[391,4412,4413],{},"401",[391,4415,4416],{},[397,4417,4418],{},"unauthorized",[391,4420,4421],{},"Any problem with the token. The message is always the same, whatever the problem was",[391,4423,4424,4425],{},"No. Fix the token; see ",[361,4426,19],{"href":20},[376,4428,4429,4431,4436,4443],{},[391,4430,4315],{},[391,4432,4433],{},[397,4434,4435],{},"forbidden",[391,4437,4438,4439,4442],{},"Your account lacks the permission (",[397,4440,4441],{},"Insufficient role permissions","), or the operation has a rule of its own and names it",[391,4444,4445,4446],{},"No. Ask for the permission; see ",[361,4447,25],{"href":26},[376,4449,4450,4452,4456,4459],{},[391,4451,1596],{},[391,4453,4454],{},[397,4455,4293],{},[391,4457,4458],{},"Missing, not yours, unknown organization, or a path that matches no operation",[391,4460,4461],{},"No",[376,4463,4464,4466,4470,4477],{},[391,4465,4309],{},[391,4467,4468],{},[397,4469,4296],{},[391,4471,4472,4473,4476],{},"The record's current state blocks the request; the message says which state, and a group challenge submit's ",[397,4474,4475],{},"error.details.reason"," too",[391,4478,4479],{},"No. Change the state first",[376,4481,4482,4485,4490,4495],{},[391,4483,4484],{},"413",[391,4486,4487],{},[397,4488,4489],{},"payload_too_large",[391,4491,4492,4493,403],{},"Body over 100 kB (1.5 MB on ",[397,4494,422],{},[391,4496,4461],{},[376,4498,4499,4502,4507,4510],{},[391,4500,4501],{},"415",[391,4503,4504],{},[397,4505,4506],{},"unsupported_media_type",[391,4508,4509],{},"Character set or compression the API does not read",[391,4511,4461],{},[376,4513,4514,4516,4521,4528],{},[391,4515,4354],{},[391,4517,4518],{},[397,4519,4520],{},"unprocessable_entity",[391,4522,4523,4524,4527],{},"Rows of a student import that cannot be registered; ",[397,4525,4526],{},"error.details.rows"," names them. Nothing was queued",[391,4529,4530],{},"No. Fix the rows and send the batch again",[376,4532,4533,4536,4541,4544],{},[391,4534,4535],{},"429",[391,4537,4538],{},[397,4539,4540],{},"too_many_requests",[391,4542,4543],{},"Rate limit reached",[391,4545,4546,4547,4550,4551],{},"Yes, after ",[397,4548,4549],{},"Retry-After"," seconds; see ",[361,4552,45],{"href":46},[376,4554,4555,4557,4562,4569],{},[391,4556,4365],{},[391,4558,4559],{},[397,4560,4561],{},"service_unavailable",[391,4563,4564,4565,4568],{},"A student import is paused, or the server is busy checking another; or a group challenge submit met a group someone else was changing (",[397,4566,4567],{},"details.reason: busy","). Nothing was written",[391,4570,4546,4571,4573],{},[397,4572,4549],{}," seconds",[376,4575,4576,4579,4584,4587],{},[391,4577,4578],{},"500",[391,4580,4581],{},[397,4582,4583],{},"internal_error",[391,4585,4586],{},"Something failed on our side",[391,4588,4589,4590],{},"Yes, with backoff; see ",[361,4591,2131],{"href":49},[357,4593,4594,4595,1170],{},"Every code, with its causes and fixes, is on the ",[361,4596,4329],{"href":43},[517,4598,4600],{"id":4599},"a-foreign-record-looks-exactly-like-a-missing-one","A foreign record looks exactly like a missing one",[357,4602,4603,4604,4606,4607,4609],{},"You can only ever reach your own students and the records that hang off them. A student, application, certificate or report that belongs to another account answers with the same status and code as one that does not exist: ",[397,4605,1548],{},". This is on purpose: an answer that differed would tell you which ids exist in another account's hands. Treat every one of them as \"not found\" and branch on the status and code, never on the message. ",[361,4608,22],{"href":23}," explains who \"your\" students are.",[517,4611,4613],{"id":4612},"a-path-that-matches-no-operation","A path that matches no operation",[357,4615,4616,4617,4619,4620,4623,4624,4627,4628,1170],{},"A typo in the path, or a method the path does not support, answers ",[397,4618,1548],{}," with a message such as ",[397,4621,4622],{},"Cannot GET \u002Fv1\u002Fstudents",". So does the bare host, ",[397,4625,4626],{},"https:\u002F\u002Fapi.main-team.org\u002F",". If you get this for a path you believe exists, compare it character by character with the ",[361,4629,116],{"href":121},[365,4631,734],{"id":4632},"request-ids",[357,4634,4635,4636,4638,4639,4642],{},"Every response, successful or not, carries an ",[397,4637,475],{}," header. Every error body carries the same value as ",[397,4640,4641],{},"error.request_id",". It is the one value that lets support find your request in our logs.",[357,4644,4645,4646,4648,4649,4651,4652,4651,4655,4651,4657,4651,4660,4651,4662,4651,4664,4651,4666,4651,4669,4672],{},"You can choose the id yourself by sending an ",[397,4647,475],{}," header. The API reuses it if it is 1 to 256 characters long and uses only letters, digits and ",[397,4650,1170],{}," ",[397,4653,4654],{},"_",[397,4656,885],{},[397,4658,4659],{},";",[397,4661,3287],{},[397,4663,2715],{},[397,4665,868],{},[397,4667,4668],{},"@",[397,4670,4671],{},"-",". Otherwise, or if you send none, the API assigns an id of its own and returns that instead. Its format is not fixed, so store it as an opaque string. Send the header once per request: a repeated header is not reused.",[357,4674,4675],{},"What we recommend:",[525,4677,4678,4681,4684,4687],{},[528,4679,4680],{},"Generate a fresh UUID for every request, retries included, so each attempt can be told apart.",[528,4682,4683],{},"Log it next to your own record of the call: the operation, your internal job or user id, and the time in UTC.",[528,4685,4686],{},"Never put personal data, a token or a secret into it. It is written to logs.",[528,4688,4689,4690,4692,4693,696,4695,1170],{},"When something goes wrong, send support the ",[397,4691,3035],{},", the time in UTC and the operation. Never send a token or your ",[397,4694,2374],{},[361,4696,345],{"href":346},[365,4698,4700],{"id":4699},"data-formats","Data formats",[370,4702,4703,4716],{},[373,4704,4705],{},[376,4706,4707,4710,4713],{},[379,4708,4709],{},"Kind",[379,4711,4712],{},"Format",[379,4714,4715],{},"Example",[386,4717,4718,4730,4749,4768,4789,4805],{},[376,4719,4720,4722,4725],{},[391,4721,481],{},[391,4723,4724],{},"24 lowercase hexadecimal characters, as a string",[391,4726,4727],{},[397,4728,4729],{},"\"652f1c9b8e4b2a0012a3c4d5\"",[376,4731,4732,4742,4745],{},[391,4733,4734,4735,750,4738,4741],{},"Timestamps (",[397,4736,4737],{},"createdAt",[397,4739,4740],{},"updatedAt",", exam session dates)",[391,4743,4744],{},"ISO 8601, UTC, with milliseconds",[391,4746,4747],{},[397,4748,1094],{},[376,4750,4751,4757,4763],{},[391,4752,4753,4754,403],{},"Date of birth (",[397,4755,4756],{},"birth",[391,4758,4759,4760,4762],{},"A ",[397,4761,507],{}," string, in requests and in responses",[391,4764,4765],{},[397,4766,4767],{},"\"14\u002F05\u002F2008\"",[376,4769,4770,4773,4784],{},[391,4771,4772],{},"Prices and amounts",[391,4774,4775,4776,4779,4780,400,4782,403],{},"Numbers. An exam that has no price has no ",[397,4777,4778],{},"price"," field at all; do not read the absence as ",[397,4781,3671],{},[361,4783,83],{"href":84},[391,4785,4786],{},[397,4787,4788],{},"25",[376,4790,4791,4794,4800],{},[391,4792,4793],{},"References to other records",[391,4795,4796,4797,403],{},"Resolved into objects on reads, plain ids on writes (see ",[361,4798,36],{"href":4799},"\u002Fapi\u002Fidentifiers#references-resolved-on-reads-plain-ids-on-writes",[391,4801,4802],{},[397,4803,4804],{},"\"grade\": { \"_id\": \"…\", \"name\": \"10\" }",[376,4806,4807,4810,4813],{},[391,4808,4809],{},"Country names",[391,4811,4812],{},"Stored in capitals",[391,4814,4815],{},[397,4816,1905],{},[365,4818,4820],{"id":4819},"putting-it-together-a-small-request-helper","Putting it together: a small request helper",[357,4822,4823,4824,1170],{},"Most integrations wrap the conventions on this page in one function. These helpers set the headers, send a request id, return the parsed envelope and turn every error into an exception that carries the status, code and request id. Token signing is covered in ",[361,4825,19],{"href":20},[357,4827,4828],{},"Node.js (18 or later):",[769,4830,4832],{"className":2590,"code":4831,"language":2592,"meta":774,"style":774},"import { randomUUID } from 'node:crypto';\n\nconst BASE = process.env.MTO_API_BASE ?? 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n\nexport class ApiError extends Error {\n  constructor(status, error, requestId) {\n    super(error?.message ?? `HTTP ${status}`);\n    this.status = status;\n    this.code = error?.code ?? 'unknown';\n    this.requestId = error?.request_id ?? requestId;\n    this.documentationUrl = error?.documentation_url;\n  }\n}\n\nexport async function api(token, method, path, body) {\n  const requestId = randomUUID();\n  const res = await fetch(`${BASE}${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  });\n\n  const text = await res.text();\n  let json = null;\n  try {\n    json = text ? JSON.parse(text) : null;\n  } catch {\n    \u002F\u002F Not JSON: something between you and the API answered. Keep the status.\n  }\n\n  if (!res.ok) throw new ApiError(res.status, json?.error, requestId);\n  return { status: res.status, body: json, requestId: res.headers.get('x-request-id') };\n}\n\n\u002F\u002F Usage\nconst { status, body } = await api(token, 'POST', `\u002F${organizationId}\u002Fapplication`, {\n  studentId,\n  examId,\n});\nconsole.log(status === 201 ? 'created' : 'already existed', body.data._id);\n",[397,4833,4834,4848,4852,4876,4880,4897,4917,4936,4949,4968,4985,4997,5001,5005,5009,5040,5054,5083,5088,5093,5106,5114,5148,5152,5179,5184,5188,5206,5220,5226,5254,5262,5267,5271,5275,5296,5313,5317,5321,5326,5364,5369,5374,5379],{"__ignoreMap":774},[778,4835,4836,4838,4841,4843,4846],{"class":780,"line":781},[778,4837,2599],{"class":805},[778,4839,4840],{"class":818}," { randomUUID } ",[778,4842,2605],{"class":805},[778,4844,4845],{"class":798}," 'node:crypto'",[778,4847,2611],{"class":818},[778,4849,4850],{"class":780,"line":809},[778,4851,2659],{"emptyLinePlaceholder":2658},[778,4853,4854,4857,4860,4862,4865,4868,4871,4874],{"class":780,"line":827},[778,4855,4856],{"class":805},"const",[778,4858,4859],{"class":788}," BASE",[778,4861,2693],{"class":805},[778,4863,4864],{"class":818}," process.env.",[778,4866,4867],{"class":788},"MTO_API_BASE",[778,4869,4870],{"class":805}," ??",[778,4872,4873],{"class":798}," 'https:\u002F\u002Fapi.main-team.org\u002Fv1'",[778,4875,2611],{"class":818},[778,4877,4878],{"class":780,"line":837},[778,4879,2659],{"emptyLinePlaceholder":2658},[778,4881,4882,4884,4887,4890,4893,4895],{"class":780,"line":847},[778,4883,2835],{"class":805},[778,4885,4886],{"class":805}," class",[778,4888,4889],{"class":784}," ApiError",[778,4891,4892],{"class":805}," extends",[778,4894,2979],{"class":788},[778,4896,3162],{"class":818},[778,4898,4899,4902,4904,4906,4908,4910,4912,4915],{"class":780,"line":920},[778,4900,4901],{"class":805},"  constructor",[778,4903,2671],{"class":818},[778,4905,2992],{"class":784},[778,4907,750],{"class":818},[778,4909,3004],{"class":784},[778,4911,750],{"class":818},[778,4913,4914],{"class":784},"requestId",[778,4916,2682],{"class":818},[778,4918,4919,4922,4925,4927,4930,4932,4934],{"class":780,"line":1001},[778,4920,4921],{"class":788},"    super",[778,4923,4924],{"class":818},"(error?.message ",[778,4926,2732],{"class":805},[778,4928,4929],{"class":798}," `HTTP ${",[778,4931,2992],{"class":818},[778,4933,2899],{"class":798},[778,4935,2738],{"class":818},[778,4937,4938,4941,4944,4946],{"class":780,"line":1014},[778,4939,4940],{"class":788},"    this",[778,4942,4943],{"class":818},".status ",[778,4945,3287],{"class":805},[778,4947,4948],{"class":818}," status;\n",[778,4950,4951,4953,4956,4958,4961,4963,4966],{"class":780,"line":1027},[778,4952,4940],{"class":788},[778,4954,4955],{"class":818},".code ",[778,4957,3287],{"class":805},[778,4959,4960],{"class":818}," error?.code ",[778,4962,2732],{"class":805},[778,4964,4965],{"class":798}," 'unknown'",[778,4967,2611],{"class":818},[778,4969,4970,4972,4975,4977,4980,4982],{"class":780,"line":1036},[778,4971,4940],{"class":788},[778,4973,4974],{"class":818},".requestId ",[778,4976,3287],{"class":805},[778,4978,4979],{"class":818}," error?.request_id ",[778,4981,2732],{"class":805},[778,4983,4984],{"class":818}," requestId;\n",[778,4986,4987,4989,4992,4994],{"class":780,"line":1049},[778,4988,4940],{"class":788},[778,4990,4991],{"class":818},".documentationUrl ",[778,4993,3287],{"class":805},[778,4995,4996],{"class":818}," error?.documentation_url;\n",[778,4998,4999],{"class":780,"line":1061},[778,5000,1113],{"class":818},[778,5002,5003],{"class":780,"line":1073},[778,5004,1119],{"class":818},[778,5006,5007],{"class":780,"line":1086},[778,5008,2659],{"emptyLinePlaceholder":2658},[778,5010,5011,5013,5015,5017,5020,5022,5024,5026,5029,5031,5034,5036,5038],{"class":780,"line":1099},[778,5012,2835],{"class":805},[778,5014,2838],{"class":805},[778,5016,2841],{"class":805},[778,5018,5019],{"class":2667}," api",[778,5021,2671],{"class":818},[778,5023,2849],{"class":784},[778,5025,750],{"class":818},[778,5027,5028],{"class":784},"method",[778,5030,750],{"class":818},[778,5032,5033],{"class":784},"path",[778,5035,750],{"class":818},[778,5037,2998],{"class":784},[778,5039,2682],{"class":818},[778,5041,5042,5044,5047,5049,5052],{"class":780,"line":1110},[778,5043,2687],{"class":805},[778,5045,5046],{"class":788}," requestId",[778,5048,2693],{"class":805},[778,5050,5051],{"class":2667}," randomUUID",[778,5053,3127],{"class":818},[778,5055,5056,5058,5060,5062,5064,5066,5068,5070,5073,5076,5078,5080],{"class":780,"line":1116},[778,5057,2687],{"class":805},[778,5059,2873],{"class":788},[778,5061,2693],{"class":805},[778,5063,2878],{"class":805},[778,5065,2881],{"class":2667},[778,5067,2671],{"class":818},[778,5069,2984],{"class":798},[778,5071,5072],{"class":788},"BASE",[778,5074,5075],{"class":798},"}${",[778,5077,5033],{"class":818},[778,5079,2899],{"class":798},[778,5081,5082],{"class":818},", {\n",[778,5084,5085],{"class":780,"line":2006},[778,5086,5087],{"class":818},"    method,\n",[778,5089,5090],{"class":780,"line":2012},[778,5091,5092],{"class":818},"    headers: {\n",[778,5094,5095,5098,5100,5102,5104],{"class":780,"line":2018},[778,5096,5097],{"class":818},"      Authorization: ",[778,5099,2909],{"class":798},[778,5101,2849],{"class":818},[778,5103,2899],{"class":798},[778,5105,954],{"class":818},[778,5107,5108,5111],{"class":780,"line":2068},[778,5109,5110],{"class":798},"      'X-Request-Id'",[778,5112,5113],{"class":818},": requestId,\n",[778,5115,5116,5119,5122,5124,5127,5130,5133,5135,5137,5140,5142,5145],{"class":780,"line":3047},[778,5117,5118],{"class":805},"      ...",[778,5120,5121],{"class":818},"(body ",[778,5123,3647],{"class":805},[778,5125,5126],{"class":788}," undefined",[778,5128,5129],{"class":805}," ?",[778,5131,5132],{"class":818}," {} ",[778,5134,885],{"class":805},[778,5136,3278],{"class":818},[778,5138,5139],{"class":798},"'Content-Type'",[778,5141,948],{"class":818},[778,5143,5144],{"class":798},"'application\u002Fjson'",[778,5146,5147],{"class":818}," }),\n",[778,5149,5150],{"class":780,"line":3052},[778,5151,1946],{"class":818},[778,5153,5154,5157,5159,5161,5163,5165,5168,5171,5173,5176],{"class":780,"line":3058},[778,5155,5156],{"class":818},"    body: body ",[778,5158,3647],{"class":805},[778,5160,5126],{"class":788},[778,5162,5129],{"class":805},[778,5164,5126],{"class":788},[778,5166,5167],{"class":805}," :",[778,5169,5170],{"class":788}," JSON",[778,5172,1170],{"class":818},[778,5174,5175],{"class":2667},"stringify",[778,5177,5178],{"class":818},"(body),\n",[778,5180,5181],{"class":780,"line":3094},[778,5182,5183],{"class":818},"  });\n",[778,5185,5186],{"class":780,"line":3119},[778,5187,2659],{"emptyLinePlaceholder":2658},[778,5189,5190,5192,5195,5197,5199,5201,5204],{"class":780,"line":3130},[778,5191,2687],{"class":805},[778,5193,5194],{"class":788}," text",[778,5196,2693],{"class":805},[778,5198,2878],{"class":805},[778,5200,2949],{"class":818},[778,5202,5203],{"class":2667},"text",[778,5205,3127],{"class":818},[778,5207,5208,5211,5214,5216,5218],{"class":780,"line":3156},[778,5209,5210],{"class":805},"  let",[778,5212,5213],{"class":818}," json ",[778,5215,3287],{"class":805},[778,5217,2966],{"class":788},[778,5219,2611],{"class":818},[778,5221,5222,5224],{"class":780,"line":3165},[778,5223,3159],{"class":805},[778,5225,3162],{"class":818},[778,5227,5228,5231,5233,5236,5238,5240,5242,5245,5248,5250,5252],{"class":780,"line":3189},[778,5229,5230],{"class":818},"    json ",[778,5232,3287],{"class":805},[778,5234,5235],{"class":818}," text ",[778,5237,1144],{"class":805},[778,5239,5170],{"class":788},[778,5241,1170],{"class":818},[778,5243,5244],{"class":2667},"parse",[778,5246,5247],{"class":818},"(text) ",[778,5249,885],{"class":805},[778,5251,2966],{"class":788},[778,5253,2611],{"class":818},[778,5255,5256,5258,5260],{"class":780,"line":3200},[778,5257,3192],{"class":818},[778,5259,2957],{"class":805},[778,5261,3162],{"class":818},[778,5263,5264],{"class":780,"line":3223},[778,5265,5266],{"class":2574},"    \u002F\u002F Not JSON: something between you and the API answered. Keep the status.\n",[778,5268,5269],{"class":780,"line":3231},[778,5270,1113],{"class":818},[778,5272,5273],{"class":780,"line":3236},[778,5274,2659],{"emptyLinePlaceholder":2658},[778,5276,5277,5279,5281,5283,5286,5289,5291,5293],{"class":780,"line":3241},[778,5278,2743],{"class":805},[778,5280,2928],{"class":818},[778,5282,2931],{"class":805},[778,5284,5285],{"class":818},"res.ok) ",[778,5287,5288],{"class":805},"throw",[778,5290,2976],{"class":805},[778,5292,4889],{"class":2667},[778,5294,5295],{"class":818},"(res.status, json?.error, requestId);\n",[778,5297,5298,5300,5303,5305,5307,5310],{"class":780,"line":3273},[778,5299,2804],{"class":805},[778,5301,5302],{"class":818}," { status: res.status, body: json, requestId: res.headers.",[778,5304,3073],{"class":2667},[778,5306,2671],{"class":818},[778,5308,5309],{"class":798},"'x-request-id'",[778,5311,5312],{"class":818},") };\n",[778,5314,5315],{"class":780,"line":3298},[778,5316,1119],{"class":818},[778,5318,5319],{"class":780,"line":3324},[778,5320,2659],{"emptyLinePlaceholder":2658},[778,5322,5323],{"class":780,"line":3333},[778,5324,5325],{"class":2574},"\u002F\u002F Usage\n",[778,5327,5328,5330,5332,5334,5336,5338,5340,5342,5344,5346,5349,5352,5354,5357,5359,5362],{"class":780,"line":3360},[778,5329,4856],{"class":805},[778,5331,3278],{"class":818},[778,5333,2992],{"class":788},[778,5335,750],{"class":818},[778,5337,2998],{"class":788},[778,5339,3284],{"class":818},[778,5341,3287],{"class":805},[778,5343,2878],{"class":805},[778,5345,5019],{"class":2667},[778,5347,5348],{"class":818},"(token, ",[778,5350,5351],{"class":798},"'POST'",[778,5353,750],{"class":818},[778,5355,5356],{"class":798},"`\u002F${",[778,5358,2854],{"class":818},[778,5360,5361],{"class":798},"}\u002Fapplication`",[778,5363,5082],{"class":818},[778,5365,5366],{"class":780,"line":3365},[778,5367,5368],{"class":818},"  studentId,\n",[778,5370,5371],{"class":780,"line":3389},[778,5372,5373],{"class":818},"  examId,\n",[778,5375,5376],{"class":780,"line":3406},[778,5377,5378],{"class":818},"});\n",[778,5380,5381,5384,5387,5390,5392,5394,5396,5399,5401,5404],{"class":780,"line":4174},[778,5382,5383],{"class":818},"console.",[778,5385,5386],{"class":2667},"log",[778,5388,5389],{"class":818},"(status ",[778,5391,3647],{"class":805},[778,5393,874],{"class":788},[778,5395,5129],{"class":805},[778,5397,5398],{"class":798}," 'created'",[778,5400,5167],{"class":805},[778,5402,5403],{"class":798}," 'already existed'",[778,5405,5406],{"class":818},", body.data._id);\n",[357,5408,5409],{},"PHP (8.1 or later):",[769,5411,5413],{"className":3418,"code":5412,"language":3420,"meta":774,"style":774},"\u003C?php\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\nfunction api(string $token, string $method, string $path, ?array $body = null): array\n{\n    $base = getenv('MTO_API_BASE') ?: 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n    $requestId = bin2hex(random_bytes(16));\n    $headers = [\"Authorization: Bearer {$token}\", \"X-Request-Id: {$requestId}\"];\n\n    $ch = curl_init($base . $path);\n    curl_setopt_array($ch, [\n        CURLOPT_CUSTOMREQUEST => $method,\n        CURLOPT_RETURNTRANSFER => true,\n        CURLOPT_CONNECTTIMEOUT => 5,\n        CURLOPT_TIMEOUT => 30,\n    ]);\n    if ($body !== null) {\n        $headers[] = 'Content-Type: application\u002Fjson';\n        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body, JSON_THROW_ON_ERROR));\n    }\n    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n\n    $raw = curl_exec($ch);\n    if ($raw === false) {\n        throw new RuntimeException('Network error: ' . curl_error($ch));\n    }\n    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n    curl_close($ch);\n\n    $json = json_decode($raw, true);\n    if ($status >= 400) {\n        $error = $json['error'] ?? [];\n        throw new ApiError($status, $error['code'] ?? 'unknown', $error['message'] ?? \"HTTP {$status}\", $error['request_id'] ?? $requestId);\n    }\n    return ['status' => $status, 'body' => $json];\n}\n\n\u002F\u002F Usage\n$result = api($token, 'POST', \"\u002F{$organizationId}\u002Fapplication\", ['studentId' => $studentId, 'examId' => $examId]);\necho ($result['status'] === 201 ? 'created ' : 'already existed ') . $result['body']['data']['_id'];\n",[397,5414,5415,5421,5435,5439,5451,5465,5477,5485,5496,5501,5512,5516,5520,5524,5563,5567,5591,5614,5640,5644,5660,5666,5676,5688,5700,5712,5716,5729,5741,5764,5768,5781,5785,5796,5809,5830,5834,5848,5854,5858,5874,5889,5906,5952,5956,5978,5982,5987,5992,6036],{"__ignoreMap":774},[778,5416,5417,5419],{"class":780,"line":781},[778,5418,3427],{"class":805},[778,5420,3430],{"class":788},[778,5422,5423,5426,5428,5430,5432],{"class":780,"line":809},[778,5424,5425],{"class":805},"final",[778,5427,4886],{"class":805},[778,5429,4889],{"class":784},[778,5431,4892],{"class":805},[778,5433,5434],{"class":788}," RuntimeException\n",[778,5436,5437],{"class":780,"line":827},[778,5438,940],{"class":818},[778,5440,5441,5444,5446,5449],{"class":780,"line":837},[778,5442,5443],{"class":805},"    public",[778,5445,2841],{"class":805},[778,5447,5448],{"class":788}," __construct",[778,5450,2884],{"class":818},[778,5452,5453,5456,5459,5462],{"class":780,"line":847},[778,5454,5455],{"class":805},"        public",[778,5457,5458],{"class":805}," readonly",[778,5460,5461],{"class":805}," int",[778,5463,5464],{"class":818}," $status,\n",[778,5466,5467,5469,5471,5474],{"class":780,"line":920},[778,5468,5455],{"class":805},[778,5470,5458],{"class":805},[778,5472,5473],{"class":805}," string",[778,5475,5476],{"class":818}," $errorCode,\n",[778,5478,5479,5482],{"class":780,"line":1001},[778,5480,5481],{"class":805},"        string",[778,5483,5484],{"class":818}," $message,\n",[778,5486,5487,5489,5491,5493],{"class":780,"line":1014},[778,5488,5455],{"class":805},[778,5490,5458],{"class":805},[778,5492,5473],{"class":805},[778,5494,5495],{"class":818}," $requestId,\n",[778,5497,5498],{"class":780,"line":1027},[778,5499,5500],{"class":818},"    ) {\n",[778,5502,5503,5506,5509],{"class":780,"line":1036},[778,5504,5505],{"class":805},"        parent::",[778,5507,5508],{"class":2667},"__construct",[778,5510,5511],{"class":818},"($message);\n",[778,5513,5514],{"class":780,"line":1049},[778,5515,2009],{"class":818},[778,5517,5518],{"class":780,"line":1061},[778,5519,1119],{"class":818},[778,5521,5522],{"class":780,"line":1073},[778,5523,2659],{"emptyLinePlaceholder":2658},[778,5525,5526,5528,5530,5532,5534,5536,5538,5541,5543,5546,5549,5552,5554,5556,5558,5560],{"class":780,"line":1086},[778,5527,2664],{"class":805},[778,5529,5019],{"class":2667},[778,5531,2671],{"class":818},[778,5533,1658],{"class":805},[778,5535,3443],{"class":818},[778,5537,1658],{"class":805},[778,5539,5540],{"class":818}," $method, ",[778,5542,1658],{"class":805},[778,5544,5545],{"class":818}," $path, ",[778,5547,5548],{"class":805},"?array",[778,5550,5551],{"class":818}," $body ",[778,5553,3287],{"class":805},[778,5555,2966],{"class":788},[778,5557,403],{"class":818},[778,5559,885],{"class":805},[778,5561,5562],{"class":805}," array\n",[778,5564,5565],{"class":780,"line":1099},[778,5566,940],{"class":818},[778,5568,5569,5572,5574,5577,5579,5582,5584,5587,5589],{"class":780,"line":1110},[778,5570,5571],{"class":818},"    $base ",[778,5573,3287],{"class":805},[778,5575,5576],{"class":788}," getenv",[778,5578,2671],{"class":818},[778,5580,5581],{"class":798},"'MTO_API_BASE'",[778,5583,3263],{"class":818},[778,5585,5586],{"class":805},"?:",[778,5588,4873],{"class":798},[778,5590,2611],{"class":818},[778,5592,5593,5596,5598,5601,5603,5606,5608,5611],{"class":780,"line":1116},[778,5594,5595],{"class":818},"    $requestId ",[778,5597,3287],{"class":805},[778,5599,5600],{"class":788}," bin2hex",[778,5602,2671],{"class":818},[778,5604,5605],{"class":2667},"random_bytes",[778,5607,2671],{"class":818},[778,5609,5610],{"class":788},"16",[778,5612,5613],{"class":818},"));\n",[778,5615,5616,5618,5620,5622,5624,5626,5628,5630,5633,5636,5638],{"class":780,"line":2006},[778,5617,3472],{"class":818},[778,5619,3287],{"class":805},[778,5621,3565],{"class":818},[778,5623,3568],{"class":798},[778,5625,3571],{"class":818},[778,5627,3544],{"class":798},[778,5629,750],{"class":818},[778,5631,5632],{"class":798},"\"X-Request-Id: {",[778,5634,5635],{"class":818},"$requestId",[778,5637,3544],{"class":798},[778,5639,4141],{"class":818},[778,5641,5642],{"class":780,"line":2012},[778,5643,2659],{"emptyLinePlaceholder":2658},[778,5645,5646,5648,5650,5652,5655,5657],{"class":780,"line":2018},[778,5647,3522],{"class":818},[778,5649,3287],{"class":805},[778,5651,3527],{"class":788},[778,5653,5654],{"class":818},"($base ",[778,5656,1170],{"class":805},[778,5658,5659],{"class":818}," $path);\n",[778,5661,5662,5664],{"class":780,"line":2068},[778,5663,3551],{"class":788},[778,5665,3554],{"class":818},[778,5667,5668,5671,5673],{"class":780,"line":3047},[778,5669,5670],{"class":788},"        CURLOPT_CUSTOMREQUEST",[778,5672,3562],{"class":805},[778,5674,5675],{"class":818}," $method,\n",[778,5677,5678,5681,5683,5686],{"class":780,"line":3052},[778,5679,5680],{"class":788},"        CURLOPT_RETURNTRANSFER",[778,5682,3562],{"class":805},[778,5684,5685],{"class":788}," true",[778,5687,954],{"class":818},[778,5689,5690,5693,5695,5698],{"class":780,"line":3058},[778,5691,5692],{"class":788},"        CURLOPT_CONNECTTIMEOUT",[778,5694,3562],{"class":805},[778,5696,5697],{"class":788}," 5",[778,5699,954],{"class":818},[778,5701,5702,5705,5707,5710],{"class":780,"line":3094},[778,5703,5704],{"class":788},"        CURLOPT_TIMEOUT",[778,5706,3562],{"class":805},[778,5708,5709],{"class":788}," 30",[778,5711,954],{"class":818},[778,5713,5714],{"class":780,"line":3119},[778,5715,3711],{"class":818},[778,5717,5718,5720,5723,5725,5727],{"class":780,"line":3130},[778,5719,3782],{"class":805},[778,5721,5722],{"class":818}," ($body ",[778,5724,3318],{"class":805},[778,5726,2966],{"class":788},[778,5728,2682],{"class":818},[778,5730,5731,5734,5736,5739],{"class":780,"line":3156},[778,5732,5733],{"class":818},"        $headers[] ",[778,5735,3287],{"class":805},[778,5737,5738],{"class":798}," 'Content-Type: application\u002Fjson'",[778,5740,2611],{"class":818},[778,5742,5743,5746,5748,5751,5753,5756,5759,5762],{"class":780,"line":3165},[778,5744,5745],{"class":788},"        curl_setopt",[778,5747,3737],{"class":818},[778,5749,5750],{"class":788},"CURLOPT_POSTFIELDS",[778,5752,750],{"class":818},[778,5754,5755],{"class":788},"json_encode",[778,5757,5758],{"class":818},"($body, ",[778,5760,5761],{"class":788},"JSON_THROW_ON_ERROR",[778,5763,5613],{"class":818},[778,5765,5766],{"class":780,"line":3189},[778,5767,2009],{"class":818},[778,5769,5770,5773,5775,5778],{"class":780,"line":3200},[778,5771,5772],{"class":788},"    curl_setopt",[778,5774,3737],{"class":818},[778,5776,5777],{"class":788},"CURLOPT_HTTPHEADER",[778,5779,5780],{"class":818},", $headers);\n",[778,5782,5783],{"class":780,"line":3223},[778,5784,2659],{"emptyLinePlaceholder":2658},[778,5786,5787,5790,5792,5794],{"class":780,"line":3231},[778,5788,5789],{"class":818},"    $raw ",[778,5791,3287],{"class":805},[778,5793,3721],{"class":788},[778,5795,3724],{"class":818},[778,5797,5798,5800,5803,5805,5807],{"class":780,"line":3236},[778,5799,3782],{"class":805},[778,5801,5802],{"class":818}," ($raw ",[778,5804,3647],{"class":805},[778,5806,3790],{"class":788},[778,5808,2682],{"class":818},[778,5810,5811,5813,5815,5817,5819,5822,5824,5827],{"class":780,"line":3241},[778,5812,3853],{"class":805},[778,5814,2976],{"class":805},[778,5816,3858],{"class":788},[778,5818,2671],{"class":818},[778,5820,5821],{"class":798},"'Network error: '",[778,5823,3872],{"class":805},[778,5825,5826],{"class":788}," curl_error",[778,5828,5829],{"class":818},"($ch));\n",[778,5831,5832],{"class":780,"line":3273},[778,5833,2009],{"class":818},[778,5835,5836,5838,5840,5842,5844,5846],{"class":780,"line":3298},[778,5837,3729],{"class":818},[778,5839,3287],{"class":805},[778,5841,3734],{"class":788},[778,5843,3737],{"class":818},[778,5845,3740],{"class":788},[778,5847,2738],{"class":818},[778,5849,5850,5852],{"class":780,"line":3324},[778,5851,3763],{"class":788},[778,5853,3724],{"class":818},[778,5855,5856],{"class":780,"line":3333},[778,5857,2659],{"emptyLinePlaceholder":2658},[778,5859,5860,5863,5865,5867,5870,5872],{"class":780,"line":3360},[778,5861,5862],{"class":818},"    $json ",[778,5864,3287],{"class":805},[778,5866,3813],{"class":788},[778,5868,5869],{"class":818},"($raw, ",[778,5871,951],{"class":788},[778,5873,2738],{"class":818},[778,5875,5876,5878,5881,5884,5887],{"class":780,"line":3365},[778,5877,3782],{"class":805},[778,5879,5880],{"class":818}," ($status ",[778,5882,5883],{"class":805},">=",[778,5885,5886],{"class":788}," 400",[778,5888,2682],{"class":818},[778,5890,5891,5893,5895,5898,5900,5902,5904],{"class":780,"line":3389},[778,5892,3808],{"class":818},[778,5894,3287],{"class":805},[778,5896,5897],{"class":818}," $json[",[778,5899,3834],{"class":798},[778,5901,2817],{"class":818},[778,5903,2732],{"class":805},[778,5905,3477],{"class":818},[778,5907,5908,5910,5912,5914,5917,5919,5921,5923,5925,5928,5930,5932,5934,5937,5939,5941,5943,5945,5947,5949],{"class":780,"line":3406},[778,5909,3853],{"class":805},[778,5911,2976],{"class":805},[778,5913,4889],{"class":788},[778,5915,5916],{"class":818},"($status, $error[",[778,5918,3878],{"class":798},[778,5920,2817],{"class":818},[778,5922,2732],{"class":805},[778,5924,4965],{"class":798},[778,5926,5927],{"class":818},", $error[",[778,5929,3899],{"class":798},[778,5931,2817],{"class":818},[778,5933,2732],{"class":805},[778,5935,5936],{"class":798}," \"HTTP {",[778,5938,3866],{"class":818},[778,5940,3544],{"class":798},[778,5942,5927],{"class":818},[778,5944,3919],{"class":798},[778,5946,2817],{"class":818},[778,5948,2732],{"class":805},[778,5950,5951],{"class":818}," $requestId);\n",[778,5953,5954],{"class":780,"line":4174},[778,5955,2009],{"class":818},[778,5957,5958,5960,5962,5965,5967,5970,5973,5975],{"class":780,"line":4183},[778,5959,4186],{"class":805},[778,5961,3565],{"class":818},[778,5963,5964],{"class":798},"'status'",[778,5966,3562],{"class":805},[778,5968,5969],{"class":818}," $status, ",[778,5971,5972],{"class":798},"'body'",[778,5974,3562],{"class":805},[778,5976,5977],{"class":818}," $json];\n",[778,5979,5980],{"class":780,"line":4192},[778,5981,1119],{"class":818},[778,5983,5985],{"class":780,"line":5984},47,[778,5986,2659],{"emptyLinePlaceholder":2658},[778,5988,5990],{"class":780,"line":5989},48,[778,5991,5325],{"class":2574},[778,5993,5995,5998,6000,6002,6005,6007,6009,6012,6014,6017,6020,6023,6025,6028,6031,6033],{"class":780,"line":5994},49,[778,5996,5997],{"class":818},"$result ",[778,5999,3287],{"class":805},[778,6001,5019],{"class":2667},[778,6003,6004],{"class":818},"($token, ",[778,6006,5351],{"class":798},[778,6008,750],{"class":818},[778,6010,6011],{"class":798},"\"\u002F{",[778,6013,3535],{"class":818},[778,6015,6016],{"class":798},"}\u002Fapplication\"",[778,6018,6019],{"class":818},", [",[778,6021,6022],{"class":798},"'studentId'",[778,6024,3562],{"class":805},[778,6026,6027],{"class":818}," $studentId, ",[778,6029,6030],{"class":798},"'examId'",[778,6032,3562],{"class":805},[778,6034,6035],{"class":818}," $examId]);\n",[778,6037,6039,6042,6045,6047,6049,6051,6053,6055,6058,6060,6063,6065,6067,6070,6072,6075,6078,6080,6083],{"class":780,"line":6038},50,[778,6040,6041],{"class":788},"echo",[778,6043,6044],{"class":818}," ($result[",[778,6046,5964],{"class":798},[778,6048,2817],{"class":818},[778,6050,3647],{"class":805},[778,6052,874],{"class":788},[778,6054,5129],{"class":805},[778,6056,6057],{"class":798}," 'created '",[778,6059,5167],{"class":805},[778,6061,6062],{"class":798}," 'already existed '",[778,6064,3263],{"class":818},[778,6066,1170],{"class":805},[778,6068,6069],{"class":818}," $result[",[778,6071,5972],{"class":798},[778,6073,6074],{"class":818},"][",[778,6076,6077],{"class":798},"'data'",[778,6079,6074],{"class":818},[778,6081,6082],{"class":798},"'_id'",[778,6084,4141],{"class":818},[357,6086,6087,6088,6090,6091,1170],{},"To page through lists, see ",[361,6089,39],{"href":40},". To stay inside the rate limit, see ",[361,6092,45],{"href":46},[6094,6095,6096],"style",{},"html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}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 .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 .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}html pre.shiki code .sKwhi, html code.shiki .sKwhi{--shiki-default:#622CBC;--shiki-dark:#DBB7FF}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":774,"searchDepth":809,"depth":827,"links":6098},[6099,6100,6105,6111,6112,6113,6119,6123,6129,6130,6131],{"id":367,"depth":809,"text":368},{"id":514,"depth":809,"text":515,"children":6101},[6102,6103,6104],{"id":519,"depth":827,"text":520},{"id":578,"depth":827,"text":579},{"id":660,"depth":827,"text":661},{"id":1122,"depth":809,"text":1123,"children":6106},[6107,6108,6109,6110],{"id":1126,"depth":827,"text":1127},{"id":1239,"depth":827,"text":1240},{"id":1264,"depth":827,"text":1265},{"id":1401,"depth":827,"text":1402},{"id":1475,"depth":809,"text":1476},{"id":1519,"depth":809,"text":1520},{"id":1608,"depth":809,"text":1609,"children":6114},[6115,6116,6117,6118],{"id":1612,"depth":827,"text":1613},{"id":2073,"depth":827,"text":2074},{"id":2134,"depth":827,"text":2135},{"id":2145,"depth":827,"text":2146},{"id":2159,"depth":809,"text":2160,"children":6120},[6121,6122],{"id":2163,"depth":827,"text":464},{"id":2402,"depth":827,"text":2403},{"id":4197,"depth":809,"text":42,"children":6124},[6125,6126,6127,6128],{"id":4200,"depth":827,"text":4201},{"id":4372,"depth":827,"text":4373},{"id":4599,"depth":827,"text":4600},{"id":4612,"depth":827,"text":4613},{"id":4632,"depth":809,"text":734},{"id":4699,"depth":809,"text":4700},{"id":4819,"depth":809,"text":4820},"What every request must look like, the success and error envelopes, file downloads, request ids, and the formats of the data you send and receive.","md",{},[6136,6137,6138,6139,6140,6141],"getCurrentApiAccount","revokeToken","downloadCertificate","downloadReport","submitGroupChallengeStep","submitGroupChallengeWork","10",{"title":33,"description":6132},"api\u002Frequests-and-responses","X9DV0THZo9FDTyscpwoaIldMkl6rc4_PKFo9up7AZ5g",[6147,6152,6154,6159,6163,6167],{"operationId":6136,"slug":6148,"method":133,"path":6149,"tag":77,"summary":143,"deprecated":134,"public":134,"permission":6150,"scope":6151,"order":827},"get-current-api-account","\u002Fv1\u002Fapi-account\u002Fvalidate-me","api\u002F*:$org:$ID","flat",{"operationId":6137,"slug":623,"method":141,"path":6153,"tag":77,"summary":139,"deprecated":134,"public":134,"permission":6150,"scope":6151,"order":809},"\u002Fv1\u002Fapi-account\u002Frevoke-token",{"operationId":6138,"slug":6155,"method":133,"path":6156,"tag":256,"summary":260,"deprecated":134,"public":134,"permission":6157,"scope":6158,"order":3241},"download-certificate","\u002Fv1\u002F{organizationId}\u002Fcertificate\u002Fdownload\u002F{certificateId}","certificate\u002Fread:$org:$ID","organization",{"operationId":6139,"slug":6160,"method":133,"path":6161,"tag":256,"summary":266,"deprecated":134,"public":134,"permission":6162,"scope":6158,"order":3298},"download-report","\u002Fv1\u002F{organizationId}\u002Freport\u002Fdownload\u002F{reportId}","report\u002Fread:$org:$ID",{"operationId":6140,"slug":6164,"method":141,"path":6165,"tag":89,"summary":293,"deprecated":134,"public":134,"permission":6166,"scope":6158,"order":4183},"submit-group-challenge-step","\u002Fv1\u002F{organizationId}\u002Fgroup-challenge\u002F{challengeId}\u002Fgroup\u002F{groupId}\u002Fstep\u002F{stepId}\u002Fsubmit","group-challenge\u002Fsubmit:$org:$ID",{"operationId":6141,"slug":6168,"method":141,"path":6169,"tag":89,"summary":290,"deprecated":134,"public":134,"permission":6166,"scope":6158,"order":4174},"submit-group-challenge-work","\u002Fv1\u002F{organizationId}\u002Fgroup-challenge\u002F{challengeId}\u002Fgroup\u002F{groupId}\u002Ffinal-submit",1791554614915]