{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aimeat-io/json-schema/aimeat-io-publish-history-item-schema.json",
  "title": "PublishHistoryItem",
  "description": "One published item, with the account it went to and the newest reading of it.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aimeat-io-connections-api-openapi.yml#/components/schemas/PublishHistoryItem",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "holder": {
      "type": "string",
      "enum": [
        "own",
        "owner"
      ],
      "description": "Whose item: `own` is the caller's; `owner` is the owner's, listed to an agent that holds `connections:read-as-owner`.\n"
    },
    "connectionId": {
      "type": "string"
    },
    "provider": {
      "type": "string"
    },
    "accountLabel": {
      "type": "string",
      "description": "`(disconnected)` when the account has since been removed. History outlives the connection that made it.\n"
    },
    "status": {
      "type": "string",
      "enum": [
        "in_flight",
        "held",
        "queued",
        "done",
        "failed",
        "rejected"
      ]
    },
    "externalRef": {
      "type": [
        "string",
        "null"
      ]
    },
    "storageKey": {
      "type": "string"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "latest": {
      "allOf": [
        {
          "$ref": "#/$defs/PublishMetricSample"
        }
      ],
      "nullable": true,
      "description": "Null means nobody has asked for a reading. It does not mean zero engagement."
    }
  },
  "$defs": {
    "PublishMetricSample": {
      "type": "object",
      "description": "One reading of how a published item is doing. Normalised so platforms can be compared at all, with the provider's own answer kept in `raw` so a wrong mapping stays discoverable.\n\nEVERY COUNT IS NULLABLE AND NULL IS NOT ZERO. A platform that does not report impressions to an author has reported nothing; writing 0 would invent a measurement nobody made.\n",
      "properties": {
        "id": {
          "type": "string"
        },
        "attemptId": {
          "type": "string"
        },
        "fetchedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When this node asked. Not when the platform computed it, which is rarely knowable."
        },
        "impressions": {
          "type": [
            "integer",
            "null"
          ]
        },
        "likes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "comments": {
          "type": [
            "integer",
            "null"
          ]
        },
        "shares": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Reblogs, reposts, retweets, shares. Cousins rather than synonyms, named once."
        },
        "raw": {
          "type": "object",
          "additionalProperties": true
        }
      }
    }
  }
}