> ## 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.

# Withdraw Nomination

> Withdraw a candidate nomination from a market still seeking a lender of record

Returns the factory transaction that withdraws one candidate's nomination. Once it mines, that wallet can no longer take the market as a nominee, and [Get Nominations](/endpoints/lending/get-nominations) stops listing it. Withdrawing is only possible while the market still seeks a lender of record: after adoption the nomination list is fixed.

A withdrawn wallet is not necessarily shut out. On a market deployed with `openToAnyCurator`, it can still claim the role the way any claimant nobody nominated can, when the deployer's borrower register verifies it. Nominating it again restores its nomination.

The same two checks apply as for [Nominate Candidate](/endpoints/lending/nominate-candidate). The API builds the transaction only when this instance's registered wallet is the factory owner or on the factory's deployer register. The factory accepts it only from the wallet that deployed this market, or from the factory owner. There is no confirm call.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Body Parameters

<ParamField body="candidate" type="string" required>
  Nominated wallet to withdraw. A checksum-valid address that is not the zero address. It must be nominated on this market right now.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="action" type="string">`SIGN_TRANSACTION`.</ResponseField>
    <ResponseField name="transaction" type="object">Unsigned transaction, `{ to, data, value, chainId }`, addressed to the lending factory.</ResponseField>
    <ResponseField name="functionName" type="string">`withdrawNomination`.</ResponseField>
    <ResponseField name="marketAddress" type="string">Market contract address, lowercased.</ResponseField>
    <ResponseField name="candidate" type="string">The wallet whose nomination is withdrawn, lowercased.</ResponseField>
    <ResponseField name="signer" type="string">This instance's registered wallet, which the transaction expects to be signed by.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/nominations/withdraw" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{ "candidate": "0xb27d0f6a91c458e307b2d4f8916ac05e73128b64" }'
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/nominations/withdraw`,
    {
      method: 'POST',
      headers: {
        'X-API-Key': 'trusset_your_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ candidate: '0xb27d0f6a91c458e307b2d4f8916ac05e73128b64' })
    }
  );
  const { data } = await res.json();

  const tx = await wallet.sendTransaction(data.transaction);
  await tx.wait();
  ```
</RequestExample>

<ResponseExample>
  ```json Calldata Response theme={null}
  {
    "success": true,
    "data": {
      "action": "SIGN_TRANSACTION",
      "transaction": {
        "to": "0xf1ad12f5698f58badd8a662acffccb067a2ddb8a",
        "data": "0x...",
        "value": "0",
        "chainId": 11155111
      },
      "functionName": "withdrawNomination",
      "marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
      "candidate": "0xb27d0f6a91c458e307b2d4f8916ac05e73128b64",
      "signer": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52"
    }
  }
  ```

  ```json Error - Not Nominated theme={null}
  {
    "success": false,
    "error": {
      "code": "NOT_NOMINATED",
      "message": "This candidate is not currently nominated for this market"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                         | HTTP  | Cause                                                                                                                                                                        |
| ---------------------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `VALIDATION_ERROR`           | `400` | `candidate` is missing, malformed, the zero address, or fails its EIP-55 checksum                                                                                            |
| `NO_MARKET_ADDRESS`          | `400` | The market has no on-chain address                                                                                                                                           |
| `WITHDRAW_NOMINATION_FAILED` | `400` | The transaction could not be built for a reason that carries no code of its own                                                                                              |
| `MISSING_MARKET_ID`          | `400` | `marketId` is longer than 100 characters                                                                                                                                     |
| `DEPLOYER_NOT_AUTHORIZED`    | `403` | This instance's registered wallet is neither the factory owner nor on the factory's deployer register. A factory that could not be read for this check answers the same code |
| `MARKET_NOT_FOUND`           | `404` | No market with this ID on your instance                                                                                                                                      |
| `MARKET_NOT_DEPLOYED`        | `404` | The lending factory holds no deployment for this market                                                                                                                      |
| `NOT_NOMINATED`              | `409` | The candidate is not nominated on this market right now                                                                                                                      |
| `NOT_SEEKING_CURATOR`        | `409` | The market already has a lender of record. The message names it                                                                                                              |
| `WALLET_NOT_CONFIGURED`      | `412` | This instance has no verified wallet to sign the withdrawal                                                                                                                  |
| `FACTORY_READ_FAILED`        | `503` | The factory could not be reached to read the market. Retry shortly                                                                                                           |
