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

# gavai get

> Fetch a page document from the active workspace and print it as JSON.

export const ErrorTable = ({errors}) => <div className="gv-error-table" role="table" aria-label="Errors and fixes">
    <div className="gv-error-table__head" role="row">
      <span className="gv-error-table__col-head" role="columnheader">Error</span>
      <span className="gv-error-table__col-head" role="columnheader">Cause</span>
      <span className="gv-error-table__col-head" role="columnheader">Fix</span>
    </div>
    {errors.map((err, i) => <div className="gv-error-table__row" role="row" key={i}>
        <code className="gv-error-table__code" role="cell">{err.code}</code>
        <div className="gv-error-table__cause" role="cell">{err.cause}</div>
        <div className="gv-error-table__fix" role="cell">{err.fix}</div>
      </div>)}
  </div>;

export const Def = ({term, type, defaultValue, required, children}) => <>
    <dt className="gv-def-list__term">
      <span className="gv-def-list__name">{term}</span>
      {type && <span className="gv-def-list__type">{type}</span>}
      {required && <span className="gv-def-list__required">required</span>}
      {defaultValue !== undefined && <span className="gv-def-list__default">
          default <code>{defaultValue}</code>
        </span>}
    </dt>
    <dd className="gv-def-list__description">{children}</dd>
  </>;

export const DefList = ({children}) => <dl className="gv-def-list">{children}</dl>;

export const BrandCard = ({eyebrow, title, href, icon, badge, cta, featured = false, horizontal = false, children}) => {
  const classes = ["gv-card", featured && "gv-card--featured", horizontal && "gv-card--horizontal"].filter(Boolean).join(" ");
  const inner = <>
      {icon && <span className="gv-card__icon" aria-hidden="true">
          <Icon icon={icon} />
        </span>}
      <div className="gv-card__main">
        {(eyebrow || badge) && <div className="gv-card__meta">
            {eyebrow && <Eyebrow label={eyebrow} tone="muted" />}
            {badge && <span className="gv-card__badge">{badge}</span>}
          </div>}
        <h3 className="gv-card__title">{title}</h3>
        {children && <div className="gv-card__body">{children}</div>}
        {cta && <span className="gv-card__cta">
            {cta}
            <svg className="gv-card__cta-arrow" viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
              <line x1="7" y1="17" x2="17" y2="7" />
              <polyline points="7 7 17 7 17 17" />
            </svg>
          </span>}
      </div>
    </>;
  return href ? <a className={classes} href={href}>
      {inner}
    </a> : <div className={classes}>{inner}</div>;
};

export const Eyebrow = ({label, tone = "default"}) => <div className={`gv-eyebrow gv-eyebrow--${tone}`}>
    <span className="gv-eyebrow__bar" aria-hidden="true" />
    <span className="gv-eyebrow__label">{label}</span>
  </div>;

<Eyebrow label="CLI" />

This page covers `gavai get`, which fetches a page document from the active workspace and prints it to stdout as pretty-printed JSON. You can pipe the output through `jq`, save it to disk for editing, or diff it against a previously stored snapshot.

## Synopsis

```bash theme={null}
gavai get <id>
```

## Arguments

<DefList>
  <Def term="<id>" type="string" required>
    The page ID. Format: `page_01HXR...` (ULID).
  </Def>
</DefList>

## Flags

<Note>
  Run `gavai get --help` for the authoritative flag list. The CLI is the source of truth.
</Note>

## Behavior

The command calls `GET /v1/workspaces/{slug}/pages/{id}`, where `{slug}` is the `active_workspace` from `~/.config/gavai/credentials.json` and `{id}` is the positional argument you passed. The full page document — version string, metadata, and block tree — is written to stdout as pretty-printed JSON. Redirect or pipe it.

## Examples

Save a page document to disk:

```bash theme={null}
gavai get page_01HXR8K2M4 > page.json
```

Inspect a specific block tree path with `jq`:

```bash theme={null}
gavai get page_01HXR8K2M4 | jq '.tree.children[0].props'
```

Diff against a previously saved version:

```bash theme={null}
gavai get page_01HXR8K2M4 > current.json
diff current.json page.json
```

## Exit codes

<ErrorTable
  errors={[
{ code: "0", cause: "Document printed.", fix: "—" },
{ code: "2", cause: "Missing `<id>` or malformed ID.", fix: "Pass a `page_01H...`-shaped ULID." },
{ code: "3", cause: "Not authenticated.", fix: "Run `gavai login`." },
{ code: "4", cause: "Insufficient scope for this page.", fix: "Mint a token with `pages:read`." },
{ code: "5", cause: "Page not found in the active workspace.", fix: "Confirm the ID and the workspace with `gavai whoami`." },
{ code: "7", cause: "Network or API server error.", fix: "Retry with backoff." },
]}
/>

See [CLI overview — exit codes](/cli/overview#exit-codes) for the full table.

<BrandCard eyebrow="NEXT" title="gavai patch" href="/cli/commands/patch">
  Apply RFC 6902 JSON Patch operations to the page you just fetched.
</BrandCard>
