> For the complete documentation index, see [llms.txt](https://docs.stellic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stellic.com/stellic-partner-api/student/unlink-a-student-from-a-department.md).

# Unlink a student from a department

Use this endpoint to remove one department from a student without sending their whole profile. `{dept_id}` is the department's short name, matched exactly. Unlinking a department the student doesn't have returns 200 with no change, and a short name that doesn't exist returns `No department exists with short_name: {dept_id}`. The response is the student's profile, with their remaining schools and departments.

## DELETE /student/{student\_username}/department/{dept\_id}

>

```json
{"openapi":"3.0.0","info":{"title":"Stellic for Developers","version":"1.0"},"tags":[{"name":"Student"}],"servers":[{"url":"https://{institution}.stellic.com/partnerapi/v1","variables":{"institution":{"default":"{institution}","description":"Your institution's Stellic subdomain: the part before `.stellic.com` in the URL you use to sign in. It becomes the host in every request, as in `https://{institution}.stellic.com/partnerapi/v1/...`. Replace the `{institution}` placeholder with your subdomain before sending."}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal Access Token issued by your Stellic integration partner. Send it as `Authorization: Bearer <token>` on every request. One token per institution; do not share across environments."}},"schemas":{"StudentLinkResponseSuccess":{"type":"object","properties":{"status":{"type":"string"},"state":{"type":"object","properties":{"username":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string","nullable":true},"level":{"type":"integer"},"year_begin":{"type":"integer"},"campus":{"type":"string","nullable":true,"description":"The student's primary campus name, or `null` if no campus is set."},"schools":{"type":"array","items":{"type":"object","properties":{"campus":{"type":"object","nullable":true,"description":"The campus the school belongs to, or `null` if the school has no campus.","properties":{"id":{"type":"integer"},"name":{"type":"string"},"screen_name":{"type":"string"}}},"name":{"type":"string"},"short_name":{"type":"string"}}}},"departments":{"type":"array","description":"The student's departments. Each one carries its name and code but not its short name.","items":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true,"description":"The department's first registered code, or `null` if the department has no codes."},"school":{"type":"object","properties":{"campus":{"type":"object","nullable":true,"description":"The campus the parent school belongs to, or `null` if the school has no campus.","properties":{"id":{"type":"integer"},"name":{"type":"string"},"screen_name":{"type":"string"}}},"name":{"type":"string"},"short_name":{"type":"string"}}}}}}}}}},"StudentLinkResponseFailure":{"allOf":[{"$ref":"#/components/schemas/GenericResponseFailure"},{"type":"object","properties":{"identifiers":{"type":"object","properties":{"student_username":{"type":"string"}}}}}]},"GenericResponseFailure":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/student/{student_username}/department/{dept_id}":{"delete":{"tags":["Student"],"parameters":[{"name":"student_username","in":"path","required":true,"description":"The student's username. Send it as stored; it isn't lowercased. Archived students and test accounts return `400`.","schema":{"type":"string"}},{"name":"dept_id","in":"path","required":true,"description":"The department's short name, matched exactly (case- and whitespace-sensitive). Unknown and deleted departments return `400`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Department unlinked, or wasn't linked (no change). The department's school stays linked. The response's `state.schools` lists each linked school once, even when it is linked for more than one term.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudentLinkResponseSuccess"}}}},"400":{"description":"Validation failure on the student or the department.\n\nCommon causes:\n- Student not found - returns `No student exists with username: {student_username}`\n- Student is archived - returns `Student with username {student_username} is archived`\n- Student is a test account - returns the same `No student exists with username: {student_username}` as a missing user\n- No department, or only a deleted one, has this short name - returns `No department exists with short_name: {dept_id}`, even though the student isn't linked to it","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/StudentLinkResponseFailure"},{"type":"object","properties":{"identifiers":{"type":"object","properties":{"student_username":{"type":"string"},"dept_id":{"type":"string"}}}}}]}}}},"401":{"description":"Missing or invalid Bearer token."},"403":{"description":"Your IP address isn't on the allowlist for this endpoint. Contact Stellic to add it; the response includes the `client_ip` Stellic saw.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"client_ip":{"type":"string"}}}}}},"500":{"description":"Unhandled error while saving the link change; the change wasn't saved. Body is `{\"identifiers\": {...}, \"errors\": [{\"message\": \"Stellic couldn't process your request\"}]}`, with no `status` key (unlike the school endpoints) and `errors[]` in place of `message`."}}}}}}
```

#### What happens after the call

* The department is unlinked and a search update is attempted during the call. A successful response confirms the unlink, not that search shows the new links. The department's school stays linked.
* General requirements and pathways aren't recalculated. If they apply by department, use [`PUT /student/{student_username}/profile/`](/stellic-partner-api/student/upsert-a-student-profile.md) with the full `department_ids` instead.

#### Notes

* **Your data sync can put the department back.** If your data sync sends student departments, the next run replaces them.
* **Send the username as stored.** The username isn't lowercased. Archived students return `Student with username {student_username} is archived`.

#### Related APIs

* [`POST /student/{student_username}/department/{dept_id}`](/stellic-partner-api/student/link-a-student-to-a-department.md) to link a department.
* [`DELETE /student/{student_username}/school/{school_id}`](/stellic-partner-api/student/unlink-a-student-from-a-school.md) to unlink a school.
