# Preview saving a template

**POST** `/api/templates/save-preview`

Shows what saving a workflow as a template would leave out, without saving.

Needs [an API token](https://docs.gorunner.io/api/authentication#scopes) with the **Read** permission for workflows (`workflow:read`).

## Parameters

### Body

- `workflowId` · Required · UUID: The workflow you would save.

## Read it

`blanked`: values the copy leaves out, by step and field. `bound`: values that travel but arrive blank in another workspace, such as a choice filled from this account. `scope`: who would get the template.

## Responses

- 200 OK

  What would be left out.

- 400 `VALIDATION_ERROR`

  The body isn’t JSON, or `workflowId` isn’t a UUID.

- 403 `FORBIDDEN`

  The token lacks the **Read** permission for workflows.

- 404 `NOT_FOUND`

  No workflow with this ID in the workspace.

- 500 `INTERNAL_ERROR`

  The workflow couldn’t be read, so saving it would fail too.

Any call can also answer: [`401 UNAUTHORIZED`](https://docs.gorunner.io/errors#UNAUTHORIZED) · [`401 TOKEN_ENDED`](https://docs.gorunner.io/errors#TOKEN_ENDED) · [`403 TOKEN_SURFACE_OFF`](https://docs.gorunner.io/errors#TOKEN_SURFACE_OFF) · [`403 FEATURE_OFF`](https://docs.gorunner.io/errors#FEATURE_OFF) · [`403 EMBED_NOT_ALLOWED`](https://docs.gorunner.io/errors#EMBED_NOT_ALLOWED) · [`403 EMBED_NOT_AVAILABLE`](https://docs.gorunner.io/errors#EMBED_NOT_AVAILABLE) · [`403 ACCOUNT_SUSPENDED`](https://docs.gorunner.io/errors#ACCOUNT_SUSPENDED) · [`413 PAYLOAD_TOO_LARGE`](https://docs.gorunner.io/errors#PAYLOAD_TOO_LARGE) · [`415 INVALID_CONTENT_TYPE`](https://docs.gorunner.io/errors#INVALID_CONTENT_TYPE) · [`429 RATE_LIMITED`](https://docs.gorunner.io/errors#RATE_LIMITED) · [`503 BUSY`](https://docs.gorunner.io/errors#BUSY) · [`503 PAUSED`](https://docs.gorunner.io/errors#PAUSED) · [`503 SERVICE_UNAVAILABLE`](https://docs.gorunner.io/errors#SERVICE_UNAVAILABLE). See [Errors](https://docs.gorunner.io/api/errors#by-status).

Request

**curl**

```bash
GORUNNER="https://api.gorunner.io"
GORUNNER_TOKEN="grt_…"  # needs Read for workflows

curl -X POST "$GORUNNER/api/templates/save-preview" \
  -H "Authorization: Bearer $GORUNNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "workflowId": "3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31"
  }'
```

**JavaScript**

```js
const GORUNNER = "https://api.gorunner.io";
const TOKEN = process.env.GORUNNER_TOKEN;

const res = await fetch(
  `${GORUNNER}/api/templates/save-preview`,
  {
    method: "POST",
    headers: {
        Authorization: `Bearer ${TOKEN}`,
        "Content-Type": "application/json",
      },
    body: JSON.stringify({
        workflowId: "3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31",
      }),
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests

GORUNNER = "https://api.gorunner.io"
TOKEN = os.environ["GORUNNER_TOKEN"]

res = requests.post(
    f"{GORUNNER}/api/templates/save-preview",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={
      "workflowId": "3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31",
    },
)
data = res.json()["data"]
```

Response · 200 OK

```json
{
  "data": {
    "scope": "org",
    "blanked": [
      {
        "step": "forward",
        "stepLabel": "Forward to fulfilment",
        "field": "auth_token",
        "fieldLabel": "Bearer Token"
      }
    ],
    "bound": []
  }
}
```

**Every field**

### Body

- `workflowId` · Required · UUID

### Response · 200 OK

- `data` · object
  - `scope` · string: Who would get it. One of `org`, `workspace`.
  - `blanked` · array of objects: Each value saving would leave out.
    - `step` · string: The step’s name (the trigger’s own name for the trigger).
    - `stepLabel` · string: The step as the canvas names it.
    - `field` · string: The top-level input key.
    - `fieldLabel` · string: The app’s title for the input.
  - `bound` · array of objects: Values that travel but arrive blank in any other workspace. The same fields as `data.blanked` above.

Related: [Save a workflow as a template](https://docs.gorunner.io/api/templates/create-template)

Source: https://docs.gorunner.io/api/templates/preview-template-save
