{"templateId":"markdown","versions":[{"version":"v1.40","label":"v1.40 STS","link":"/products/custody/v1.40/resources/sdk/entities","default":true,"active":false,"folderId":"c15a2701"},{"version":"v1.39","label":"v1.39 STS","link":"/products/custody/v1.39/resources/sdk/entities","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.38","label":"v1.38 STS","link":"/products/custody/v1.38/resources/sdk/entities","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.34","label":"v1.34 LTS","link":"/products/custody/v1.34/resources/sdk/entities","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.26","label":"v1.26 LTS","link":"/products/custody/v1.26/resources/sdk/entities","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.19","label":"v1.19 LTS","link":"/products/custody/v1.19/resources/sdk/entities","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.15","label":"v1.15 LTS","link":"/products/custody/v1.15/resources/sdk/entities","default":false,"active":true,"folderId":"c15a2701"}],"sharedDataIds":{"sidebar":"sidebar-products/custody/@v1.15/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Create and update entities","description":"User guides, API reference, and support resources.","siteUrl":"https://docs.ripple.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"create-and-update-entities","__idx":0},"children":["Create and update entities"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These procedures describe how to submit the main operations (create, update, lock, and unlock) for different entities, such as domains, vaults, and accounts."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information about these operations and entities, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/get-started"},"children":["API > Get started"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We assume that you have access to ","Ripple Custody",", for example, a Ripple-provided sandbox, and that the environment is initialized and fully functional, that is, system setup is complete, as described in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/get-started/deployment/system-setup/setup"},"children":["Run system setup"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"create-an-entity","__idx":1},"children":["Create an entity"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create"]}," type intents passed to the API have a builder object: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{Entity.builder()} -> {build methods} -> {.build}"]},". You need to use the correct builder for the entity. You can also access builder objects through the action object that represents the entity. The following sections show examples for each entity type."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"update-an-entity","__idx":2},"children":["Update an entity"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Updates are retrieved from their ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get/list"]}," representations, and have ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["set"]}," methods to update their values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{get} -> {set values} -> {actions} -> {update operation}"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":3},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The examples below represent a comprehensive set of operations needed for proposing intents for managing entities."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"domain","__idx":4},"children":["Domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples create, update, and lock and unlock domains. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-domain","__idx":5},"children":["Create a domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example creates a domain with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar domainName = \"\";\nvar parentDomainId = \"\";\n\nvar userId = \"\";\nvar userAlias = \"\";\nvar userDescription = \"\";\nvar userPublicKey = \"\";\nvar userRole = \"\";\n\nvar domain = Domains.CreateDomain.builder()\n        .id(domainId)\n        .alias(domainName)\n        .permissions(Domains.Permissions.builder().readAccess(\n                Domains.ReadAccess.builder().all(\"admin\").build()\n        ).build())\n        .policy(Policies.CreateDomainGenesisPolicy.buildDefault())\n        .governingStrategy(Domains.GoverningStrategy.CoerceDescendants)\n        .user(Users.CreateDomainGenesisUser.builder()\n                .id(userId)\n                .alias(userAlias)\n                .description(userDescription)\n                .publicKey(userPublicKey)\n                .role(userRole)\n                .build())\n        .parentId(parentDomainId)\n        .build();\n\nharmonize.domains().create(domain, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the domain:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar domainName = \"\";\nvar parentDomainId = \"\";\n\nvar userId = \"\";\nvar userAlias = \"\";\nvar userDescription = \"\";\nvar userPublicKey = \"\";\nvar userRole = \"\";\n\nharmonize.domains().create()\n        .id(domainId)\n        .alias(domainName)\n        .permissions(Domains.Permissions.builder().readAccess(\n                Domains.ReadAccess.builder().all(\"admin\").build()\n        ).build())\n        .policy(Policies.CreateDomainGenesisPolicy.buildDefault())\n        .governingStrategy(Domains.GoverningStrategy.CoerceDescendants)\n        .user(Users.CreateDomainGenesisUser.builder()\n              .id(userId)\n              .alias(userAlias)\n              .description(userDescription)\n              .publicKey(userPublicKey)\n              .role(userRole)\n              .build())\n        .parentId(parentDomainId)\n        .expire(Expire.hours(24))\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-a-domain","__idx":6},"children":["Update a domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates a domain:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\n\n// Fetch the entity\nvar domain = harmonize.domains().get(domainId).orElseThrow();\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar domainUpdate = domain.asUpdate();\n\n// Call the `.set*` methods to make the changes\ndomainUpdate.setAlias(\"ABC-\")\n        .setDescription(\"Another description\");\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Ripple Custody.\nharmonize.domains().update(domainUpdate, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-a-domain","__idx":7},"children":["Lock or unlock a domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock a domain:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar domain = harmonize.domains().get(domainId).orElseThrow();\n\n// Then call the lock method on the actions instance\nharmonize.domains().lock(domain, Timeout.minutes(1))\n                .waitForSucceed(Timeout.minutes(1))\n\n// Or to unlock we call the `unlock` method:\nharmonize.domains().unlock(domain, Timeout.minutes(1))\n                .waitForSucceed(Timeout.minutes(1))\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"vaults","__idx":8},"children":["Vaults"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples register, update, and lock and unlock vaults. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"register-a-vault","__idx":9},"children":["Register a vault"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example registers a vault with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var vaultId = \"\";\nvar vaultAlias = \"\";\nvar vaultDescription = \"\";\nvar vaultPublicKey = \"\";\nvar vault = Vaults.CreateVault.builder()\n        .id(vaultId)\n        .alias(vaultAlias)\n        .description(vaultDescription)\n        .pubKey(vaultPublicKey)\n        .build();\n\nharmonize.vaults().create(\n        vault,\n        Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the vault:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var vaultId = \"\";\nvar vaultAlias = \"\";\nvar vaultDescription = \"\";\nvar vaultPublicKey = \"\";\n\nharmonize.vaults().create()\n        .id(vaultId)\n        .alias(vaultAlias)\n        .description(vaultDescription)\n        .pubKey(vaultPublicKey)\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-a-vault","__idx":10},"children":["Update a vault"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates a vault:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var vaultId = \"\";\n\n// Fetch the entity\nvar vault = harmonize.vaults().get(vaultId).orElseThrow();\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar vaultUpdate = vault.asUpdate();\n\n// Call the `.set*` methods to make the changes\nvaultUpdate.setAlias(\"Test alias\")\n        .setDescription(\"New description\")\n        .setCustomProperties(Map.of(\"A\", \"1\"));\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Harmonize.\nharmonize.vaults().update(vaultUpdate, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-a-vault","__idx":11},"children":["Lock or unlock a vault"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock a vault:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar vault = harmonize.vaults().get(vaultId).orElseThrow();\n\n// Then call the lock method on the actions instance\nharmonize.vaults().lock(vault, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n\n// Or to unlock we call the `unlock` method:\n    harmonize.vaults().unlock(vault, Expire.hours(24))\n                    .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"account","__idx":12},"children":["Account"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples create, update, and lock and unlock accounts. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-an-account","__idx":13},"children":["Create an account"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example creates an account with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar accountId = \"\";\nvar accountAlias = \"\";\nvar accountDescription = \"\";\nvar vaultId = \"\";\nvar ledgerId = \"\";\n\nvar account = Accounts.CreateAccount.builder()\n        .id(accountId)\n        .alias(accountAlias)\n        .description(accountDescription)\n        .ledgerId(ledgerId)\n        .vaultId(vaultId)\n        .build();\n\nharmonize.accounts(domainId).create(account, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the account:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar accountId = \"\";\nvar accountAlias = \"\";\nvar accountDescription = \"\";\nvar vaultId = \"\";\nvar ledgerId = \"\";\n\nharmonize.accounts(domainId)\n        .create()\n        .id(accountId)\n        .alias(accountAlias)\n        .description(accountDescription)\n        .ledgerId(ledgerId)\n        .vaultId(vaultId)\n        .expire(Expire.hours(24))\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-an-account","__idx":14},"children":["Update an account"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates an account:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar accountId = \"\";\n\n// Fetch the entity\nvar account = harmonize.accounts(domainId).get(accountId).orElseThrow();\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar accountUpdate = account.asUpdate();\n\n// Call the `.set*` methods to make the changes\naccountUpdate.setAlias(\"Test alias\")\n        .setDescription(\"Test description\");\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Ripple Custody.\nharmonize.accounts(domainId)\n        .update(accountUpdate, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-an-account","__idx":15},"children":["Lock or unlock an account"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock an account:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar account = harmonize.accounts(domainId).get(accountId).orElseThrow();\n\n// Then call the lock method on the actions instance\nharmonize.accounts(domainId).lock(account, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n\n// Or to unlock we call the `unlock` method:\nharmonize.accounts(domainId).unlock(account, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"endpoints","__idx":16},"children":["Endpoints"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples register, update, and lock and unlock endpoints. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"register-an-endpoint","__idx":17},"children":["Register an endpoint"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example registers an endpoint with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar endpointId = \"\";\nvar endpointAlias = \"\";\nvar endpointDescription = \"\";\nvar address = \"\";\nvar ledgerId = \"\";\n\nvar endpoint = Endpoints.CreateEndpoint.builder()\n        .id(endpointId)\n        .alias(endpointId)\n        .address(address)\n        .ledgerId(ledgerId)\n        .description(endpointDescription)\n        .build();\n\nharmonize.endpoints(domainId)\n        .create(endpoint, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the endpoint:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar endpointId = \"\";\nvar endpointAlias = \"\";\nvar endpointDescription = \"\";\nvar address = \"\";\nvar ledgerId = \"\";\n\nharmonize.endpoints(domainId).create()\n        .id(endpointId)\n        .alias(endpointAlias)\n        .address(address)\n        .ledgerId(ledgerId)\n        .description(endpointDescription)\n        .expire(Expire.hours(24))\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-an-endpoint","__idx":18},"children":["Update an endpoint"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates an endpoint:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar endpointId = \"\";\n\n// Fetch the entity\nvar endpoint = harmonize.endpoints(domainId).get(endpointId).orElseThrow()\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar endpointUpdate = endpoint.asUpdate();\n\n// Call the `.set*` methods to make the changes\nendpointUpdate.setAlias(\"TestAlias-\")\n        .setDescription(\"Test description\");\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Ripple Custody.\nharmonize.endpoints(domainId)\n        .update(endpointUpdate, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-an-endpoint","__idx":19},"children":["Lock or unlock an endpoint"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock an endpoint:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar endpoint = harmonize.endpoints(domainId).get(endpointId).orElseThrow()\n\n// Then call the lock method on the actions instance\nharmonize.endpoints(domainId).lock(endpoint, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n\n// Or to unlock we call the `unlock` method:\nharmonize.endpoints(domainId).unlock(endpoint, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"policies","__idx":20},"children":["Policies"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples create, update, and lock and unlock policies. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-policy","__idx":21},"children":["Create a policy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example creates a policy with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar policyId = \"\";\nvar policyAlias = \"\";\n\nvar policyDescription = \"\";\nvar conditionExpression = \"context.request.author.id != '6ac20654-450e-29e4-65e2-1bdecb7db7c4'\";\n\nvar policyWorkflow = Policies.WorkflowCondition.simpleBuilder()\n        .quorum(1)\n        .role(\"admin\")\n        .build();\n\nvar policyCondition = Policies.PolicyCondition.simpleBuilder()\n        .expression(conditionExpression)\n        .build();\n\nvar policy = Policies.CreatePolicy.builder()\n        .id(policyId)\n        .alias(policyAlias)\n        .intentType(Policies.IntentType.v0_CreateAccount)\n        .description(policyDescription)\n        .locked(false)\n        .rank(1)\n        .condition(policyCondition)\n        .workflow(policyWorkflow)\n        .build();\n\nharmonize.policies(domainId).create(policy, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the policy:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar policyId = \"\";\nvar policyAlias = \"\";\n\nvar policyDescription = \"\";\nvar conditionExpression = \"context.request.author.id != '6ac20654-450e-29e4-65e2-1bdecb7db7c4'\";\n\nvar policyWorkflow = Policies.WorkflowCondition.simpleBuilder()\n        .quorum(1)\n        .role(\"admin\")\n        .build();\n\nvar policyCondition = Policies.PolicyCondition.simpleBuilder()\n        .expression(conditionExpression)\n        .build();\n\nharmonize.policies(domainId).create()\n        .id(policyId)\n        .alias(policyAlias)\n        .intentType(Policies.IntentType.v0_CreateAccount)\n        .description(policyDescription)\n        .locked(false)\n        .rank(1)\n        .condition(policyCondition)\n        .workflow(policyWorkflow)\n        .expire(Expire.hours(24))\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-a-policy","__idx":22},"children":["Update a policy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates an policy:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar policyId = \"\";\n\nvar conditionExpression = \"context.request.author.id != '6ac20654-450e-29e4-65e2-1bdecb7db7c4'\";\n\n// Fetch the entity\nvar policy = harmonize.policies(domainId).get(policyId).orElseThrow();\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar policyUpdate = policy.asUpdate();\n\n// Call the `.set*` methods to make the changes\npolicyUpdate.setAlias(\"Test-Alias\")\n        .setDescription(\"ABC\");\n\nvar policyWorkflow = Policies.WorkflowCondition.simpleBuilder()\n        .quorum(1)\n        .role(\"admin\")\n        .build();\n\npolicyUpdate.setWorkflow(policyWorkflow);\n\nvar policyCondition = Policies.PolicyCondition.simpleBuilder()\n        .expression(conditionExpression)\n        .build();\n\npolicyUpdate.setCondition(policyCondition);\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Ripple Custody.\nharmonize.policies(domainId)\n        .update(policyUpdate, Expire.hours(24))\n        .waitForProcessingOrSucceeded(Timeout.minutes(1));\n\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-a-policy","__idx":23},"children":["Lock or unlock a policy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock a policy:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar policy = harmonize.policies(domainId).get(policyId).orElseThrow();\n\n// Then call the lock method on the actions instance\nharmonize.policies(domainId).lock(policy, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n\n// Or to unlock we call the `unlock` method:\nharmonize.policies(domainId).unlock(policy, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"transactions","__idx":24},"children":["Transactions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example creates a transaction. The example results in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-transaction","__idx":25},"children":["Create a transaction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example creates a transaction with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar fromAccount = \"\";\nvar toAccount = \"\";\nvar amount = \"5432\";\nvar maxFee = \"5432\";\n\nvar transaction = Transactions.CreateTransactionOrder.builder()\n        .fromAccount(fromAccount)\n        .orderParameters(Transactions.btcParameters()\n                .maxFee(maxFee)\n                .priorityHigh()\n                .toAccount(domainId, toAccount)\n                .amount(amount)\n                .build()\n        )\n        .build();\n\nharmonize.transactions(domainId).create(transaction, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the transaction:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar fromAccount = \"\";\nvar toAccount = \"\";\nvar amount = \"5432\";\nvar maxFee = \"5432\";\n\nharmonize.transactions(domainId)\n        .create()\n        .fromAccount(fromAccount)\n        .orderParameters(Transactions.btcParameters()\n                .maxFee(maxFee)\n                .priorityHigh()\n                .toAccount(domainId, toAccount)\n                .amount(amount)\n                .build()\n        ).expire(Expire.hours(24))\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"users","__idx":26},"children":["Users"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples create, update, and lock and unlock users. All examples result in an intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-user","__idx":27},"children":["Create a user"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example creates a policy with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar userId = \"\";\nvar userAlias = \"\";\nvar userRoles = List.of(\"admin\");\nvar userPublicKey = \"\";\nvar userDescription = \"\";\n\nvar user = Users.CreateUser.builder()\n        .id(userId)\n        .alias(userAlias)\n        .description(userDescription)\n        .roles(userRoles)\n        .publicKey(userPublicKey)\n        .build();\n\nharmonize.users(domainId)\n        .create(user, Expire.hours(24))\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example accesses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["builder"]}," object through the action object that represents the user:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar userId = \"\";\nvar userAlias = \"\";\nvar userRoles = List.of(\"admin\");\nvar userPublicKey = \"\";\nvar userDescription = \"\";\n        \nharmonize.users(domainId).create()\n        .id(userId)\n        .alias(userAlias)\n        .description(userDescription)\n        .roles(userRoles)\n        .publicKey(userPublicKey)\n        .submit()\n        .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this example to simultaneously create and submit an intent for an entity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"update-a-user","__idx":28},"children":["Update a user"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example updates a user:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var domainId = \"\";\nvar userId = \"\";\n\n// Fetch the entity\nvar user = harmonize.users(domainId).get(userId).orElseThrow();\n// Then call the `.asUpdate()` method, which will return an updatable object\nvar userUpdate = user.asUpdate();\n\n// Call the `.set*` methods to make the changes\nuserUpdate.setAlias(\"TestAlias-2\")\n        .addRole(\"account\");\n\n// And finally, use the Actions object `.update( updateEntity, expire)` method to send the update request to Ripple Custody.\nharmonize.users(domainId)\n        .update(userUpdate, Expire.hours(24))\n        .waitForProcessingOrSucceeded(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"lock-or-unlock-a-user","__idx":29},"children":["Lock or unlock a user"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples lock and unlock a user:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"// Fetch the entity\nvar user = harmonize.users(domainId).get(userId).orElseThrow();\n\n// Then call the lock method on the actions instance\nharmonize.users(domainId).lock(user, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n\n// Or to unlock we call the `unlock` method:\nharmonize.users(domainId).unlock(user, Expire.hours(24))\n                .waitForSucceed(Timeout.minutes(1));\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ledgers","__idx":30},"children":["Ledgers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These examples list all ledgers and return the details of a ledger."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You cannot create or update ledgers with the API."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"list-ledgers","__idx":31},"children":["List ledgers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following operation lists ledgers:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"harmonize.ledgers().list().ledgers.forEach(System.out::println)\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"get-a-ledger","__idx":32},"children":["Get a ledger"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following operation gets a ledger:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var ledger harmonize.ledgers().get(ledgerId).orElseThrow();\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"requests","__idx":33},"children":["Requests"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You cannot create or modify requests directly from the API. They are a result of sending intent proposals via the other actions objects."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"list-requests","__idx":34},"children":["List requests"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following operation lists requests:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"harmonize.requests(domainId).list().forEach(System.out::println);\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"get-a-request","__idx":35},"children":["Get a request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following operation gets a request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"var request = harmonize.requests(domainId).get(requestId).orElseThrow();\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"events","__idx":36},"children":["Events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You cannot create or modify events directly from the API."," ","You can retrieve events from the ","Ripple Custody"," cluster."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"list-events","__idx":37},"children":["List events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To list events:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"harmonize.events(domainId).list().forEach(System.out::println);\n","lang":"java"},"children":[]}]},"headings":[{"value":"Create and update entities","id":"create-and-update-entities","depth":1},{"value":"Create an entity","id":"create-an-entity","depth":2},{"value":"Update an entity","id":"update-an-entity","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"Domain","id":"domain","depth":3},{"value":"Create a domain","id":"create-a-domain","depth":4},{"value":"Update a domain","id":"update-a-domain","depth":4},{"value":"Lock or unlock a domain","id":"lock-or-unlock-a-domain","depth":4},{"value":"Vaults","id":"vaults","depth":3},{"value":"Register a vault","id":"register-a-vault","depth":4},{"value":"Update a vault","id":"update-a-vault","depth":4},{"value":"Lock or unlock a vault","id":"lock-or-unlock-a-vault","depth":4},{"value":"Account","id":"account","depth":3},{"value":"Create an account","id":"create-an-account","depth":4},{"value":"Update an account","id":"update-an-account","depth":4},{"value":"Lock or unlock an account","id":"lock-or-unlock-an-account","depth":4},{"value":"Endpoints","id":"endpoints","depth":3},{"value":"Register an endpoint","id":"register-an-endpoint","depth":4},{"value":"Update an endpoint","id":"update-an-endpoint","depth":4},{"value":"Lock or unlock an endpoint","id":"lock-or-unlock-an-endpoint","depth":4},{"value":"Policies","id":"policies","depth":3},{"value":"Create a policy","id":"create-a-policy","depth":4},{"value":"Update a policy","id":"update-a-policy","depth":4},{"value":"Lock or unlock a policy","id":"lock-or-unlock-a-policy","depth":4},{"value":"Transactions","id":"transactions","depth":3},{"value":"Create a transaction","id":"create-a-transaction","depth":4},{"value":"Users","id":"users","depth":3},{"value":"Create a user","id":"create-a-user","depth":4},{"value":"Update a user","id":"update-a-user","depth":4},{"value":"Lock or unlock a user","id":"lock-or-unlock-a-user","depth":4},{"value":"Ledgers","id":"ledgers","depth":3},{"value":"List ledgers","id":"list-ledgers","depth":4},{"value":"Get a ledger","id":"get-a-ledger","depth":4},{"value":"Requests","id":"requests","depth":3},{"value":"List requests","id":"list-requests","depth":4},{"value":"Get a request","id":"get-a-request","depth":4},{"value":"Events","id":"events","depth":3},{"value":"List events","id":"list-events","depth":4}],"frontmatter":{"seo":{"title":"Create and update entities"}},"lastModified":"2025-10-28T02:35:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/custody/v1.15/resources/sdk/entities","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}