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

# Authentication

> Authenticate with Pragmatiks

## Login

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma auth login
```

Opens your browser for authentication.

## Check Status

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma auth whoami
```

## Logout

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma auth logout
```

## Contexts

Contexts allow you to switch between different Pragmatiks environments—for example, development and production—each with its own API endpoint and credentials.

Each context stores:

* **API URL** - The endpoint for that environment
* **Authentication token** - Your credentials for that environment

This is useful when you need to work with multiple deployments or test against a local development server.

<Note>
  You can override the current context for a single command using the `--context` / `-c` flag, or set the `PRAGMA_CONTEXT` environment variable.
</Note>

### List Contexts

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma config get-contexts
```

### Switch Context

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma config use-context production
```

### Create Context

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma config set-context staging --api-url <url>
```

### Delete Context

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
pragma config delete-context staging
```

## Next Steps

<Card title="Resources" icon="cube" href="/cli/resources">
  Start managing resources.
</Card>
