# Consensus Messages

## Create new consensus message

<mark style="color:green;">`POST`</mark> `https://hedera-serverless-consensus.vercel.app/api/consensus/message/`

This endpoint allows you to send a message to a topic id, you may simply broadcast the message, or wait for consensus to be reached using **allow\_synchronous\_consensus.** \
\
If you are using testnet or mainnet environments there will be a **explorer\_url** property linking to an external hashgraph explorer for the given transaction.

#### Query Parameters

| Name                          | Type    | Description                                                                                    |
| ----------------------------- | ------- | ---------------------------------------------------------------------------------------------- |
| reference                     | string  | A reference to an internal app idenitier so that after the response it will be easier to link. |
| allow\_synchronous\_consensus | boolean | Wait for consensus to be finished to finality before receiving a response.                     |
| topic\_id                     | string  | The id of the topic you want to sent the message to.                                           |
| message                       | string  | The string message that is sent to received a consensus response.                              |

#### Headers

| Name           | Type   | Description                                                        |
| -------------- | ------ | ------------------------------------------------------------------ |
| Authentication | string | The **API\_SECRET\_KEY** from th e client's environment variables. |

{% tabs %}
{% tab title="200 New message sent to a topic, using a topic\_id and message." %}

```
{
    "data": {
        "reference": "my reference",
        "topic_id": "16091",
        "transaction_id": "0.0.1156@1598828456.197000000",
        "explorer_url": "https://ledger-testnet.hashlog.io/tx/0.0.1156@1598828456.197000000",
        "consensus_timestamp": {
            "seconds": 1598828466,
            "nanos": 501124002
        }
    }
```

{% endtab %}
{% endtabs %}

**WARNING**: if you have a **WEBHOOK\_URL** set in your client it is recommended that you **do not set** the **allow\_synchronous\_consensus** to false due to the implications of the NodeJS event loop with AWS Lambda.
