# Root

Source: https://www.pontive.com/docs/api-reference/management/root

Base URL: `https://api.{region}.pontive.com/v1` (operations that name another server say so).

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## List the instance root's members

```http
GET https://api.{region}.pontive.com/v1/root/members
```

List the users holding a role on the instance root — its owners and admins, and in the directory Pontive's staff. The root is the request's own instance.

Operation ID: `ListRootMembers`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `user_ids` | string[] |  | Filter by user IDs |
| `emails` | string[] |  | Filter by emails |
| `roles` | string[] |  | Filter by roles |
| `search` | string |  | search query |
| `page` | integer |  | Page number |
| `limit` | integer |  | Items per page |
| `sort` | string |  | Sort field; prefix with - for descending (e.g. -created_at). Allowed: created_at, updated_at, joined_at, email. Default: -created_at |

### Responses

- `200` OK: ListMembersResponse
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Add a root member

```http
POST https://api.{region}.pontive.com/v1/root/members
```

Give a user roles on the instance root (api-route-review D4, D38): written from the root, like an organization's or a resource's members. A root role is granted with sys:root:grant.

Operation ID: `CreateRootMember`

### Request body (`application/json`, required): AddRootMemberRequest

The user and the root roles

### Responses

- `201` Created: Member
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse

## Get a root member

```http
GET https://api.{region}.pontive.com/v1/root/members/{user_id}
```

One user's roles on the instance root.

Operation ID: `GetRootMember`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | string | yes | User ID |

### Responses

- `200` OK: Member
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` Not Found: ErrResponse

## Update a root member

```http
PATCH https://api.{region}.pontive.com/v1/root/members/{user_id}
```

Replace a user's roles on the instance root.

Operation ID: `UpdateRootMember`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | string | yes | User ID |

### Request body (`application/json`, required): UpdateRootMemberRequest

The root roles

### Responses

- `200` OK: Member
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` Not Found: ErrResponse

## Remove a root member

```http
DELETE https://api.{region}.pontive.com/v1/root/members/{user_id}
```

Take every root role from a user. The instance's last owner cannot be removed.

Operation ID: `DeleteRootMember`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | string | yes | User ID |

### Responses

- `204` No Content
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse

## Schemas

### ListMembersResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | Member[] |  | List of members |
| `object` | string |  | The object type |
| `pagination` | Pagination |  | Pagination is the page answered (api-route-review D9). |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### AddRootMemberRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `roles` | string[] | yes |  |
| `user_id` | string | yes |  |

### Member

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `created_at` | string |  |  |
| `instance_id` | string |  |  |
| `joined_at` | string |  |  |
| `last_active_at` | string |  |  |
| `object` | string |  |  |
| `resource_id` | string |  |  |
| `resource_name` | string |  |  |
| `resource_type` | string |  |  |
| `roles` | RoleRef[] |  |  |
| `updated_at` | string |  |  |
| `user` | MemberUser |  |  |

### UpdateRootMemberRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `roles` | string[] | yes |  |

### Pagination

Pagination is the page answered (api-route-review D9).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | Limit is the maximum number of items per page. |
| `page` | integer |  | Page is the 1-based index of the returned page. |
| `total` | integer |  | Total is the total number of items across all pages. |
| `total_pages` | integer |  | TotalPages is the total number of pages available. |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### RoleRef

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string |  |  |
| `name` | string |  |  |

### MemberUser

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | string |  |  |
| `email_verified` | boolean |  |  |
| `family_name` | string |  |  |
| `given_name` | string |  |  |
| `id` | string |  |  |
| `name` | string |  |  |
| `picture` | string |  |  |
| `status` | string |  |  |
| `username` | string |  |  |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |
