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

# Finalize run

> Finalize a run.

`finalizeRun(command: RunsFinalizeRunCommand!, idempotencyKey: String): RunsRun!`

## Arguments

| Argument | Type | Required | Description |
| - | - | - | - |
| `command` | [`RunsFinalizeRunCommand!`](https://veryfront.com/docs/cloud/graphql/types/runsfinalizeruncommand) | Yes | |
| `idempotencyKey` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Retry key for this mutation (1-128 characters); overrides Idempotency-Key. |

## Input fields

### command

[`RunsFinalizeRunCommand`](https://veryfront.com/docs/cloud/graphql/types/runsfinalizeruncommand)

| Field | Type | Required | Description |
| - | - | - | - |
| `runId` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Yes | Run for a terminal action. A fresh or different terminal request against an already-terminal run or stale execution generation returns 409. Retrying the identical request with the same idempotency key returns its stored result after replay authorization. |
| `input` | [`RunsFinalizeRunCommandInput!`](https://veryfront.com/docs/cloud/graphql/types/runsfinalizeruncommandinput) | Yes | Finalizes a run with output or an error. |

## Response

Returns [`RunsRun!`](https://veryfront.com/docs/cloud/graphql/types/runsrun). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `id` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Unique run UUID. |
| `runId` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Public run ID that run events (metadata.run\_id) and runtime tools name. Equals id for runs the server names; older runs keep their run\_ ID. |
| `status` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Current execution state. |
| `projectId` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Project containing the run. |
| `target` | [`RunsRunTarget!`](https://veryfront.com/docs/cloud/graphql/types/runsruntarget) | Execution definition; its ID may be null only on historical runs. |
| `input` | [`JSON`](https://veryfront.com/docs/cloud/graphql/types/json) | Business input supplied when the run was created. |
| `output` | [`JSON`](https://veryfront.com/docs/cloud/graphql/types/json) | Final business output; null until successful finalization. |
| `error` | [`RunsRunError`](https://veryfront.com/docs/cloud/graphql/types/runsrunerror) | Failure details, present only when the run failed. |

[All fields of `RunsRun`](https://veryfront.com/docs/cloud/graphql/types/runsrun).

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
mutation FinalizeRun($command: RunsFinalizeRunCommand!, $idempotencyKey: String) {
  finalizeRun(command: $command, idempotencyKey: $idempotencyKey) {
    id
    projectId
    runId
    status
    createdAt
  }
}
```

```json title="variables.json" theme={null}
{
  "command": {
    "runId": "11111111-1111-4111-8111-111111111111",
    "input": {
      "status": "completed",
      "output": {
        "summary": "A short summary."
      }
    }
  }
}
```

<details>
  <summary>Try this mutation</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Mutation

  Variables (JSON)
</details>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.