# Indexer REST API

Base URL: <https://api.trypact.xyz>

Public, no auth, CORS open. JSON over HTTPS. All `uint128` and `uint256` values are returned as decimal strings for JSON safety.

***

## Endpoints

### `GET /healthz`

```bash
curl https://api.trypact.xyz/healthz
```

```jsonc
{
  "ok": true,
  "uptimeSec": 12345,
  "lastIndexedBlock": "32987654",
  "counters": {
    "services": 1,
    "jobs": 3,
    "settledJobs": 3,
    "expiredJobs": 0,
    "slashedJobs": 0,
    "totalSettledWei": "3000000000000000"
  }
}
```

***

### `GET /v1/services`

Full service catalog, every registered seller.

```bash
curl https://api.trypact.xyz/v1/services
```

```jsonc
{
  "count": 1,
  "services": [ /* Service[] */ ]
}
```

Each `Service` has the same shape as the SDK's [`Service`](/reference/sdk.md#service-type).

***

### `GET /v1/services/:id`

One service by id.

```bash
curl https://api.trypact.xyz/v1/services/1
```

Returns the `Service` struct, or `404` if not found.

***

### `GET /v1/jobs?limit=N`

Recent jobs across all services, newest first. Default `limit=50`.

```bash
curl 'https://api.trypact.xyz/v1/jobs?limit=10'
```

```jsonc
{
  "count": 3,
  "jobs": [ /* Job[] */ ]
}
```

***

### `GET /v1/jobs/:id`

One job's full state plus attestation bytes (if state ≥ Attested).

```bash
curl https://api.trypact.xyz/v1/jobs/2
```

Returns the `Job` struct, or `404` if not found.

***

### `GET /v1/sellers/:address`

Every service plus job for one seller wallet address.

```bash
curl https://api.trypact.xyz/v1/sellers/0xbF7EF900E2dB365455B91Fb133f78Fc70114Bf31
```

```jsonc
{
  "seller": "0xbF7EF900E2dB365455B91Fb133f78Fc70114Bf31",
  "services": [ /* Service[] */ ],
  "jobs": [ /* Job[] */ ]
}
```

***

### `GET /v1/stats`

Aggregate protocol counters.

```bash
curl https://api.trypact.xyz/v1/stats
```

```jsonc
{
  "services": 1,
  "jobs": {
    "total": 3,
    "settled": 3,
    "expired": 0,
    "slashed": 0
  },
  "totalSettledWei": "3000000000000000"
}
```

***

## Caching and freshness

The indexer polls events every 3s (configurable). Typical lag from on chain settlement to indexed availability is under 6s. If you need rock solid real time, use the SDK against the contract directly (`pact.jobs.watch(id)`) or subscribe to events via viem's `watchContractEvent`.

***

## Source

* App: [`apps/indexer/`](https://github.com/winsznx/pact/tree/main/apps/indexer)
* Deployment: Railway
* Status: <https://api.trypact.xyz/healthz>


---

# 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.trypact.xyz/reference/indexer-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.
