# 6.1 Using REST API

Spicenet provides a comprehensive REST API for interacting with your node. Here are some key endpoints and their usage:

1. Get events for a specific slot:

```bash
GET http://localhost:12346/ledger/events/{slot_number}
```

Example: `http://localhost:12346/ledger/events/17`

2. Get events for a specific transaction:

```
GET http://localhost:12346/ledger/txs/{tx_id}/events/{event_index}
```

Example: `http://localhost:12346/ledger/txs/50/events/0`

3. Get events with a specific key:

```
GET http://localhost:12346/ledger/batches/{batch_id}/txs/{tx_index}/events/{event_index}
```

Example: `http://localhost:12346/ledger/batches/10/txs/2/events/0`

To use these endpoints, you can use curl in your terminal or any HTTP client. For example:

```bash
curl -s http://localhost:12346/ledger/events/17 | jq
```

This will retrieve all events for slot 17 and format the JSON output for readability.


---

# 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://validators.spicenet.io/interacting-with-your-node/6.1-using-rest-api.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.
