# Session

> The dashboard's sign-in: an emailed code or link, then an httpOnly cookie. No passwords

Source: https://tickets.roostertail.com/docs/reference/session

Every operation below is also in [the OpenAPI document](https://tickets.roostertail.com/v1/openapi.yaml). One that names an MCP tool can be called through [the MCP server](https://tickets.roostertail.com/docs/mcp.md); one that names none cannot.

## Email a sign-in code and link

`POST /v1/session/code`

Operation id `startSignIn`.

Starts a passwordless sign-in: emails a 6-digit code and a link to the address. The answer is the same whether or not the address has an account, so it cannot be used to find out who has one.

**Who may call it.** Anyone: no key or sign-in is needed.

**Request body** (`StartSignInInput`)

| Field | Type | Description |
| --- | --- | --- |
| `email` * | string (email) | An email address. |

\* required

```json
{
  "email": "owner@example.com"
}
```

**Answers 202.** Sent (the same answer for any address).

**Fields** (`SignInStarted`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "sign_in" |  |
| `email` * | string (email) | An email address. |
| `expires_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |

\* required

## Sign in with the code or link

`POST /v1/session/verify`

Operation id `verifySignIn`.

Finishes sign-in with the emailed `code` (and `email`) or the link's `token`, and sets the httpOnly session cookie. A first sign-in creates the person's org. An `invite` token joins that invite's org instead.

**Who may call it.** Anyone: no key or sign-in is needed.

**Request body** (`VerifySignInInput`)

| Field | Type | Description |
| --- | --- | --- |
| `email` | string (email) | An email address. |
| `code` | string | The 6-digit code from the email. |
| `token` | string | The token from the emailed link, instead of email and code. |
| `invite` | string | An invite token: a first sign-in joins that org instead of making one. |

```json
{
  "email": "owner@example.com",
  "code": "123456"
}
```

**Answers 200.** Signed in; the session cookie is set. A first sign-in makes an org.

**Fields** (`Session`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "session" |  |
| `member` * | Member | A person on the team. Signs in by an emailed code or link; there are no passwords. |
| `org` * | Org | An organization: the account. It holds both modes; every other record belongs to one of them. |
| `orgs` * | array of object | Every org this person belongs to. |
| `created_org` * | boolean | True when this sign-in made a new org (the first sign-in of a new address). |
| `expires_at` * | string (date-time) | When the session ends if unused (7 days idle). |
| `mode` | "test" \| "live" | The mode the dashboard acts in. Sent only where live mode exists (production); absent means test. |
| `live_available` | boolean | True where this organization may switch the dashboard to live mode (production, and the org cleared for live). Absent means no. |

\* required

**Errors of its own.** [`sign_in_code_invalid`](https://tickets.roostertail.com/docs/errors.md#sign_in_code_invalid), [`too_many_attempts`](https://tickets.roostertail.com/docs/errors.md#too_many_attempts), [`invite_invalid`](https://tickets.roostertail.com/docs/errors.md#invite_invalid). The errors every operation can answer are on [the errors page](https://tickets.roostertail.com/docs/errors.md).

## The current session

`GET /v1/session`

Operation id `getSession`.

The signed-in member, the org and mode the session acts in, and every org the member belongs to. The dashboard calls this on load.

**Who may call it.** A signed-in dashboard member of any role.

**Answers 200.** The session.

**Fields** (`Session`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "session" |  |
| `member` * | Member | A person on the team. Signs in by an emailed code or link; there are no passwords. |
| `org` * | Org | An organization: the account. It holds both modes; every other record belongs to one of them. |
| `orgs` * | array of object | Every org this person belongs to. |
| `created_org` * | boolean | True when this sign-in made a new org (the first sign-in of a new address). |
| `expires_at` * | string (date-time) | When the session ends if unused (7 days idle). |
| `mode` | "test" \| "live" | The mode the dashboard acts in. Sent only where live mode exists (production); absent means test. |
| `live_available` | boolean | True where this organization may switch the dashboard to live mode (production, and the org cleared for live). Absent means no. |

\* required

## Sign out

`DELETE /v1/session`

Operation id `signOut`.

Ends this dashboard session and clears its cookie. Answers 204 with no body.

**Who may call it.** A signed-in dashboard member of any role.

**Answers 204.** Signed out of this browser; the cookie is cleared. API keys and connected apps (an agent signed in as you) keep working: end those under Settings.

## Switch to another of your orgs

`POST /v1/session/org`

Operation id `switchOrg`.

Moves the session to another org the member belongs to. Everything after this call acts in that org.

**Who may call it.** A signed-in dashboard member of any role.

**Request body** (`SwitchOrgInput`)

| Field | Type | Description |
| --- | --- | --- |
| `org` * | string | An id starting with org_. |

\* required

```json
{
  "org": "org_other"
}
```

**Answers 200.** Switched.

**Fields** (`Session`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "session" |  |
| `member` * | Member | A person on the team. Signs in by an emailed code or link; there are no passwords. |
| `org` * | Org | An organization: the account. It holds both modes; every other record belongs to one of them. |
| `orgs` * | array of object | Every org this person belongs to. |
| `created_org` * | boolean | True when this sign-in made a new org (the first sign-in of a new address). |
| `expires_at` * | string (date-time) | When the session ends if unused (7 days idle). |
| `mode` | "test" \| "live" | The mode the dashboard acts in. Sent only where live mode exists (production); absent means test. |
| `live_available` | boolean | True where this organization may switch the dashboard to live mode (production, and the org cleared for live). Absent means no. |

\* required

## Switch the dashboard between test and live mode

`POST /v1/session/mode`

Operation id `switchMode`.

Moves the dashboard session between test and live mode. Live exists only on production, for an organization an operator cleared; test is always allowed.

**Who may call it.** A signed-in dashboard member of any role.

**Request body** (`SwitchModeInput`)

| Field | Type | Description |
| --- | --- | --- |
| `mode` * | "test" \| "live" |  |

\* required

```json
{
  "mode": "live"
}
```

**Answers 200.** Switched. Live mode exists only on production, for an organization cleared for it.

**Fields** (`Session`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "session" |  |
| `member` * | Member | A person on the team. Signs in by an emailed code or link; there are no passwords. |
| `org` * | Org | An organization: the account. It holds both modes; every other record belongs to one of them. |
| `orgs` * | array of object | Every org this person belongs to. |
| `created_org` * | boolean | True when this sign-in made a new org (the first sign-in of a new address). |
| `expires_at` * | string (date-time) | When the session ends if unused (7 days idle). |
| `mode` | "test" \| "live" | The mode the dashboard acts in. Sent only where live mode exists (production); absent means test. |
| `live_available` | boolean | True where this organization may switch the dashboard to live mode (production, and the org cleared for live). Absent means no. |

\* required

## Your signed-in devices

`GET /v1/session/devices`

Operation id `listSignedInDevices`.

The member's own signed-in browsers and phones across every org, this one first, then the most recently active.

**Who may call it.** A signed-in dashboard member of any role.

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `limit` | query | integer | How many to return, 1 to 100 (default 20). |
| `starting_after` | query | string | An id from the page before: the page after it. |
| `ending_before` | query | string | An id from the page after: the page before it. A list read from the database offers it as the list comes and filtered by event alone, in the default order, and answers parameter_invalid to any other… |

**Answers 200.** Your own sessions in every org: this device first, then the most recently active.

**Fields**

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "list" |  |
| `data` * | array of SignedInDevice | This page, newest first. |
| `has_more` * | boolean | True when there is another page: pass the last id as starting_after. |
| `url` * | "/v1/session/devices" | The path this list came from (/v1/session/devices). |

\* required

## Sign out one of your devices

`DELETE /v1/session/devices/{id}`

Operation id `signOutDevice`.

Ends one of the member's own sessions by its handle. Signing out the current one clears its cookie too. Someone else's session is `resource_missing`.

**Who may call it.** A signed-in dashboard member of any role.

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | A signed-in device (ses_…): a handle for one dashboard session, never its cookie or hash. |

**Answers 200.** Signed out (this device too: its cookie is cleared). Another person's or an ended session answers resource_missing.

**Fields** (`SignedOutDevice`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "signed_in_device" |  |
| `id` * | string | A signed-in device (ses_…): a handle for one dashboard session, never its cookie or hash. |
| `signed_out` * | true |  |
| `this_device` * | boolean | True when it was this session: its cookie is cleared too. |

\* required

## Sign out everywhere else

`POST /v1/session/sign_out_others`

Operation id `signOutOthers`.

Ends every session of this person but the one making the call, and every app they connected: a stolen session may have made one, and it lasts longer.

**Who may call it.** A signed-in dashboard member of any role.

**Answers 200.** Every other session ended, and every app this person connected.

**Fields** (`SignedOutOthers`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "signed_out_others" |  |
| `revoked` * | integer | How many other sessions ended. |

\* required
