{
  "openapi": "3.1.0",
  "info": {
    "title": "EasyIDCard API",
    "version": "1.2.0",
    "description": "Discover curated templates, create/clone custom 30 Mil CR80 PVC photo ID badges with dual-sided text-fit, portrait auto-crop, barcode/QR regeneration, and full-bleed backgrounds, stage orders, and checkout using account credits (dane.balancedol), Open Invoice (PO), or Stripe."
  },
  "servers": [
    {
      "url": "https://www.easyidcard.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key (eic_live_...)"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/api/v1/credits": {
      "get": {
        "summary": "Check available dollar credit balance (dane.balancedol), custom card rate (dane.rate), and Open Invoice status"
      }
    },
    "/api/v1/pricing": {
      "get": {
        "summary": "Get live card, option, and shipping rates from dbo.api_pricing_config with account-specific overrides"
      }
    },
    "/api/v1/templates": {
      "get": {
        "summary": "List user saved cards (dbo.projekty), curated public templates (dbo.Templates), and categories"
      }
    },
    "/api/v1/templates/{tid}": {
      "get": {
        "summary": "Inspect a curated public template's editable fields (eName), side (front/back), and max character hints"
      }
    },
    "/api/v1/cards/{cardId}": {
      "get": {
        "summary": "Inspect a saved card's editable fields (eName), side (front/back), and metadata"
      },
      "patch": {
        "summary": "Update text fields, barcodes/QRs, front/back photos, and front/back backgrounds on an existing saved card"
      }
    },
    "/api/v1/cards": {
      "post": {
        "summary": "Create a new saved card from a public template (template_id) or existing card (source_card_id) with dual-sided auto text-fit, portrait crop, barcode regeneration, and background support"
      }
    },
    "/api/v1/orders/staged": {
      "get": {
        "summary": "List active pending staged orders for the authenticated account"
      }
    },
    "/api/v1/orders/stage": {
      "post": {
        "summary": "Stage a badge + accessories order, calculate tax/shipping/credits without charging"
      }
    },
    "/api/v1/orders/{stageId}": {
      "delete": {
        "summary": "Discard/cancel a pending staged order"
      }
    },
    "/api/v1/orders/{stageId}/confirm": {
      "post": {
        "summary": "Confirm staged order: deducts dane.balancedol, creates Open Invoice (OI), or returns Stripe Checkout URL"
      }
    },
    "/api/v1/orders/{txnId}": {
      "get": {
        "summary": "Get order status and details"
      }
    }
  }
}