# Real-time Visualization

In order to visualize your cloud assets across hyperscalers in real time (e.g. you create a vpc using cli or terraform and it shows up in MechCloud in few seconds without you triggering the discovery manually), you will need to post your hyperscaler events to a certain endpoint of MechCloud. Here are the details of this endpoint -

**Url** - <https://portal-api.mechcloud.io/mechcloud-turbine-discovery/v1.0/sync/events>

**Query parameter(s)**

* **cloudAccountId** - This is the unique id which is generated by MechCloud when you register a cloud account. You can get this from MechCloud console -> Infrastructure -> Cloud Accounts page.

**Headers**

* **Mc-Team-Id** - This is the id generated by MechCloud for a team which a cloud account belongs to. Its value is **d65e32d2-e18f-49a7-8cbf-e19205772ea0** for the default team.
* **Referer** - <https://portal.mechcloud.io/>
* **Content-Type** - application/json
* **Authorization** - Bearer \<jwt\_token>
  * Once you are logged into MechCloud, simply open a new tab, and enter <https://portal-api.mechcloud.io/oauth2/auth1> url in the address bar. It will print your access/jwt token.

**Response code(s)**

* Any response with 200 status code means event was processed or was a duplicate event and so you can remove such event from the queue.
* For any other status code, you can retry it 2-3 times to see if it goes through. If not, then pause the mechanism which is posting events to MechCloud and post your issue in the MechCloud discord server.

**It is your responsibility to make sure that events are posted in the correct order. E.g. you should not post an event corresponding to a subnet to MechCloud when the event corresponding to its parent vpc creation has not been posted yet.**

Before you can invoke this endpoint, you will need to get a jwt token for your MechCloud account. To fetch you jwt token, make sure you are logged into MechCloud and then enter <https://portal-preview.mechcloud.io/oauth2/auth1> in a new browser tab. It will fetch your jwt token and display it. Copy this jwt token and replace \<jwt\_token> placehoder in **Authorization** header with it.

How to post hyperscaler specific events to MechCloud and the format of these events is described in the respective hyperscaler section under this page.

In order to visualize your hyperscaler assets, first you need to follow the instructions under the respective hyperscale section, navigate to **Infrastructure -> Discover Assets** in the MechCloud porta&#x6C;**,** select one or more AWS accounts under **Select cloud accounts** dropdown and then click on **Enable Real-time updates** button. Now go ahead and create a vpc/subnet/vm as per the instruction mentioned in the respective hyperscaler section, make sure it is posted to MechCloud and you get a success response for same. It will then appear on MechCloud UI within few seconds.

**Real-time updates are streamed for 25 mins only after enabling it from UI and disabled at the end of this duration automatically. You will need to enable it again if you want to stream real-time updates after it is disabled automatically.**


---

# 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.mechcloud.io/cloud-computing/real-time-visualization.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.
