{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/merchantflow-ai/json-schema/merchantflow-ai-meta-schema.json",
  "title": "Meta",
  "description": "Provenance attached to every response.",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/merchantflow-ai-openapi.json#/components/schemas/Meta",
  "type": "object",
  "properties": {
    "store_id": {
      "type": "string"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217 for this store."
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone. All date-only filters resolve in it."
    },
    "as_of": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When this store last synced. Not the request time."
    },
    "stale": {
      "type": "boolean",
      "description": "True when the last sync is more than 24 hours old."
    },
    "history_available_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "Earliest date this store's plan includes (YYYY-MM-DD), or null for unlimited history."
    },
    "truncated": {
      "type": "boolean",
      "description": "True when the request reached further back than the plan includes. Everything from history_available_from onwards is present and complete."
    },
    "order_allowance": {
      "$ref": "#/$defs/OrderAllowance"
    }
  },
  "$defs": {
    "OrderAllowance": {
      "type": "object",
      "description": "Present only on the metrics and profitability endpoints, and only when the store has exceeded its monthly order allowance and the window you asked for holds orders past it. The response still covers the whole window, but order-derived figures (revenue, COGS, fees, refunds, order counts, profit) leave those orders out; ad spend and expenses are complete. These are the same figures the merchant's own dashboard shows. Absent when every order in the window is counted.",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "partial"
          ]
        },
        "missing_orders": {
          "type": "integer",
          "description": "Orders in the requested window placed after the store passed its monthly allowance, left out of the figures."
        },
        "resets_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the allowance resets (the start of the store's next calendar month). Later months count every order again, and an upgrade includes them sooner."
        }
      },
      "required": [
        "status",
        "missing_orders",
        "resets_at"
      ]
    }
  }
}