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

# Administer your delegate

> Read your stablecoin delegate's on-chain configuration, then prepare the transaction that changes it for your capital provider admin wallet to sign.

This recipe changes one setting of your stablecoin delegate on Ethereum: you read its current configuration, prepare the transaction that makes the change, then sign and send it from your capital provider admin wallet. The example sets the discount on USTB to 0.1%. Every other change, such as whitelisting an RWA, setting a custody address, or pausing the delegate, follows the same steps with another action from [Admin actions](https://docs.multiliquid.xyz/api-reference/capital-providers/delegates.md#admin-actions).

Multiliquid never signs or sends the transaction. Your capital provider admin wallet signs it and sends it to Ethereum, and the change takes effect when it is included in a block.

## Before you start

* **Your organization ID and delegate ID.** `GET /v1/organization` returns the organization's `id`, and `GET /v1/organizations/{organizationId}/delegates` lists your delegates with their `delegateId`, as [Delegates](https://docs.multiliquid.xyz/api-reference/capital-providers/delegates.md) shows. The examples set them as `$ORGANIZATION_ID` and `$DELEGATE_ID`.
* **An API key** with `read` to read the configuration and `cp:admin` to prepare a change. Only an admin of your organization can grant `cp:admin`. [Authentication](https://docs.multiliquid.xyz/api-reference/authentication.md#scopes) explains scopes.
* **The capital provider admin wallet.** On-chain, the delegate keeps its admins under the identifier `issuerAdmins`, so the API names this wallet `issuerAdminAddress`. Only an admin wallet can make a change. The examples use `0x1111111111111111111111111111111111111111`.
* **ETH for gas** in that wallet.

## 1. Read the current configuration

`GET /v1/organizations/{organizationId}/delegates/{delegateId}/admin/state` returns the delegate's configuration as it is on-chain now. Add `rwa`, `stablecoin`, `account`, or `issuerAdminAddress` to check one address against the delegate's RWA whitelist, stablecoin whitelist, blacklist, or admins. Here you confirm that USTB is whitelisted and that your wallet is an admin.

```bash theme={null}
curl "https://api.multiliquid.xyz/v1/organizations/$ORGANIZATION_ID/delegates/$DELEGATE_ID/admin/state?network=evm-mainnet&rwa=0x43415eb6ff9db7e26a15b704e7a3edce97d31c4e&issuerAdminAddress=0x1111111111111111111111111111111111111111" \
  -H "Authorization: Bearer $MULTILIQUID_API_KEY"
```

```json Response theme={null}
{
  "delegateId": "0x58e27f2731863499e6a23a1662ebeed9041d6b40996ea9ca7f4ebc54201823b4",
  "delegateAddress": "0x0630582db5a1949509f21b315677c40b9aeb7bda",
  "network": "evm-mainnet",
  "chainId": 1,
  "stablecoinAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "swapContract": "0xd66211cf522ba23b59789fff6524c1f03e13e20c",
  "paused": false,
  "rwaCustodyAddress": "0xa05c84c4daa64bf29b35e1ff06446fb0766e0a69",
  "stablecoinCustodyAddress": "0xa05c84c4daa64bf29b35e1ff06446fb0766e0a69",
  "rwaColdStorageAddresses": [],
  "stablecoinColdStorageAddresses": [],
  "rwaWhitelisted": true,
  "isIssuerAdmin": true
}
```

`rwaWhitelisted` and `isIssuerAdmin` appear because the request asked for them. [Admin state](https://docs.multiliquid.xyz/api-reference/capital-providers/delegates.md#admin-state) describes every field.

## 2. Prepare the change

`POST /v1/organizations/{organizationId}/delegates/{delegateId}/admin/prepare` takes the `network`, the admin wallet that will send the transaction, and the `action`. A discount is set by the RWA's ID, which [deployment info](https://docs.multiliquid.xyz/api-reference/data/endpoints.md#deployment-info) lists, and a rate is a whole number of basis points in `rateBps`: `10` is 0.1%.

```bash theme={null}
curl -X POST "https://api.multiliquid.xyz/v1/organizations/$ORGANIZATION_ID/delegates/$DELEGATE_ID/admin/prepare" \
  -H "Authorization: Bearer $MULTILIQUID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "evm-mainnet",
    "issuerAdminAddress": "0x1111111111111111111111111111111111111111",
    "action": {
      "type": "setRwaDiscountRate",
      "rwaId": "0x6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da68",
      "rateBps": 10
    }
  }'
```

```json Response theme={null}
{
  "delegateId": "0x58e27f2731863499e6a23a1662ebeed9041d6b40996ea9ca7f4ebc54201823b4",
  "delegateAddress": "0x0630582db5a1949509f21b315677c40b9aeb7bda",
  "network": "evm-mainnet",
  "description": "Set discount rate to 10 bps for RWA 0x6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da68 on delegate 0x0630582db5a1949509f21b315677c40b9aeb7bda",
  "checks": {
    "isIssuerAdmin": true,
    "simulation": {
      "passed": true
    }
  },
  "transaction": {
    "runtime": "evm",
    "chainId": 1,
    "from": "0x1111111111111111111111111111111111111111",
    "to": "0x0630582db5a1949509f21b315677c40b9aeb7bda",
    "data": "0x72749fde6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da6800000000000000000000000000000000000000000000000000038d7ea4c68000",
    "value": "0",
    "nonce": "4",
    "gas": "85141",
    "maxFeePerGas": "21500000000",
    "maxPriorityFeePerGas": "1500000000",
    "serialized": "0x02f86e01048459682f008505017ff70083014c95940630582db5a1949509f21b315677c40b9aeb7bda80b84472749fde6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da6800000000000000000000000000000000000000000000000000038d7ea4c68000c0"
  }
}
```

Preparing stores nothing and changes nothing. You can prepare as often as you like, and discard a transaction you don't send.

## 3. Check the result

`checks` tells you whether the transaction would succeed if sent now:

* **`isIssuerAdmin`** is whether `issuerAdminAddress` is an admin of the delegate.
* **`simulation.passed`** is whether the transaction succeeds when run against the current chain state. When it fails, `simulation.error` says why, and the transaction's `gas` and `serialized` are `null`.

A failing check never fails the request: you still receive the transaction, so you can see what to fix. Here, a wallet that is not an admin of the delegate prepared the same change:

```json Response theme={null}
{
  "delegateId": "0x58e27f2731863499e6a23a1662ebeed9041d6b40996ea9ca7f4ebc54201823b4",
  "delegateAddress": "0x0630582db5a1949509f21b315677c40b9aeb7bda",
  "network": "evm-mainnet",
  "description": "Set discount rate to 10 bps for RWA 0x6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da68 on delegate 0x0630582db5a1949509f21b315677c40b9aeb7bda",
  "checks": {
    "isIssuerAdmin": false,
    "simulation": {
      "passed": false,
      "error": "the transaction reverts in simulation with NotIssuerAdmin(): the sender is not an issuer admin of the delegate"
    }
  },
  "transaction": {
    "runtime": "evm",
    "chainId": 1,
    "from": "0x2222222222222222222222222222222222222222",
    "to": "0x0630582db5a1949509f21b315677c40b9aeb7bda",
    "data": "0x72749fde6f640388b2d2075b1c9f2f195fa3d1e4b26167f5e25357294d44c4b7c877da6800000000000000000000000000000000000000000000000000038d7ea4c68000",
    "value": "0",
    "nonce": "4",
    "gas": null,
    "maxFeePerGas": "21500000000",
    "maxPriorityFeePerGas": "1500000000",
    "serialized": null
  }
}
```

Don't send a transaction whose checks fail: it reverts on-chain and still costs gas. Fix the cause, such as preparing from an admin wallet or unpausing the delegate first, and prepare again.

## 4. Sign and send the transaction

Sign `transaction` with the wallet in `transaction.from`, your capital provider admin wallet, and send it to Ethereum mainnet. It is the only transaction the change needs. It is [complete](https://docs.multiliquid.xyz/api-reference/swap/quote-and-build.md#transactions-on-evm): the API filled in the wallet's next `nonce`, the `gas` limit, and current fees, so sign `serialized` as returned, or the fields unchanged, and don't set the nonce or fees yourself. Sign it within a few blocks; if the wallet sends another transaction first, or the fees have risen, prepare again.

## 5. Confirm the change

Once the transaction is in a block, check its receipt: `status` `1` means the change is live, and `0` means it reverted and nothing changed, so prepare again and check `checks` before you resend. Read the configuration again, as in step 1, to confirm a whitelist, custody, cold storage, pause, blacklist, or admin change. A rate, such as this discount, is not part of the admin state; the transaction's inclusion is the confirmation.

## When something goes wrong

| Code | What happened | What to do |
| - | - | - |
| `INVALID_REQUEST` | The `organizationId` or `delegateId` in the path is malformed, a query parameter is unknown or not an address, the state's `network` query parameter is missing or not `evm-mainnet` or `evm-sepolia`, or the body is not JSON | Correct the request; `details.field` names the value at fault |
| `INVALID_BODY` | A body field is missing, unknown, or invalid: a missing `network` or one other than `evm-mainnet` or `evm-sepolia`, an unknown action `type`, a zero or malformed address, a `rateBps` of `10000` (100%) or more, a withdrawal `amount` of zero or with more than 6 decimal places or more than the stablecoin has, a custody or cold storage address that is the delegate itself, or a `removeIssuerAdmin` that removes `issuerAdminAddress` | Correct the field that `details.field` names |
| `UNAUTHORIZED` | The API key is missing, invalid, expired, or revoked | Send a valid key |
| `INSUFFICIENT_SCOPE` | The key lacks `read` for the state, or `cp:admin` to prepare | Use a key with the scope; an admin can create one |
| `NOT_FOUND` | The organization in the path is not your key's, or your organization does not own the delegate on the network | Check both IDs and the network |
| `PAYLOAD_TOO_LARGE` | The body exceeds 1 KiB | Send only the documented fields |
| `NETWORK_NOT_ACTIVE` | The API does not serve delegate administration on the network | Don't retry; use `evm-mainnet` |
| `SERVICE_UNAVAILABLE` | The chain cannot be read now | Retry later |

[Errors](https://docs.multiliquid.xyz/api-reference/guides/errors.md) lists every code.


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