[{"data":1,"prerenderedAt":2389},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Fguides\u002Fsupervisors":351,"api-spec:guide:\u002Fapi\u002Fguides\u002Fsupervisors":2384},[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":71,"body":353,"description":2375,"extension":2376,"meta":2377,"navTitle":71,"navigation":1419,"operations":2378,"order":2380,"path":72,"section":58,"seo":2381,"status":14,"stem":2382,"__hash__":2383},"apiGuides\u002Fapi\u002Fguides\u002Fsupervisors.md",{"type":354,"value":355,"toc":2363},"minimark",[356,360,382,390,395,406,409,422,426,434,468,478,482,493,556,604,614,876,883,966,985,988,991,1061,1064,1157,1160,1165,1168,1337,1341,1370,1373,1377,1384,1388,1391,1790,2332,2336,2359],[357,358,359],"p",{},"A supervisor is a teacher's or coach's account on an organization. You can link one of your students\nto a supervisor there by the supervisor's username:",[361,362,367],"pre",{"className":363,"code":364,"language":365,"meta":366,"style":366},"language-http shiki shiki-themes github-light-high-contrast github-dark-high-contrast","PUT \u002Fv1\u002F\u003CorganizationId>\u002Fstudent\u002F\u003CstudentId>\u002Fsupervisor\n","http","",[368,369,370],"code",{"__ignoreMap":366},[371,372,375,378],"span",{"class":373,"line":374},"line",1,[371,376,190],{"class":377},"sHUrx",[371,379,381],{"class":380},"suds8"," \u002Fv1\u002F\u003CorganizationId>\u002Fstudent\u002F\u003CstudentId>\u002Fsupervisor\n",[357,383,384,385,389],{},"That is the whole API surface for supervisors: one operation,\n",[386,387,388],"a",{"href":205},"Link a student to a supervisor",". The API never creates,\nlists, changes or removes supervisor accounts. Supervisors register on the platform themselves. When\nyou want to link a student, ask the supervisor for their username.",[391,392,394],"h2",{"id":393},"a-link-belongs-to-one-organization","A link belongs to one organization",[357,396,397,398,401,402,405],{},"Each organization keeps its own record of a student and of each supervisor, so a supervisor link is\nmade on one organization and stays there. Linking a student to ",[368,399,400],{},"XXT1003"," on stem changes nothing on\nhilingua, neo or any other organization. To link the same student on two organizations, call the\nroute once for each, with each organization's ",[368,403,404],{},"_id"," in the path.",[357,407,408],{},"The same person can have a supervisor account on several organizations under one username. The link\nalways uses the supervisor account on the organization in the path.",[357,410,411,412,417,418,421],{},"Links are made on the olympiads: stem, hilingua, neo, gmath and coding, the organizations\n",[386,413,414],{"href":162},[368,415,416],{},"GET \u002Fv1\u002Forganization"," lists. ",[368,419,420],{},"mto"," holds the core record\nitself, not an organization copy, so it has nothing to link.",[391,423,425],{"id":424},"before-you-link","Before you link",[357,427,428,429,433],{},"Three things must be true, and the API does not tell you which one failed (see\n",[386,430,432],{"href":431},"#every-refusal-is-the-same-404","Every refusal is the same 404","):",[435,436,437,452,462],"ol",{},[438,439,440,444,445,448,449,451],"li",{},[441,442,443],"strong",{},"The student is yours."," ",[368,446,447],{},"\u003CstudentId>"," is the ",[368,450,404],{}," you got when you registered the student, and\nthe student belongs to your account.",[438,453,454,457,458,461],{},[441,455,456],{},"The student has signed in to this organization at least once."," The link is written to that\norganization's copy of the student, and the copy only exists after the student's first sign-in\nthere, through a ",[386,459,460],{"href":81},"sign-in link"," you create or on their own. The API\ncannot create the copy for you. Until it exists there is nothing to attach a supervisor to.",[438,463,464,467],{},[441,465,466],{},"The username belongs to a supervisor on this organization."," Not a student, and not a supervisor\nwho only has an account on another organization.",[469,470,472],"callout",{"type":471},"note",[357,473,474,477],{},[441,475,476],{},"Right after registration, link on the next step, not the same one."," A newly registered student\nhas no copy on any organization yet. The usual order is: register → create a sign-in link for this\norganization → the student opens it → link the supervisor. The link-in step creates the copy.",[391,479,481],{"id":480},"link-a-student","Link a student",[357,483,484,485,488,489,492],{},"The account needs ",[368,486,487],{},"student\u002Fupdate"," on the organization in the path: a role with target that\norganization's slug or ",[368,490,491],{},"*",".",[361,494,498],{"className":495,"code":496,"language":497,"meta":366,"style":366},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","curl -X PUT \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F64b7f0c2a1e4d93b5c2f1a02\u002Fstudent\u002F6650f1a2b3c4d5e6f7a8b9c0\u002Fsupervisor\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"supervisorUsername\": \"XXT1003\" }'\n","bash",[368,499,500,520,537,547],{"__ignoreMap":366},[371,501,502,506,510,514,517],{"class":373,"line":374},[371,503,505],{"class":504},"soyes","curl",[371,507,509],{"class":508},"s-5SL"," -X",[371,511,513],{"class":512},"sT6z2"," PUT",[371,515,516],{"class":512}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002F64b7f0c2a1e4d93b5c2f1a02\u002Fstudent\u002F6650f1a2b3c4d5e6f7a8b9c0\u002Fsupervisor\"",[371,518,519],{"class":377}," \\\n",[371,521,523,526,529,532,535],{"class":373,"line":522},2,[371,524,525],{"class":508},"  -H",[371,527,528],{"class":512}," \"Authorization: Bearer ",[371,530,531],{"class":380},"$TOKEN",[371,533,534],{"class":512},"\"",[371,536,519],{"class":377},[371,538,540,542,545],{"class":373,"line":539},3,[371,541,525],{"class":508},[371,543,544],{"class":512}," \"Content-Type: application\u002Fjson\"",[371,546,519],{"class":377},[371,548,550,553],{"class":373,"line":549},4,[371,551,552],{"class":508},"  -d",[371,554,555],{"class":512}," '{ \"supervisorUsername\": \"XXT1003\" }'\n",[557,558,559,578],"table",{},[560,561,562],"thead",{},[563,564,565,569,572,575],"tr",{},[566,567,568],"th",{},"Field",[566,570,571],{},"Type",[566,573,574],{},"Required",[566,576,577],{},"Rules",[579,580,581],"tbody",{},[563,582,583,589,592,595],{},[584,585,586],"td",{},[368,587,588],{},"supervisorUsername",[584,590,591],{},"string",[584,593,594],{},"yes",[584,596,597,598,601,602,492],{},"The supervisor's username. Letter case does not matter, and spaces around it are ignored: ",[368,599,600],{},"\" xxt1003 \""," finds ",[368,603,400],{},[357,605,606,607,610,611,492],{},"The body takes that one field. Any other property is refused with ",[368,608,609],{},"400",", ",[368,612,613],{},"property \u003Cname> should not exist",[361,615,619],{"className":616,"code":617,"language":618,"meta":366,"style":366},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"success\": true,\n  \"message\": \"Student linked to supervisor successfully.\",\n  \"data\": {\n    \"organization\": \"stem\",\n    \"student\": {\n      \"_id\": \"6651a7b8c9d0e1f2a3b4c5d6\",\n      \"mainId\": \"6650f1a2b3c4d5e6f7a8b9c0\",\n      \"username\": \"XXB1045\",\n      \"firstName\": \"Katherine\",\n      \"lastName\": \"Lovelace\",\n      \"fullName\": \"Katherine Lovelace\",\n      \"email\": \"k.pioneer@example.org\",\n      \"emailConfirmed\": false,\n      \"supervisor\": \"64c1d2e3f4a5b6c7d8e9f0a1\",\n      \"createdAt\": \"2026-09-02T08:30:11.204Z\",\n      \"updatedAt\": \"2026-09-15T10:21:47.655Z\"\n    },\n    \"supervisor\": {\n      \"_id\": \"64c1d2e3f4a5b6c7d8e9f0a1\",\n      \"username\": \"XXT1003\"\n    }\n  }\n}\n","json",[368,620,621,626,641,653,661,674,682,695,708,721,734,747,760,773,786,799,812,823,829,837,848,858,864,870],{"__ignoreMap":366},[371,622,623],{"class":373,"line":374},[371,624,625],{"class":380},"{\n",[371,627,628,632,635,638],{"class":373,"line":522},[371,629,631],{"class":630},"sne4z","  \"success\"",[371,633,634],{"class":380},": ",[371,636,637],{"class":508},"true",[371,639,640],{"class":380},",\n",[371,642,643,646,648,651],{"class":373,"line":539},[371,644,645],{"class":630},"  \"message\"",[371,647,634],{"class":380},[371,649,650],{"class":512},"\"Student linked to supervisor successfully.\"",[371,652,640],{"class":380},[371,654,655,658],{"class":373,"line":549},[371,656,657],{"class":630},"  \"data\"",[371,659,660],{"class":380},": {\n",[371,662,664,667,669,672],{"class":373,"line":663},5,[371,665,666],{"class":630},"    \"organization\"",[371,668,634],{"class":380},[371,670,671],{"class":512},"\"stem\"",[371,673,640],{"class":380},[371,675,677,680],{"class":373,"line":676},6,[371,678,679],{"class":630},"    \"student\"",[371,681,660],{"class":380},[371,683,685,688,690,693],{"class":373,"line":684},7,[371,686,687],{"class":630},"      \"_id\"",[371,689,634],{"class":380},[371,691,692],{"class":512},"\"6651a7b8c9d0e1f2a3b4c5d6\"",[371,694,640],{"class":380},[371,696,698,701,703,706],{"class":373,"line":697},8,[371,699,700],{"class":630},"      \"mainId\"",[371,702,634],{"class":380},[371,704,705],{"class":512},"\"6650f1a2b3c4d5e6f7a8b9c0\"",[371,707,640],{"class":380},[371,709,711,714,716,719],{"class":373,"line":710},9,[371,712,713],{"class":630},"      \"username\"",[371,715,634],{"class":380},[371,717,718],{"class":512},"\"XXB1045\"",[371,720,640],{"class":380},[371,722,724,727,729,732],{"class":373,"line":723},10,[371,725,726],{"class":630},"      \"firstName\"",[371,728,634],{"class":380},[371,730,731],{"class":512},"\"Katherine\"",[371,733,640],{"class":380},[371,735,737,740,742,745],{"class":373,"line":736},11,[371,738,739],{"class":630},"      \"lastName\"",[371,741,634],{"class":380},[371,743,744],{"class":512},"\"Lovelace\"",[371,746,640],{"class":380},[371,748,750,753,755,758],{"class":373,"line":749},12,[371,751,752],{"class":630},"      \"fullName\"",[371,754,634],{"class":380},[371,756,757],{"class":512},"\"Katherine Lovelace\"",[371,759,640],{"class":380},[371,761,763,766,768,771],{"class":373,"line":762},13,[371,764,765],{"class":630},"      \"email\"",[371,767,634],{"class":380},[371,769,770],{"class":512},"\"k.pioneer@example.org\"",[371,772,640],{"class":380},[371,774,776,779,781,784],{"class":373,"line":775},14,[371,777,778],{"class":630},"      \"emailConfirmed\"",[371,780,634],{"class":380},[371,782,783],{"class":508},"false",[371,785,640],{"class":380},[371,787,789,792,794,797],{"class":373,"line":788},15,[371,790,791],{"class":630},"      \"supervisor\"",[371,793,634],{"class":380},[371,795,796],{"class":512},"\"64c1d2e3f4a5b6c7d8e9f0a1\"",[371,798,640],{"class":380},[371,800,802,805,807,810],{"class":373,"line":801},16,[371,803,804],{"class":630},"      \"createdAt\"",[371,806,634],{"class":380},[371,808,809],{"class":512},"\"2026-09-02T08:30:11.204Z\"",[371,811,640],{"class":380},[371,813,815,818,820],{"class":373,"line":814},17,[371,816,817],{"class":630},"      \"updatedAt\"",[371,819,634],{"class":380},[371,821,822],{"class":512},"\"2026-09-15T10:21:47.655Z\"\n",[371,824,826],{"class":373,"line":825},18,[371,827,828],{"class":380},"    },\n",[371,830,832,835],{"class":373,"line":831},19,[371,833,834],{"class":630},"    \"supervisor\"",[371,836,660],{"class":380},[371,838,840,842,844,846],{"class":373,"line":839},20,[371,841,687],{"class":630},[371,843,634],{"class":380},[371,845,796],{"class":512},[371,847,640],{"class":380},[371,849,851,853,855],{"class":373,"line":850},21,[371,852,713],{"class":630},[371,854,634],{"class":380},[371,856,857],{"class":512},"\"XXT1003\"\n",[371,859,861],{"class":373,"line":860},22,[371,862,863],{"class":380},"    }\n",[371,865,867],{"class":373,"line":866},23,[371,868,869],{"class":380},"  }\n",[371,871,873],{"class":373,"line":872},24,[371,874,875],{"class":380},"}\n",[357,877,878,879,882],{},"The example shows only some of ",[368,880,881],{},"student","'s fields. What each part means:",[557,884,885,894],{},[560,886,887],{},[563,888,889,891],{},[566,890,568],{},[566,892,893],{},"Meaning",[579,895,896,906,923,933,943,956],{},[563,897,898,903],{},[584,899,900],{},[368,901,902],{},"organization",[584,904,905],{},"The slug of the organization the link was made on.",[563,907,908,912],{},[584,909,910],{},[368,911,881],{},[584,913,914,915,918,919,922],{},"The ",[441,916,917],{},"organization's copy"," of the student, after the change. It has the same kinds of fields as a student anywhere in the API (",[386,920,62],{"href":921},"\u002Fapi\u002Fguides\u002Fstudents#fields-returned","), as that organization holds them.",[563,924,925,930],{},[584,926,927],{},[368,928,929],{},"student._id",[584,931,932],{},"That organization's own id for the student. It differs from the id you registered the student with.",[563,934,935,940],{},[584,936,937],{},[368,938,939],{},"student.mainId",[584,941,942],{},"The id you registered the student with. Match on this.",[563,944,945,950],{},[584,946,947],{},[368,948,949],{},"student.supervisor",[584,951,952,953,492],{},"The supervisor's id ",[441,954,955],{},"on this organization",[563,957,958,963],{},[584,959,960],{},[368,961,962],{},"supervisor",[584,964,965],{},"The supervisor who was linked: their id on this organization and their username.",[469,967,969],{"type":968},"warn",[357,970,971,444,974,977,978,981,982,984],{},[441,972,973],{},"Keep the response; the student reads will not show the link.",[368,975,976],{},"GET \u002Fv1\u002Fstudent\u002F\u003CstudentId>"," and\n",[368,979,980],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fstudent\u002F\u003CstudentId>"," return the core record, and a link made on an\norganization lives on that organization's copy. The ",[368,983,962],{}," you see on those reads is not this\nlink. If you need to know later who supervises a student on which organization, record it from this\nresponse.",[391,986,432],{"id":987},"every-refusal-is-the-same-404",[357,989,990],{},"If the link cannot be made, the answer is always the same:",[361,992,994],{"className":616,"code":993,"language":618,"meta":366,"style":366},"{\n  \"error\": {\n    \"code\": \"not_found\",\n    \"message\": \"Not found!\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\",\n    \"request_id\": \"c4e2a9b7-1d3f-4a6e-8b5c-2f0e9d7a6b31\"\n  }\n}\n",[368,995,996,1000,1007,1019,1031,1043,1053,1057],{"__ignoreMap":366},[371,997,998],{"class":373,"line":374},[371,999,625],{"class":380},[371,1001,1002,1005],{"class":373,"line":522},[371,1003,1004],{"class":630},"  \"error\"",[371,1006,660],{"class":380},[371,1008,1009,1012,1014,1017],{"class":373,"line":539},[371,1010,1011],{"class":630},"    \"code\"",[371,1013,634],{"class":380},[371,1015,1016],{"class":512},"\"not_found\"",[371,1018,640],{"class":380},[371,1020,1021,1024,1026,1029],{"class":373,"line":549},[371,1022,1023],{"class":630},"    \"message\"",[371,1025,634],{"class":380},[371,1027,1028],{"class":512},"\"Not found!\"",[371,1030,640],{"class":380},[371,1032,1033,1036,1038,1041],{"class":373,"line":663},[371,1034,1035],{"class":630},"    \"documentation_url\"",[371,1037,634],{"class":380},[371,1039,1040],{"class":512},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\"",[371,1042,640],{"class":380},[371,1044,1045,1048,1050],{"class":373,"line":676},[371,1046,1047],{"class":630},"    \"request_id\"",[371,1049,634],{"class":380},[371,1051,1052],{"class":512},"\"c4e2a9b7-1d3f-4a6e-8b5c-2f0e9d7a6b31\"\n",[371,1054,1055],{"class":373,"line":684},[371,1056,869],{"class":380},[371,1058,1059],{"class":373,"line":697},[371,1060,875],{"class":380},[357,1062,1063],{},"The status and message are identical whatever the reason, and the response never repeats the username\nyou sent. That is deliberate. Otherwise the route could be used to find out which usernames exist,\nwhich of them are supervisors, and which students belong to which account. The cost is that you have\nto work out the cause yourself. Go through this list in order:",[557,1065,1066,1079],{},[560,1067,1068],{},[563,1069,1070,1073,1076],{},[566,1071,1072],{},"Cause",[566,1074,1075],{},"How to check",[566,1077,1078],{},"Fix",[579,1080,1081,1103,1121,1132,1146],{},[563,1082,1083,1086,1097],{},[584,1084,1085],{},"The student is not on your account, or the id is wrong.",[584,1087,1088,1090,1091,610,1094,492],{},[368,1089,976],{}," answers ",[368,1092,1093],{},"404",[368,1095,1096],{},"Student not found!",[584,1098,1099,1100,1102],{},"Use the ",[368,1101,404],{}," from registration, with a token for the account that registered the student.",[563,1104,1105,1108,1111],{},[584,1106,1107],{},"The student has never signed in to this organization.",[584,1109,1110],{},"The API cannot show this directly. It is the likely cause if the student was registered recently, or has only ever used another organization.",[584,1112,1113,1114,1117,1118,1120],{},"Create a sign-in link for ",[441,1115,1116],{},"this"," organization (",[386,1119,80],{"href":81},"), have the student open it, then link again.",[563,1122,1123,1126,1129],{},[584,1124,1125],{},"The username has a typo, or nobody on this organization has it.",[584,1127,1128],{},"Ask the supervisor to read their username back to you.",[584,1130,1131],{},"Correct it and link again.",[563,1133,1134,1137,1140],{},[584,1135,1136],{},"The username belongs to someone who is not a supervisor on this organization, such as a student, or a supervisor on another organization only.",[584,1138,1139],{},"Ask the supervisor which organization they registered on.",[584,1141,1142,1143,1145],{},"Use the right organization's ",[368,1144,404],{},", or ask the supervisor to register on this one.",[563,1147,1148,1151,1154],{},[584,1149,1150],{},"The username is blank or only spaces.",[584,1152,1153],{},"Look at the body you sent.",[584,1155,1156],{},"Send the username.",[357,1158,1159],{},"Nothing is written for any refusal.",[1161,1162,1164],"h3",{"id":1163},"other-refusals","Other refusals",[357,1166,1167],{},"These come from checks that run before the link is attempted, so they do say what went wrong:",[557,1169,1170,1185],{},[560,1171,1172],{},[563,1173,1174,1177,1180,1183],{},[566,1175,1176],{},"Status",[566,1178,1179],{},"Code",[566,1181,1182],{},"Message",[566,1184,1072],{},[579,1186,1187,1213,1234,1256,1279,1305],{},[563,1188,1189,1193,1201,1210],{},[584,1190,1191],{},[368,1192,609],{},[584,1194,1195],{},[386,1196,1198],{"href":1197},"\u002Fapi\u002Ferrors#bad_request",[368,1199,1200],{},"bad_request",[584,1202,1203,1206,1207],{},[368,1204,1205],{},"supervisorUsername should not be empty"," or ",[368,1208,1209],{},"supervisorUsername must be a string",[584,1211,1212],{},"The field is missing, empty, or not a string.",[563,1214,1215,1219,1225,1229],{},[584,1216,1217],{},[368,1218,609],{},[584,1220,1221],{},[386,1222,1223],{"href":1197},[368,1224,1200],{},[584,1226,1227],{},[368,1228,613],{},[584,1230,1231,1232,492],{},"The body has a field other than ",[368,1233,588],{},[563,1235,1236,1240,1246,1251],{},[584,1237,1238],{},[368,1239,609],{},[584,1241,1242],{},[386,1243,1244],{"href":1197},[368,1245,1200],{},[584,1247,1248],{},[368,1249,1250],{},"Invalid value for '_id': expected ObjectId.",[584,1252,1253,1255],{},[368,1254,447],{}," is not 24 hex characters.",[563,1257,1258,1263,1271,1276],{},[584,1259,1260],{},[368,1261,1262],{},"401",[584,1264,1265],{},[386,1266,1268],{"href":1267},"\u002Fapi\u002Ferrors#unauthorized",[368,1269,1270],{},"unauthorized",[584,1272,1273],{},[368,1274,1275],{},"Authentication is required or the provided credentials are invalid.",[584,1277,1278],{},"The token was refused.",[563,1280,1281,1286,1294,1299],{},[584,1282,1283],{},[368,1284,1285],{},"403",[584,1287,1288],{},[386,1289,1291],{"href":1290},"\u002Fapi\u002Ferrors#forbidden",[368,1292,1293],{},"forbidden",[584,1295,1296],{},[368,1297,1298],{},"Insufficient role permissions",[584,1300,1301,1302,1304],{},"No ",[368,1303,487],{}," on this organization.",[563,1306,1307,1311,1319,1324],{},[584,1308,1309],{},[368,1310,1093],{},[584,1312,1313],{},[386,1314,1316],{"href":1315},"\u002Fapi\u002Ferrors#not_found",[368,1317,1318],{},"not_found",[584,1320,1321],{},[368,1322,1323],{},"Organization not found!",[584,1325,1326,1329,1330,1332,1333,1336],{},[368,1327,1328],{},"\u003CorganizationId>"," is not an organization ",[368,1331,404],{},". A slug such as ",[368,1334,1335],{},"stem"," is not accepted.",[391,1338,1340],{"id":1339},"change-repeat-or-remove-a-link","Change, repeat or remove a link",[1342,1343,1344,1350,1356],"ul",{},[438,1345,1346,1349],{},[441,1347,1348],{},"Link again with another username"," to change the supervisor. A student has one supervisor per\norganization, and the new link replaces the old one.",[438,1351,1352,1355],{},[441,1353,1354],{},"Link again with the same username"," and nothing changes. You get the same successful response.\nRetrying after a timeout is safe.",[438,1357,1358,1361,1362,1366,1367,1369],{},[441,1359,1360],{},"Removing a link"," is not possible through the API. Write to\n",[386,1363,1365],{"href":1364},"mailto:info@main-team.org","info@main-team.org"," with the student's ",[368,1368,404],{}," and the organization.",[357,1371,1372],{},"A link stays in place when the student signs in again later. Signing in brings the organization's\ncopy up to date with the student's profile, but it leaves the supervisor alone.",[391,1374,1376],{"id":1375},"anyone-who-is-a-supervisor-there-can-be-linked","Anyone who is a supervisor there can be linked",[357,1378,1379,1380,1383],{},"The route accepts any supervisor on the organization, not only supervisors connected to your account.\nA mistyped username that happens to belong to another real supervisor links your student to that\nperson. Take usernames from the supervisors themselves, check them before you send them, and show the\nresult (",[368,1381,1382],{},"supervisor.username"," in the response) to whoever asked for the link.",[391,1385,1387],{"id":1386},"a-complete-example","A complete example",[357,1389,1390],{},"Register-then-link is two separate moments in time: the student has to sign in to the organization in\nbetween. This helper links a student and turns the one 404 into a useful error for your own staff.",[361,1392,1396],{"className":1393,"code":1394,"filename":308,"language":1395,"meta":366,"style":366},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","const BASE = 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n\nexport async function linkSupervisor(token, organizationId, studentId, supervisorUsername) {\n  const res = await fetch(`${BASE}\u002F${organizationId}\u002Fstudent\u002F${studentId}\u002Fsupervisor`, {\n    method: 'PUT',\n    headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application\u002Fjson' },\n    body: JSON.stringify({ supervisorUsername }),\n  });\n  const body = await res.json();\n\n  if (res.ok) {\n    const { organization, student, supervisor } = body.data;\n    \u002F\u002F Store the link on your side: the student reads will not show it.\n    return { organization, studentId: student.mainId, supervisor: supervisor.username };\n  }\n\n  const { code, message, request_id } = body.error;\n  if (res.status === 404 && message === 'Not found!') {\n    throw new Error(\n      `Supervisor link refused (request ${request_id}). Check: the student is ours; ` +\n        `the student has signed in to this organization at least once; ` +\n        `\"${supervisorUsername}\" is a supervisor on this organization.`,\n    );\n  }\n  throw new Error(`${res.status} ${code}: ${message} (request ${request_id})`);\n}\n","js",[368,1397,1398,1415,1421,1459,1499,1509,1535,1551,1556,1575,1579,1587,1614,1620,1628,1632,1636,1661,1687,1701,1714,1721,1733,1738,1742,1785],{"__ignoreMap":366},[371,1399,1400,1403,1406,1409,1412],{"class":373,"line":374},[371,1401,1402],{"class":377},"const",[371,1404,1405],{"class":508}," BASE",[371,1407,1408],{"class":377}," =",[371,1410,1411],{"class":512}," 'https:\u002F\u002Fapi.main-team.org\u002Fv1'",[371,1413,1414],{"class":380},";\n",[371,1416,1417],{"class":373,"line":522},[371,1418,1420],{"emptyLinePlaceholder":1419},true,"\n",[371,1422,1423,1426,1429,1432,1436,1439,1442,1444,1447,1449,1452,1454,1456],{"class":373,"line":539},[371,1424,1425],{"class":377},"export",[371,1427,1428],{"class":377}," async",[371,1430,1431],{"class":377}," function",[371,1433,1435],{"class":1434},"sKwhi"," linkSupervisor",[371,1437,1438],{"class":380},"(",[371,1440,1441],{"class":504},"token",[371,1443,610],{"class":380},[371,1445,1446],{"class":504},"organizationId",[371,1448,610],{"class":380},[371,1450,1451],{"class":504},"studentId",[371,1453,610],{"class":380},[371,1455,588],{"class":504},[371,1457,1458],{"class":380},") {\n",[371,1460,1461,1464,1467,1469,1472,1475,1477,1480,1483,1486,1488,1491,1493,1496],{"class":373,"line":549},[371,1462,1463],{"class":377},"  const",[371,1465,1466],{"class":508}," res",[371,1468,1408],{"class":377},[371,1470,1471],{"class":377}," await",[371,1473,1474],{"class":1434}," fetch",[371,1476,1438],{"class":380},[371,1478,1479],{"class":512},"`${",[371,1481,1482],{"class":508},"BASE",[371,1484,1485],{"class":512},"}\u002F${",[371,1487,1446],{"class":380},[371,1489,1490],{"class":512},"}\u002Fstudent\u002F${",[371,1492,1451],{"class":380},[371,1494,1495],{"class":512},"}\u002Fsupervisor`",[371,1497,1498],{"class":380},", {\n",[371,1500,1501,1504,1507],{"class":373,"line":663},[371,1502,1503],{"class":380},"    method: ",[371,1505,1506],{"class":512},"'PUT'",[371,1508,640],{"class":380},[371,1510,1511,1514,1517,1519,1522,1524,1527,1529,1532],{"class":373,"line":676},[371,1512,1513],{"class":380},"    headers: { Authorization: ",[371,1515,1516],{"class":512},"`Bearer ${",[371,1518,1441],{"class":380},[371,1520,1521],{"class":512},"}`",[371,1523,610],{"class":380},[371,1525,1526],{"class":512},"'Content-Type'",[371,1528,634],{"class":380},[371,1530,1531],{"class":512},"'application\u002Fjson'",[371,1533,1534],{"class":380}," },\n",[371,1536,1537,1540,1543,1545,1548],{"class":373,"line":684},[371,1538,1539],{"class":380},"    body: ",[371,1541,1542],{"class":508},"JSON",[371,1544,492],{"class":380},[371,1546,1547],{"class":1434},"stringify",[371,1549,1550],{"class":380},"({ supervisorUsername }),\n",[371,1552,1553],{"class":373,"line":697},[371,1554,1555],{"class":380},"  });\n",[371,1557,1558,1560,1563,1565,1567,1570,1572],{"class":373,"line":710},[371,1559,1463],{"class":377},[371,1561,1562],{"class":508}," body",[371,1564,1408],{"class":377},[371,1566,1471],{"class":377},[371,1568,1569],{"class":380}," res.",[371,1571,618],{"class":1434},[371,1573,1574],{"class":380},"();\n",[371,1576,1577],{"class":373,"line":723},[371,1578,1420],{"emptyLinePlaceholder":1419},[371,1580,1581,1584],{"class":373,"line":736},[371,1582,1583],{"class":377},"  if",[371,1585,1586],{"class":380}," (res.ok) {\n",[371,1588,1589,1592,1595,1597,1599,1601,1603,1605,1608,1611],{"class":373,"line":749},[371,1590,1591],{"class":377},"    const",[371,1593,1594],{"class":380}," { ",[371,1596,902],{"class":508},[371,1598,610],{"class":380},[371,1600,881],{"class":508},[371,1602,610],{"class":380},[371,1604,962],{"class":508},[371,1606,1607],{"class":380}," } ",[371,1609,1610],{"class":377},"=",[371,1612,1613],{"class":380}," body.data;\n",[371,1615,1616],{"class":373,"line":762},[371,1617,1619],{"class":1618},"sLBg1","    \u002F\u002F Store the link on your side: the student reads will not show it.\n",[371,1621,1622,1625],{"class":373,"line":775},[371,1623,1624],{"class":377},"    return",[371,1626,1627],{"class":380}," { organization, studentId: student.mainId, supervisor: supervisor.username };\n",[371,1629,1630],{"class":373,"line":788},[371,1631,869],{"class":380},[371,1633,1634],{"class":373,"line":801},[371,1635,1420],{"emptyLinePlaceholder":1419},[371,1637,1638,1640,1642,1644,1646,1649,1651,1654,1656,1658],{"class":373,"line":814},[371,1639,1463],{"class":377},[371,1641,1594],{"class":380},[371,1643,368],{"class":508},[371,1645,610],{"class":380},[371,1647,1648],{"class":508},"message",[371,1650,610],{"class":380},[371,1652,1653],{"class":508},"request_id",[371,1655,1607],{"class":380},[371,1657,1610],{"class":377},[371,1659,1660],{"class":380}," body.error;\n",[371,1662,1663,1665,1668,1671,1674,1677,1680,1682,1685],{"class":373,"line":825},[371,1664,1583],{"class":377},[371,1666,1667],{"class":380}," (res.status ",[371,1669,1670],{"class":377},"===",[371,1672,1673],{"class":508}," 404",[371,1675,1676],{"class":377}," &&",[371,1678,1679],{"class":380}," message ",[371,1681,1670],{"class":377},[371,1683,1684],{"class":512}," 'Not found!'",[371,1686,1458],{"class":380},[371,1688,1689,1692,1695,1698],{"class":373,"line":831},[371,1690,1691],{"class":377},"    throw",[371,1693,1694],{"class":377}," new",[371,1696,1697],{"class":1434}," Error",[371,1699,1700],{"class":380},"(\n",[371,1702,1703,1706,1708,1711],{"class":373,"line":839},[371,1704,1705],{"class":512},"      `Supervisor link refused (request ${",[371,1707,1653],{"class":380},[371,1709,1710],{"class":512},"}). Check: the student is ours; `",[371,1712,1713],{"class":377}," +\n",[371,1715,1716,1719],{"class":373,"line":850},[371,1717,1718],{"class":512},"        `the student has signed in to this organization at least once; `",[371,1720,1713],{"class":377},[371,1722,1723,1726,1728,1731],{"class":373,"line":860},[371,1724,1725],{"class":512},"        `\"${",[371,1727,588],{"class":380},[371,1729,1730],{"class":512},"}\" is a supervisor on this organization.`",[371,1732,640],{"class":380},[371,1734,1735],{"class":373,"line":866},[371,1736,1737],{"class":380},"    );\n",[371,1739,1740],{"class":373,"line":872},[371,1741,869],{"class":380},[371,1743,1745,1748,1750,1752,1754,1756,1759,1761,1764,1767,1769,1772,1774,1777,1779,1782],{"class":373,"line":1744},25,[371,1746,1747],{"class":377},"  throw",[371,1749,1694],{"class":377},[371,1751,1697],{"class":1434},[371,1753,1438],{"class":380},[371,1755,1479],{"class":512},[371,1757,1758],{"class":380},"res",[371,1760,492],{"class":512},[371,1762,1763],{"class":380},"status",[371,1765,1766],{"class":512},"} ${",[371,1768,368],{"class":380},[371,1770,1771],{"class":512},"}: ${",[371,1773,1648],{"class":380},[371,1775,1776],{"class":512},"} (request ${",[371,1778,1653],{"class":380},[371,1780,1781],{"class":512},"})`",[371,1783,1784],{"class":380},");\n",[371,1786,1788],{"class":373,"line":1787},26,[371,1789,875],{"class":380},[361,1791,1795],{"className":1792,"code":1793,"filename":311,"language":1794,"meta":366,"style":366},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\nconst MT_BASE = 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n\nfunction mt_link_supervisor(string $token, string $organizationId, string $studentId, string $username): array\n{\n    $url = MT_BASE . '\u002F' . rawurlencode($organizationId) . '\u002Fstudent\u002F' . rawurlencode($studentId) . '\u002Fsupervisor';\n    $ch = curl_init($url);\n    curl_setopt_array($ch, [\n        CURLOPT_CUSTOMREQUEST => 'PUT',\n        CURLOPT_RETURNTRANSFER => true,\n        CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token, 'Content-Type: application\u002Fjson'],\n        CURLOPT_POSTFIELDS => json_encode(['supervisorUsername' => $username]),\n        CURLOPT_TIMEOUT => 30,\n    ]);\n    $raw = curl_exec($ch);\n    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n    curl_close($ch);\n    $body = json_decode($raw, true);\n\n    if ($status === 200) {\n        $data = $body['data'];\n        \u002F\u002F Store the link on your side: the student reads will not show it.\n        return [\n            'organization' => $data['organization'],\n            'studentId' => $data['student']['mainId'],\n            'supervisor' => $data['supervisor']['username'],\n        ];\n    }\n\n    $error = $body['error'];\n    if ($status === 404 && $error['message'] === 'Not found!') {\n        throw new RuntimeException(\n            \"Supervisor link refused (request {$error['request_id']}). Check: the student is ours; \"\n            . \"the student has signed in to this organization at least once; \"\n            . \"\\\"$username\\\" is a supervisor on this organization.\"\n        );\n    }\n    throw new RuntimeException(\"$status {$error['code']}: {$error['message']} (request {$error['request_id']})\");\n}\n","php",[368,1796,1797,1805,1818,1822,1858,1862,1904,1917,1925,1938,1950,1973,1994,2006,2011,2024,2042,2049,2066,2070,2085,2101,2106,2114,2129,2149,2168,2174,2179,2184,2199,2227,2240,2252,2261,2280,2286,2291,2327],{"__ignoreMap":366},[371,1798,1799,1802],{"class":373,"line":374},[371,1800,1801],{"class":377},"\u003C?",[371,1803,1804],{"class":508},"php\n",[371,1806,1807,1809,1812,1814,1816],{"class":373,"line":522},[371,1808,1402],{"class":377},[371,1810,1811],{"class":508}," MT_BASE",[371,1813,1408],{"class":377},[371,1815,1411],{"class":512},[371,1817,1414],{"class":380},[371,1819,1820],{"class":373,"line":539},[371,1821,1420],{"emptyLinePlaceholder":1419},[371,1823,1824,1827,1830,1832,1834,1837,1839,1842,1844,1847,1849,1852,1855],{"class":373,"line":549},[371,1825,1826],{"class":377},"function",[371,1828,1829],{"class":1434}," mt_link_supervisor",[371,1831,1438],{"class":380},[371,1833,591],{"class":377},[371,1835,1836],{"class":380}," $token, ",[371,1838,591],{"class":377},[371,1840,1841],{"class":380}," $organizationId, ",[371,1843,591],{"class":377},[371,1845,1846],{"class":380}," $studentId, ",[371,1848,591],{"class":377},[371,1850,1851],{"class":380}," $username)",[371,1853,1854],{"class":377},":",[371,1856,1857],{"class":377}," array\n",[371,1859,1860],{"class":373,"line":663},[371,1861,625],{"class":380},[371,1863,1864,1867,1869,1871,1874,1877,1879,1882,1885,1887,1890,1892,1894,1897,1899,1902],{"class":373,"line":676},[371,1865,1866],{"class":380},"    $url ",[371,1868,1610],{"class":377},[371,1870,1811],{"class":508},[371,1872,1873],{"class":377}," .",[371,1875,1876],{"class":512}," '\u002F'",[371,1878,1873],{"class":377},[371,1880,1881],{"class":508}," rawurlencode",[371,1883,1884],{"class":380},"($organizationId) ",[371,1886,492],{"class":377},[371,1888,1889],{"class":512}," '\u002Fstudent\u002F'",[371,1891,1873],{"class":377},[371,1893,1881],{"class":508},[371,1895,1896],{"class":380},"($studentId) ",[371,1898,492],{"class":377},[371,1900,1901],{"class":512}," '\u002Fsupervisor'",[371,1903,1414],{"class":380},[371,1905,1906,1909,1911,1914],{"class":373,"line":684},[371,1907,1908],{"class":380},"    $ch ",[371,1910,1610],{"class":377},[371,1912,1913],{"class":508}," curl_init",[371,1915,1916],{"class":380},"($url);\n",[371,1918,1919,1922],{"class":373,"line":697},[371,1920,1921],{"class":508},"    curl_setopt_array",[371,1923,1924],{"class":380},"($ch, [\n",[371,1926,1927,1930,1933,1936],{"class":373,"line":710},[371,1928,1929],{"class":508},"        CURLOPT_CUSTOMREQUEST",[371,1931,1932],{"class":377}," =>",[371,1934,1935],{"class":512}," 'PUT'",[371,1937,640],{"class":380},[371,1939,1940,1943,1945,1948],{"class":373,"line":723},[371,1941,1942],{"class":508},"        CURLOPT_RETURNTRANSFER",[371,1944,1932],{"class":377},[371,1946,1947],{"class":508}," true",[371,1949,640],{"class":380},[371,1951,1952,1955,1957,1960,1963,1965,1967,1970],{"class":373,"line":736},[371,1953,1954],{"class":508},"        CURLOPT_HTTPHEADER",[371,1956,1932],{"class":377},[371,1958,1959],{"class":380}," [",[371,1961,1962],{"class":512},"'Authorization: Bearer '",[371,1964,1873],{"class":377},[371,1966,1836],{"class":380},[371,1968,1969],{"class":512},"'Content-Type: application\u002Fjson'",[371,1971,1972],{"class":380},"],\n",[371,1974,1975,1978,1980,1983,1986,1989,1991],{"class":373,"line":749},[371,1976,1977],{"class":508},"        CURLOPT_POSTFIELDS",[371,1979,1932],{"class":377},[371,1981,1982],{"class":508}," json_encode",[371,1984,1985],{"class":380},"([",[371,1987,1988],{"class":512},"'supervisorUsername'",[371,1990,1932],{"class":377},[371,1992,1993],{"class":380}," $username]),\n",[371,1995,1996,1999,2001,2004],{"class":373,"line":762},[371,1997,1998],{"class":508},"        CURLOPT_TIMEOUT",[371,2000,1932],{"class":377},[371,2002,2003],{"class":508}," 30",[371,2005,640],{"class":380},[371,2007,2008],{"class":373,"line":775},[371,2009,2010],{"class":380},"    ]);\n",[371,2012,2013,2016,2018,2021],{"class":373,"line":788},[371,2014,2015],{"class":380},"    $raw ",[371,2017,1610],{"class":377},[371,2019,2020],{"class":508}," curl_exec",[371,2022,2023],{"class":380},"($ch);\n",[371,2025,2026,2029,2031,2034,2037,2040],{"class":373,"line":801},[371,2027,2028],{"class":380},"    $status ",[371,2030,1610],{"class":377},[371,2032,2033],{"class":508}," curl_getinfo",[371,2035,2036],{"class":380},"($ch, ",[371,2038,2039],{"class":508},"CURLINFO_RESPONSE_CODE",[371,2041,1784],{"class":380},[371,2043,2044,2047],{"class":373,"line":814},[371,2045,2046],{"class":508},"    curl_close",[371,2048,2023],{"class":380},[371,2050,2051,2054,2056,2059,2062,2064],{"class":373,"line":825},[371,2052,2053],{"class":380},"    $body ",[371,2055,1610],{"class":377},[371,2057,2058],{"class":508}," json_decode",[371,2060,2061],{"class":380},"($raw, ",[371,2063,637],{"class":508},[371,2065,1784],{"class":380},[371,2067,2068],{"class":373,"line":831},[371,2069,1420],{"emptyLinePlaceholder":1419},[371,2071,2072,2075,2078,2080,2083],{"class":373,"line":839},[371,2073,2074],{"class":377},"    if",[371,2076,2077],{"class":380}," ($status ",[371,2079,1670],{"class":377},[371,2081,2082],{"class":508}," 200",[371,2084,1458],{"class":380},[371,2086,2087,2090,2092,2095,2098],{"class":373,"line":850},[371,2088,2089],{"class":380},"        $data ",[371,2091,1610],{"class":377},[371,2093,2094],{"class":380}," $body[",[371,2096,2097],{"class":512},"'data'",[371,2099,2100],{"class":380},"];\n",[371,2102,2103],{"class":373,"line":860},[371,2104,2105],{"class":1618},"        \u002F\u002F Store the link on your side: the student reads will not show it.\n",[371,2107,2108,2111],{"class":373,"line":866},[371,2109,2110],{"class":377},"        return",[371,2112,2113],{"class":380}," [\n",[371,2115,2116,2119,2121,2124,2127],{"class":373,"line":872},[371,2117,2118],{"class":512},"            'organization'",[371,2120,1932],{"class":377},[371,2122,2123],{"class":380}," $data[",[371,2125,2126],{"class":512},"'organization'",[371,2128,1972],{"class":380},[371,2130,2131,2134,2136,2138,2141,2144,2147],{"class":373,"line":1744},[371,2132,2133],{"class":512},"            'studentId'",[371,2135,1932],{"class":377},[371,2137,2123],{"class":380},[371,2139,2140],{"class":512},"'student'",[371,2142,2143],{"class":380},"][",[371,2145,2146],{"class":512},"'mainId'",[371,2148,1972],{"class":380},[371,2150,2151,2154,2156,2158,2161,2163,2166],{"class":373,"line":1787},[371,2152,2153],{"class":512},"            'supervisor'",[371,2155,1932],{"class":377},[371,2157,2123],{"class":380},[371,2159,2160],{"class":512},"'supervisor'",[371,2162,2143],{"class":380},[371,2164,2165],{"class":512},"'username'",[371,2167,1972],{"class":380},[371,2169,2171],{"class":373,"line":2170},27,[371,2172,2173],{"class":380},"        ];\n",[371,2175,2177],{"class":373,"line":2176},28,[371,2178,863],{"class":380},[371,2180,2182],{"class":373,"line":2181},29,[371,2183,1420],{"emptyLinePlaceholder":1419},[371,2185,2187,2190,2192,2194,2197],{"class":373,"line":2186},30,[371,2188,2189],{"class":380},"    $error ",[371,2191,1610],{"class":377},[371,2193,2094],{"class":380},[371,2195,2196],{"class":512},"'error'",[371,2198,2100],{"class":380},[371,2200,2202,2204,2206,2208,2210,2212,2215,2218,2221,2223,2225],{"class":373,"line":2201},31,[371,2203,2074],{"class":377},[371,2205,2077],{"class":380},[371,2207,1670],{"class":377},[371,2209,1673],{"class":508},[371,2211,1676],{"class":377},[371,2213,2214],{"class":380}," $error[",[371,2216,2217],{"class":512},"'message'",[371,2219,2220],{"class":380},"] ",[371,2222,1670],{"class":377},[371,2224,1684],{"class":512},[371,2226,1458],{"class":380},[371,2228,2230,2233,2235,2238],{"class":373,"line":2229},32,[371,2231,2232],{"class":377},"        throw",[371,2234,1694],{"class":377},[371,2236,2237],{"class":508}," RuntimeException",[371,2239,1700],{"class":380},[371,2241,2243,2246,2249],{"class":373,"line":2242},33,[371,2244,2245],{"class":512},"            \"Supervisor link refused (request {",[371,2247,2248],{"class":380},"$error",[371,2250,2251],{"class":512},"['request_id']}). Check: the student is ours; \"\n",[371,2253,2255,2258],{"class":373,"line":2254},34,[371,2256,2257],{"class":377},"            .",[371,2259,2260],{"class":512}," \"the student has signed in to this organization at least once; \"\n",[371,2262,2264,2266,2269,2272,2275,2277],{"class":373,"line":2263},35,[371,2265,2257],{"class":377},[371,2267,2268],{"class":512}," \"",[371,2270,2271],{"class":377},"\\\"",[371,2273,2274],{"class":380},"$username",[371,2276,2271],{"class":377},[371,2278,2279],{"class":512}," is a supervisor on this organization.\"\n",[371,2281,2283],{"class":373,"line":2282},36,[371,2284,2285],{"class":380},"        );\n",[371,2287,2289],{"class":373,"line":2288},37,[371,2290,863],{"class":380},[371,2292,2294,2296,2298,2300,2302,2304,2307,2310,2312,2315,2317,2320,2322,2325],{"class":373,"line":2293},38,[371,2295,1691],{"class":377},[371,2297,1694],{"class":377},[371,2299,2237],{"class":508},[371,2301,1438],{"class":380},[371,2303,534],{"class":512},[371,2305,2306],{"class":380},"$status",[371,2308,2309],{"class":512}," {",[371,2311,2248],{"class":380},[371,2313,2314],{"class":512},"['code']}: {",[371,2316,2248],{"class":380},[371,2318,2319],{"class":512},"['message']} (request {",[371,2321,2248],{"class":380},[371,2323,2324],{"class":512},"['request_id']})\"",[371,2326,1784],{"class":380},[371,2328,2330],{"class":373,"line":2329},39,[371,2331,875],{"class":380},[391,2333,2335],{"id":2334},"related","Related",[1342,2337,2338,2343,2351],{},[438,2339,2340,2342],{},[386,2341,80],{"href":81},": how the student's first sign-in creates the\norganization's copy.",[438,2344,2345,2347,2348,492],{},[386,2346,62],{"href":63},": the core record, organization copies and ",[368,2349,2350],{},"mainId",[438,2352,2353,2355,2356,2358],{},[386,2354,36],{"href":37},": why the same person has a different ",[368,2357,404],{}," on every organization.",[2360,2361,2362],"style",{},"html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .sKwhi, html code.shiki .sKwhi{--shiki-default:#622CBC;--shiki-dark:#DBB7FF}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}",{"title":366,"searchDepth":522,"depth":539,"links":2364},[2365,2366,2367,2368,2371,2372,2373,2374],{"id":393,"depth":522,"text":394},{"id":424,"depth":522,"text":425},{"id":480,"depth":522,"text":481},{"id":987,"depth":522,"text":432,"children":2369},[2370],{"id":1163,"depth":539,"text":1164},{"id":1339,"depth":522,"text":1340},{"id":1375,"depth":522,"text":1376},{"id":1386,"depth":522,"text":1387},{"id":2334,"depth":522,"text":2335},"Link a student to a supervisor on one organization by the supervisor's username, and work out why a link was refused.","md",{},[2379],"linkStudentSupervisor","30",{"title":71,"description":2375},"api\u002Fguides\u002Fsupervisors","twsfzK9qmjQpwh2m7JqAcd38ZTwGwpB2FY28bBA7-uA",[2385],{"operationId":2379,"slug":2386,"method":190,"path":2387,"tag":62,"summary":204,"deprecated":134,"public":134,"permission":2388,"scope":902,"order":850},"link-student-supervisor","\u002Fv1\u002F{organizationId}\u002Fstudent\u002F{studentId}\u002Fsupervisor","student\u002Fupdate:$org:$ID",1791554615070]