# health.hats.institution.leaveRole

> A clinician leaves an institution: their role there ends now. It's their own act, honored at once, since giving up a role only removes access; an administrator revokes the role credential after. The institution's node writes the ended PractitionerRole and a Provenance naming the clinician. Authenticated as the clinician (service auth).

- 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.leaveRole)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uvvhtareovj2oaregs7vsibv/health.hats.institution.leaveRole/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uvvhtareovj2oaregs7vsibv/health.hats.institution.leaveRole/analytics)

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

Type: procedure · POST

### Input (application/json)

- `institution` (string · did, required): The institution, by its DID.

### Output (application/json)

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

### Errors

- `NoRole`: The caller holds no role in force at that institution.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A clinician leaves an institution: their role there ends now. It's their own act, honored at once, since giving up a role only removes access; an administrator revokes the role credential after. The institution's node writes the ended PractitionerRole and a Provenance naming the clinician. Authenticated as the clinician (service auth).",
      "errors": [
        {
          "description": "The caller holds no role in force at that institution.",
          "name": "NoRole"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "institution": {
              "description": "The institution, by its DID.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "institution"
          ],
          "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.leaveRole",
  "lexicon": 1
}
```
