# The workspaces one verified email may join by its domain

POST

/v1/system/join-domains/lookup

```sh
curl --request POST \
  --url https://example.com/v1/system/join-domains/lookup \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "email": "example" }'
```

For a sign-up page that offers a workspace before it makes a new one: of the workspaces this runtime serves that let people at the email’s domain join, by the emailed link’s rules, the ones it may join (`join`) and the ones it’s in already (`member`). Never one that removed the email, nor one that takes only its own identity provider for the domain, and never a list of every workspace the email is in. Ids, names and join roles only. Empty for a public mailbox domain. The email goes in the body, so it stays out of access logs. Takes `system:join-domains:read` or `system:join-domains`, and every read is recorded.

## Authorizations

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

## Request Bodyrequired

application/json

One email a sign-up page verified.

object

**email**

required

An email the page proved its visitor reads (its own emailed code or link): the lookup takes the page’s word for it.

string

\>= 3 characters

##### Examplegenerated

```json
{
  "email": "example"
}
```

## Responses

### 200

The workspaces.

application/json

For one email, the workspaces this runtime serves that let people at its domain join: never a list of every workspace the email is in. Empty for a public mailbox domain.

object

**data**

required

Array

One of:

- **object**

  object

  **kind**

  required

  string

  Allowed value: join

  **tenantId**

  required

  string format: uuid

  **name**

  required

  string

  **role**

  required

  What someone who joins by the domain gets: `viewer` or `runner` (who also runs its agents and flows) on the tenant’s default project, or `none`, a tenant member with no project. Never tenant admin.

  string

  Allowed values: viewer runner none

- **object**

  object

  **kind**

  required

  string

  Allowed value: member

  **tenantId**

  required

  string format: uuid

  **name**

  required

  string

**hasMore**

required

boolean

##### Example

```json
{
  "data": [
    {
      "kind": "join",
      "role": "viewer"
    }
  ]
}
```

### 400

A body that isn’t `{ email }`, or an email that isn’t one (`bad-input`).

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

A tenant’s key or session (`system-principal-required`), or a system key with neither `system:join-domains:read` nor `system:join-domains` (`system-scope-missing`).

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"
  }
}
```

### 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"
  }
}
```

### 503

The authorization store couldn’t be reached (`authz-backend-unavailable`), or the database was too busy for the authorization check (`database-busy`), so the request wasn’t run; `Retry-After` (whole seconds) says when to try 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.

## See also

- [Serve many tenants](https://docs.kindgi.com/v0.7.0/deploy/self-hosted/serve-many-tenants.md)
- [Error code `authz-backend-unavailable`](https://docs.kindgi.com/v0.7.0/reference/errors.md#authz-backend-unavailable)
- [Error code `bad-input`](https://docs.kindgi.com/v0.7.0/reference/errors.md#bad-input)
- [Error code `database-busy`](https://docs.kindgi.com/v0.7.0/reference/errors.md#database-busy)
- [Error code `request-too-large`](https://docs.kindgi.com/v0.7.0/reference/errors.md#request-too-large)
- [Error code `system-principal-required`](https://docs.kindgi.com/v0.7.0/reference/errors.md#system-principal-required)
- [Error code `system-scope-missing`](https://docs.kindgi.com/v0.7.0/reference/errors.md#system-scope-missing)
- [Every error code](https://docs.kindgi.com/v0.7.0/reference/errors.md)
