# findPiece

> **findPiece**(`options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`PieceCID`](/reference/filoz/synapse-core/piece/classes/piececid/)\>

Defined in: [packages/synapse-core/src/sp/find-piece.ts:65](https://github.com/FilOzone/synapse-sdk/blob/840d7b2c6263846ac51b7558000e62dd68d33a44/packages/synapse-core/src/sp/find-piece.ts#L65)

Find a piece on the PDP API.

GET /pdp/piece?pieceCid={pieceCid}

Transient failures (5xx, 429, network errors) are retried. HTTP errors and timeouts are thrown as
[FindPieceError](/reference/filoz/synapse-core/errors/classes/findpieceerror/) with the original error as `cause`; `notFound` tells a missing piece apart
from other failures.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `options` | [`OptionsType`](/reference/filoz/synapse-core/sp/namespaces/findpiece/type-aliases/optionstype/) | [findPiece.OptionsType](/reference/filoz/synapse-core/sp/namespaces/findpiece/type-aliases/optionstype/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`PieceCID`](/reference/filoz/synapse-core/piece/classes/piececid/)\>

Piece CID [findPiece.OutputType](/reference/filoz/synapse-core/sp/namespaces/findpiece/type-aliases/outputtype/)

## Example

```ts
import * as SP from '@filoz/synapse-core/sp'
import * as Piece from '@filoz/synapse-core/piece'

// wait for an uploaded piece to be parked
const pieceCid = await SP.findPiece({
  serviceURL: 'https://pdp.example.com',
  pieceCid: Piece.from('bafkzcib...'),
  poll: true,
})
```

## Throws

Errors [findPiece.ErrorType](/reference/filoz/synapse-core/sp/namespaces/findpiece/type-aliases/errortype/)