Egress Message Format

Schema for enriched transaction messages produced to the Kafka egress topic.


Egress message schema

FieldType                      OptionalDescription
transactionIdString (max 36)NoUnique identifier for the transaction.
accountIdString (max 36)NoUnique identifier for the account.
userIdString (max 36)YesUnique identifier for the customer/user.
accountTypeString (max 10)NoThe account type. Permitted values: cash, card, savings, investment, loan, mortgage, pension.
txCodeString (max 64)YesThe transaction code. The code is defined by the provider to describe the transaction type.
dateString (max 35)NoThe date and time of the transaction in ISO 8601 format.
descriptionString (max 256)NoThe transaction description which is commonly a combination of the merchant name and merchant location.
amountNumberNoThe transaction amount in major units of the currency.
currencyString (max 3)NoThe currency of the transaction, e.g. GBP, EUR. Defaults to GBP.
statusString (max 7)YesThe status of the transaction: either pending or posted.
merchantCategoryCodeString (max 4)YesMCC code for the merchant's primary activities. A maximum 4 digit string.
metaObjectYesAdditional data for storage/pass-through.
mhInsightsObjectYesContains the insights from Moneyhub's Data Enrichment Engine. See mhInsights fields below.

mhInsights Fields

FieldType                    OptionalDescription
l1CategoryGroupIdString (max 2)NoThe level 1 category group to which the category belongs.
l1CategoryGroupNameString (max 13)NoThe name of the level 1 category group.
l1CategoryTypeString (max 12)NoThe type of the level 1 category group. One of: expense, income, investment, transfer, pension, transfer_savings, uncategorised.
l2CategoryIdString (max 3)NoThe ID of the level 2 category.
l2CategoryNameString (max 21)NoThe name of the level 2 category.
l3CounterpartyCounterpartyYesThe L3 counterparty of the transaction. See Counterparty Schema.
geotagsArray<Geotag>YesArray of geotags for the transaction. Geotags for up to 3 candidate locations where the transaction could have taken place are ordered from most likely to least likely. See Geotag Schema.
cardPresentBooleanYesIndicates if the cardholder was present when the transaction occurred. Note that, online purchases are considered card holder not present. Only card holder present transactions are eligible for geotagging. We estimate this field from the transaction data.
timestampCreatedString (max 24)YesTimestamp of when message containing the transaction was created on the Kafka raw ingest topic i.e. the topic that the Data Enrichment Engine retrieves messages from. For the API interface, this is effectively when the transaction was sent to the API.
timestampIngressString (max 24)YesTimestamp of when a transaction started being processed.
timestampEgressString (max 24)YesTimestamp set on transaction when processing has finished and it is about to be sent to the egress topic, and in the API case, sent back as the response.
errorsArray <Error>YesAn array of errors that occurred during enrichment of transaction.

Example

Based on the example ingress message.

{
  "transactionId": "123456",
  "accountId": "5382358854398",
  "userId": "5382358854398",
  "accountType": "cash",
  "txCode": ")))",
  "date": "1970-01-01T00:00:00Z",
  "description": "Tesco BriLL 293484 SS",
  "amount": -10.99,
  "currency": "GBP",
  "status": "posted",
  "merchantCategoryCode": "5411",
  "meta": {
    "sourceSystem": "hex",
    "authorisedBy": "PStibbons",
    "yearOfCreation": "Year of the Luminous Lemur"
  },
  "mhInsights": {
    "l1CategoryGroupId": "4",
    "l1CategoryGroupName": "shopping",
    "l1CategoryType": "expense",
    "l2CategoryId": "22",
    "l2CategoryName": "groceries",
    "l3Counterparty": {
      "l3CounterpartyId": "030a7556-e17d-432d-8afb-7a9f71128152",
      "l3CounterpartyName": "Tesco Express - Redcliffe, Bristol",
      "parentId": "b3e0c142-1377-4e7d-b434-37b64d34a008",
      "parentName": "Tesco Groceries",
      "fullCompanyName": "Tesco Stores Limited",
      "logoUrl": "examplelogo.com",
      "website": "example.com",
      "registeredLocation": null,
      "l2CategoryName": "groceries",
      "l3CounterpartyCategory": "convenience-shop",
      "l4LoanType": null
    },
    "geotags": [
      {
        "geotagId": "39828184-5334-4ec5-ba65-8985912542dc",
        "counterpartyName": "Tesco Express",
        "counterpartyLabel": "Tesco Express, Redcliffe, Bristol, United Kingdom",
        "houseNumber": "45",
        "street": "Redcliffe Street",
        "neighbourhood": "Redcliffe",
        "locality": "Bristol",
        "city": "Bristol",
        "county": "Bristol",
        "region": "South West England",
        "postcode": "BS1 6NP",
        "latitude": 51.4477,
        "longitude": -2.5903,
        "l3CounterpartyCategory": "convenience-shop",
        "postcodeEstimated": false,
        "postcodeErrorKm": null
      },
      {
        "geotagId": "b4a9bf43-2b54-45d9-9bbd-a0aa1286e302",
        "counterpartyName": "Tesco Express",
        "counterpartyLabel": "Tesco Express, Victoria Street, Bristol, United Kingdom",
        "houseNumber": null,
        "street": "Victoria Street",
        "neighbourhood": null,
        "locality": "Bristol",
        "city": "Bristol",
        "county": "Bristol",
        "region": "South West England",
        "postcode": "BS1 6AH",
        "latitude": 51.4493,
        "longitude": -2.5878,
        "l3CounterpartyCategory": "convenience-shop",
        "postcodeEstimated": true,
        "postcodeErrorKm": 0.21
      },
      {
        "geotagId": "669c42a7-632c-43e4-b9f8-7f2b9f797e5e",
        "counterpartyName": "Tesco Express",
        "counterpartyLabel": "Tesco Express, Park Street, Bristol, United Kingdom",
        "houseNumber": "12",
        "street": "Park Street",
        "neighbourhood": null,
        "locality": "Bristol",
        "city": "Bristol",
        "county": "Bristol",
        "region": "South West England",
        "postcode": "BS1 5JA",
        "latitude": 51.4539,
        "longitude": -2.6019,
        "l3CounterpartyCategory": "convenience-shop",
        "postcodeEstimated": true,
        "postcodeErrorKm": 0.08
      }
  ],
    "cardPresent": true,
    "timestampCreated": "1970-01-01T00:00:00Z",
    "timestampIngress": "1970-01-01T00:00:01Z",
    "timestampEgress": "1970-01-01T00:00:02Z",
    "errors": [
   {
     "source": "counterparty",
     "code": "COUNTERPARTY_DETECTION_ERROR",
     "cause": {
       "message": "Counterparty detection error",
       "type": "Error"
     }
   }
  ]
  }
}