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

# Turn On Agent Deployments

> Turns on deployments for the agent: the dashboard's **Deployments** mode. In the API this setting is called `versioning` (as in this path, `versioning.enabled` and the `VERSIONING_ON`/`VERSIONING_OFF` reasons); an agent without it is in the dashboard's **Versioning** mode. This is one way: it can't be turned off. Calling it again changes nothing and returns the current state. Nothing callers hear changes: `prod` keeps running what it runs now, and `dev` and `staging` start on that same version with a copy of `prod`'s values. From then on, versions are published to `dev` and promoted to `staging` and `prod` (see the environment endpoints), and you can run A/B tests on `prod` with Set Agent Deployment.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/voice-agents/{voiceAgentId}/versioning:enable
openapi: 3.0.1
info:
  title: Hamsa API
  description: >-
    The Hamsa API: voice agents and their calls, phone numbers, batch calls and
    knowledge bases; speech to text, text to speech, voices and AI content.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v2/voice-agents/{voiceAgentId}/versioning:enable:
    post:
      summary: Turn on deployments for an agent
      description: >-
        Turns on deployments for the agent: the dashboard's **Deployments**
        mode. In the API this setting is called `versioning` (as in this path,
        `versioning.enabled` and the `VERSIONING_ON`/`VERSIONING_OFF` reasons);
        an agent without it is in the dashboard's **Versioning** mode. This is
        one way: it can't be turned off. Calling it again changes nothing and
        returns the current state. Nothing callers hear changes: `prod` keeps
        running what it runs now, and `dev` and `staging` start on that same
        version with a copy of `prod`'s values. From then on, versions are
        published to `dev` and promoted to `staging` and `prod` (see the
        environment endpoints), and you can run A/B tests on `prod` with Set
        Agent Deployment.
      parameters:
        - in: path
          name: voiceAgentId
          required: true
          description: ID of the voice agent.
          schema:
            type: string
            format: uuid
            example: fc6f158b-24c2-45a6-957b-c57c0a8979b5
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      versioning:
                        type: object
                        properties:
                          enabled:
                            type: boolean
                            example: true
                          enabledAt:
                            type: string
                            format: date-time
                            example: '2026-10-28T09:15:00.000Z'
                          enabledBy:
                            $ref: '#/components/schemas/AgentVersionActor'
                      environments:
                        type: array
                        items:
                          $ref: '#/components/schemas/AgentVersionEnvironment'
                        description: '`dev`, `staging` and `prod`, in that order.'
        '400':
          description: Invalid request (for example a missing or invalid field).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '401':
          description: 'Unauthorized: missing or invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '403':
          description: >-
            Your API key or role does not have the `agents:manage_versioning`
            permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '404':
          description: Voice agent not found in this project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AgentVersionActor:
      type: object
      description: A project member.
      properties:
        id:
          type: string
          format: uuid
          example: b7d9e979-4a16-437b-8571-4ed92a94faa8
        name:
          type: string
          example: Sara Ahmad
    AgentVersionEnvironment:
      type: object
      description: One of the agent's environments (`dev`, `staging`, `prod`).
      properties:
        id:
          type: string
          format: uuid
          example: 6d2e8f14-3a7b-4c9d-b1e5-0f8a2c4d6e71
        name:
          type: string
          enum:
            - dev
            - staging
            - prod
          example: prod
        isDefault:
          type: boolean
          description: '`true` for `prod`.'
          example: true
        isLocked:
          type: boolean
          description: 'Always `true`: every agent has exactly these three environments.'
          example: true
        revision:
          type: string
          format: uuid
          description: Current revision of the environment's values.
          example: 1c5a7e93-4d2f-4b6a-9e8c-3f1d5b7a9c02
        variables:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                example: SUPPORT_PHONE
              value:
                type: string
                example: '+966500000000'
        savedBy:
          $ref: '#/components/schemas/AgentVersionActor'
          description: Who last saved the values.
        updatedAt:
          type: string
          format: date-time
          example: '2026-10-28T09:15:00.000Z'
        publishedVersionId:
          type: string
          format: uuid
          nullable: true
          description: 'The version this environment runs. `null`: none yet.'
          example: 3b9e2c71-8f4d-4a6b-9c1e-2d7f5a8b0c34
        deployedBy:
          $ref: '#/components/schemas/AgentVersionActor'
          description: Who pointed it at that version.
        deployedAt:
          type: string
          format: date-time
          example: '2026-10-28T09:15:00.000Z'
    AgentVersionError:
      type: object
      properties:
        code:
          type: integer
          description: Service error code (8400, 8403, 8404, 8409, ...).
          example: 8409
        message:
          type: string
          example: >-
            Your draft changed in another tab or through your API key. Reload it
            and try again.
        messageKey:
          type: string
          description: Stable error key.
          example: DraftStaleRevision
        params:
          type: object
          additionalProperties: true
          description: >-
            Details. `reason` names the case (for example `STALE_REVISION`,
            `NO_DRAFT`, `SESSION_ONLY`); `action` names a missing permission
            (for example `agents:deploy`).
          example:
            reason: STALE_REVISION
            revision: e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````

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