> ## Documentation Index
> Fetch the complete documentation index at: https://docs.co-mind.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 1. Log in

> Sign in to receive a session JWT and confirm which workspace your session is scoped to.

The first thing you do is establish an interactive session. Sign in with email and password, get a short-lived JWT back, and confirm which workspace it applies to. If you belong to more than one workspace, switch it now — the Personal Access Token you'll mint in the next step inherits the workspace active on this session.

## Sign in

```bash theme={null}
curl -X POST {BASE_URL}/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "password": "your-password"
  }'
```

```json theme={null}
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer",
  "expires_in": 3600
}
```

Save the access token — it's what you'll authenticate the next couple of requests with:

```bash theme={null}
export JWT="eyJhbGciOiJIUzI1NiIs..."
```

## Confirm your workspace

Check which workspace (tenant) your session is scoped into, plus every other workspace you have access to:

```bash theme={null}
curl {BASE_URL}/v1/auth/me \
  -H "Authorization: Bearer $JWT"
```

```json theme={null}
{
  "id": "user_abc123",
  "email": "you@example.com",
  "currentTenantId": "tenant_workspace1",
  "memberships": [
    { "tenantId": "tenant_workspace1", "role": "Admin", "tenantName": "Workspace One" },
    { "tenantId": "tenant_workspace2", "role": "Member", "tenantName": "Workspace Two" }
  ]
}
```

`currentTenantId` is the workspace the next actions apply to.

## Switch workspace (only if you need to)

If you have more than one membership and need a different active workspace before minting the PAT:

```bash theme={null}
curl -X POST {BASE_URL}/v1/auth/switch-tenant \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{"tenantId": "tenant_workspace2"}'
```

The response returns a new JWT pair scoped to the chosen workspace. Update `$JWT` with the new access token and re-run `/v1/auth/me` to confirm.

<Tip>
  A JWT lasts one hour by default. Long enough to follow this walkthrough; for anything long-lived, use the Personal Access Token you're about to mint.
</Tip>

Next: [Create a Personal Access Token →](/guides/api-walkthrough/personal-access-token)
