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

# Deploy a Botsify AI Agent with Versioned Configurations

> Learn how to configure agent instructions, save a named version, set it as active, and deploy your Botsify AI agent to production.

Botsify gives you a full version-control workflow for your AI agents. You can iterate on prompts, memory settings, and conversation flows in isolation, then promote a specific version to production with a single API call. This guide covers each step from saving a configuration through to live deployment.

<Steps>
  <Step title="Save an agent version">
    Use `POST /api/v1/update-agent` to write your agent's configuration. Every call to this endpoint creates or updates a named version associated with your bot.

    ```bash theme={null}
    curl --request POST \
      --url https://app.botsify.com/api/v1/update-agent \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer <YOUR_API_KEY>' \
      --data '{
        "bot_id": "bot_abc123",
        "name": "v2-improved-tone",
        "agent": "You are a friendly support assistant. Always greet users by name.",
        "chat_flow": { "welcome_message": "Hi there! How can I help you today?" },
        "memory": "Remember the user'\''s name and previous issues across sessions.",
        "soul": "Empathetic, concise, never dismissive.",
        "identity": "Acme Support Bot — powered by Botsify.",
        "user_info": "Collect: name, email, order number.",
        "version_id": "v2-improved-tone",
        "edit": false
      }'
    ```

    **Request body fields**

    | Field | Type | Required | Description |
    | - | - | - | - |
    | `bot_id` | string | ✅ | The ID of the bot to update |
    | `name` | string | ✅ | Human-readable label for this version |
    | `agent` | string | ✅ | The system prompt or instructions given to the AI |
    | `chat_flow` | object | ✅ | Structured conversation flow definition |
    | `memory` | string | ❌ | Instructions for what the agent should remember across turns |
    | `soul` | string | ❌ | Personality and tone guidelines for the agent |
    | `identity` | string | ❌ | How the agent should describe itself to users |
    | `user_info` | string | ❌ | Fields the agent should collect from the user |
    | `version_id` | string | ❌ | Identifier for this version; auto-generated if omitted |
    | `edit` | boolean | ❌ | Set to `true` to overwrite an existing version rather than creating a new one |
  </Step>

  <Step title="Review your saved versions">
    Before promoting a version, fetch the full list of saved versions for your bot to confirm the version ID you want to deploy.

    ```bash theme={null}
    curl --request GET \
      --url 'https://app.botsify.com/api/v1/bot/agent-versions?bot_id=bot_abc123' \
      --header 'Authorization: Bearer <YOUR_API_KEY>'
    ```

    The response returns an array of version objects — each containing its `version_id`, `name`, creation timestamp, and whether it is currently active. Note the `version_id` of the version you want to promote.
  </Step>

  <Step title="Set the active version">
    Mark a specific version as the active one. This determines which configuration is used when you trigger a deployment.

    ```bash theme={null}
    curl --request POST \
      --url https://app.botsify.com/api/v1/set-active-version \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer <YOUR_API_KEY>' \
      --data '{
        "version_id": "v2-improved-tone",
        "bot_id": "bot_abc123"
      }'
    ```

    **Request body fields**

    | Field | Type | Required | Description |
    | - | - | - | - |
    | `version_id` | string | ✅ | The ID of the version to activate |
    | `bot_id` | string | ❌ | Scopes the operation to a specific bot |
  </Step>

  <Step title="Deploy the agent">
    Push the active version — or a specific version — to production with `POST /api/v1/deploy-ai-agent`.

    ```bash theme={null}
    curl --request POST \
      --url https://app.botsify.com/api/v1/deploy-ai-agent \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer <YOUR_API_KEY>' \
      --data '{
        "version_id": "v2-improved-tone",
        "new_version_name": "Production — Jan 2025"
      }'
    ```

    **Request body fields**

    | Field | Type | Required | Description |
    | - | - | - | - |
    | `version_id` | string | ❌ | The version to deploy; defaults to the currently active version if omitted |
    | `new_version_name` | string | ❌ | An optional display name for this deployment snapshot |

    <Note>
      You do not need to pass `version_id` if you have already set the active version in the previous step. Omitting it will deploy whichever version is currently marked active for the bot.
    </Note>
  </Step>
</Steps>

<Warning>
  **Deployment is immediate and affects all live users.** As soon as `deploy-ai-agent` returns successfully, every new conversation on your bot will use the deployed configuration. Test thoroughly in a staging bot before deploying changes that affect your agent's `soul`, `identity`, or core `agent` instructions.
</Warning>

## Rollback strategy

If a deployment causes issues, call `POST /api/v1/set-active-version` with the `version_id` of your last stable release, then redeploy with `POST /api/v1/deploy-ai-agent`. Because all versions are persisted, rolling back is as fast as rolling forward.

## Next steps

* **Monitor performance** — track message counts and engagement after a deployment using [Analytics](/guides/analytics).
* **Send proactive messages** — reach out to users with announcements or follow-ups using [Send Messages](/guides/send-messages).


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