# Domains

### History <a href="#history" id="history"></a>

This endpoint can be used to retrieve the transaction history for all registered domains. Since the response payload will be large, the below optional query parameters can be passed.

`limit` - This is the number of records per response up to 200. 200 is also the default if no limit parameter is passed.

`start_time` - The start in unix timestamp from when the domain transaction records should be obtained.

`end_time` - The end in unix timestamp to when the domain transaction records should be obtained.

`last_token` - This token is used to fetch the next set of responses and is recieved from the API response. After the initial API call, you can pass this as a parameter for further responses.

`order_by` - Sorting direction. Use "ASC" to return results from oldest to newest, or "DESC" (default) to return newest to oldest.

> Request

```
GET v2/domains/history?limit={limit}&start_time={start_time}&end_time={end_time}&last_token={last_token}&order_by={order_by}
```

> Response

```json
{
  "data": [
    {
      "operation": 1,
      "unix_timestamp": 1622592000,
      "tx_signature": "27EjmB4NdsRKMNkeYeF4rva...",
      "domain_key": "4cQ3zUeardJweGTnk...",
      "pre_tx_owner": "5fEPywJMxeP2HBo7JyBUv1G...",
      "post_tx_owner": "CUcYT9ZoBXET88o...",
      "transaction_type": 1,
      "usd_price": 152,
      "price": 1,
      "quote_mint": "So11111111111111111111111111111111111111112"
    }
  ],
  "last_token": "1622592000:abcdef1234567890:domain1"
}
```

The `operation` property in the response has the structure below. The `transaction_type` property correlates to `operation` where a value of 0 indicates a registration, and a value of 1 indicates a sale or transfer. For other operations, the `transaction_type` is `null`.

```ts
enum Operation {
  Create, // registration (0)
  Transfer, // sale or transfer (1)
  Update, // update data in a name record (2)
  Delete, // delete or burn a domain (3)
  Realloc, // change the domain storage size (4)
}
```


---

# 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.sns.id/dev/sns-api/domains.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.
