# Event tracking

You can track and respond to events in Ripple Custody domains in an external system through the API, or consume them through an Advanced Message Queuing Protocol (AMQP) compatible message queue, if Ripple Custody is set up to push the events to a queue.

Events do not provide a detailed description of a state change, but are a starting point for requesting further information from the API.

For more information about querying events with the API, see [Events](/products/custody/v1.15/api/reference/openapi/events/getevents) in the API reference.

You can pull events with the API out of the box.
However, creating a push event setup is not possible without involvement from Ripple. For more information, contact [Ripple support](/products/custody/v1.15/support/get-support).

The different event types available are described below.

## Genesis event

The genesis event is triggered upon successful completion of the system setup genesis operation. The event contains the following important public keys:

- `apiPublicKey`: to be used to validate the data integrity at the API level.
- `messagingPublicKey`: to be used by vaults to authenticate transaction processing requests.


The payload also includes the following blocks:

- `createdEntitiesReferences`: a list of all entities created
- `genesis`: the full genesis payload, execution time, and signature


| Event type | Event trigger | Fields in the payload |
|  --- | --- | --- |
| `GenesisSucceeded` | Successful completion of genesis | `apiPublicKey`, `messagingPublicKey`, `type` |


Payload example:


```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "apiPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAET1BnSIvToEO6r5BMmaG+O3GL0/A7JilzCdmJ3trIWIsXDuv8jAcGizraMouqWIHTx2hi3rxoH7eABURbfSSryw==",
        "messagingPublicKey": "MCowBQYDK2VwAyEAUGkt+kcvAT4vh+XSEL5Azv4XjjN4e+RojV2gr+Bu0Uk=",
        "type": "GenesisSucceeded",
        "createdEntitiesReferences": {
          "domains": [
            {
              "id": "70fe2431-0c7e-4251-aa69-8c960a4303b5",
              "parentDomainId": null | "27aef9d4-c41f-496b-a84b-89a0982f230d"
            }
          ],
          "users": [
            {
              "domainId": "70fe2431-0c7e-4251-aa69-8c960a4303b5",
              "id": "b9e2a9ca-2eb5-4cc3-98b1-0e9d3ec09129"
            }
          ],
          "policies": [
            {
              "domainId": "70fe2431-0c7e-4251-aa69-8c960a4303b5",
              "id": "8e7a40d3-b255-4a0a-8b80-13596bf566ae"
            }
          ],
          "tickers": [
            {
              "id": "def26868-39e0-4ad3-8f02-22d388409544"
            }
          ],
          "systemProperties": [
            {
              "id": "STATE_REVIEW_AUTHORITY"
            }
          ]
        },
        "genesis": null | {
          "data": {
            "executedAt": "2019-08-24T14:15:10Z",
            "payload": {
              "rootDomainSetup": {
              },
              "cryptoSetup": {
              },
              "tickers": [
              ],
              "systemProperties": [
              ]
            }
          },
          "signature": "<SIGNATURE>",
        }
      },
    },
    "id": "d1553d40-fbd9-3e44-ac7b-8cd59fa20c77",
    "sequenceNumber": 1,
    "savedAt": "2021-11-26T12:16:23.027Z"
}
```

## Intent events

The creation, update (due to an approval or rejection), or closure (after final decision or expiry) of an intent triggers a corresponding event. The event exposes the `id` of the intent, which you can retrieve independently to view more details of the intent.

| Event type | Event trigger | Fields in the payload |
|  --- | --- | --- |
| `IntentCreated` | Creation of an intent | `id`, `type` |
| `IntentUpdated` | Update of an intent | `id`, `type` |
| `IntentClosed` | Closure of an intent | `id`, `type` |


Payload examples:

IntentCreated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "6a9a5cc0-3536-46e2-b9b5-7533ee25a0eb",
        "type": "IntentCreated"
    },
    "id": "117d8e91-7dd8-3e5d-8e5e-1d11ac57e148",
    "sequenceNumber": 1989,
    "savedAt": "2022-01-10T17:27:09.902Z"
}
```

IntentUpdated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "6a9a5cc0-3536-46e2-b9b5-7533ee25a0eb",
        "type": "IntentUpdated"
    },
    "id": "067d411c-ef2a-347a-adc6-67d9e2156750",
    "sequenceNumber": 1990,
    "savedAt": "2022-01-10T17:27:09.934Z"
}
```

IntentClosed

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "6a9a5cc0-3536-46e2-b9b5-7533ee25a0eb",
        "type": "IntentClosed"
    },
    "id": "817459ba-bd2b-355e-ab7e-699c53e21af8",
    "sequenceNumber": 1991,
    "savedAt": "2022-01-10T17:27:09.934Z"
}
```

The following events typically follow an `IntentClosed` event, as the creation or update of an entity often follows intent closure.

Some entities, such as an account, transaction, or vault, need special processing steps after creation until they are fully operational. An `Updated` type event is triggered upon full creation of the entity.

| Event type | Event trigger | Fields in the payload |
|  --- | --- | --- |
| `AccountCreated` | Creation of an account | `id`, `type` |
| `AccountUpdated` | Update of an account | `id`, `type` |
| `TransferUpdated` | Quarantine of a transfer released | `id`, `type` |
| `DomainCreated` | Creation of a domain | `id`, `type` |
| `DomainUpdated` | Update of a domain | `id`, `type` |
| `EndpointCreated` | Creation of a endpoint | `id`, `type` |
| `EndpointUpdated` | Update of an endpoint | `id`, `type` |
| `PolicyCreated` | Creation of a policy | `id`, `type` |
| `PolicyUpdated` | Update of a policy | `id`, `type` |
| `UserCreated` | Creation of a user | `id`, `type` |
| `UserUpdated` | Update of a user | `id`, `type` |
| `VaultCreated` | Creation of a vault | `id`, `type` |
| `VaultUpdated` | Update of a vault | `id`, `type` |
| `ManifestCreated` | Creation of a manifest | `id`, `type`, `accountId` |
| `ManifestUpdated` | Manifest signed by the vault | `id`, `type`, `accountId` |


The payload format is the same for all of these events except `ManifestCreated` and `ManifestUpdated`, which contain an additional `accountId` field.

Payload examples:

AccountCreated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "f0048a50-3988-4e31-9cbf-c4b6582d338d",
        "type": "AccountCreated"
    },
    "id": "f2803e98-2980-3324-9c69-430dfc88b8bc",
    "sequenceNumber": 190,
    "savedAt": "2021-12-03T11:36:06.834Z"
}
```

AccountUpdated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "f0048a50-3988-4e31-9cbf-c4b6582d338d",
        "type": "AccountUpdated"
    },
    "id": "608fdbcd-c614-3f96-b0f9-c1580a81084a",
    "sequenceNumber": 191,
    "savedAt": "2021-12-03T11:36:07.271Z"
}
```

ManifestCreated

```json
{
    "domainId": "d6554f85-d7ac-45b9-8f36-648f56ea5c3b",
    "payload": {
        "id": "6b11452c-1851-42ae-8d86-6cb8cea4fbc5",
        "accountId": "237295f6-bcca-4429-a1ff-48a12e58af31",
        "type": "ManifestCreated"
    },
    "id": "1f214b96-4b5a-3d93-8284-534ec722d6b7",
    "sequenceNumber": 594752,
    "savedAt": "2024-10-24T10:41:42.782Z"
}
```

## Transaction events

The creation of a transaction, its first detection on the blockchain (that is, an outgoing transaction is broadcast, or an incoming transaction is captured), and any change of status (such as confirmation status) triggers a corresponding event. The event exposes the `id` of the transaction as well as the references to the accounts that are related to the transaction.

A single transaction may impact multiple accounts at once, for example if a Bitcoin transaction with multiple outputs targets more than one Ripple Custody account.

| Event type | Event trigger | Fields in the payload |
|  --- | --- | --- |
| `TransactionCreated` | Creation of a transaction | `id`, `accountReferences`, `type` |
| `TransactionDetected` | Detection of a transaction | `id`, `accountReferences`, `type` |
| `TransactionUpdated` | Update of a transaction | `id`, `accountReferences`,`type` |


Payload examples:

TransactionCreated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "77cd7e83-f884-46cc-a557-997cae558fb9",
        "senderReferences": [
            {
                "id": "632d9607-f523-446c-99a3-ad78fdd438e2",
                "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1"
            }
        ],
        "type": "TransactionCreated"
    },
    "id": "6422fdfa-558c-346f-9a2e-da6f45210ece",
    "sequenceNumber": 692,
    "savedAt": "2021-12-14T16:59:53.521Z"
}
```

TransactionDetected

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "852a2495-17b4-4b92-8ef7-4e823302ee83",
        "accountReferences": [
            {
                "id": "f0048a50-3988-4e31-9cbf-c4b6582d338d",
                "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1"
            }
        ],
        "type": "TransactionDetected"
    },
    "id": "3ab29804-6a8b-38e5-97c5-f513244a2bad",
    "sequenceNumber": 686,
    "savedAt": "2021-12-14T14:15:27.821Z"
}
```

TransactionUpdated

```json
{
    "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1",
    "payload": {
        "id": "852a2495-17b4-4b92-8ef7-4e823302ee83",
        "accountReferences": [
            {
                "id": "f0048a50-3988-4e31-9cbf-c4b6582d338d",
                "domainId": "5cd224fe-193e-8bce-c94c-c6c05245e2d1"
            }
        ],
        "type": "TransactionUpdated"
    },
    "id": "b4390a9c-5011-3977-9456-4218224e4801",
    "sequenceNumber": 687,
    "savedAt": "2021-12-14T14:18:12.493Z"
}
```