{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/descriptorapi-com/json-schema/descriptorapi-com-enrich-result-schema.json",
  "title": "EnrichResult",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/descriptorapi-com-openapi.yml#/components/schemas/EnrichResult",
  "type": "object",
  "required": [
    "descriptor",
    "normalized",
    "merchant",
    "location",
    "processor",
    "is_subscription",
    "confidence",
    "source",
    "verified",
    "kind",
    "related"
  ],
  "properties": {
    "descriptor": {
      "type": "string",
      "description": "The descriptor you sent."
    },
    "normalized": {
      "type": "string",
      "description": "The cleaned merchant part of the descriptor."
    },
    "merchant": {
      "oneOf": [
        {
          "$ref": "#/$defs/Merchant"
        },
        {
          "type": "null"
        }
      ]
    },
    "location": {
      "description": "Where the transaction happened, from the descriptor, else the currency. When neither says, a merchant with one site or one country of business gives its own country (a card used abroad); otherwise your country hint.",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "city",
            "country"
          ],
          "properties": {
            "city": {
              "type": [
                "string",
                "null"
              ]
            },
            "country": {
              "type": [
                "string",
                "null"
              ],
              "description": "ISO 3166-1 alpha-2."
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "processor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Aggregator or wallet detected in the descriptor (PayPal, Square, Apple Pay, Tabby, ...). May also be present on a transfer or bank line; it does not imply a merchant purchase."
    },
    "is_subscription": {
      "type": "boolean"
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "0 when nothing was found."
    },
    "source": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "cache",
        "rules",
        "fuzzy",
        "ai",
        null
      ],
      "description": "How the merchant was resolved; null when nothing was found."
    },
    "verified": {
      "type": "boolean",
      "description": "True only when the merchant record has been approved by our team."
    },
    "kind": {
      "type": "string",
      "enum": [
        "purchase",
        "refund",
        "declined",
        "transfer",
        "bank",
        "promo"
      ],
      "description": "What the descriptor is. `purchase`: a payment to a merchant, also when the merchant\nis not identified. `refund`: money back from a merchant; `merchant` is the merchant\nthat refunded. `declined`: a payment that did not go through, so no money moved;\n`merchant` is where it was tried. `transfer`: money between people or accounts (wallet top-ups included),\nor salary.\n`bank`: a line the bank or wallet writes itself, such as a fee, interest, cashback,\na cash withdrawal or a card payment. `promo`: an advert sent in place of a transaction, so\nno money moved; `normalized` is empty and `merchant` is null. The AI is never asked about\n`transfer`, `bank` and `promo` lines.\n"
    },
    "related": {
      "description": "For a `bank` line that names a merchant, the merchant it is about: \"Rs.6 cashback for\nyour Dunzo order\" is about Dunzo, \"Loan EMI of Rs. 12,000 paid to Bajaj Finance\" is\nabout the lender Bajaj Finance. A card's own EMI names no one: that is the bank itself.\n`merchant` is null when we do not know that merchant yet. Null when the line names\nno merchant.\n",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "normalized",
            "merchant"
          ],
          "properties": {
            "normalized": {
              "type": "string"
            },
            "merchant": {
              "oneOf": [
                {
                  "$ref": "#/$defs/Merchant"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "Merchant": {
      "type": "object",
      "required": [
        "id",
        "name",
        "legal_name",
        "website",
        "logo_url",
        "category",
        "subcategory",
        "mcc"
      ],
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Merchant ID, or null for an AI suggestion that has not been reviewed yet."
        },
        "name": {
          "type": "string"
        },
        "legal_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The registered company. A brand can trade through a different company in each country: this is the one where the transaction happened (the country in the descriptor, else the currency's, else your country hint), or the brand's own when we do not know that one."
        },
        "website": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "The brand's website for that same country (lidl.ch in Switzerland), else its main one."
        },
        "logo_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "category": {
          "type": "string",
          "description": "Top-level category ID, see /v1/categories."
        },
        "subcategory": {
          "type": [
            "string",
            "null"
          ]
        },
        "mcc": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}