End an assignment
Code Mode: praxis.workforce.assignments.terminate.create
HTTP: POST /workforce/v1/assignments/{id}/terminate
Ends a current assignment with the reason you give; the position becomes vacant and the assignment stays as history that never revives. If it was the actor’s primary and the actor still holds other positions, the earliest of those becomes primary. Use transfer instead to move the actor to another position. Requires an organization owner or admin, or the head of the position’s department or of a department above it. Errors: 400 INVALID_PARAMS for a missing reason or one outside the list; 403 PERMISSION_DENIED; 404 ASSIGNMENT_NOT_FOUND for an unknown or already ended assignment. Example body: {“reason”:“resigned”}.
Signature
praxis.workforce.assignments.terminate.create(args:{path:{id:string};body:{/** Why the assignment ends; recorded as its end_reason. e.g. "resigned" */ reason:"resigned"|"dismissed"|"replaced"|"retired"}}):Promise<{/** Assignment id (asg_...); use it with transfer, terminate and make_primary. */ id:string;/** Id of the organization that owns the assignment. */ organization_id:string;/** Id of the position (pos_...) the actor holds. */ position_id:string;/** Actor address of the holder, such as human:usr_123 for a person or agent:agent_123 for an agent. */ actor:string;/** The holder's display name from the organization's directory, archived agents included, so a past holder is still named; null when the directory does not know th */ actor_name:string|null;/** Whether this is the actor's primary assignment; an actor holding positions has exactly one primary, and the others are concurrent. */ primary:boolean;/** UTC instant (RFC 3339) when the actor took the position. */ start_time:string;/** UTC instant (RFC 3339) when the assignment ended; null while it is current. */ end_time:string|null;/** Why the assignment ended; null while it is current. */ end_reason:"resigned"|"dismissed"|"replaced"|"retired"|"transferred"|"position_closed"|"actor_archived"|null;/** Actor address that made the appointment, such as human:usr_123. */ appointed_by:string;/** Actor address that ended the assignment; null while it is current. */ ended_by:string|null;/** Id of the successor's assignment (asg_...) when the holder was replaced in one step; null otherwise. */ successor_assignment_id:string|null;/** UTC instant (RFC 3339) when the assignment was recorded. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the assignment. */ update_time:string}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | yes | Assignment id (asg_…) to end, from the assignments list. |
Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | The assignment with its end_time and end_reason set. |
| 400 | application/problem+json | INVALID_PARAMS; send reason as resigned, dismissed, replaced or retired. |
| 401 | Missing or invalid credential; provide a valid organization API key or sign in to the Console. | |
| 403 | application/problem+json | PERMISSION_DENIED; an organization owner or admin, or the head of the position’s department or of a department above it may call this, and machine tokens are always refused (an agent’s session token may read the organization, never change it). Use an API key or Console session of an allowed role. |
| 404 | application/problem+json | ASSIGNMENT_NOT_FOUND; list assignments with active=true and copy a current assignment id. |