# Log

The log API is how you get data into Telemetry. These events could be anything from user interactions to system metrics, such as CPU usage spikes or memory leaks. The endpoint accepts data in any form of valid JSON, making it really easy to integrate into your code.&#x20;

<mark style="color:green;">**POST**</mark> **`https://api.telemetry.sh/log`**

**Headers**

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Content-Type  | String | application/json  |
| Authorization | String | \<YOUR\_API\_KEY> |

**Body**

| Name  | Type   | Description                          |
| ----- | ------ | ------------------------------------ |
| table | String | The table where you want to log data |
| data  | JSON   | The data you want to log             |

### Example Usage with cURL

To send Uber ride data to a table named `uber_rides` using cURL, you can use the following command:

```
curl -X POST https://api.telemetry.sh/log \
  -H "Content-Type: application/json" \
  -H "Authorization: $API_KEY" \
  -d '{
    "table": "uber_rides",
    "data": {
      "city": "paris",
      "price": 42,
      "timestamp": "'"$(date -u +"%Y-%m-%dT%H:%M:%SZ")"'"
    }
  }'
```

### Using the JavaScript SDK

We recommend using our SDKs for a better developer experience. Here’s an example of how to use our JavaScript SDK:

```javascript
import telemetry from "telemetry-sh";

telemetry.init("YOUR_API_KEY");

telemetry.log("uber_rides", {
  city: "paris",
  price: 42,
  timestamp: new Date().toISOString()
});
```

### **Bulk logging**

You can also pass in an array of objects to bulk ingest events. This is useful for limiting the number of requests to the API. For example, instead of:

```js
telemetry.log("uber_rides", { a: 1 })
```

You can do:

```js
telemetry.log("uber_rides", [{a: 1}, {a: 2}])
```

This will ingest the data as two rows.


---

# 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.telemetry.sh/api-reference/log.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.
