# Event Search API

Once you've created at least one event indexer, and events indexed by your Graffle company will be available for searching over via the Event Search API.

{% hint style="info" %}
Your company id is viewable in the top right corner of the projects page in the Graffle management dashboard.&#x20;
{% endhint %}

The url for the Event Search API is:

Main Net:\
`https://prod-main-net-dashboard-api.azurewebsites.net/api/company/{ COMPANY ID }/search`

Test Net:

`https://prod-test-net-dashboard-api.azurewebsites.net/api/company/{ COMPANY ID }/search`

{% hint style="info" %}
NOTE:\
\
Events on Test Net are stored for 3 days before being removed.&#x20;
{% endhint %}

#### Example Response

```
[
	{
		"id": "068883b1178935195289a4fe910f4adbf4fb2db6ca100fa529506834f2e152ea",
		"blockEventData": {
			"id": 292,
			"price": 25,
			"from": "0x886f3aeaf848c535"
		},
		"eventDate": "2021-08-19T16:10:06.4281827+00:00",
		"flowEventId": "A.d796ff17107bbff6.Marketplace.ForSale",
		"flowTransactionId": "599b5aba16ab072dd12a2449521afdbcdc0dcd4a1b4436374dcef7dc58587b4a"
	},
	{
		"id": "56abe3770e7520ecbea62efb19422ae886e99b8fa2304a972ec3e71e12fb3713",
		"blockEventData": {
			"name": "Solitude 2.0",
			"artist": "Jos",
			"edition": "1 of 1",
			"bidder": "0xa9a82c6a04d6df2b",
			"price": 25,
			"dropId": 21,
			"auctionId": 387
		},
		"eventDate": "2021-07-29T13:24:35.52458+00:00",
		"flowEventId": "A.d796ff17107bbff6.Versus.Bid",
		"flowTransactionId": "905e102ce2b4af8dffc0420f52fce833f177467082942713f56306e8d16d6c1b"
		},
]
```

{% hint style="info" %}
All of the following query parameters can be combined together to narrow down your search results.
{% endhint %}

#### BlockEventData Query Parameters

Any of the properties in "blockEventData" can be searched against. In the above sample response the following are all valid search parameters:

* /search?id=292&#x20;
* /search?price=25&#x20;
* /search?from="0x886f3aeaf848c535"&#x20;
* /search?name="Solitude 2.0"&#x20;
* /search?artist="Jos"&#x20;
* /search?edition="1 of 1"&#x20;
* /search?bidder="0xa9a82c6a04d6df2b"&#x20;
* /search?price=25&#x20;
* /search?dropId=21&#x20;
* /search?auctionId=387

#### Standard Query Parameters

There are also standard query parameters that can be applied regardless of what events you are indexing.

| Parameter Name | Description                                                                                       |
| -------------- | ------------------------------------------------------------------------------------------------- |
| projectId      | Your Graffle project id. Will limit results to only events indexed by this project.               |
| eventType      | Full Flow event type, or a comma delimited list of event types. ex: A.d796ff17107bbff6.Versus.Bid |
| transactionId  | Transaction id on Flow. Will limit results to only events that occurred within this transaction   |
| startDate      | DateTimeOffset, limits results to those that occurred after.                                      |
| endDate        | DateTimeOffset, limits results to those that occurred before.                                     |
| since          | Unix seconds timestamp. Will limit results to events that occurred after this timestamp.          |

#### Paging

You can page through your results using `page` and `pageSize` parameters.

To assist with pagination you can provide the following in the request header to retrieve the total number of events for the query

```
Header: x-row-count
Value: true

sample response
{
    "count": 339
}
```
