> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spark.money/llms.txt
> Use this file to discover all available pages before exploring further.

# queryHTLC

> Query HTLCs by payment hash, status, or transfer ID.

Queries HTLCs with flexible filtering options.

## Method Signature

```typescript theme={null}
async queryHTLC({
  paymentHashes,
  status,
  transferIds,
  matchRole,
  limit,
  offset,
}: {
  paymentHashes?: string[];
  status?: PreimageRequestStatus;
  transferIds?: string[];
  matchRole?: PreimageRequestRole;
  limit?: number;
  offset?: number;
}): Promise<QueryHtlcResponse>
```

## Parameters

<ResponseField name="paymentHashes" type="string[]">
  Array of payment hashes to filter by
</ResponseField>

<ResponseField name="status" type="PreimageRequestStatus">
  Filter by HTLC status
</ResponseField>

<ResponseField name="transferIds" type="string[]">
  Array of transfer IDs to filter by
</ResponseField>

<ResponseField name="matchRole" type="PreimageRequestRole">
  Filter by role (default: `PREIMAGE_REQUEST_ROLE_RECEIVER`)
</ResponseField>

<ResponseField name="limit" type="number">
  Maximum results to return (1-100, default: 100). Values outside this range throw `SparkValidationError`.
</ResponseField>

<ResponseField name="offset" type="number">
  Pagination offset (default: 0). Must be non-negative.
</ResponseField>

## Returns

<ResponseField name="response" type="QueryHtlcResponse" required>
  HTLC query results
</ResponseField>

## Example

```typescript theme={null}
const htlcs = await wallet.queryHTLC({
  limit: 50,
  offset: 0
});
console.log("HTLCs:", htlcs);
```
