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

# Create Message

> Create a chat message.

#### Recipes

<AccordionGroup>
  <Accordion title="Create message with extra data">
    <Steps>
      <Step title="1. Set the ID of the dialog">
        Set a `chat_dialog_id` to send a message to the specific dialog.

        ```curl {5} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: 2e80acd7f3d9c1e79312e0d1dafd6691ba012bba" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Type a message">
        Enter a message text using the message parameter.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: 2e80acd7f3d9c1e79312e0d1dafd6691ba012bba" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. Specify if you want to send a message">
        Set a `send_to_chat` parameter to `1` to send a message to the dialog.

        ```curl {7} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: 2e80acd7f3d9c1e79312e0d1dafd6691ba012bba" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="4. Add extra data to a message">
        You can extend a message with additional fields by setting key-value custom parameters.

        Here, the `is_pinned` is a custom parameter key and the `false` is a custom parameter value.

        ```curl {8} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: 2e80acd7f3d9c1e79312e0d1dafd6691ba012bba" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="5. As a result, the API returns a message with additional fields.">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: 2e80acd7f3d9c1e79312e0d1dafd6691ba012bba" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Create message in group dialog">
    <Steps>
      <Step title="1. Set ID of the dialog">
        Use a `chat_dialog_id` parameter to create a message for the specific dialog.

        ```curl {5} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Type a message">
        Enter a `message` text using the message parameter.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. Specify if you want to send a message">
        Set a `send_to_chat` parameter to `1` to send a message to the dialog.

        ```curl {7} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="4. Specify if you want to mark messages as read/delivered">
        Set a `markable` parameter to `1` to mark all messages as read/delivered.

        ```curl {8} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="5. Set message attachment">
        You can add an attachement to the message using the `attachment` parameter.

        Just specify the `ID` of the file on QuickBlox server and its `type`.

        You can add as many attachments as you need.

        ```curl {9-18} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="6. As a result, the API returns a newly created message">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Create message in private dialog">
    <Steps>
      <Step title="1. Set the ID of the message recipient">
        Use a `recipient_id` parameter to set the ID of the message recipient.

        ```curl {5} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: ee4b9e6cad16378aab011c236b186aec09012bba" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Type a message">
        Enter a message text using the `message` parameter.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: ee4b9e6cad16378aab011c236b186aec09012bba" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. As a result, the API returns a newly created message.">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "QB-Token: ee4b9e6cad16378aab011c236b186aec09012bba" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Create message in private dialog with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. Set the ID of the message recipient">
        Use a `recipient_id` parameter to set the ID of the message recipient.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="4. Type a message">
        Enter a message text using the message parameter.

        ```curl {7} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="5. As a result, the API returns a newly created message.">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "recipient_id":102460596,
          "message":"Hello!"
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Create message with extra data and API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. Set the ID of the dialog">
        Set a `chat_dialog_id` to send a message to the specific dialog.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="4. Type a message">
        Enter a message text using the message parameter.

        ```curl {7} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="5. Specify if you want to send a message">
        Set a `send_to_chat` parameter to 1 to send a message to the dialog.

        ```curl {8} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="6. Add extra data to a message">
        You can extend a message with additional fields by setting key-value custom parameters.

        Here, the `is_pinned` is a custom parameter key and the false is a custom parameter value.

        ```curl {9} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="7. As a result, the API returns a message with additional fields.">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"Allison will take it",
          "send_to_chat":1,
          "is_pinned":false
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Create message in group dialog with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="3. Set ID of the dialog">
        Use a `chat_dialog_id` parameter to create a message for the specific dialog.

        ```curl {6} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="4. Type a message">
        Enter a message text using the message parameter.

        ```curl {7} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="5. Specify if you want to send a message">
        Set a `send_to_chat` parameter to 1 to send a message to the dialog.

        ```curl {8} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="6. Specify if you want to mark messages as read/delivered">
        Set a `markable` parameter to `1` to mark all messages as read/delivered.

        ```curl {9} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="7. Set message attachment">
        You can add an attachement to the message using the `attachment` parameter.

        Just specify the `ID` of the file on QuickBlox server and its `type`.

        You can add as many attachments as you need.

        ```curl {10-19} theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>

      <Step title="8. As a result, the API returns a newly created message.">
        ```curl theme={null}
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
          "message":"look at this photos",
          "send_to_chat":1,
          "markable":1,
          "attachments":{  
            "0":{  
              "type":"image",
              "id":"47863"
            },
            "1":{  
              "type":"image",
              "id":"47864"
            }
          }
        }' \
        https://api.quickblox.com/chat/Message.json
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

It’s possible to inject a new chat message into the chat history. In this case, this new message won't be delivered to the recipients by XMPP real-time transport, it will be just added to the history. If you want to send a message, pass `send_to_chat=1` parameter.

#### Body Parameters

<ParamField body="chat_dialog_id" type="string"> ID of the dialog to which these messages will be added. </ParamField>
<ParamField body="message" type="string"> Text of the <Tooltip tip="CGI escape - The function is used for query parameters only. It comes from the CGI specification describing how data should be encoded/decoded between the web server and application; used for escaping a URL value in the query string. All characters that don't fall into the ALPHA, DIGIT, '_'- ','' and '' character set get escaped.">message (CGI escaped).</Tooltip> </ParamField>
<ParamField body="recipient_id" type="string"> ID of the recipient. Useful only when dialog's `type=3` (PRIVATE). </ParamField>

<ParamField body="attachments" type="object">
  <Expandable title="propeties">
    <ParamField body="N" type="object">
      Array index 0..N.

      <Expandable title="properties">
        <ParamField body="id" type="string"> ID of the file on QuickBlox server. </ParamField>
        <ParamField body="type" type="string"> Type of attachment. Example: `audio`, `video`, `image` or other. </ParamField>
        <ParamField body="url" type="string"> Link to a file in Internet. </ParamField>
        <ParamField body="name" type="string"> Name of attachment </ParamField>
        <ParamField body="size" type="string"> Size of attachment </ParamField>
        <ParamField body="content-type" type="string"> Content-Type of attachment </ParamField>
        <ParamField body="width" type="string"> Width of Image/Video. Useful for Image/Video type attachments </ParamField>
        <ParamField body="height" type="string"> Height of Image/Video. Useful for Image/Video type attachments </ParamField>
        <ParamField body="duration" type="string"> Duration of Video. Useful for Video type attachments </ParamField>
        <ParamField body="data" type="json"> Custom parameters. Useful for storing metadata of attachment </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="send_to_chat" type="integer"> Sends a message to chat. Set send\_to\_chat=1 to perform. </ParamField>
<ParamField body="markable" type="integer"> Mark messages to support read/delivered statuses. Set `markable=1` to perform. </ParamField>

<ParamField body="{custom_field_N}" type="string">
  Name of a custom field. Chat message can be extended with additional fields and contain any other user key-value custom parameters. Can be many 1..N.
</ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>
<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}"> API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used either QB-Token or Authorization.</ParamField>
<ParamField header="On-Behalf-Of" type="string">User ID. The user ID of the user on whose behalf the request is being made.</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="201">
    A successful response

    <ResponseField name="_id" type="string" />

    <ResponseField name="attachments" type="array">
      <Expandable title="properties">
        <ResponseField name="type" type="string" />

        <ResponseField name="id" type="string" />
      </Expandable>
    </ResponseField>

    <ResponseField name="chat_dialog_id" type="string" />

    <ResponseField name="created_at" type="string" />

    <ResponseField name="date_sent" type="integer" />

    <ResponseField name="delivered_ids" type="array" />

    <ResponseField name="markable" type="integer" />

    <ResponseField name="message" type="string" />

    <ResponseField name="read_ids" type="array" />

    <ResponseField name="recipient_id" type="integer" />

    <ResponseField name="sender_id" type="integer" />

    <ResponseField name="updated_at" type="string" />

    <ResponseField name="read" type="integer" />
  </Accordion>

  <Accordion title="404">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
  -H "Content-Type: application/json" \
  -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
  -d '{  
    "chat_dialog_id":"5d75327ba28f9a0f32cb0f99",
    "message":"look at this photos",
    "send_to_chat":1,
    "markable":1,
    "attachments":{  
      "0":{  
        "type":"image",
        "id":"47863"
      },
      "1":{  
        "type":"image",
        "id":"47864"
      }
    }
  }' \
  https://api.quickblox.com/chat/Message.json
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "_id": "5d76b657a28f9a0cc7cb0f99",
    "attachments": [
      {
        "type": "image",
        "id": "47863"
      },
      {
        "type": "image",
        "id": "47864"
      }
    ],
    "chat_dialog_id": "5d75327ba28f9a0f32cb0f99",
    "created_at": null,
    "date_sent": 1568061015,
    "delivered_ids": [],
    "markable": 1,
    "message": "look at this photos",
    "read_ids": [],
    "recipient_id": 0,
    "sender_id": 96830631,
    "updated_at": null,
    "read": 0
  }
  ```

  ```json 404 theme={null}
  {
    "errors": [
      "The recipient wasn't found"
    ]
  }
  ```
</ResponseExample>
