# --session-id Flag

> It starts a session with an ID you choose.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --session-id, --session-id

## Think of it like

It is like you pick your own box number. Then you put your bag in that box.

## Definition

--session-id starts a session with an ID you choose, not one Claude Code makes up. The ID must be a UUID, a long code of letters and numbers in a fixed shape. A script uses it to know the ID up front, so it can resume or look up that exact session later.

## Example

Emma's script makes a UUID, saves it with the job, then runs claude -p with that --session-id. The next day it resumes the same session by the saved ID.

## Example code

```bash
claude --session-id "550e8400-e29b-41d4-a716-446655440000"
```

Start a session with a set UUID.

## Why it matters

A script can find its own sessions later without reading a list or guessing.

## Common mistake

Passing a name like fix-login. It must be a UUID. For a name you can read, use --name.

## Three principles

- **You choose it.** Up front.
- **Must be a UUID.** Not a name.
- **For scripts.** To find it later.

## Related terms

- [--name Flag](https://learn.benibix.com/term/ai/name-flag)
- [--resume Flag](https://learn.benibix.com/term/ai/resume-flag)
- [Non-Interactive Mode](https://learn.benibix.com/term/ai/non-interactive-mode)

## Told apart from

- [--name vs --session-id](https://learn.benibix.com/compare/name-flag-vs-session-id-flag): People think --name and --session-id are two ways to label a session. They are not the same kind of thing. --name is a label for people: any short text you will remember, shown in the /resume list and the title bar, and you can change it with /rename. --session-id is the session's real ID, and it must be a UUID. A script sets it so it can find that exact session later. Pick --name for yourself and --session-id for a script.

## Taught in

- [Resume, Branch and Rename](https://learn.benibix.com/learn/ai-claude-code-commands/resume-branch-and-rename): Claude Code Commands, 4/17

![Set a name or ID when you start, then use it with --resume or --from-pr to come back.](https://learn.benibix.com/diagrams/flag-find-session.svg)

---

Source: https://learn.benibix.com/term/ai/session-id-flag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
