# schedulePieceDeletions

> **schedulePieceDeletions**(`client`, `options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/sp/namespaces/deletepieces/type-aliases/outputtype/)\>

Defined in: [packages/synapse-core/src/sp/schedule-piece-deletion.ts:151](https://github.com/FilOzone/synapse-sdk/blob/b35b371ef603fd76d17b0f4e9e740bcdd9b7fbc3/packages/synapse-core/src/sp/schedule-piece-deletion.ts#L151)

Schedule piece deletions in one transaction.

Call the Service Provider API to schedule the piece deletion.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `client` | `Client`\<`Transport`, `Chain`, `Account`\> | The client to use to schedule the piece deletion. |
| `options` | [`OptionsType`](/reference/filoz/synapse-core/sp/namespaces/schedulepiecedeletions/type-aliases/optionstype/) | [schedulePieceDeletions.OptionsType](/reference/filoz/synapse-core/sp/namespaces/schedulepiecedeletions/type-aliases/optionstype/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/sp/namespaces/deletepieces/type-aliases/outputtype/)\>

Schedule piece deletions operation hash [schedulePieceDeletions.OutputType](/reference/filoz/synapse-core/sp/namespaces/schedulepiecedeletions/type-aliases/outputtype/)

## Throws

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

## Example

```ts
import { schedulePieceDeletions } from '@filoz/synapse-core/sp'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { calibration } from '@filoz/synapse-core/chains'

const account = privateKeyToAccount('0x...')
const client = createWalletClient({
  account,
  chain: calibration,
  transport: http(),
})

const result = await schedulePieceDeletions(client, {
  pieceIds: [1n, 2n],
  dataSetId: 1n,
  clientDataSetId: 1n,
  serviceURL: 'https://pdp.example.com',
})

console.log(result.hash)
```