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

# publishVersion

> Starts publishing a version and returns it at once, in state `UPDATING` (`PREVIEW_PUBLISH_STARTED` with `isPreview: true`). Publishing runs in the background: follow `ApiVersion.state` until `PUBLISHED` or `PUBLISH_FAILED`, and `publishingStatus` for the steps. On a `PUBLISHED` version it publishes only what changed. Fails with `ConflictError` when the version has no endpoints, a publish is already running, or the state isn't `NEW`, `PUBLISHED`, `OPERATIONAL` or `PUBLISH_FAILED`.



**mutation** `publishVersion(input: PublishVersionInput!): PublishVersionPayload!`

## Arguments

**`input`**: `PublishVersionInput!` (required)

## Returns

`PublishVersionPayload!`

**`apiVersion`**: `ApiVersion`

---

**`errors`**: `[PublishVersionError!]`

## Examples

```graphql Mutation
mutation PublishVersion($input: PublishVersionInput!) {
  publishVersion(input: $input) {
    apiVersion {
      allowedOrigins
      applications {
        edges {
          __typename
        }
        nodes {
          __typename
        }
        pageInfo {
          __typename
        }
        totalCount
      }
      authentication
      cardDefinitions {
        edges {
          __typename
        }
        nodes {
          __typename
        }
        pageInfo {
          __typename
        }
        totalCount
      }
      clusters {
        edges {
          __typename
        }
        nodes {
          __typename
        }
        pageInfo {
          __typename
        }
      }
      createdAt
    }
    errors {
      __typename
      ... on GraphQlError {
        code
        details {
          __typename
        }
        message
      }
    }
  }
}
```

```json Variables
{
  "input": {
    "destinationId": "id",
    "id": "id",
    "isPreview": true
  }
}
```

```json Response
{
  "data": {
    "publishVersion": {
      "apiVersion": {
        "allowedOrigins": [
          "value"
        ],
        "applications": {
          "edges": [
            {
              "__typename": "ApplicationsEdge"
            }
          ],
          "nodes": [
            {
              "__typename": "Application"
            }
          ],
          "pageInfo": {
            "__typename": "PageInfo"
          },
          "totalCount": 1
        },
        "authentication": "PROTECTED",
        "cardDefinitions": {
          "edges": [
            {
              "__typename": "CardDefinitionsEdge"
            }
          ],
          "nodes": [
            {
              "__typename": "CardDefinition"
            }
          ],
          "pageInfo": {
            "__typename": "PageInfo"
          },
          "totalCount": 1
        },
        "clusters": {
          "edges": [
            {
              "__typename": "ClustersEdge"
            }
          ],
          "nodes": [
            {
              "__typename": "Cluster"
            }
          ],
          "pageInfo": {
            "__typename": "PageInfo"
          }
        },
        "createdAt": "value"
      },
      "errors": [
        {
          "__typename": "GraphQlError",
          "code": "string",
          "details": [
            {
              "__typename": "KeyValuePairOfStringAndString"
            }
          ],
          "message": "string"
        }
      ]
    }
  }
}
```


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