# Update XRPL account settings with the API

You can use the `AccountSet` operation to update account settings. This operation involves the creation of a transaction order.

For more information about the `AccountSet` operation, see AccountSet Flags in the XRPL documentation.

System change process
All new requests to change the system state follow the same process. To familiarize yourself with this process first, see [Manage intents and approvals](/pt-br/products/custody/governance/intents/manage-intents-and-approvals).

## Supported settings

You can set or clear the following settings:

- `asfGlobalFreeze`: Freeze all assets issued by the account.
- `asfNoFreeze`: Permanently give up the ability to freeze individual trust lines or disable global freeze on the issuer account. This flag can only be set once and can't be unset.
- `asfRequireAuth`: Require authorization for accounts to hold balances issued by this address.
- `asfAllowTrustLineClawback`: Allow the issuer account to claw back tokens it has issued. Can only be set before issuing tokens.
- `asfAccountTxnID`: Track the ID of this account's most recent transaction.
- `asfDepositAuth`: Enable deposit authorization on the holder account. Applies to both tokens and XRP.
- `asfRequireDest`: Require a destination tag for incoming payments to the account.
- `asfDefaultRipple`: Enable rippling on this account's trust lines by default. For more information, see [Rippling](https://xrpl.org/docs/concepts/tokens/fungible-tokens/rippling#rippling) in the XRPL documentation.


To update account settings, follow the steps in [Manage intents and approvals](/pt-br/products/custody/governance/intents/manage-intents-and-approvals) with a transaction order payload similar to the following example.

### Payload example

The SDK examples assume a configured client. See [Integrate via SDK](/pt-br/products/custody/get-started/integrate-via-sdk). The SDK methods build the `AccountSet` operation, submit the intent, and return a pending intent that you can wait on. The following examples set and clear account flags:

API
```json
{
    "payload": {
        "id": "8fd2d859-77de-4bcc-976c-3f4ccdfdcc3d",
        "accountId": "c8b9519a-be18-4db7-9aca-cce93834841b",
        "parameters": {
            "operation": {
                "type": "AccountSet",
                "setFlag": "asfGlobalFreeze",
                "clearFlag": "asfRequireDest",
                "transferRate": 1000000000
            },
            "sourceTag": 123456,
            "memos": [],
            "feeStrategy": {
                "drops": "5",
                "type": "SpecifiedAdditionalFee"
            },
            "maximumFee": "50",
            "type": "XRPL"
        },
        "description": "string",
        "customProperties": {},
        "type": "v0_CreateTransactionOrder"
    }
}
```

TypeScript
```typescript
import { CoreXrplAccountSetFlag } from '@ripple/ripple-custody-client-lib-typescript';

const pending = await client.transactions.xrpl.accountSet(accountId, {
  setFlag: CoreXrplAccountSetFlag.AsfGlobalFreeze,
  clearFlag: CoreXrplAccountSetFlag.AsfRequireDest,
  transferRate: 1000000000,
  maximumFee: '50',
});

await pending.waitAccepted(30_000);
await pending.waitExecuted(120_000);
const result = await pending.waitTxHash(300_000);
console.log(result.isSuccess, result.errorCode);
```

Java
```java
import com.ripple.custody.PendingIntent;
import com.ripple.custody.models.CoreApiTransaction;
import com.ripple.custody.models.CoreFeePriority;
import com.ripple.custody.models.CoreXrplAccountSetFlag;
import com.ripple.custody.models.CoreXrplFeeStrategy;
import com.ripple.custody.models.CoreXrplFeeStrategyPriority;

CoreXrplFeeStrategy feeStrategy = new CoreXrplFeeStrategy(
    new CoreXrplFeeStrategyPriority().priority(CoreFeePriority.MEDIUM));

PendingIntent pending = client.transactions().xrplAccountSet(
    domainId,
    accountId,
    "xrpl-testnet", // the ledger ID; required unless the account has a default ledger
    CoreXrplAccountSetFlag.ASF_GLOBAL_FREEZE,
    CoreXrplAccountSetFlag.ASF_REQUIRE_DEST,
    1000000000,
    feeStrategy,
    "50",
    null);

pending.waitAccepted(30);
var intent = pending.waitExecuted(120);
if (!"Executed".equals(String.valueOf(intent.getData().getState().getStatus()))) {
    throw new IllegalStateException("Intent did not execute: " + intent.getData().getState().getStatus());
}
CoreApiTransaction tx = pending.waitTxHash(300);
```

Python
```python
pending = client.transactions.xrpl.account_set(
    account_id,
    set_flag="asfGlobalFreeze",
    clear_flag="asfRequireDest",
    transfer_rate=1000000000,
    maximum_fee="50",
    source_tag=123456,
)

pending.wait_accepted(timeout=30)
intent = pending.wait_executed(timeout=120)
if intent.data.state.status != "Executed":
    raise RuntimeError(f"Intent did not execute: {intent.data.state.status}")
result = pending.wait_tx_hash(timeout=300)
print(result.is_success, result.error_code)
```

The TypeScript and Python methods use the `Priority` fee strategy. You set the priority with `feePriority` or `fee_priority`, which defaults to `Medium`. The Java method takes a `CoreXrplFeeStrategy`, which wraps either a `Priority` or a `SpecifiedAdditionalFee` strategy. Only the Python method accepts a source tag.

You can't set the same flag in `setFlag` and `clearFlag`. The SDKs reject that combination before they submit the intent.

Fields of the `payload` block to note are as follows:

| Field | Description |
|  --- | --- |
| `id` | ID of the transaction order |
| `accountId` | ID of the account to update |
| `parameters.operation` | Details of the operation:`type`: `AccountSet``setFlag`: Enable the specified setting.`clearFlag`: Disable the specified setting.`transferRate`: Optional XRPL transfer rate integer, for example `1000000000` for no transfer fee. You must set at least one of `setFlag`, `clearFlag`, or `transferRate`. For a list of supported settings, see [Supported settings](#supported-settings). |
| `parameters.sourceTag` | Optional source tag for the XRPL transaction. |
| `parameters.memos` | XRPL memos to include. Use an empty array when there are no memos. |
| `parameters.feeStrategy` | The fee strategy to use for the transaction. For more information, see [Fee strategy and maximum fee](/pt-br/products/custody/transactions/reference#fee-strategy-and-maximum-fee). |
| `parameters.maximumFee` | The maximum fee, in drops. For more information, see [Fee strategy and maximum fee](/pt-br/products/custody/transactions/reference#fee-strategy-and-maximum-fee). |
| `parameters.type` | Ledger type, in this case `XRPL`. |
| `type` | `v0_CreateTransactionOrder` |