{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/luckpanda-app/json-schema/luckpanda-app-api-key-input-schema.json",
  "title": "ApiKeyInput",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/luckpanda-app-openapi.yaml#/components/schemas/ApiKeyInput",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "agent",
        "integration"
      ],
      "default": "agent"
    },
    "name": {
      "type": "string",
      "maxLength": 150
    },
    "grants": {
      "type": "array",
      "description": "Integration keys only. Default: every grant except payment_link.create:sales.",
      "items": {
        "type": "string",
        "enum": [
          "company.read_context",
          "resource.read",
          "party.create",
          "party.update",
          "document.create:sales",
          "document.issue:sales",
          "document.send:sales",
          "payment.record:sales",
          "payment_link.create:sales"
        ]
      }
    },
    "limits": {
      "$ref": "#/$defs/IntegrationLimits"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "IntegrationLimits": {
      "type": "object",
      "properties": {
        "kinds": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "invoice",
              "credit_note",
              "debit_note",
              "receipt",
              "proforma",
              "quote"
            ]
          },
          "default": [
            "invoice",
            "credit_note"
          ]
        },
        "legal_entity_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Uuid"
          },
          "description": "Empty = every legal entity."
        },
        "max_total_minor": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Largest document total in any currency without its own limit."
        },
        "max_total_by_currency": {
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "minimum": 0
          },
          "description": "Largest document total per currency, e.g. {\"USD\": 100000}."
        }
      }
    },
    "Uuid": {
      "type": "string",
      "format": "uuid"
    }
  }
}