> 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/contact-variables.md).

# Contact variables

## Lists all custom variables of a contact

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

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Contact variables","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/contacts/variables/{contactId}":{"get":{"operationId":"ConversationContactVariableController_listVariables[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The Id of the chatbot.","schema":{"type":"string"}},{"name":"contactId","required":true,"in":"path","description":"The Id of the contact.","schema":{"type":"string"}}],"responses":{"200":{"description":"The list of contact variables.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListVariablesResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Lists all custom variables of a contact","tags":["Contact variables"],"description":"\n\n**Required Permission:** `chatbots.contacts.variables.list`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ListVariablesResponseDto":{"type":"object","properties":{"variables":{"description":"The list of conversation variables.","type":"array","items":{"$ref":"#/components/schemas/VariableDto"}},"error":{"type":"string","description":"Optional error message."}},"required":["variables"]},"VariableDto":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the variable (corresponds to the global variable ID)."},"name":{"type":"string","description":"The programmatic name of the variable."},"type":{"type":"string","description":"The data type of the variable."},"value":{"type":"string","description":"The value assigned in this conversation."},"updated":{"type":"string","description":"The timestamp of the last update."}},"required":["id","name","type","value","updated"]}}}}
```

## Deletes all custom variables of a contact

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

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Contact variables","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/contacts/variables/{contactId}":{"delete":{"operationId":"ConversationContactVariableController_deleteVariables[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The Id of the chatbot.","schema":{"type":"string"}},{"name":"contactId","required":true,"in":"path","description":"The Id of the contact.","schema":{"type":"string"}}],"responses":{"200":{"description":"The deletion result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteVariablesResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Deletes all custom variables of a contact","tags":["Contact variables"],"description":"\n\n**Required Permission:** `chatbots.contacts.variables.delete`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"DeleteVariablesResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","description":"Indicates whether the deletion operation was successful."},"error":{"type":"string","description":"Optional error message."}}}}}}
```

## Gets a specific custom variable of a contact

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

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Contact variables","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/contacts/variables/{contactId}/{variableId}":{"get":{"operationId":"ConversationContactVariableController_getVariable[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The Id of the chatbot.","schema":{"type":"string"}},{"name":"variableId","required":true,"in":"path","description":"The Id of the variable.","schema":{"type":"string"}},{"name":"contactId","required":true,"in":"path","description":"The Id of the contact.","schema":{"type":"string"}}],"responses":{"200":{"description":"The requested variable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariableResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Gets a specific custom variable of a contact","tags":["Contact variables"],"description":"\n\n**Required Permission:** `chatbots.contacts.variables.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"VariableResponseDto":{"type":"object","properties":{"variable":{"description":"The variable.","allOf":[{"$ref":"#/components/schemas/VariableDto"}]},"error":{"type":"string","description":"Optional error message."}}},"VariableDto":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the variable (corresponds to the global variable ID)."},"name":{"type":"string","description":"The programmatic name of the variable."},"type":{"type":"string","description":"The data type of the variable."},"value":{"type":"string","description":"The value assigned in this conversation."},"updated":{"type":"string","description":"The timestamp of the last update."}},"required":["id","name","type","value","updated"]}}}}
```

## Sets or updates the value of a custom variable of a contact

> \
> \
> \*\*Required Permission:\*\* \`chatbots.contacts.variables.edit\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Contact variables","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/contacts/variables/{variableId}":{"put":{"operationId":"ConversationContactVariableController_assignValueToVariable[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The Id of the chatbot.","schema":{"type":"string"}},{"name":"variableId","required":true,"in":"path","description":"The Id of the variable whose value is to be set.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignValueToVariableRequestDto"}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariableResponseDto"}}}},"400":{"description":"Invalid input data."},"403":{"description":"Insufficient permissions."}},"summary":"Sets or updates the value of a custom variable of a contact","tags":["Contact variables"],"description":"\n\n**Required Permission:** `chatbots.contacts.variables.edit`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"AssignValueToVariableRequestDto":{"type":"object","properties":{"value":{"type":"string","description":"The new value to be assigned to the variable."},"contactId":{"type":"string","description":"The id of the contact to assign the variable to."}},"required":["value"]},"VariableResponseDto":{"type":"object","properties":{"variable":{"description":"The variable.","allOf":[{"$ref":"#/components/schemas/VariableDto"}]},"error":{"type":"string","description":"Optional error message."}}},"VariableDto":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the variable (corresponds to the global variable ID)."},"name":{"type":"string","description":"The programmatic name of the variable."},"type":{"type":"string","description":"The data type of the variable."},"value":{"type":"string","description":"The value assigned in this conversation."},"updated":{"type":"string","description":"The timestamp of the last update."}},"required":["id","name","type","value","updated"]}}}}
```


---

# 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/contact-variables.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.
