---
title: "Publish the current draft to an environment"
method: POST
path: "/v1/agents/{agentId}/deployments/publish"
tags: ["Deployments"]
---

# Publish the current draft to an environment

`POST /v1/agents/{agentId}/deployments/publish`

## Request body

- PublishDeploymentBody — Metadata attached to a publish action, with an optional target environment.
  - `deploymentMessage` string — Message describing this publish
  - `environment` string — Environment to publish to (defaults to sandbox)

## Response `201`

Successful response

- MutationDeploymentResponse — The resulting deployment from a promote / rollback / publish action, plus any test runs it triggered.
  - `deployment` DeploymentResponse, required — A deployment of an agent version to a specific environment, plus who created it and when.
    - `id` string, required — Unique deployment identifier
    - `accountId` string, required — Account this deployment belongs to
    - `agentId` string, required — Agent (project) this deployment belongs to
    - `environment` string, required — Environment (sandbox, pre-release, live)
    - `artifactVersion` string, required — Artifact version reference
    - `version` string, required — Version hash linking deployments across environments
    - `createdBy` string, required — Email of user who created the deployment
    - `createdAt` string, required — ISO 8601 timestamp of when the deployment was created
    - `metadata` object — Deployment metadata (e.g. deployment_message)
  - `testRunIds` string[] — IDs of test runs triggered by this deployment action

## Other responses

- `400` — Validation error
- `401` — Unauthorized – missing or invalid API key
- `403` — Forbidden – insufficient permissions

---

[API](https://skmtc.net/poly/apis/polyai-agents-api.md) · [All operations](https://skmtc.net/poly/apis/polyai-agents-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/poly/polyai-agents-api/revisions/76f3c606e395/schema)
