> ## 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 invite

> Invite a user to the active workspace by email.

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 ExpectedOutput = ({caption = "Expected output", children}) => <div className="gv-output">
    <div className="gv-output__label">
      <svg className="gv-output__icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
        <polyline points="15 10 20 15 15 20" />
        <path d="M4 4v7a4 4 0 0 0 4 4h12" />
      </svg>
      <span>{caption}</span>
    </div>
    <div className="gv-output__body">{children}</div>
  </div>;

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" />

Send a workspace invitation to an email address. The recipient receives a sign-in link that grants them access to the workspace currently active in `~/.config/gavai/credentials.json`. This page covers the synopsis, the scope of the invite, and the exit codes the command returns.

## Synopsis

```bash theme={null}
gavai invite
```

## Arguments

None positional. The recipient email is passed via a flag — see below.

## Flags

<Note>
  The exact flag for the recipient email (and any role / scope flags) is the source of truth on the CLI itself. Run `gavai invite --help` for the authoritative list.
</Note>

## Behavior

The command is **workspace-scoped**: it always operates on the workspace named in `active_workspace`. To invite someone to a different workspace, switch the active workspace first — list candidates with `gavai tenant`, then re-run `gavai login` if you need to change which workspace the credentials are bound to.

The recipient receives an email with a one-time sign-in link. The invitation remains valid until they accept it or you revoke it from the console.

## Examples

Inspect the flag set:

```bash theme={null}
gavai invite --help
```

Confirm which workspace the invite would land in before sending:

```bash theme={null}
gavai whoami
```

<ExpectedOutput>
  ```text theme={null}
  gavin@acme.io (workspace: acme)
  ```
</ExpectedOutput>

## Exit codes

<ErrorTable
  errors={[
{ code: "0", cause: "Invitation sent.", fix: "—" },
{ code: "2", cause: "Missing or malformed email.", fix: "Pass a valid email address. Run `gavai invite --help` for the flag." },
{ code: "3", cause: "Not authenticated.", fix: "Run `gavai login`." },
{ code: "4", cause: "Insufficient scope to invite to this workspace.", fix: "Have a workspace admin mint a token with `members:write`." },
{ 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="RELATED" title="gavai tenant" href="/cli/commands/tenant">
  List the workspaces accessible to the signed-in user before sending an invite.
</BrandCard>
