# Give a tenant admin capabilities

POST

/v1/identity/users/{userId}/capabilities

```sh
curl --request POST \
  --url https://example.com/v1/identity/users/example/capabilities \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "capabilities": [ "example" ] }'
```

A tenant admin gives another tenant admin capabilities their own person holds now, such as `env:write` or `signing-keys:write`. What a key was minted with never counts, so a service account or a system key gives none. No person gives `secrets:reveal` or a system capability. Written before the call answers, so the person’s next request holds them. Tenant admins only.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/reference/api.md#bearerauth)**

## Parameters

### Path Parameters

**userId**

required

string

\>= 1 characters

### Header Parameters

**Idempotency-Key**

string

\>= 1 characters

Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per `docs/API-ROUTE-CONVENTIONS.md` §3.1). A retry sent while the first request still runs is answered `409 idempotency-key-in-flight` with `Retry-After`, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets `409 idempotency-key-replay-withheld`, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered `503 idempotency-store-unavailable` with `Retry-After`: nothing ran, so retry with the same key (from 0.3.0).

## Request Bodyrequired

application/json

The capabilities to give: 1 to 32 names, counted as sent; a name sent twice is given once.

object

**capabilities**

required

Array\<string>

\>= 1 items <= 32 items

##### Examplegenerated

```json
{
  "capabilities": [
    "example"
  ]
}
```

## Responses

### 200

The person’s grants, after, with the capabilities they hold.

application/json

What a person may do, as granted directly: tenant admin, a role on a project (its memberships), a role in a team, and the reviewer roster. What a team’s or an org’s grants imply is not expanded.

object

**userId**

required

string

**tenantAdmin**

Whether the person is a tenant admin. Absent when the runtime has no authorization store: nothing grants it then.

boolean

**tenantAdminFromSetting**

Whether the running server’s `KINDGI_ADMIN_EMAILS` names the person: they’re a tenant admin at every start, and taking tenant admin from them, or removing them, answers 409 `listed-admin` until the address is off the list. Absent when the runtime doesn’t report it.

boolean

**tenantMember**

Whether the person is a tenant member: they read the workspace’s settings (providers, policies, adapters, signing keys, deployments), not its projects. A person is one from being added. Absent when the runtime has no authorization store, or doesn’t report it.

boolean

**projects**

required

Direct project memberships.

Array\<object>

A person’s direct role on a project.

object

**projectId**

required

string

**role**

required

Role on a project, as read. `member` is only read, on a role given before it was retired: it grants what `viewer` does, and writes refuse it.

string

Allowed values: viewer runner editor owner admin member

**teams**

required

Team memberships.

Array\<object>

A person’s role in a team.

object

**teamId**

required

string

**role**

required

Role on a team membership.

string

Allowed values: member admin

**reviewer**

A person’s active entry on the reviewer roster.

object

**role**

required

Reviewer role class. Hierarchy: standard < senior < admin.

string

Allowed values: standard senior admin

**capabilities**

The capabilities the person holds, such as `env:write` or `signing-keys:write`. Absent when the runtime doesn’t report them: unknown, not none.

Array\<string>

##### Example

```json
{
  "projects": [
    {
      "role": "viewer"
    }
  ],
  "teams": [
    {
      "role": "member"
    }
  ],
  "reviewer": {
    "role": "standard"
  }
}
```

### 400

Malformed request body.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 403

Not a tenant admin; asked by a service account or a system key (`caller-not-a-person`); a capability no person gives (`capability-not-givable`); or one the caller’s own person doesn’t hold now (`capability-not-held`, naming the missing ones).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 404

No user with that id under this workspace (`identity-user-not-found`).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 409

The person was removed from the workspace (`identity-user-unregistered`), isn’t a tenant admin (`receiver-not-tenant-admin`: make them one first), or an idempotency conflict. Or `idempotency-key-in-flight` (with `Retry-After`): a request with the same `Idempotency-Key` still runs, so this one wasn’t run; send it again after `Retry-After` to get that request’s answer.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 413

The request body is over the API’s limit (`request-too-large`; `details.maxBytes` says how much).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 429

`rate-limit-exceeded` with `details.limit: "api-requests"`, on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; `Retry-After` says when to send it again.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 500

Server error (unmapped domain code or framework crash).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 501

The runtime has no authorization store (`person-grants-unsupported`), or doesn’t give capabilities (`person-capabilities-unsupported`).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 503

The `Idempotency-Key` store (`idempotency-store-unavailable`) or the authorization store (`authz-backend-unavailable`) couldn’t be reached before the request ran, or the database was too busy for its authorization check (`database-busy`), so nothing was changed; `Retry-After` (whole seconds) says when to try again with the same key. Or `tenant-state-unavailable` (with `Retry-After`), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

## See also

- [`GET /v1/identity/users`: List users in the workspace](https://docs.kindgi.com/reference/api/operations/identityuserslist.md)
- [`POST /v1/identity/users`: Add a person](https://docs.kindgi.com/reference/api/operations/identityuserscreate.md)
- [`GET /v1/identity/users/{userId}`: Get a user by id](https://docs.kindgi.com/reference/api/operations/identityusersget.md)
- [`GET /v1/identity/users/{userId}/sessions`: List active sessions for a user](https://docs.kindgi.com/reference/api/operations/identityuserslistsessions.md)
- [People, API keys and service accounts](https://docs.kindgi.com/deploy/people-and-keys.md)
- [Error code `authz-backend-unavailable`](https://docs.kindgi.com/reference/errors.md#authz-backend-unavailable)
- [Error code `caller-not-a-person`](https://docs.kindgi.com/reference/errors.md#caller-not-a-person)
- [Error code `capability-not-givable`](https://docs.kindgi.com/reference/errors.md#capability-not-givable)
- [Error code `capability-not-held`](https://docs.kindgi.com/reference/errors.md#capability-not-held)
- [Error code `database-busy`](https://docs.kindgi.com/reference/errors.md#database-busy)
- [Error code `idempotency-key-in-flight`](https://docs.kindgi.com/reference/errors.md#idempotency-key-in-flight)
- [Error code `idempotency-store-unavailable`](https://docs.kindgi.com/reference/errors.md#idempotency-store-unavailable)
- [Error code `identity-user-not-found`](https://docs.kindgi.com/reference/errors.md#identity-user-not-found)
- [Error code `identity-user-unregistered`](https://docs.kindgi.com/reference/errors.md#identity-user-unregistered)
- [Error code `person-capabilities-unsupported`](https://docs.kindgi.com/reference/errors.md#person-capabilities-unsupported)
- [Error code `person-grants-unsupported`](https://docs.kindgi.com/reference/errors.md#person-grants-unsupported)
- [Error code `rate-limit-exceeded`](https://docs.kindgi.com/reference/errors.md#rate-limit-exceeded)
- [Error code `receiver-not-tenant-admin`](https://docs.kindgi.com/reference/errors.md#receiver-not-tenant-admin)
- [Error code `request-too-large`](https://docs.kindgi.com/reference/errors.md#request-too-large)
- [Error code `tenant-state-unavailable`](https://docs.kindgi.com/reference/errors.md#tenant-state-unavailable)
- [Every error code](https://docs.kindgi.com/reference/errors.md)
