---
title: "alpacon work-session extend"
description: "Extend the expiry of an approved or active Alpacon work session from the CLI, and see whether the extension applied immediately or is waiting on approval."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# alpacon work-session extend

Request a later expiry for an approved or active work session.

## Usage

`alpacon work-session extend SESSION_ID [flags]`

## Key facts

- A reason is required for every extension.
- Choose `--expires-in` or `--expires-at`.
- An extension awaiting approval leaves the current expiry unchanged.

## Flags

| Flag | Type | Description | Default |
| --- | --- | --- | --- |
| `--expires-at` | `string` | New absolute expiry time (RFC3339) | — |
| `--expires-in` | `string` | New expiry set to now + duration (e.g. 2h) | — |
| `-h, --help` | `bool` | help for extend | `false` |
| `--reason` | `string` | Why the session needs more time (required) | — |
| `--output` | `string` | Output format: table or json | `table` |

## Examples

Extend a session by two hours from now

```bash
alpacon work-session extend 11111111-2222-3333-4444-555555555555 --expires-in 2h --reason "finish incident investigation"
```

Set a new absolute expiry time

```bash
alpacon work-session extend 11111111-2222-3333-4444-555555555555 --expires-at 2027-01-15T10:00:00Z --reason "finish incident investigation"
```

Explain why more time is needed

```bash
alpacon work-session extend 11111111-2222-3333-4444-555555555555 --expires-in 2h --reason "customer escalation, still triaging"
```

## Details

Extend the expiry of an approved or active work session.

`--reason` is required. Whether the extension applies right away or waits for approval follows your workspace's approval policy—see [Applied vs. pending approval](#applied-vs-pending-approval). A session with a live sudo policy where the session approval takes the place of MFA has the additional restrictions below. See [Extending with approval](/use/work-sessions/detail/#extending-with-approval) for how this works from the web console.

## Applied vs. pending approval

- **Applied**: the command prints the new expiry and exits `0`.
- **Pending approval**: the workspace queues the extension for review instead of applying it. The session's expiry is unchanged until a Superuser decides. The CLI prints a warning with the request id and the requested expiry, and exits `4`. With `--output json`, the same information is emitted as a `{"status": "pending_approval", ...}` object on stdout.

A session with a live sudo policy where the session approval takes the place of MFA never extends immediately from the CLI, MCP, an API token, or a service token. In an **Enforce** workspace it waits for a person's approval. In an **Advisory** workspace it is refused with HTTP 403 and `work_session_sudo_bypass_console_only`. Extend from the web console instead; console extensions do not have this additional hold or refusal.

The CLI exits 1 and prints `Error: Failed to extend work session: this workspace adds session-authorized sudo to a work session from the web console only; open the session in the console and add Sudo there, or use your standing sudo access.`. With `--output json`, the error includes `error_code: "work_session_sudo_bypass_console_only"`. The error refers to a sudo policy where the session approval takes the place of MFA.

The server’s [refusal response](/reference/api/#refusals) carries the hint `A session-authorized sudo policy can be added to a work session only from the web console; add it there.`.

`extend` has no `--wait`—check back with [`alpacon work-session describe`](/reference/cli/work-session/describe/) `SESSION_ID`, or run `extend` again with a new reason once the request settles. Only one extension request can be pending on a session at a time; running `extend` again while one is already pending is refused.

Source: https://docs.alpacax.com/reference/cli/work-session/extend/
