# health.hats.institution.endRole

> An administrator ends someone's role at their institution, when the person didn't choose to go, or records a leaving by revoking the credential. The node writes the ended PractitionerRole, pointing its forward where the administrator says, and a Provenance naming the administrator. Authenticated as the administrator (service auth), who must hold institution.administrator there.

- Kind: procedure
- Authority: institution.hats.health
- Lexicon: 1
- Published by [hats.health](https://lexicon.garden/identity/did:plc:uvvhtareovj2oaregs7vsibv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:uvvhtareovj2oaregs7vsibv/health.hats.institution.endRole)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uvvhtareovj2oaregs7vsibv/health.hats.institution.endRole/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uvvhtareovj2oaregs7vsibv/health.hats.institution.endRole/analytics)

## Procedure (`health.hats.institution.endRole`)

Type: procedure · POST

### Input (application/json)

- `forward` (string · did): Whom requests for them go to now: a colleague's DID, or the institution's own. The ended role's endpoint.
- `institution` (string · did, required): The institution, by its DID.
- `practitioner` (string · did, required): Whose role ends.

### Output (application/json)

- `endedAt` (string · datetime, required)
- `role` (string · at-uri, required): The ended PractitionerRole, which stays published with its end date.

### Errors

- `NotAdministrator`: The caller holds no institution.administrator role in force there.
- `NoRole`: The person holds no role there to end.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "An administrator ends someone's role at their institution, when the person didn't choose to go, or records a leaving by revoking the credential. The node writes the ended PractitionerRole, pointing its forward where the administrator says, and a Provenance naming the administrator. Authenticated as the administrator (service auth), who must hold institution.administrator there.",
      "errors": [
        {
          "description": "The caller holds no institution.administrator role in force there.",
          "name": "NotAdministrator"
        },
        {
          "description": "The person holds no role there to end.",
          "name": "NoRole"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "forward": {
              "description": "Whom requests for them go to now: a colleague's DID, or the institution's own. The ended role's endpoint.",
              "format": "did",
              "type": "string"
            },
            "institution": {
              "description": "The institution, by its DID.",
              "format": "did",
              "type": "string"
            },
            "practitioner": {
              "description": "Whose role ends.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "institution",
            "practitioner"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "endedAt": {
              "format": "datetime",
              "type": "string"
            },
            "role": {
              "description": "The ended PractitionerRole, which stays published with its end date.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "role",
            "endedAt"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "health.hats.institution.endRole",
  "lexicon": 1
}
```
