---
title: "nextmail share-links"
description: "Every command in this namespace, with its arguments, flags and examples."
url: "https://nextmail.sh/docs/cli/reference/share-links"
area: "CLI"
category: "Reference"
---

# nextmail share-links

Every command in this namespace, with its arguments, flags and examples.

## Commands

### `nextmail share-links list`

List one page of the public links of the workspace

```bash
nextmail share-links list [flags]
```

Returns one page of the templates, forms and automations this workspace shares at a public link, the newest link first, with how often each page was opened and how often the item was copied from it. Everything is private until it is shared, so an item that is not in the list has no link. Paging is keyset: `--limit` takes 1 to 100 and defaults to 50, and `nextCursor` goes back as `--cursor` while `hasMore` is true.

One read scope is enough, and each one reaches its own kind: `templates:read` lists the templates, `forms:read` the forms and `automations:read` the automations, and the kinds a key cannot read are left out. An app a member connected lists the templates of the workspace and the forms and automations that member made.

Add `--all` to walk every page: a table on a terminal, one JSON object per line when piped or with `--ndjson`, and one `{ items, hasMore, nextCursor }` document with `--json`. `--max <n>` stops after that many items.

- Scopes: `templates:read`.
- Needs a sign-in.
- Aliases: `ls`.

**Flags**

- `--kind <value>`: Only links to this kind of item: `template`, `form` or `automation`. Left out, every kind the scopes read.
- `--limit <n>` (default `50`): Rows per page, a whole number from 1 to 100. The server defaults to 50.
- `--cursor <value>`: The `nextCursor` from the previous page, passed back exactly as it came. It names the last link of that page, so one that names no link of this workspace is a 400 `invalid_cursor`, and so is one whose link was made private since.
- `--all`: Fetch every page and stream the items as they arrive.
- `--max <n>`: Stop after this many items. Implies `--all`.
- `--ndjson`: Print every item as one JSON object per line. Implies `--all`

**Examples**

```bash
nextmail share-links list
```

With optional flags

```bash
nextmail share-links list --kind template
```

Walk every page and stop after 100 items

```bash
nextmail share-links list --all --max 100
```

One JSON object per line when piped

```bash
nextmail share-links list --all > share-links.ndjson
```

Also available in: API [`GET /share-links`](https://nextmail.sh/docs/api/reference/sharing#get-share-links); TypeScript [`shareLinks.list()`](https://nextmail.sh/docs/sdk/reference/share-links#list); Python [`share_links.list()`](https://nextmail.sh/docs/python/reference/share-links#list); Ruby [`share_links.list`](https://nextmail.sh/docs/ruby/reference/share-links#list); PHP [`shareLinks->list`](https://nextmail.sh/docs/php/reference/share-links#list); Go [`ShareLinks.List`](https://nextmail.sh/docs/go/reference/share-links#list); Java [`shareLinks().list`](https://nextmail.sh/docs/java/reference/share-links#list); C# [`ShareLinks.ListAsync`](https://nextmail.sh/docs/csharp/reference/share-links#list).

### `nextmail share-links get`

Read the public link of a template, form or automation

```bash
nextmail share-links get <kind> <item-id> [flags]
```

Resolves with the public link of one item, with how often its page was opened and how often the item was copied from it. `url` is the page anyone with the link can open without an account, and `token`, its last part, is what `shared.get` and `shared.copy` take.

Reading it takes the read scope of its kind: `templates:read`, `forms:read` or `automations:read`. A private item has no link, so it answers 404 `share_link_not_found`, and `set` makes it public.

- Scopes: `templates:read`.
- Needs a sign-in.
- Aliases: `show`, `view`.

**Arguments**

- `<kind>` (required): What the item is: `template`, `form` or `automation`.
- `<item-id>` (required): The id of the item, as `templates.list`, `forms.list` or `automations.list` returns it: a `tpl_`, `frm_` or `aut_` id. A template is named by its id here, never by its slug.

**Examples**

```bash
nextmail share-links get form frm_8d2f6a1c9b3e47d0a5f1c2e9
```

Print the raw JSON

```bash
nextmail share-links get form frm_8d2f6a1c9b3e47d0a5f1c2e9 --json
```

Also available in: API [`GET /share-links/{kind}/{itemId}`](https://nextmail.sh/docs/api/reference/sharing#get-share-links-kind-itemid); TypeScript [`shareLinks.get()`](https://nextmail.sh/docs/sdk/reference/share-links#get); Python [`share_links.get()`](https://nextmail.sh/docs/python/reference/share-links#get); Ruby [`share_links.get`](https://nextmail.sh/docs/ruby/reference/share-links#get); PHP [`shareLinks->get`](https://nextmail.sh/docs/php/reference/share-links#get); Go [`ShareLinks.Get`](https://nextmail.sh/docs/go/reference/share-links#get); Java [`shareLinks().get`](https://nextmail.sh/docs/java/reference/share-links#get); C# [`ShareLinks.GetAsync`](https://nextmail.sh/docs/csharp/reference/share-links#get).

### `nextmail share-links set`

Make a template, form or automation public

```bash
nextmail share-links set <kind> <item-id> [flags]
```

Shares one item at a public link, as Share does in the app, and resolves with the link. Anyone holding `url` can open the page without an account and try the item there: fill in the props of a template, type into a form or follow an automation step by step. With `copyable` on, anyone signed in can also copy it into their own workspace.

An item that is already public keeps its link and its counts, so the call is safe to repeat. `--copyable` changes whether people may copy it, and leaving it out keeps what it was, which is `true` for a new link, so a call with no body shares an item with the defaults.

The page shows what is live: the published version of a template, the published design of a form and the published flow of an automation, or the draft while nothing was published. A copy carries the design only, never the submissions, sends, runs or contacts the original collected, and never the audiences, addresses, forms or webhook endpoints it points at, which stay with you.

- Scopes: `templates:write`.
- Needs a sign-in.

**Arguments**

- `<kind>` (required): What the item is: `template`, `form` or `automation`.
- `<item-id>` (required): The id of the item, as `templates.list`, `forms.list` or `automations.list` returns it: a `tpl_`, `frm_` or `aut_` id. A template is named by its id here, never by its slug.

**Flags**

- `--copyable`: `true` lets anyone signed in copy the item into their own workspace from the page, and `false` lets people only look at it. Left out, a new link is copyable and a link that already exists keeps what it had.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
nextmail share-links set template tpl_3f9a1c7e5b2d48a6c0e4f1b9
```

With optional flags

```bash
nextmail share-links set template tpl_3f9a1c7e5b2d48a6c0e4f1b9 --no-copyable
```

Also available in: API [`PUT /share-links/{kind}/{itemId}`](https://nextmail.sh/docs/api/reference/sharing#put-share-links-kind-itemid); TypeScript [`shareLinks.set()`](https://nextmail.sh/docs/sdk/reference/share-links#set); Python [`share_links.set()`](https://nextmail.sh/docs/python/reference/share-links#set); Ruby [`share_links.set`](https://nextmail.sh/docs/ruby/reference/share-links#set); PHP [`shareLinks->set`](https://nextmail.sh/docs/php/reference/share-links#set); Go [`ShareLinks.Set`](https://nextmail.sh/docs/go/reference/share-links#set); Java [`shareLinks().set`](https://nextmail.sh/docs/java/reference/share-links#set); C# [`ShareLinks.SetAsync`](https://nextmail.sh/docs/csharp/reference/share-links#set).

### `nextmail share-links delete`

Make a template, form or automation private

```bash
nextmail share-links delete <kind> <item-id> [flags]
```

Takes the public link of one item down, as turning Share off does in the app, and resolves with the link that stopped working. The page stops working at once for everyone who has the link, and the copies already made stay in the workspaces that made them.

Making the item public again with `set` gives it a new link with its counts at zero, so the old `url` never works again. Deleting the template, form or automation itself takes its link down too.

- Scopes: `templates:write`.
- Needs a sign-in.
- Asks you to confirm.
- Aliases: `rm`, `del`, `remove`.

**Arguments**

- `<kind>` (required): What the item is: `template`, `form` or `automation`.
- `<item-id>` (required): The id of the item, as `templates.list`, `forms.list` or `automations.list` returns it: a `tpl_`, `frm_` or `aut_` id. A template is named by its id here, never by its slug.

**Examples**

```bash
nextmail share-links delete automation aut_5c1e9a7b3d2f48e6a0b4c7d1
```

Skip the confirmation, for scripts

```bash
nextmail share-links delete automation aut_5c1e9a7b3d2f48e6a0b4c7d1 --yes
```

Also available in: API [`DELETE /share-links/{kind}/{itemId}`](https://nextmail.sh/docs/api/reference/sharing#delete-share-links-kind-itemid); TypeScript [`shareLinks.delete()`](https://nextmail.sh/docs/sdk/reference/share-links#delete); Python [`share_links.delete()`](https://nextmail.sh/docs/python/reference/share-links#delete); Ruby [`share_links.delete`](https://nextmail.sh/docs/ruby/reference/share-links#delete); PHP [`shareLinks->delete`](https://nextmail.sh/docs/php/reference/share-links#delete); Go [`ShareLinks.Delete`](https://nextmail.sh/docs/go/reference/share-links#delete); Java [`shareLinks().delete`](https://nextmail.sh/docs/java/reference/share-links#delete); C# [`ShareLinks.DeleteAsync`](https://nextmail.sh/docs/csharp/reference/share-links#delete).
