{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/imagefactory-co-kr/json-schema/imagefactory-co-kr-transactions-response-schema.json",
  "title": "TransactionsResponse",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/imagefactory-co-kr-openapi.json#/components/schemas/TransactionsResponse",
  "type": "object",
  "required": [
    "data",
    "as_of",
    "has_more",
    "next_page"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UsageTransaction"
      }
    },
    "as_of": {
      "type": "string",
      "format": "date-time",
      "description": "Server timestamp at which the response was generated. Use this to reason about data freshness when reconciling."
    },
    "has_more": {
      "type": "boolean",
      "description": "Whether additional pages of results are available for the same query."
    },
    "next_page": {
      "type": [
        "string",
        "null"
      ],
      "description": "Opaque cursor for fetching the next page. `null` when `has_more` is `false`. Forward this value verbatim as the `page` parameter on the next request."
    }
  },
  "$defs": {
    "UsageTransaction": {
      "type": "object",
      "required": [
        "transaction_id",
        "user_id",
        "team_id",
        "type",
        "feature",
        "points",
        "delta",
        "direction",
        "currency",
        "created_at"
      ],
      "properties": {
        "external_user_id": {
          "type": "string",
          "description": "Optional caller-supplied identifier; not an authorization identity."
        },
        "task_id": {
          "type": "string",
          "description": "External image task identifier, when applicable."
        },
        "transaction_id": {
          "type": "string",
          "description": "Unique identifier for the transaction. Stable across requests; use as an idempotency key when persisting to your own store."
        },
        "user_id": {
          "type": "string",
          "description": "Identifier of the team member who initiated the transaction."
        },
        "team_id": {
          "type": "string",
          "description": "Identifier of the requesting team. Rows without this teamId are excluded."
        },
        "type": {
          "type": "string",
          "enum": [
            "usage",
            "team_usage",
            "refund"
          ],
          "description": "Kind of transaction. `usage` — deducted from a personal point balance. `team_usage` — deducted from the shared team balance. `refund` — credited back after a failed operation."
        },
        "feature": {
          "type": "string",
          "enum": [
            "banner_create",
            "banner_resize",
            "banner_edit",
            "other",
            "unknown"
          ],
          "description": "Product feature that incurred the charge. `unknown` is returned only for a small number of historical rows where the feature could not be inferred."
        },
        "points": {
          "type": "integer",
          "minimum": 0,
          "description": "Magnitude of the transaction in points. Always non-negative — use this field for usage totals."
        },
        "delta": {
          "type": "integer",
          "description": "Signed change to the point balance. Negative for debits, positive for refunds. Use this field when integrating with double-entry accounting."
        },
        "direction": {
          "type": "string",
          "enum": [
            "debit",
            "credit"
          ],
          "description": "`debit` indicates a deduction; `credit` indicates a refund or restoration."
        },
        "currency": {
          "type": "string",
          "enum": [
            "POINT"
          ],
          "description": "Unit of measure. Currently always `POINT`. Future revisions may introduce additional units (such as USD); always inspect this field rather than assuming a fixed unit."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the transaction occurred. ISO 8601 UTC with millisecond precision."
        }
      }
    }
  }
}