{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/appy-to/json-schema/appy-to-install-record-schema.json",
  "title": "InstallRecord",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/appy-to-openapi.yaml#/components/schemas/InstallRecord",
  "type": "object",
  "required": [
    "installId",
    "platform",
    "firstSeenAt",
    "lastSeenAt",
    "attribution"
  ],
  "properties": {
    "installId": {
      "type": "string"
    },
    "platform": {
      "type": "string",
      "enum": [
        "ios",
        "android"
      ]
    },
    "osVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "deviceModel": {
      "type": [
        "string",
        "null"
      ]
    },
    "appVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "sdkVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "locale": {
      "type": [
        "string",
        "null"
      ]
    },
    "userId": {
      "type": [
        "string",
        "null"
      ]
    },
    "installer": {
      "type": [
        "string",
        "null"
      ],
      "description": "Android installer package reported by the SDK."
    },
    "store": {
      "type": "string",
      "description": "Store derived from the platform and installer, with the same values as `byStore` in app statistics."
    },
    "firstSeenAt": {
      "type": "string",
      "format": "date-time"
    },
    "lastSeenAt": {
      "type": "string",
      "format": "date-time"
    },
    "attribution": {
      "type": "object",
      "required": [
        "status",
        "verified",
        "link",
        "url",
        "parameters",
        "source",
        "medium",
        "campaign",
        "clickedAt"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "attributed",
            "organic"
          ],
          "description": "`attributed` when Appy matched the install to a link, otherwise `organic`. Organic installs have null fields, empty `parameters` and `verified: false`."
        },
        "verified": {
          "type": "boolean",
          "description": "True when Appy can prove the link: it opened the app, its click came back in the deep link,\nor the store's install referrer carried it. Require it before granting money or rewards.\n"
        },
        "link": {
          "description": "Null for organic installs and when the link has been deleted since.",
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "required": [
                "id",
                "slug",
                "url"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "slug": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "The clicked URL."
        },
        "parameters": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "source": {
          "type": [
            "string",
            "null"
          ],
          "description": "The click's `utm_source`."
        },
        "medium": {
          "type": [
            "string",
            "null"
          ],
          "description": "The click's `utm_medium`."
        },
        "campaign": {
          "type": [
            "string",
            "null"
          ],
          "description": "The click's `utm_campaign`."
        },
        "clickedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "network": {
          "description": "Ad network attribution, or null. Apple Ads (iOS, verified by Apple), Google Ads (`gclid` in the\nPlay install referrer) and Meta (decrypted Meta Install Referrer) installs have `link` null.\n",
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/NetworkAttribution"
            }
          ]
        }
      }
    },
    "activity": {
      "description": "Only on `GET /v1/apps/{appId}/installs/{installId}`.",
      "$ref": "#/$defs/InstallActivity"
    }
  },
  "$defs": {
    "InstallActivity": {
      "type": "object",
      "required": [
        "events",
        "revenue",
        "lastEventAt"
      ],
      "properties": {
        "events": {
          "type": "integer",
          "description": "Events stored for the install",
          "from the SDK and from your server.": null
        },
        "revenue": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RevenueAmount"
          }
        },
        "lastEventAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "NetworkAttribution": {
      "type": "object",
      "required": [
        "name"
      ],
      "description": "Campaign data from the ad network. Fields the network does not report are omitted.",
      "properties": {
        "name": {
          "type": "string",
          "enum": [
            "apple_ads",
            "google_ads",
            "meta"
          ]
        },
        "campaignId": {
          "type": "string"
        },
        "campaignName": {
          "type": "string"
        },
        "adGroupId": {
          "type": "string"
        },
        "adGroupName": {
          "type": "string",
          "description": "Meta reports the ad set here."
        },
        "adId": {
          "type": "string"
        },
        "adName": {
          "type": "string",
          "description": "Meta ad name."
        },
        "keywordId": {
          "type": "string",
          "description": "Apple Ads keyword id."
        },
        "clickId": {
          "type": "string",
          "description": "Google Ads `gclid` from the Play install referrer."
        },
        "touch": {
          "type": "string",
          "enum": [
            "click",
            "view"
          ]
        },
        "conversionType": {
          "type": "string",
          "description": "Apple Ads: `Download`, `Redownload` or `PreOrder`."
        },
        "country": {
          "type": "string",
          "description": "Apple Ads country or region."
        },
        "sourceApp": {
          "type": "string",
          "enum": [
            "facebook",
            "instagram",
            "facebook_lite"
          ]
        }
      }
    },
    "RevenueAmount": {
      "type": "object",
      "required": [
        "currency",
        "amount"
      ],
      "properties": {
        "currency": {
          "type": "string"
        },
        "amount": {
          "type": "string",
          "description": "Decimal sum as a string to avoid rounding."
        }
      }
    }
  }
}