{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/infiniteaudience-ai/json-schema/infiniteaudience-ai-integration-run-schema.json",
  "title": "IntegrationRun",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infiniteaudience-ai-partnerships-api-openapi.yml#/components/schemas/IntegrationRun",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "run_id",
    "provider",
    "connection_id",
    "connection_display_name",
    "kind",
    "data_flow",
    "purpose",
    "status",
    "billing_source",
    "customer_boundary",
    "counts",
    "selected_fields",
    "boundary_at",
    "failure_code",
    "failure_message",
    "created_at",
    "updated_at",
    "completed_at",
    "data_release"
  ],
  "properties": {
    "data_release": {
      "oneOf": [
        {
          "$ref": "#/$defs/EnrichmentRelease"
        },
        {
          "type": "null"
        }
      ]
    },
    "run_id": {
      "type": "string"
    },
    "provider": {
      "type": "string"
    },
    "connection_id": {
      "type": "string"
    },
    "connection_display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "batch_enrichment",
        "file_enrichment",
        "ingest",
        "activation",
        "export"
      ]
    },
    "data_flow": {
      "type": "string",
      "enum": [
        "provider_to_platform",
        "platform_to_provider",
        "round_trip"
      ]
    },
    "purpose": {
      "type": "string",
      "enum": [
        "enrichment",
        "ingest",
        "activation",
        "export"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "created",
        "processing",
        "awaiting_boundary",
        "settling",
        "completed",
        "failed",
        "cancelled"
      ]
    },
    "billing_source": {
      "type": "string",
      "enum": [
        "native",
        "shopify"
      ]
    },
    "customer_boundary": {
      "type": "string",
      "enum": [
        "api_response",
        "file_available",
        "destination_handoff",
        "provider_writeback"
      ]
    },
    "counts": {
      "$ref": "#/$defs/IntegrationRunCounts"
    },
    "selected_fields": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "boundary_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "failure_code": {
      "type": [
        "string",
        "null"
      ]
    },
    "failure_message": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "EnrichmentRelease": {
      "type": "object",
      "required": [
        "major",
        "minor"
      ],
      "description": "Delivered IAG refresh version. Independent of license status. Null provenance means unknown; a newer refresh-major can prompt a refresh through existing workflows. Active licenses and existing identity IDs support free refresh; normal charges may apply otherwise.",
      "properties": {
        "major": {
          "type": "integer",
          "minimum": 1
        },
        "minor": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "IntegrationRunCounts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "input",
        "matched",
        "delivered",
        "applied",
        "unchanged",
        "skipped",
        "failed"
      ],
      "properties": {
        "input": {
          "type": "integer",
          "minimum": 0
        },
        "matched": {
          "type": "integer",
          "minimum": 0
        },
        "delivered": {
          "type": "integer",
          "minimum": 0
        },
        "applied": {
          "type": "integer",
          "minimum": 0
        },
        "unchanged": {
          "type": "integer",
          "minimum": 0
        },
        "skipped": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}