# Team

## What this covers

Invite people to work in your account as Admin, Editor or Viewer (no seat fee, at most 25 people and open invites). A member signs in with their own account and sends `X-Acting-Account: <your account id>` with every console request; the server checks the membership and the role on each one. A team account's activity (every change, and every download of conversation content or money documents) is kept 365 days. Console door only, on our own host.

Every example below runs as written once these are exported:

```bash
export DVAARIK_TOKEN="<account access token>"   # console session, from POST /console/auth/login
export INVITE_ID="<uuid>"
export MEMBER_ID="<uuid>"
export USER_ID="<uuid>"
```

A `<value>` inside a JSON body is a value you supply. Responses are JSON; every error body is `{ "detail": … }`. Each schema is expanded once per page, where it first appears.

### Account door errors

| Status | Cause |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. Refresh once, then re-authenticate. |
| `403` | The account is suspended or its email is not verified. |

## Operations — account session

The same resource through the console door. These are what the web console calls; both doors return the same shapes.

### POST `/console/auth/team-invite`

Who a team invite link is for (the account, who invited, the address, the role, until when), before signing in. No session needed; any bad or used link answers one sentence.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `teamInvitePeek` |
| Success | `200` `TeamInvitePeek` |

Request body: `TeamInviteToken`.

#### `TeamInviteToken`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `token` | string | yes | min length 20; max length 100; The token from the invite link's fragment. |

#### `TeamInvitePeek`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account_name` | string | yes | The account you are invited to. |
| `email` | string | yes | The address the invite is for. |
| `expires_at` | date-time | yes |  |
| `inviter_name` | string | yes |  |
| `role` | "admin" or "editor" or "viewer" | yes |  |

| Error | When |
| --- | --- |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/auth/team-invite" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<token>"
  }'
```

### GET `/console/v2/team`

The team of the account the request works in: its owner, members with their roles, invites not yet accepted or revoked, and the seats used (members plus open invites).

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleGetTeam` |
| Success | `200` `TeamView` |

#### `TeamView`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `enabled` | boolean | yes |  |
| `inbound_links_to_change` | integer | no | default 0; How many numbers still use an inbound link a former Admin could see. Change each one and paste the new link into the carrier. |
| `invites` | TeamInviteInfo[] | yes | Invites not yet accepted or revoked (open or expired). |
| `members` | TeamMemberInfo[] | yes |  |
| `owner` | TeamOwner | yes |  |
| `recording_since` | date-time or null | yes | When the audit log started (the first invite). |
| `seats_max` | integer | yes |  |
| `seats_used` | integer | yes | Members plus open invites. |
| `your_role` | string | yes | owner, admin, editor or viewer. |

#### `TeamInviteInfo`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `created_at` | date-time | yes |  |
| `email` | string | yes |  |
| `expires_at` | date-time | yes |  |
| `id` | uuid | yes |  |
| `last_sent_at` | date-time or null | yes |  |
| `role` | "admin" or "editor" or "viewer" | yes |  |
| `sent_count` | integer | yes | How many times the mail went (at most 5). |
| `state` | "open" or "expired" or "accepted" or "revoked" | yes |  |

#### `TeamMemberInfo`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string | yes |  |
| `member_id` | uuid | yes | The member's own account id. |
| `name` | string | yes |  |
| `role` | "admin" or "editor" or "viewer" | yes |  |
| `since` | date-time | yes |  |

#### `TeamOwner`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account_id` | uuid | yes |  |
| `email` | string | yes |  |
| `name` | string | yes |  |

#### `FieldErrors`

A 422 from a route that names its fields: every field that failed validation, or one sentence when the request validated and was then refused.

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `detail` | string or FieldError[] | yes | The fields that failed validation (each named), or a sentence for the developer. |

#### `FieldError`

One request field that failed validation, NAMED (routes on `core.field_errors.FieldErrorRoute`).

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `field` | string or null | yes | The field, as a path into the request: `checks[2].text`, `max_turns`, `test_ids[0]`, `run_id`. Null when the error is about the request body as a whole (it is missing or is not JSON). |
| `loc` | string or integer[] | yes | FastAPI's location: where the value came from (`body`, `query` or `path`), then the path into it as the validator reported it. |
| `message` | string | yes | What is wrong with the field, without its name. |
| `msg` | string | yes | One sentence naming the field and what is wrong with it, e.g. `checks[2].text: text is required`. The same as `message` when `field` is null. |
| `type` | string | yes | The validator's error type: `missing`, `value_error`, `extra_forbidden`, ... |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/team" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### GET `/console/v2/team/accounts`

The accounts you can work in: your own first, then each team you are in, with your role.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleListTeamAccounts` |
| Success | `200` `TeamAccounts` |

#### `TeamAccounts`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `accounts` | TeamAccount[] | yes | Your own account first (role owner), then the teams you are in. |
| `enabled` | boolean | yes |  |

#### `TeamAccount`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account_id` | uuid | yes | Send this as X-Acting-Account to work in the account. |
| `company` | string or null | yes |  |
| `email` | string | yes |  |
| `name` | string | yes |  |
| `role` | string | yes | owner (your own account), admin, editor or viewer. |
| `since` | date-time or null | yes | When you joined (null for your own account). |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/team/accounts" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### GET `/console/v2/team/audit`

The account's activity, newest first: who (with their role then), what, where, the outcome and the address it came from; never what was typed or downloaded. Page with `before` = the last page's `next_before`.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleListTeamAudit` |
| Success | `200` `AuditPage` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `before` | query | uuid or null | no | An event id from next_before: the page older than it. |
| `limit` | query | integer | no | 1 to 100 events (default 50). |
| `actor_id` | query | uuid or null | no | Only this person's actions. |
| `project_id` | query | uuid or null | no | Only actions in this project. |

#### `AuditPage`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `events` | AuditEventInfo[] | yes |  |
| `next_before` | uuid or null | yes | Pass as `before` for the next (older) page; null at the end. |
| `recording_since` | date-time or null | yes | When this account started recording (its first invite). |

#### `AuditEventInfo`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `action` | string | yes | The door's stable key. |
| `actor` | AuditActor | yes |  |
| `at` | date-time | yes |  |
| `detail` | object<string> or null | yes | Team changes only: email, role, old_role, member_id, invite_id. |
| `id` | uuid | yes |  |
| `ip` | string or null | yes | The address the request came from. |
| `label` | string | yes | What happened, in words. |
| `method` | string | yes |  |
| `outcome` | "done" or "refused" or "failed" | yes | done (2xx/3xx), refused (4xx) or failed (5xx, or 499: the browser left before any answer; read the resource itself to see what changed). |
| `project_id` | uuid or null | yes |  |
| `route` | string | yes | The route template, never the raw path. |
| `status_code` | integer | yes |  |
| `target` | object<string> or null | yes | The path's ids; any other path value (a phone number, for example) is 'redacted'. |

#### `AuditActor`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string | yes | The person's address as it was when they acted. |
| `role` | string | yes | owner, admin, editor or viewer, as it was when they acted. |
| `user_id` | uuid | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/team/audit?limit=20" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### GET `/console/v2/team/credentials`

What each person made in this account that still works: API keys apart from everything else, exact counts and the newest 50 items. Members first, then people no longer in the team. Made before this was recorded: not listed.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleListTeamCredentials` |
| Success | `200` `TeamCredentials` |

#### `TeamCredentials`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `not_listed_note` | string | yes | Credentials made before who made them was recorded are not listed: where to check them. |
| `people` | PersonCredentials[] | yes | Members first (team order), then people no longer in the team. The owner is never listed. |

#### `PersonCredentials`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `api_keys` | integer | yes | Active API keys this person made (all projects). |
| `email` | string or null | yes | Their address (as it was when they made the newest item, once they left). |
| `items` | CredentialItem[] | yes | Newest first, at most 50; the counts are exact. |
| `member_role` | string or null | yes | admin, editor or viewer while still in the team; null once they left. |
| `other` | integer | yes | Their other credentials still active: website call button keys, webhook endpoints, agents that send data out, AI accounts, carriers, chat channels, Resell domains, mail and payment accounts. |
| `user_id` | uuid | yes | The person's own account id. |

#### `CredentialItem`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `created_at` | date-time | yes |  |
| `detail` | string or null | yes | A line about it, never a secret: a key's prefix and scopes, an endpoint's host, a provider. |
| `id` | uuid | yes |  |
| `kind` | "api_key" or "publishable_key" or "webhook_endpoint" or "agent" or "provider_account" or "carrier" or "chat_channel" or "reseller_domain" or "reseller_mail" or "reseller_payment" or "api_credential" | yes |  |
| `name` | string | yes |  |
| `project_id` | uuid or null | yes | Its project; null for account-wide Resell items. |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/team/credentials" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### POST `/console/v2/team/invites`

Invite someone by email as `admin`, `editor` or `viewer`. The mail goes from us with a one-time link valid for 7 days that opens only for an account with that address. Shares a budget of 20 an hour and 50 a day per account with Resend.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleCreateTeamInvite` |
| Success | `201` `TeamInviteSent` |

Request body: `TeamInviteIn`.

#### `TeamInviteIn`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string | yes | The person's address. The invite opens only for an account with it. |
| `role` | "admin" or "editor" or "viewer" | yes | admin (connects outside accounts, holds keys, money, privacy, the team and Resell), editor (builds and runs agents, tests, knowledge, call lists, chats, webhooks, alerts) or viewer (reads; never changes or spends). |

#### `TeamInviteSent`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `invite` | TeamInviteInfo | yes |  |
| `mail_sent` | boolean | yes | False when the mail could not be sent: the invite stays; press Resend. |
| `problem` | string or null | yes | Why the mail did not go, in words; null when it went. |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/team/invites" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "role": "admin"
  }'
```

### DELETE `/console/v2/team/invites/{invite_id}`

Revoke an open invite: its link stops working.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleRevokeTeamInvite` |
| Success | `200` `TeamInviteInfo` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `invite_id` | path | uuid | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X DELETE "https://api.developers.dvaarik.com/console/v2/team/invites/$INVITE_ID" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### POST `/console/v2/team/invites/{invite_id}/resend`

Send an open or expired invite again with a new link valid for 7 days; the old link stops working. At most 5 sends per invite.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleResendTeamInvite` |
| Success | `200` `TeamInviteSent` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `invite_id` | path | uuid | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/team/invites/$INVITE_ID/resend" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### POST `/console/v2/team/invites/accept`

Accept an invite with the token from its link, signed in with the address it was sent to. Acts as you whatever `X-Acting-Account` says.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleAcceptTeamInvite` |
| Success | `200` `TeamAccount` |

Request body: `TeamInviteToken`.

| Error | When |
| --- | --- |
| `400` | `invite_invalid`: the link is invalid or expired. |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/team/invites/accept" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<token>"
  }'
```

### POST `/console/v2/team/leave`

Leave a team you are in. Your own account is not affected.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleLeaveTeam` |
| Success | `200` `TeamLeft` |

Request body: `TeamLeaveIn`.

#### `TeamLeaveIn`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account_id` | uuid | yes | The account whose team you leave. |

#### `TeamLeft`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account_id` | uuid | yes |  |
| `left` | boolean | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/team/leave" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "<account_id uuid>"
  }'
```

### DELETE `/console/v2/team/members/{member_id}`

Remove a member: their next request in this account is refused. Rotate any API keys or webhook secrets they had.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleRemoveTeamMember` |
| Success | `200` `TeamMemberRemoved` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `member_id` | path | uuid | yes |  |

#### `TeamMemberRemoved`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `api_keys_active` | integer | no | default 0; API keys this person made that still work. |
| `inbound_links_to_change` | integer | no | default 0; How many numbers still use an inbound link someone who has lost access could see. Change each one and paste the new link into the carrier. |
| `member_id` | uuid | yes |  |
| `not_listed_note` | string | yes | Credentials made before who made them was recorded are not counted: where to check them. |
| `note` | string | yes | What to do next: keys and secrets they saw belong to the account. |
| `other_credentials_active` | integer | no | default 0; Their other credentials still active (see the Team page). |
| `removed` | boolean | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X DELETE "https://api.developers.dvaarik.com/console/v2/team/members/$MEMBER_ID" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### PATCH `/console/v2/team/members/{member_id}`

Change a member's role (`member_id` is their own account id). It applies to their next request.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleUpdateTeamMember` |
| Success | `200` `TeamMemberInfo` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `member_id` | path | uuid | yes |  |

Request body: `TeamMemberIn`.

#### `TeamMemberIn`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `role` | "admin" or "editor" or "viewer" | yes | admin (connects outside accounts, holds keys, money, privacy, the team and Resell), editor (builds and runs agents, tests, knowledge, call lists, chats, webhooks, alerts) or viewer (reads; never changes or spends). |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | `invite_not_found` or `member_not_found`: not of this team. |
| `409` | A refusal with its `code`: `switched_off`, `invite_self`, `already_member`, `invite_exists`, `team_full`, `invite_closed`, `send_limit`, `invite_wrong_account`, `teams_full`, `owner_unavailable`. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X PATCH "https://api.developers.dvaarik.com/console/v2/team/members/$MEMBER_ID" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
```

### POST `/console/v2/team/people/{user_id}/revoke-api-keys`

Revoke every API key this person made in this account that still works: new requests with them are refused at once; calls and sessions already started finish. Nothing else they made is touched (each needs replacing where it was typed). Pressing it again revokes nothing more. The account owner's own keys are revoked one at a time on Projects and keys.

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleRevokePersonApiKeys` |
| Success | `200` `PersonKeysRevoked` |

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `user_id` | path | uuid | yes |  |

#### `PersonKeysRevoked`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `api_keys` | integer | yes | API keys this person made that still work after it. |
| `other` | integer | yes | Their other credentials still active (never touched by this). |
| `revoked` | integer | yes | API keys revoked by this request (0 when none still worked). |
| `user_id` | uuid | yes |  |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `409` | A refusal with its `code`: `switched_off`, or `owner_keys` (the account owner's keys are revoked one at a time on Projects and keys). |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/team/people/$USER_ID/revoke-api-keys" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

### GET `/console/v2/team/session`

Who you are, which account this request works in, your role there and what that role may do (`can`: view, edit, admin, owner).

| Detail | Value |
| --- | --- |
| Door | Account session — `Authorization: Bearer $DVAARIK_TOKEN` |
| Operation | `consoleGetTeamSession` |
| Success | `200` `TeamSession` |

#### `TeamSession`

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `account` | TeamOwner | yes | The account this request acted in. |
| `acting` | boolean | yes | True while you work in another person's account. |
| `can` | object<boolean> | yes | What your role may do: view, edit, admin, owner. |
| `enabled` | boolean | yes |  |
| `role` | string | yes | Your role in the account: owner, admin, editor or viewer. |
| `you` | TeamOwner | yes | You, the signed-in person. |

| Error | When |
| --- | --- |
| `401` | No account session was presented, or it is invalid or expired. |
| `403` | Not allowed: `role_forbidden` (your role in the account), `not_a_member`, `team_unavailable`, or the account is unavailable. |
| `404` | The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed. |
| `422` | The request body or query is not valid. `detail` is an array of `{loc, msg, type}` and `loc` names the offending field. |

Plus the account-door errors above. Full list on the [errors page](/docs/errors).

```bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/team/session" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"
```

---

Source: https://developers.dvaarik.com/docs/api/team · every page as one file: https://developers.dvaarik.com/docs.md
