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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.poly.ai/feedback

```json
{
  "path": "/api-reference/agents/endpoint/deployments/rollback-to-a-previous-deployment",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Rollback to a previous deployment



## OpenAPI

````yaml POST /v1/agents/{agentId}/deployments/{deploymentId}/rollback
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.3
  description: >-
    Build and deploy PolyAI agents programmatically. Create agents, manage
    branches, update behavior rules, configure knowledge bases, provision
    telephony, publish deployments, and update real-time configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.eu.poly.ai
    description: EU region
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
    description: Create, list, duplicate, and delete agents.
  - name: Branches
    description: Create isolated branches for parallel development and merge back to main.
  - name: Agent Behavior
    description: >-
      Read and update an agent's behavior rules (system prompt, interaction
      style, edge cases).
  - name: Knowledge Base
    description: Manage knowledge base topics used for retrieval and tool invocation.
  - name: Variants
    description: Manage site-specific variations of an agent using attributes and variants.
  - name: Deployments
    description: Publish drafts, promote across environments, and roll back deployments.
  - name: Connectors
    description: >-
      Manage telephony connectors that bind phone numbers to voice
      infrastructure.
  - name: Phone Numbers
    description: Provision, reassign, and delete phone numbers on an agent's connectors.
  - name: Real-Time Configs
    description: Update runtime values (e.g. opening hours) outside the publish workflow.
paths:
  /v1/agents/{agentId}/deployments/{deploymentId}/rollback:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: deploymentId
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Deployments
      summary: Rollback to a previous deployment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RollbackDeploymentBody'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MutationDeploymentResponse'
        '400':
          description: Validation error
        '401':
          description: Unauthorized – missing or invalid API key
        '403':
          description: Forbidden – insufficient permissions
        '404':
          description: Resource not found
components:
  schemas:
    RollbackDeploymentBody:
      description: Metadata attached to a rollback action.
      type: object
      properties:
        deploymentMessage:
          description: Message describing this rollback
          default: ''
          type: string
    MutationDeploymentResponse:
      description: |-
        The resulting deployment from a promote / rollback / publish action,
        plus any test runs it triggered.
      type: object
      properties:
        deployment:
          $ref: '#/components/schemas/DeploymentResponse'
        testRunIds:
          description: IDs of test runs triggered by this deployment action
          type: array
          items:
            type: string
      required:
        - deployment
    DeploymentResponse:
      description: |-
        A deployment of an agent version to a specific environment, plus
        who created it and when.
      type: object
      properties:
        id:
          description: Unique deployment identifier
          type: string
        accountId:
          description: Account this deployment belongs to
          type: string
        agentId:
          description: Agent (project) this deployment belongs to
          type: string
        environment:
          description: Environment (sandbox, pre-release, live)
          type: string
        artifactVersion:
          description: Artifact version reference
          type: string
        version:
          description: Version hash linking deployments across environments
          type: string
        createdBy:
          description: Email of user who created the deployment
          type: string
        createdAt:
          description: ISO 8601 timestamp of when the deployment was created
          type: string
        metadata:
          description: Deployment metadata (e.g. deployment_message)
          type: object
      required:
        - id
        - accountId
        - agentId
        - environment
        - artifactVersion
        - version
        - createdBy
        - createdAt
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````