# Chatbot versions

## Lists all versions of a chatbot

> \
> \
> \*\*Required Permission:\*\* \`chatbots.versions.list\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot versions","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/versions":{"get":{"operationId":"ChatbotVersionController_listVersions[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of all versions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListVersionsResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Lists all versions of a chatbot","tags":["Chatbot versions"],"description":"\n\n**Required Permission:** `chatbots.versions.list`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ListVersionsResponseDto":{"type":"object","properties":{"versions":{"description":"The list of versions.","type":"array","items":{"$ref":"#/components/schemas/VersionDto"}},"error":{"type":"string","description":"Optional error message."}},"required":["versions"]},"VersionDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the version."},"name":{"type":"string","description":"The display name of the version."},"created":{"type":"string","description":"Timestamp of when the version was created."},"deployed":{"type":"string","description":"Timestamp of when the version was deployed."},"modelId":{"type":"string","description":"The ID of the associated model."},"versionNumber":{"type":"string","description":"The semantic version number."},"stats":{"description":"Statistics about the version contents.","allOf":[{"$ref":"#/components/schemas/VersionStatsDto"}]},"description":{"type":"string","description":"A description of the version."},"environment":{"type":"string","description":"The environment this version is associated with.","enum":["dev","test","prod"]},"deploymentId":{"type":"string","description":"The ID of the active deployment, if any."},"hasActiveDeployment":{"type":"boolean","description":"Indicates whether the version has an active deployment."},"resettable":{"type":"boolean","description":"Indicates whether the version can be reset."}},"required":["id","name","created","deployed","modelId","versionNumber","stats","description","environment","hasActiveDeployment"]},"VersionStatsDto":{"type":"object","properties":{"steps":{"type":"number","description":"The number of steps in this version."},"events":{"type":"number","description":"The number of events in this version."},"intents":{"type":"number","description":"The number of intents in this version."},"entities":{"type":"number","description":"The number of entities in this version."},"flows":{"type":"number","description":"The number of flows in this version."},"triggers":{"type":"number","description":"The number of triggers in this version."}},"required":["steps","events","intents","entities","flows","triggers"]}}}}
```

## Creates a new version

> \
> \
> \*\*Required Permission:\*\* \`chatbots.versions.create\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot versions","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/versions":{"post":{"operationId":"ChatbotVersionController_createVersion[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVersionRequestDto"}}}},"responses":{"201":{"description":"Version created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionResponseDto"}}}},"400":{"description":"Invalid input data."},"403":{"description":"Insufficient permissions."}},"summary":"Creates a new version","tags":["Chatbot versions"],"description":"\n\n**Required Permission:** `chatbots.versions.create`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"CreateVersionRequestDto":{"type":"object","properties":{"description":{"type":"string","description":"An optional description for the new version."},"name":{"type":"string","description":"The name of the new version (often automatically generated)."},"environment":{"type":"string","description":"The environment for which this version is created. None being dev, as no deployment is needed.","enum":["test","prod","none"]}},"required":["name","environment"]},"VersionResponseDto":{"type":"object","properties":{"version":{"description":"The version.","allOf":[{"$ref":"#/components/schemas/VersionDto"}]},"error":{"type":"string","description":"Optional error message."}}},"VersionDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the version."},"name":{"type":"string","description":"The display name of the version."},"created":{"type":"string","description":"Timestamp of when the version was created."},"deployed":{"type":"string","description":"Timestamp of when the version was deployed."},"modelId":{"type":"string","description":"The ID of the associated model."},"versionNumber":{"type":"string","description":"The semantic version number."},"stats":{"description":"Statistics about the version contents.","allOf":[{"$ref":"#/components/schemas/VersionStatsDto"}]},"description":{"type":"string","description":"A description of the version."},"environment":{"type":"string","description":"The environment this version is associated with.","enum":["dev","test","prod"]},"deploymentId":{"type":"string","description":"The ID of the active deployment, if any."},"hasActiveDeployment":{"type":"boolean","description":"Indicates whether the version has an active deployment."},"resettable":{"type":"boolean","description":"Indicates whether the version can be reset."}},"required":["id","name","created","deployed","modelId","versionNumber","stats","description","environment","hasActiveDeployment"]},"VersionStatsDto":{"type":"object","properties":{"steps":{"type":"number","description":"The number of steps in this version."},"events":{"type":"number","description":"The number of events in this version."},"intents":{"type":"number","description":"The number of intents in this version."},"entities":{"type":"number","description":"The number of entities in this version."},"flows":{"type":"number","description":"The number of flows in this version."},"triggers":{"type":"number","description":"The number of triggers in this version."}},"required":["steps","events","intents","entities","flows","triggers"]}}}}
```

## Deletes a version

> \
> \
> \*\*Required Permission:\*\* \`chatbots.versions.delete\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot versions","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/versions/{versionId}":{"delete":{"operationId":"ChatbotVersionController_deleteVersion[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"versionId","required":true,"in":"path","description":"The Id of the version to be deleted.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteVersionResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Deletes a version","tags":["Chatbot versions"],"description":"\n\n**Required Permission:** `chatbots.versions.delete`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"DeleteVersionResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","description":"Indicates whether the version was successfully deleted."},"error":{"type":"string","description":"Optional error message."}}}}}}
```

## Deploys a version to an environment

> \
> \
> \*\*Required Permission:\*\* \`chatbots.versions.deploy\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot versions","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/versions/{versionId}/deploy":{"post":{"operationId":"ChatbotVersionController_deployVersion[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"versionId","required":true,"in":"path","description":"The Id of the version to be deployed.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployVersionRequestDto"}}}},"responses":{"202":{"description":"Deployment process started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployVersionResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Deploys a version to an environment","tags":["Chatbot versions"],"description":"\n\n**Required Permission:** `chatbots.versions.deploy`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"DeployVersionRequestDto":{"type":"object","properties":{"environment":{"type":"string","description":"The target environment for the deployment.","enum":["test","prod","dev"]}},"required":["environment"]},"DeployVersionResponseDto":{"type":"object","properties":{"started":{"type":"boolean","description":"Indicates whether the deployment was successfully started."},"error":{"type":"string","description":"Optional error message."}}}}}}
```

## Performs a rollback to a specific version

> \
> \
> \*\*Required Permission:\*\* \`chatbots.versions.deploy\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot versions","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/versions/{versionId}/rollback":{"post":{"operationId":"ChatbotVersionController_rollbackVersion[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"versionId","required":true,"in":"path","description":"The Id of the version to roll back on.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RollbackVersionRequestDto"}}}},"responses":{"200":{"description":"Result of the rollback operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RollbackVersionResponseDto"}}}},"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Performs a rollback to a specific version","tags":["Chatbot versions"],"description":"\n\n**Required Permission:** `chatbots.versions.deploy`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"RollbackVersionRequestDto":{"type":"object","properties":{"excludeComponents":{"type":"array","items":{"$ref":"#/components/schemas/RollbackVersionComponents"},"description":"Components to be excluded from the rollback.\n\n- `0`: Apps\n- `1`: Settings"}},"required":["excludeComponents"]},"RollbackVersionComponents":{"type":"number","enum":[0,1,-1],"description":"Components to be excluded from the rollback.\n\n- `0`: Apps\n- `1`: Settings"},"RollbackVersionResponseDto":{"type":"object","properties":{"rolledBack":{"type":"boolean","description":"Indicates whether the rollback was successful."},"error":{"type":"string","description":"Optional error message."}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatcaptain.com/api/api-dokumentation/chatbot-versions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
