---
title: "Uploads"
description: "Upload a local PDF, DOCX, or PNG for an envelope, keep a template permanently, and check its placeholders with the SignatureAPI CLI uploads commands."
canonical: "https://signatureapi.com/docs/cli/uploads"
source: "https://signatureapi.com/docs/cli/uploads.md"
last_verified_api_version: "1.18.1"
---

# Uploads

Upload a local PDF, DOCX, or PNG for an envelope, keep a template permanently, and check its placeholders with the SignatureAPI CLI uploads commands.

_Last verified against API version 1.18.1._

The `uploads` commands turn a file on your machine into a URL you can use as a document's `url` in [`envelopes create`](https://signatureapi.com/docs/cli/envelopes), and show what SignatureAPI found in it.

| Command           | API operations                                                                                                                                                                         |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uploads create`  | [Create an upload URL](https://signatureapi.com/docs/api/resources/uploads/create-url), then [Store an upload](https://signatureapi.com/docs/api/resources/uploads/store) with `--key` |
| `uploads inspect` | [Retrieve upload structure](https://signatureapi.com/docs/api/resources/uploads/structure)                                                                                             |

Uploads belong to the account, not to a mode, so these commands take no `--mode`. Any credential works: the sign-in, a test key, or a live key.

## Upload a local document

```bash
npx signatureapi uploads create contract.pdf
```

The result shows the upload ID (`upl_...`) and its URL. Use the URL as a document's `url` in an envelope body. The upload expires after 24 hours.

The file can be a PDF, DOCX, or PNG, up to your account's maximum document size. Its extension and its first bytes must agree. A larger file fails with `validation-error` before any bytes are sent.

The CLI uploads through an [upload URL](https://signatureapi.com/docs/api/resources/uploads/create-url): it requests a signed URL for the file, then sends the bytes to it. That is why it takes files over 4.5 MB. From your own code, use [Create an upload](https://signatureapi.com/docs/api/resources/uploads/create), the recommended way for files up to 4.5 MB. Upload URLs are for larger files.

## Upload and send in one step

Read the URL from the `--json` result and put it into the envelope body with `jq`:

```bash
url=$(npx signatureapi uploads create contract.pdf --json | jq -r 'select(.type == "result") | .data.url')
jq --arg url "$url" '.documents[0].url = $url' envelope.json | npx signatureapi envelopes create --body -
```

`envelope.json` is the body from [Request bodies](https://signatureapi.com/docs/cli/working-with-resources#request-bodies). Its places need the `[[client_signs_here]]` and `[[provider_signs_here]]` placeholders in your document; [check them first](https://signatureapi.com/docs/cli/uploads#check-placeholders-before-you-send).

## Keep a template permanently

With `--key`, the CLI also [stores the upload](https://signatureapi.com/docs/api/resources/uploads/store) under that key, and it does not expire:

```bash
npx signatureapi uploads create template.pdf --key contract-template-v2
```

A key is 1 to 100 lowercase letters, digits, hyphens, and underscores, unique within the account. SignatureAPI can refuse to store it, for example with `upload-key-conflict` when another upload has that key. The result is then `upload_not_stored`, and its `url` still works as a temporary upload.

## Check placeholders before you send

`uploads inspect` shows a PDF or DOCX upload's structure: its pages, the `[[key]]` placeholders it found, and, for DOCX templates, its template fields. Run it before you create the envelope to check that every place key has its placeholder.

The text output shows the format and the page count. The placeholders are in the `--json` result:

```bash
npx signatureapi uploads inspect upl_3JJz6t1o8A5YjX5VpnX27Z --json \
  | jq -c 'select(.type == "result") | .data.placeholders[] | {key, page_number, errors}'
```

```json Output
{"key":"client_signs_here","page_number":1,"errors":[]}
{"key":"provider_signs_here","page_number":1,"errors":[]}
```

A placeholder with entries in `errors` can't be used as written, for example because its key is used twice. See [Retrieve upload structure](https://signatureapi.com/docs/api/resources/uploads/structure) for every field.

## Command reference

Generated from the help of the published `signatureapi` package.

Commands of the `signatureapi` CLI, version 0.7.1. Run `npx signatureapi <command> --help` for the same text in a terminal.

### `uploads create`

Upload a local PDF, DOCX or PNG and show the URL to use as a document's url in envelopes create. Uploads expire after 24 hours unless --key stores them permanently, and belong to the account, not a mode.

```bash
npx signatureapi uploads create <path> [options]
```

Arguments:

- `<path>`: PDF, DOCX or PNG file to upload, up to the account's maximum document size

Options:

- `--key <key>`: Store the upload permanently under this key (permanent uploads don't expire)

Global options: `--api-key-var`, `--credential-store`, `--json`.

Upload a contract:

```bash
npx signatureapi uploads create contract.pdf
```

Upload and keep the URL for a script:

```bash
npx signatureapi uploads create contract.pdf --json
```

Upload a template and keep it permanently:

```bash
npx signatureapi uploads create template.pdf --key contract-template-v2
```

Related: https://signatureapi.com/docs/api/resources/uploads/object

### `uploads inspect`

Show the analyzed structure of a PDF or DOCX upload: pages, the placeholders found and, for DOCX templates, the template fields. Uploads belong to the account, not a mode.

```bash
npx signatureapi uploads inspect <upload-id> [options]
```

Arguments:

- `<upload-id>`: ID of the upload (upl_...), as uploads create shows it

Global options: `--api-key-var`, `--credential-store`, `--json`.

Inspect an uploaded contract:

```bash
npx signatureapi uploads inspect upl_...
```

Related: https://signatureapi.com/docs/api/resources/uploads/object
