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

# Cancel Listing

> Calldata that cancels an open listing

> [!NOTE]
>
> Seller Financing is in beta and runs on Ethereum Sepolia instances only for now (`DEVELOPMENT` instances on Ethereum). A `PRODUCTION` instance, or one on another network, answers `503 SELLER_FINANCING_UNAVAILABLE`. See [Seller Financing](/endpoints/seller-financing/introduction.md).

Builds the cancellation of an `OPEN` listing. The seller or the market's operator signs it. Once mined, the listing reads `CANCELLED` and can no longer be bought.

In freeze mode nothing moves, since nothing was frozen before a purchase. In custody mode the adapter returns the asset to the seller. When the token refuses that return, the cancellation still goes through and the adapter keeps the asset in escrow for the seller. Before building, the API simulates the return from the adapter: when the token refuses it, the answer carries `assetReturn` with `willEscrow: true` and the same text in `warning`. Once the token admits the seller again, the seller takes the asset back with [Claim Escrowed Collateral](/endpoints/seller-financing/claim-escrowed-collateral.md).

Cancellation stays open while the market is paused. An operator uses it to withdraw the open listings of a seller who lost verification.

## Path Parameters

**marketId** `string` *required*

The market's record ID, as `id` on [List Markets](/endpoints/seller-financing/list-markets.md).

**listingId** `string` *required*

The listing's ID on the market.

## Body Parameters

**from** `string` *required*

The wallet that signs: the seller or a holder of `OPERATOR_ROLE`. Without it the answer is `400 FROM_REQUIRED`. Any other wallet answers `409 TX_WOULD_REVERT` with `NotSeller`, and the message names the seller and the current operators, also in `details.seller` and `details.roleHolders`.

## Response Fields

**data** `object`

**action** `string`

`SIGN_TRANSACTIONS`.

**chainId** `integer`

The chain the step is built for.

**steps** `array`

One step, `cancelListing` on the market, with `gasLimit`.

**confirmStepIndex** `integer`

`0`.

**preflight** `object`

`{ simulated: true, gasEstimate }`.

**signer** `object`

`{ role: "SELLER_OR_OPERATOR_ROLE", seller }`: the seller of the listing, or a holder of `OPERATOR_ROLE`, signs.

**assetReturn** `object`

Custody mode only, present when the asset token refuses the return to the seller: `{ willEscrow: true, reason, message }`. `reason` is the token's refusal when it gave one, otherwise `null`. Absent when the return goes through or could not be checked.

**warning** `string`

`assetReturn.message`, present with it.

```bash cURL theme={null}
curl -X POST "https://api.trusset.org/seller-financing/api/markets/cmsg4x7k20003sf9q1d8v6b2e/listings/5/cancel" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"from": "0x3E22FdfA28e880239541d9c5B66B3b161F9ED77b"}'
```

```typescript TypeScript theme={null}
const res = await fetch(
  `https://api.trusset.org/seller-financing/api/markets/${marketId}/listings/${listingId}/cancel`,
  {
    method: 'POST',
    headers: { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' },
    body: JSON.stringify({ from: await seller.getAddress() })
  }
);
const { data } = await res.json();
const step = data.steps[0];
await (await seller.sendTransaction({ to: step.to, data: step.data, value: 0, gasLimit: step.gasLimit })).wait();
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "action": "SIGN_TRANSACTIONS",
    "chainId": 11155111,
    "steps": [
      {
        "to": "0xc35e5f74eC4C1dfB8cE2b8798D6161B706F9B5E1",
        "data": "0x305a67a8...",
        "value": "0",
        "functionName": "cancelListing",
        "label": "Cancel listing 5",
        "description": "Cancel listing 5",
        "gasLimit": "88071",
        "chainId": 11155111
      }
    ],
    "confirmStepIndex": 0,
    "preflight": {
      "simulated": true,
      "gasEstimate": "67747"
    },
    "signer": {
      "role": "SELLER_OR_OPERATOR_ROLE",
      "seller": "0x3E22FdfA28e880239541d9c5B66B3b161F9ED77b"
    }
  },
  "error": null,
  "metadata": {
    "timestamp": "2026-10-19T09:12:04.318Z",
    "requestId": "3f7c2a91-6d84-4b0e-9a15-c2e8f4d7b603",
    "instanceId": "inst_abc123"
  }
}
```

```json Error - Not Open theme={null}
{
  "success": false,
  "data": null,
  "error": {
    "code": "INVALID_STATUS",
    "message": "Listing 4 is active; this action needs it open.",
    "details": { "status": "ACTIVE" }
  },
  "metadata": {
    "timestamp": "2026-10-19T09:12:04.318Z",
    "requestId": "3f7c2a91-6d84-4b0e-9a15-c2e8f4d7b603",
    "instanceId": "inst_abc123"
  }
}
```

## Error Codes

| Code | HTTP | Cause |
| - | - | - |
| `INVALID_LISTING_ID` | `400` | `listingId` is not a positive integer of up to 19 digits |
| `VALIDATION_ERROR` | `400` | `from` is malformed, or the body carries another field. `error.details` names it |
| `FROM_REQUIRED` | `400` | `from` is missing. The message names who signs: the seller of the listing or a wallet that holds `OPERATOR_ROLE` |
| `MARKET_NOT_FOUND` | `404` | No market with this ID that your instance reaches on its network |
| `LISTING_NOT_FOUND` | `404` | No listing with this ID on the market |
| `INVALID_STATUS` | `409` | The listing is not `OPEN`. `details.status` names its status |
| `TX_WOULD_REVERT` | `409` | The cancellation would revert, for example with `NotSeller` when `from` is neither the seller nor an operator (`details.requiredRole`, `details.seller` and `details.roleHolders` name who can sign), or with `InsufficientLocked` because the custody adapter holds less than it recorded. A return the token refuses does not revert: it is escrowed, as `assetReturn` says |
| `CHAIN_UNAVAILABLE` | `503` | The chain could not be read. Nothing was built. Retry shortly |
| `SELLER_FINANCING_UNAVAILABLE` | `503` | The instance is a `PRODUCTION` instance or not on Ethereum |
| `CANCEL_BUILD_FAILED` | `500` | Unexpected failure. Nothing was built. Retry, or contact support with the request ID |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.