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

# Auth

> Log in and end sessions for Workspace API access.

Use these endpoints to exchange credentials for a session and log out. For SSO login redirects (Google/Microsoft) and integration OAuth, see [OpenID & OAuth](/en/developer-manual/build-with-zylon/workspace-api/authentication/openid).

## Account creation

Use `POST /api/v1/auth/register` to create a new credentials-based account.

To use that account in Workspace, complete one of these operations:

* Create a workspace user with the account ID in [Users - Create a user](/en/developer-manual/build-with-zylon/workspace-api/users/user).
* Join directly to an organization through `POST /api/v1/account/organization/{orgId}/join`.

## Log in with credentials

```bash theme={null}
curl -X POST "https://{BASE_URL}/api/v1/auth/login" \
  -H "Authorization: Bearer {API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "{username}",
    "password": "{password}"
  }'
```

<Accordion title="Example response">
  ```json theme={null}
  {
    "id": "acct_6c8a1f3b2d4e5f7a",
    "email": "sasha@auroralabs.com",
    "name": "Sasha Patel",
    "given_name": "Sasha",
    "family_name": "Patel",
    "provider": "Credentials",
    "users": [
      {
        "id": "user_4b7c2a1d9e5f3c8b",
        "org_id": "org_2f3a9d1c7b5e4a8f",
        "account_id": "acct_6c8a1f3b2d4e5f7a",
        "name": "Sasha Patel",
        "email": "sasha@auroralabs.com",
        "state": "Active",
        "roles": ["AppAdmin"],
        "created_at": "2026-02-08T14:12:45Z"
      }
    ],
    "roles": ["AppAdmin"]
  }
  ```
</Accordion>

## Log out

```bash theme={null}
curl -X POST "https://{BASE_URL}/api/v1/auth/logout" \
  -H "Authorization: Bearer {API_TOKEN}"
```

<Accordion title="Example response">
  ```json theme={null}
  "ok"
  ```
</Accordion>

## Errors and edge cases

* **401/403**: missing or invalid API token.
* **429**: too many login attempts.
