# Intents

An **intent** represents a request to execute an action within the system, which shall eventually be executed if fully approved. In *Harmonize*, all security-critical operations follow the below execution lifecycle:
1. a user submits a properly signed intent to execute an action;
2. *Harmonize* browses through the **policies**, sorted by `rank`, and selects the first **policy** with matching `intentTypes` and `condition`;
3. *Harmonize* validates that the **policy** authorizes the author of the intent to submit it and sets the full approval `workflow` required for execution;
4. *Harmonize* waits for the required quorum of approvals as defined in the selected **policy** `workflow`;
5. Once fully approved, *Harmonize* executes the intent and mutates the state of the system, possibly triggering the execution of a side effect such as the processing of a transaction.

The author of an intent defines, in particular, the following fields:
- `payload`, which sets the `type` of the intent and the details of the operation to process;
- `expiry`, which sets an expiration time to the intent;
- `targetDomainId`, which sets the domain in which to execute the intent (either in the current domain or within a descendant domain);
- `type`, which defines whether the intent is an original submission (`Propose`), an intention to approve an existing intent (`Approve`) or an intention to reject an existing intent (`Reject`).

There exist four intent types for most entities in the system, as prefixed by:
- **Create** to create an entity of a given type;
- **Update** to update the definition of an entity;
- **Lock** to lock an entity;
- **Unlock** to unlock an entity.

Exceptions exist, such as for the release of quarantined **transfers**, which has its dedicated intent called **ReleaseQuarantinedTransfers**.

A generic intent, named **NotarizeData**, allows the submission of intents not related to internal processes of *Harmonize*. Such **intents** may be used to trigger external effects to extend the capabilities of the system, such as to initiate fiat payment orders or trading orders.

## Propose an intent

 - [POST /v1/intents](https://docs.ripple.com/products/custody/v1.36/devbox/intents/createintent.md)

## Approve an intent

 - [POST /v1/intents/approve](https://docs.ripple.com/products/custody/v1.36/devbox/intents/approveintent.md)

## Reject an intent

 - [POST /v1/intents/reject](https://docs.ripple.com/products/custody/v1.36/devbox/intents/rejectintent.md)

## List intents

 - [GET /v1/domains/{domainId}/intents](https://docs.ripple.com/products/custody/v1.36/devbox/intents/getintents.md)

## Get intent details

 - [GET /v1/domains/{domainId}/intents/{intentId}](https://docs.ripple.com/products/custody/v1.36/devbox/intents/getintent.md)

## Get remaining users

 - [GET /v1/domains/{domainId}/intents/{intentId}/remaining-users](https://docs.ripple.com/products/custody/v1.36/devbox/intents/getremainingusers.md): This API will return the remaining user IDs able to approve for the currently open step of the intent approval process.

## Perform a dry-run for given intent payload

 - [POST /v1/intents/dry-run](https://docs.ripple.com/products/custody/v1.36/devbox/intents/intentdryrun.md)

