# Contact

Contact us and conversation endpoints

## Submit Contact Us Form

> Submits a contact us message.\
> \
> \*\*Business Logic:\*\*\
> \- \*\*Email Routing:\*\* Sends an email to recipients configured in \`CONTACT\_US\_EMAIL\_TO\` based on the operation type.\
> \- \*\*User Notification:\*\* Optionally sends a copy to the user if \`CONTACT\_US\_SEND\_USER\` is enabled.\
> \- \*\*Reply-To:\*\* Sets the Reply-To header to the user's email if \`CONTACT\_US\_REPLY\_TO\_ONLY\_USER\` is enabled.\
> \- \*\*CC/BCC:\*\* Applies CC/BCC rules from \`EMAIL\_BCC\_AND\_CC\` setting.\
> \- \*\*Attachments:\*\* Validates and attaches files if provided.\
> \- \*\*Order Linking:\*\* Links the message to a specific order if required by the subject.\
> \
> \*\*Dynamic Settings:\*\*\
> \- \`CONTACT\_US\_EMAIL\_TO\`: Dictionary mapping operations to recipient emails.\
> \- \`CONTACT\_US\_SEND\_USER\`: Boolean to enable sending a copy to the user.\
> \- \`CONTACT\_US\_REPLY\_TO\_ONLY\_USER\`: Boolean to set user as the only Reply-To address.\
> \- \`EMAIL\_BCC\_AND\_CC\`: Configuration for CC and BCC recipients.

```json
{"openapi":"3.1.0","info":{"title":"User API","version":"1.0.0"},"tags":[{"name":"Contact","description":"Contact us and conversation endpoints"}],"servers":[{"description":"Server base URL","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[],"paths":{"/users/contact-us/":{"post":{"tags":["Contact"],"summary":"Submit Contact Us Form","description":"Submits a contact us message.\n\n**Business Logic:**\n- **Email Routing:** Sends an email to recipients configured in `CONTACT_US_EMAIL_TO` based on the operation type.\n- **User Notification:** Optionally sends a copy to the user if `CONTACT_US_SEND_USER` is enabled.\n- **Reply-To:** Sets the Reply-To header to the user's email if `CONTACT_US_REPLY_TO_ONLY_USER` is enabled.\n- **CC/BCC:** Applies CC/BCC rules from `EMAIL_BCC_AND_CC` setting.\n- **Attachments:** Validates and attaches files if provided.\n- **Order Linking:** Links the message to a specific order if required by the subject.\n\n**Dynamic Settings:**\n- `CONTACT_US_EMAIL_TO`: Dictionary mapping operations to recipient emails.\n- `CONTACT_US_SEND_USER`: Boolean to enable sending a copy to the user.\n- `CONTACT_US_REPLY_TO_ONLY_USER`: Boolean to set user as the only Reply-To address.\n- `EMAIL_BCC_AND_CC`: Configuration for CC and BCC recipients.","operationId":"submitContactUs","parameters":[{"$ref":"#/components/parameters/CSRFTokenHeader"},{"$ref":"#/components/parameters/CookieHeader"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ContactUsRequest"}}}},"responses":{"200":{"description":"Message sent successfully"},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}}}}}},"components":{"parameters":{"CSRFTokenHeader":{"name":"X-CSRFToken","in":"header","description":"CSRF token for write operations (POST, PUT, PATCH, DELETE).\nRequired for security when using session authentication.\nObtain token from cookie 'csrftoken' or meta tag in HTML.","required":true,"schema":{"type":"string"}},"CookieHeader":{"name":"Cookie","in":"header","description":"Session ID and CSRF token cookies.\nFormat: `sessionid=<id>; osessionid=<id>; csrftoken=<token>`","required":true,"schema":{"type":"string"}}},"schemas":{"ContactUsRequest":{"type":"object","required":["subject","full_name","email","message"],"properties":{"subject":{"type":"integer","description":"ID of the contact subject. Determines if an order reference is required."},"full_name":{"type":"string","maxLength":70},"email":{"type":"string","format":"email"},"phone":{"type":"string","maxLength":70},"message":{"type":"string"},"file":{"type":"string","format":"binary","description":"Optional file attachment. Validated for allowed extensions and size limits."},"order":{"type":"integer","description":"ID of the related order. Required if the selected subject implies an order context. Must belong to the authenticated user."},"operation":{"type":"string","maxLength":30,"description":"Operation type key. Validated against configured contact email recipients (`CONTACT_US_EMAIL_TO`)."}}},"ValidationErrorResponse":{"type":"object","description":"Standard DRF validation error response","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}
```

## List Contact Us Subjects

> Lists available subjects for the contact us form.\
> \
> \*\*Business Logic:\*\*\
> \- Returns subjects localized to the current language.

```json
{"openapi":"3.1.0","info":{"title":"User API","version":"1.0.0"},"tags":[{"name":"Contact","description":"Contact us and conversation endpoints"}],"servers":[{"description":"Server base URL","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[],"paths":{"/users/contact-us-subjects/":{"get":{"tags":["Contact"],"summary":"List Contact Us Subjects","description":"Lists available subjects for the contact us form.\n\n**Business Logic:**\n- Returns subjects localized to the current language.","operationId":"listContactUsSubjects","responses":{"200":{"description":"List of subjects","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContactUsSubject"}}}}}}}}},"components":{"schemas":{"ContactUsSubject":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the contact subject."},"text":{"type":"string","description":"Localized subject text."},"is_order_needed":{"type":"boolean","description":"Indicates if an order ID is required for this subject."}}}}}}
```

## List Conversations

> Lists the user's conversations (messages).

```json
{"openapi":"3.1.0","info":{"title":"User API","version":"1.0.0"},"tags":[{"name":"Contact","description":"Contact us and conversation endpoints"}],"servers":[{"description":"Server base URL","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"cookieAuth":[]}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"}},"schemas":{"Conversation":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the conversation."},"subject":{"type":"string","description":"The subject of the conversation."},"user":{"$ref":"#/components/schemas/UserMessage","description":"The user associated with the conversation."},"datasource":{"$ref":"#/components/schemas/DataSource","description":"The data source associated with the conversation (if applicable)."},"item_object":{"type":"object","description":"Details of the related item (Product or OrderItem). Structure depends on `item_content`."},"item_content":{"type":"string","description":"Model name of the item content (e.g., 'product', 'orderitem')."},"message_set":{"type":"array","items":{"$ref":"#/components/schemas/Message"},"description":"List of messages in the conversation."},"conversation_type":{"$ref":"#/components/schemas/EnumValue","description":"The type of conversation."},"last_message_date":{"type":"string","format":"date-time","description":"Timestamp of the last message in the conversation."},"is_public":{"type":"boolean","description":"Indicates if the conversation is public."},"is_answered":{"type":"boolean","description":"Indicates if the conversation has been answered."}}},"UserMessage":{"type":"object","properties":{"id":{"type":"integer","description":"User ID."},"first_name":{"type":"string","description":"User's first name."},"last_name":{"type":"string","description":"User's last name."},"email":{"type":"string","description":"User's email address."},"phone":{"type":"string","description":"User's phone number."},"gender":{"$ref":"#/components/schemas/EnumValue","description":"User's gender."}}},"EnumValue":{"type":"object","properties":{"value":{"type":"string","description":"The internal value of the enum choice."},"label":{"type":"string","description":"The human-readable label of the enum choice."}}},"DataSource":{"type":"object","properties":{"id":{"type":"integer","description":"DataSource ID."},"name":{"type":"string","description":"Name of the data source."}}},"Message":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the message."},"message_content":{"type":"string","description":"The content of the message."},"user_type":{"$ref":"#/components/schemas/EnumValue","description":"The type of user who sent the message."},"content_object":{"$ref":"#/components/schemas/MessageContent","description":"Details of the sender (User or DataSource)."},"content_type":{"type":"string","description":"The type of the sender (e.g., 'user', 'datasource')."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the message was created."}}},"MessageContent":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the sender."},"email":{"type":"string","description":"Email of the sender."},"first_name":{"type":"string","description":"First name of the sender."},"last_name":{"type":"string","description":"Last name of the sender."},"phone":{"type":"string","description":"Phone number of the sender."},"gender":{"type":"string","description":"Gender of the sender."},"name":{"type":"string","description":"Name of the sender (if DataSource)."},"title":{"type":"string","description":"Title of the sender (if applicable)."}}}}},"paths":{"/users/conversations/":{"get":{"tags":["Contact"],"summary":"List Conversations","description":"Lists the user's conversations (messages).","operationId":"listConversations","responses":{"200":{"description":"List of conversations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}}}}}}}}}}
```

## Create Conversation

> Creates a new conversation or message.

```json
{"openapi":"3.1.0","info":{"title":"User API","version":"1.0.0"},"tags":[{"name":"Contact","description":"Contact us and conversation endpoints"}],"servers":[{"description":"Server base URL","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"cookieAuth":[]}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"}},"parameters":{"CSRFTokenHeader":{"name":"X-CSRFToken","in":"header","description":"CSRF token for write operations (POST, PUT, PATCH, DELETE).\nRequired for security when using session authentication.\nObtain token from cookie 'csrftoken' or meta tag in HTML.","required":true,"schema":{"type":"string"}},"CookieHeader":{"name":"Cookie","in":"header","description":"Session ID and CSRF token cookies.\nFormat: `sessionid=<id>; osessionid=<id>; csrftoken=<token>`","required":true,"schema":{"type":"string"}}},"schemas":{"CreateConversationRequest":{"type":"object","required":["message_content","user_type","content_id","content_type"],"properties":{"message_content":{"type":"string","maxLength":500,"description":"The body of the message."},"user_type":{"type":"string","enum":["guest","registered"],"description":"Type of user creating the conversation."},"content_id":{"type":"integer","minimum":1,"description":"ID of the related content object (e.g., User ID)."},"content_type":{"type":"string","enum":["user","datasource"],"description":"Slug of the content type. Determines the context of the conversation."},"conversation":{"type":"integer","description":"ID of existing conversation to reply to."},"datasource":{"type":"integer","description":"ID of the datasource (if applicable)."},"user":{"type":"integer","description":"ID of the user."},"subject":{"type":"string","maxLength":500,"description":"Subject of the conversation."},"item_content":{"type":"string","enum":["product","orderitem"],"description":"Model name of the item content. Used to link conversation to specific items."},"item_id":{"type":"integer","description":"ID of the specific item."},"conversation_type":{"type":"string","enum":["message","question","review"],"description":"Type of conversation."},"is_public":{"type":"boolean","description":"Whether the conversation is public."}},"description":"Request body for creating a conversation or message.\n\n**Validation:**\n- `DataSource` cannot reply to a review.\n- Users must match the authenticated user and content owner."},"ValidationErrorResponse":{"type":"object","description":"Standard DRF validation error response","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"paths":{"/users/conversations/":{"post":{"tags":["Contact"],"summary":"Create Conversation","description":"Creates a new conversation or message.","operationId":"createConversation","parameters":[{"$ref":"#/components/parameters/CSRFTokenHeader"},{"$ref":"#/components/parameters/CookieHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConversationRequest"}}}},"responses":{"201":{"description":"Conversation created"},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}}}}}}}
```

## Retrieve Conversation

> Retrieves details of a specific conversation.

```json
{"openapi":"3.1.0","info":{"title":"User API","version":"1.0.0"},"tags":[{"name":"Contact","description":"Contact us and conversation endpoints"}],"servers":[{"description":"Server base URL","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"cookieAuth":[]}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"}},"schemas":{"Conversation":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the conversation."},"subject":{"type":"string","description":"The subject of the conversation."},"user":{"$ref":"#/components/schemas/UserMessage","description":"The user associated with the conversation."},"datasource":{"$ref":"#/components/schemas/DataSource","description":"The data source associated with the conversation (if applicable)."},"item_object":{"type":"object","description":"Details of the related item (Product or OrderItem). Structure depends on `item_content`."},"item_content":{"type":"string","description":"Model name of the item content (e.g., 'product', 'orderitem')."},"message_set":{"type":"array","items":{"$ref":"#/components/schemas/Message"},"description":"List of messages in the conversation."},"conversation_type":{"$ref":"#/components/schemas/EnumValue","description":"The type of conversation."},"last_message_date":{"type":"string","format":"date-time","description":"Timestamp of the last message in the conversation."},"is_public":{"type":"boolean","description":"Indicates if the conversation is public."},"is_answered":{"type":"boolean","description":"Indicates if the conversation has been answered."}}},"UserMessage":{"type":"object","properties":{"id":{"type":"integer","description":"User ID."},"first_name":{"type":"string","description":"User's first name."},"last_name":{"type":"string","description":"User's last name."},"email":{"type":"string","description":"User's email address."},"phone":{"type":"string","description":"User's phone number."},"gender":{"$ref":"#/components/schemas/EnumValue","description":"User's gender."}}},"EnumValue":{"type":"object","properties":{"value":{"type":"string","description":"The internal value of the enum choice."},"label":{"type":"string","description":"The human-readable label of the enum choice."}}},"DataSource":{"type":"object","properties":{"id":{"type":"integer","description":"DataSource ID."},"name":{"type":"string","description":"Name of the data source."}}},"Message":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the message."},"message_content":{"type":"string","description":"The content of the message."},"user_type":{"$ref":"#/components/schemas/EnumValue","description":"The type of user who sent the message."},"content_object":{"$ref":"#/components/schemas/MessageContent","description":"Details of the sender (User or DataSource)."},"content_type":{"type":"string","description":"The type of the sender (e.g., 'user', 'datasource')."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the message was created."}}},"MessageContent":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the sender."},"email":{"type":"string","description":"Email of the sender."},"first_name":{"type":"string","description":"First name of the sender."},"last_name":{"type":"string","description":"Last name of the sender."},"phone":{"type":"string","description":"Phone number of the sender."},"gender":{"type":"string","description":"Gender of the sender."},"name":{"type":"string","description":"Name of the sender (if DataSource)."},"title":{"type":"string","description":"Title of the sender (if applicable)."}}}}},"paths":{"/users/conversations/{id}/":{"get":{"tags":["Contact"],"summary":"Retrieve Conversation","description":"Retrieves details of a specific conversation.","operationId":"getConversation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Conversation ID"}],"responses":{"200":{"description":"Conversation details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}}}}}}}
```


---

# 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://apidocs.akinon.com/commerce-openapis/users/module-2/contact.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.
