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

# Cloud Quickstart

> Send your first event to Trench Cloud

In this guide, we'll walk you through the process of sending your first event and reading it back using the Trench Cloud API.
The example uses the [Trench JavaScript client](https://www.npmjs.com/package/trench-js), but the same can be achieved by calling the [Events API](https://docs.trench.dev/api-reference/events-create) directly.

## Getting Started

<Steps>
  <Step title="Sign up for Trench Cloud">
    To get started with Trench Cloud, you need to sign up at [app.trench.dev](https://app.trench.dev?utm_campaign=cloud-quickstart). Then, locate the necessary credentials in the `API Keys` tab.

    <Frame caption="The Trench cloud dashboard">
      <img src="https://mintcdn.com/frigade-v2-docs/FxFHpZ8uaGl7Kvi_/images/trench-dashboard-dark.png?fit=max&auto=format&n=FxFHpZ8uaGl7Kvi_&q=85&s=6a1e940ad65d1cd04adb492e9b808174" className="pointer-events-none" width="1952" height="1020" data-path="images/trench-dashboard-dark.png" />
    </Frame>
  </Step>

  <Step title="Install Trench JavaScript Client">
    Next, install the Trench JavaScript client using your favorite package manager:

    ```bash theme={null}
    npm install trench-js
    ```

    Alternatively, you can use the hosted version via the script tag below and skip the **Initialize the Client** step:

    ```html theme={null}
    <script>
      (function(d,w){if(!w.Trench){w.Trench=function(c){var i={_config:c,_q:[]},m=["track","page","identify","group","getEvents","executeQueries"];m.forEach(function(f){i[f]=function(){i._q.push([f,arguments])}});return i;}; 
      window.trench=new Trench({
        publicApiKey: 'YOUR_PUBLIC_API_KEY',
        serverUrl: 'YOUR_SERVER_URL', 
        autoCaptureEvents: true
      });
      var s=d.createElement("script");s.type="text/javascript";s.async=!0;s.src="https://cdn.jsdelivr.net/npm/trench-js@latest/dist/trench.min.js";
      s.onload=function(){var r=new Trench(trench._config);trench._q.forEach(function(q){r[q[0]].apply(r,q[1])});w.trench=r;};
      d.getElementsByTagName("head")[0].appendChild(s);}})(document,window);
    </script>
    ```
  </Step>

  <Step title="Initialize the Client">
    After installing the client, you need to initialize it with your API key. Replace `YOUR_API_KEY` and `YOUR_SERVER_URL` with the actual API key and server URL you received:

    ```javascript theme={null}
    import Trench from 'trench-js'

    const trench = new Trench({
      publicApiKey: 'YOUR_PUBLIC_API_KEY',
      serverUrl: 'YOUR_SERVER_URL'
    });
    ```

    Optionally, you can identify a user with the `identify` method:

    ```javascript theme={null}
    trench.identify('user-id', {
      email: 'test@example.com',
      // Add any other traits you want to associate with the user
    })
    ```
  </Step>

  <Step title="Send a Sample Event">
    Now you can send a sample event to Trench Cloud. Here is an example of how to send an event:

    ```javascript theme={null}
    trench.track("Test Event");
    ```

    This will send an event with the name `Test Event`.
  </Step>

  <Step title="Verify the Event">
    You can verify that the event was received by opening the `Events` tab in the Trench Cloud dashboard.
  </Step>
</Steps>

## Going Further

Now that you've sent your first event, you can learn more about the many things you can do with Trench.

<CardGroup cols={2}>
  <Card title="Get Events API →" href="/api-reference/events-get" horizontal={true} />

  <Card title="Create Events API →" href="/api-reference/events-create" horizontal={true} />

  <Card title="Webhooks API →" href="/api-reference/webhooks-create" horizontal={true} />

  <Card title="Query API →" href="/api-reference/queries-execute" horizontal={true} />
</CardGroup>
