# 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.


---

# 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://docs.trust.enterprises/rest-api/consensus-messages.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.
