# Sign-in

address.seleya.ai's own sign-in, through the shared Seleya sign-in (accounts.seleya.ai).

Calls go to https://address.seleya.ai/api. Errors are `{"error": {"code", "message"}}` with the HTTP status: https://address.seleya.ai/docs/reference/errors.md

## Sign out

`POST /v1/auth/sign-out`, called with 

address.seleya.ai's own sign-in, from its own origin.

Called by the console's own page, signed in; not for agents.

Answers:

- 200: Done
- 400: The request is malformed
- 401: No valid key, session or token
- 403: Not allowed for this caller
- 422: A value is refused; the message says which
- 429: A limit is reached

## You

`GET /v1/me`, called with a person signed in

The person signed in: companies, held addresses, own address.

Called by the console's own page, signed in; not for agents.

Answers:

- 200: Done
- 401: No valid key, session or token

| Field (200) | Type | | |
| --- | --- | --- | --- |
| `person` | object | required |  |
| `companies` | array of objects | required |  |
| `held` | array of Address | required |  |
| `can_claim` | array of objects | optional |  |
| `personal` | object | optional |  |
| `next` | string | optional | Optional relative consent path returned by email verification. |

## Sign in with your Seleya account

`GET /v1/auth/seleya`, called with 

Sends the person to the shared Seleya sign-in (accounts.seleya.ai) and back to `next` (the console's home, or a /connect/ or /confirm/ page).

Called by the console's own page, signed in; not for agents.

Answers:

- 302: Off to accounts.seleya.ai
- 400: The request is malformed
- 401: No valid key, session or token
- 403: Not allowed for this caller
- 422: A value is refused; the message says which
- 429: A limit is reached

## Back from the Seleya sign-in

`GET /v1/auth/seleya/callback`, called with 

The shared sign-in returns here with its code; the person's session starts and they go on to where they were going.

Called by the console's own page, signed in; not for agents.

Answers:

- 302: Signed in, on to the next page
- 400: The request is malformed
- 401: No valid key, session or token
- 403: Not allowed for this caller
- 422: A value is refused; the message says which
- 429: A limit is reached

## Address's client document

`GET /v1/auth/seleya/client.json`, called with 

Seleya Address's Client ID Metadata Document for the shared sign-in.

Called by the console's own page, signed in; not for agents.

Answers:

- 200: The document
- 400: The request is malformed
- 401: No valid key, session or token
- 403: Not allowed for this caller
- 422: A value is refused; the message says which
- 429: A limit is reached

```json
{
  "client_id": "https://address.seleya.ai/api/v1/auth/seleya/client.json",
  "client_name": "Seleya Address",
  "redirect_uris": [
    "https://address.seleya.ai/api/v1/auth/seleya/callback"
  ],
  "token_endpoint_auth_method": "none"
}
```

## The shared Seleya sign-in's identity events

`POST /v1/seleya/events`, called with 

For accounts.seleya.ai only, signed by Standard Webhooks with Address's identity-event secret. When a Seleya account is deleted, its person's console sessions and agent connections end at once (B2-O60).

Called by the console's own page, signed in; not for agents.

Answers:

- 204: Done
- 401: The event is not signed by the Seleya sign-in

