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

# Sessions and commands

> Create a Linc session, send prompts, cancel work, and end the runtime.

## Create a session

`POST /linc/v1/sessions` starts asynchronous provisioning and returns `202 Accepted`.

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl -X POST https://api.case.dev/linc/v1/sessions \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Privilege review",
    "model": "casemark/core-large",
    "idleTimeoutMs": 900000,
    "vaultIds": ["vault_123"],
    "skillSlugs": ["privilege-review"],
    "documentTemplateSlugs": ["privilege-log"]
  }'
```

The response includes the session ID, provisioning status, installed-skill report, and URLs for
state, replay, and live event streams. Missing requested skills are reported explicitly.

## Wait for activation

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl https://api.case.dev/linc/v1/sessions/$SESSION_ID/state \
  -H "Authorization: Bearer $CASEDEV_API_KEY"
```

Wait until `session.status` is `active`. A runtime that has idle-stopped remains resumable; the
next prompt wakes it and restores its session file.

## Send a prompt

Commands use the native Linc RPC envelope. Prompt IDs are idempotency keys, so retry the same
request with the same ID if delivery is uncertain.

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl -X POST https://api.case.dev/linc/v1/sessions/$SESSION_ID/rpc \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "prompt",
    "id": "prompt_01",
    "message": "Review the agreement and produce a risk-ranked issue list."
  }'
```

The endpoint returns `202 Accepted` after Linc accepts or rejects the command. Read results from
the event stream or durable replay endpoints.

## Cancel or end

Abort only the current turn while preserving the session:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl -X POST https://api.case.dev/linc/v1/sessions/$SESSION_ID/cancel \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"clearQueue": true}'
```

End the session and stop its sandbox:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl -X DELETE https://api.case.dev/linc/v1/sessions/$SESSION_ID \
  -H "Authorization: Bearer $CASEDEV_API_KEY"
```

Deletion revokes the managed session credential and marks the durable session record as ended.
