> For the complete documentation index, see [llms.txt](https://docs.chatcaptain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatcaptain.com/api/api-dokumentation/chatbot-api-keys.md).

# Chatbot api Keys

## Retrieves an existing API key

> \
> \
> \*\*Required Permission:\*\* \`chatbots.apikey.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot api-keys","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/workspaces/{workspaceId}/chatbots/{chatbotId}/api/{index}":{"get":{"operationId":"ChatbotApikeyController_getApiKey[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"index","required":true,"in":"path","description":"The index of the key (e.g., 1 or 2)","schema":{"type":"number"}},{"name":"workspaceId","required":true,"in":"path","description":"The ID of the workspace.","schema":{"type":"string"}}],"responses":{"200":{"description":"The API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Retrieves an existing API key","tags":["Chatbot api-keys"],"description":"\n\n**Required Permission:** `chatbots.apikey.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ApiKeyResponseDto":{"type":"object","properties":{"apiKey":{"type":"string","description":"The generated API key. Only fully displayed upon creation."},"error":{"type":"string","description":"Optional error message."}}}}}}
```

## Generates a new API key

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

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot api-keys","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/workspaces/{workspaceId}/chatbots/{chatbotId}/api/{index}":{"post":{"operationId":"ChatbotApikeyController_generateApiKey[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"index","required":true,"in":"path","description":"The index of the key (e.g., 1 or 2)","schema":{"type":"number"}},{"name":"workspaceId","required":true,"in":"path","description":"The ID of the workspace.","schema":{"type":"string"}}],"responses":{"201":{"description":"The newly generated API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Generates a new API key","tags":["Chatbot api-keys"],"description":"\n\n**Required Permission:** `chatbots.apikey.create`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ApiKeyResponseDto":{"type":"object","properties":{"apiKey":{"type":"string","description":"The generated API key. Only fully displayed upon creation."},"error":{"type":"string","description":"Optional error message."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
