# Approve and reject intents

For any intent that is submitted, one or more approvals are needed, depending on the workflow of the governing policy. The policy prescribes that certain users with a defined role need to approve or reject the intent.

## Retrieve intent details

To retrieve the details of the intent to approve or reject, call the [List intents](/products/custody/v1.34/api/reference/openapi/intents/getintents) operation, with the following query parameters:

- `details.payload.type` set to the intent type.
- `details.targetDomainId` set to the domain where the intent was submitted.
- `state.status` set to `Open`.


For example, the following response shows an open intent to create a transaction order:


```json
{
    "items": [
        {
            "data": {
                "id": "846b5c3c-27e3-4146-ab18-ce6732624d35",
                "details": {
                    "payload": {
                        "id": "5710cfd1-ee87-4dff-9967-4dd7f3379950",
                        "accountId": "c364d7bb-4bfa-4725-bbfe-2a0b9dcd375d",
                        "ledgerId": "xrpl-testnet-april-2024",
                        "parameters": {
                            "destination": {
                                "accountId": "827ce666-16d8-4716-8541-6ccce8a045cd",
                                "type": "Account"
                            },
                            "amount": "15000000",
                            "feeStrategy": {
                                "priority": "High",
                                "type": "Priority"
                            },
                            "maximumFee": null,
                            "sourceTag": null,
                            "destinationTag": null,
                            "memos": [],
                            "type": "XRPL"
                        },
                        "description": null,
                        "customProperties": {},
                        "type": "v0_CreateTransactionOrder"
                    },
                    "expiryAt": "2024-07-10T06:56:23.991Z",
                    "author": {
                        "id": "3b04df44-29a8-4b00-ad69-d76c44998e40",
                        "domainId": "79c862af-de9f-4312-ac26-ca4703605143"
                    },
                    "targetDomainId": "79c862af-de9f-4312-ac26-ca4703605143",
                    "metadata": {
                        "description": null,
                        "createdAt": "2024-06-10T06:56:33.560Z",
                        "customProperties": {}
                    },
                    "proposalSignature": "<PROPOSAL_SIGNATURE>"
                },
                "state": {
                    "status": "Open",
                    "lastModifiedAt": "2024-06-10T06:56:33.560Z",
                    "error": null,
                    "progressPerPolicy": [
                        {
                            "stepProgress": [
                                {
                                    "state": "Open",
                                    "decisions": []
                                }
                            ],
                            "policyReference": {
                                "id": "7ce188ac-3b4d-4dcb-a317-e10e2c89b096",
                                "revision": 2,
                                "domainId": "09ecd783-932c-45d0-ad66-3b22e4f621a2"
                            }
                        },
                        {
                            "stepProgress": [
                                {
                                    "state": "Approved",
                                    "decisions": [
                                        {
                                            "author": {
                                                "id": "3b04df44-29a8-4b00-ad69-d76c44998e40",
                                                "domainId": "79c862af-de9f-4312-ac26-ca4703605143"
                                            },
                                            "authorRoles": [
                                                "manager",
                                                "tester",
                                                "transaction"
                                            ],
                                            "seenBySystemAt": "2024-06-10T06:56:33.560Z",
                                            "expiryAt": null,
                                            "decision": "Approve",
                                            "approvalReason": null,
                                            "rejectionReason": null,
                                            "rawRequest": "{\"author\":{\"domainId\":\"79c862af-de9f-4312-ac26-ca4703605143\",\"id\":\"3b04df44-29a8-4b00-ad69-d76c44998e40\"},\"customProperties\":{},\"expiryAt\":\"2024-07-10T06:56:23.991Z\",\"id\":\"846b5c3c-27e3-4146-ab18-ce6732624d35\",\"payload\":{\"accountId\":\"c364d7bb-4bfa-4725-bbfe-2a0b9dcd375d\",\"customProperties\":{},\"id\":\"5710cfd1-ee87-4dff-9967-4dd7f3379950\",\"ledgerId\":\"xrpl-testnet-april-2024\",\"parameters\":{\"amount\":\"15000000\",\"destination\":{\"accountId\":\"827ce666-16d8-4716-8541-6ccce8a045cd\",\"type\":\"Account\"},\"feeStrategy\":{\"priority\":\"High\",\"type\":\"Priority\"},\"memos\":[],\"type\":\"XRPL\"},\"type\":\"v0_CreateTransactionOrder\"},\"targetDomainId\":\"79c862af-de9f-4312-ac26-ca4703605143\",\"type\":\"Propose\"}",
                                            "signature": "<RAW_REQUEST_SIGNATURE>"
                                        }
                                    ]
                                }
                            ],
                            "policyReference": {
                                "id": "5f1a8cde-3685-41f7-8572-216bbd023325",
                                "revision": 1,
                                "domainId": "455ad43e-cdd9-11eb-8465-dcfb48cfb3cb"
                            }
                        }
                    ]
                }
            },
            "signature": "<SIGNATURE>"
        }
        {...}
    ],
    "count": 2,
    "currentStartingAfter": null,
    "nextStartingAfter": "79c862af-de9f-4312-ac26-ca4703605143_846b5c3c-27e3-4146-ab18-ce6732624d35"
}
```

## Approve an intent

To approve an intent:

1. Prepare the approval details in the format shown in [Dry run and signature request body](/products/custody/v1.34/api/reference/intent-structure#dry-run-and-signature-request-body), with the following fields returned by [Retrieve intent details](#retrieve-intent-details):
  - `intentId`: Returned as `data.id`
  - `proposalSignature`: Returned as `data.details.proposalSignature`


For example:


```json
{
    "author":{
        "id":"828b554c-c9c9-11eb-a79b-dcfb48cfb3cb",
        "domainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb"
    },
    "targetDomainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb",
    "intentId": "846b5c3c-27e3-4146-ab18-ce6732624d35",
    "proposalSignature": "<PROPOSAL_SIGNATURE>",
    "approvalReason": "All is well",
    "type":"Approve"
}
```

1. Send the approval body to a signing service, as described in [Sign intents](/products/custody/v1.34/api/get-started/key-operations/update/intent-signature).
2. Create the full approval request body, including the signature from the signing service. For example:



```json
{
    "request": {
        "author":{
            "id":"828b554c-c9c9-11eb-a79b-dcfb48cfb3cb",
            "domainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb"
        },
        "targetDomainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb",
        "intentId": "846b5c3c-27e3-4146-ab18-ce6732624d35",
        "proposalSignature": "<PROPOSAL_SIGNATURE>",
        "approvalReason": "All is well",
        "type":"Approve"
    },
    "signature": "<APPROVAL_SIGNATURE>"
}
```

1. Call the [Approve an intent](/products/custody/v1.34/api/reference/openapi/intents/approveintent) operation, with the signed request body.


## Reject an intent

To reject an intent:

1. Repeat steps 1 - 3 of [Approve an intent](#approve-an-intent), with an example rejection body similar to the following:



```json
{
    "request":{
        "author":{
            "id":"828b554c-c9c9-11eb-a79b-dcfb48cfb3cb",
            "domainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb"
        },
        "targetDomainId":"455ad43e-cdd9-11eb-8465-dcfb48cfb3cb",
        "intentId": "846b5c3c-27e3-4146-ab18-ce6732624d35",
        "proposalSignature":"<PROPOSAL_SIGNATURE>",
        "rejectReason": "Amount is too high",
        "type":"Reject"
        }
}
```

1. Call the [Reject an intent](/products/custody/v1.34/api/reference/openapi/intents/rejectintent) operation, with the signed request body.