# Member Directory routes: deactivate, deprovision, provision

URL: /code/api/member-directory/verbs · Id: `page:code/api/member-directory/verbs`

> The Member Directory Verbs deactivate, deprovision, provision as api.sb routes, with inputs, result, refusals and an example.

Reference for [Member Directory](/business/nouns/member-directory), one group of [Member Directory routes](/code/api/member-directory).

### MemberDirectory.deactivate
Deactivate stops a Member Directory’s pushes; everyone it added keeps their Roles until an admin removes them. [Verb page](/business/nouns/member-directory/deactivate?interface=api).

```text
POST /{namespace}/member-directories/{directory}/deactivate
```

Path: `directory`. Emits [`MemberDirectory.deactivated`](/business/events/MemberDirectory.deactivated).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `directory` | [Member Directory](/business/nouns/member-directory) | Yes | The Member Directory to turn off. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `directory` | [Member Directory](/business/nouns/member-directory) | Yes | The Member Directory, now `inactive`. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/member-directories/directory_qZldlwGLVN/deactivate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "directory": {
    "$id": "https://api.sb/leaseline.app/member-directories/directory_qZldlwGLVN",
    "$type": "MemberDirectory",
    "state": "draft"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "MemberDirectory.deactivate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### MemberDirectory.deprovision
Deprovision ends one person’s access to a Tenant in one Action when the Customer’s directory removes them. [Verb page](/business/nouns/member-directory/deprovision?interface=api).

```text
POST /{namespace}/member-directories/{directory}/deprovision
```

Path: `directory`. Body, as JSON: the other inputs. Emits [`MemberDirectory.deprovisioned`](/business/events/MemberDirectory.deprovisioned).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `directory` | [Member Directory](/business/nouns/member-directory) | Yes | The Member Directory that removed the person. |
| `person` | [Person](/business/nouns/person) | Yes | The person removed. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `person` | [Person](/business/nouns/person) | Yes | The person, with no Role left in the Tenant. |
| `memberDirectory` | [Member Directory](/business/nouns/member-directory) | Yes | The Member Directory that removed the person. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/member-directories/directory_qZldlwGLVN/deprovision \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"person":"person_sLqbXbW683"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "person": {
    "$id": "https://api.sb/leaseline.app/people/person_sLqbXbW683",
    "$type": "Person",
    "name": "Dana Okafor"
  },
  "memberDirectory": {
    "$id": "https://api.sb/leaseline.app/member-directories/directory_qZldlwGLVN",
    "$type": "MemberDirectory",
    "state": "draft"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "MemberDirectory.deprovision",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### MemberDirectory.provision
Provision starts a Customer’s Member Directory pushing people and groups into its Tenant, with groups mapped to Roles. [Verb page](/business/nouns/member-directory/provision?interface=api).

```text
POST /{namespace}/member-directories/provision
```

Body, as JSON: the inputs. Emits [`MemberDirectory.provisioned`](/business/events/MemberDirectory.provisioned).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `tenant` | [Tenant](/business/nouns/tenant) | Yes | The Tenant it fills. |
| `groupRoles` | `json` | No | Which group fills which Role. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `directory` | [Member Directory](/business/nouns/member-directory) | Yes | The Member Directory, now active. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/member-directories/provision \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenant":"ten_Bu63f0he26"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "directory": {
    "$id": "https://api.sb/leaseline.app/member-directories/directory_qZldlwGLVN",
    "$type": "MemberDirectory",
    "state": "draft"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "MemberDirectory.provision",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```