{
  "openapi": "3.1.0",
  "info": {
    "title": "Vikka API",
    "version": "1.0.0",
    "description": "The Vikka API — EU Battery Regulation 2023/1542 Digital Product Passports. Authenticated endpoints use an API key (Authorization: Bearer tk_...); the QR code and public passport view need no auth. Every response carries an `X-Request-Id` header. Errors share one shape: `{ \"error\": { \"type\", \"code\", \"message\", \"param?\", \"request_id\" } }`. Passport objects carry a `type` discriminator (`battery` today) so the platform can add more product types without breaking the contract."
  },
  "servers": [
    {
      "url": "https://vikka.io",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Passports",
      "description": "Programmatic passport access (API key)."
    },
    {
      "name": "Public",
      "description": "Unauthenticated public reads."
    }
  ],
  "paths": {
    "/api/v1/passports": {
      "get": {
        "operationId": "listPassports",
        "tags": [
          "Passports"
        ],
        "summary": "List passports",
        "description": "List the authenticated org’s passports. Requires the `read` scope.",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "manufacturer",
            "schema": {
              "description": "Filter by manufacturer (contains, case-insensitive)",
              "type": "string"
            },
            "description": "Filter by manufacturer (contains, case-insensitive)"
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "description": "Filter by battery_category",
              "type": "string"
            },
            "description": "Filter by battery_category"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "Max results (1–200)",
              "example": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Max results (1–200)"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "default": 0,
              "description": "Pagination offset",
              "example": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Pagination offset"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of passports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PassportList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Query failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPassport",
        "tags": [
          "Passports"
        ],
        "summary": "Create a passport",
        "description": "Create a passport in the authenticated org. Requires the `write` scope. Server-owned fields are ignored.",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "requestBody": {
          "description": "Passport fields (`name` required)",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassportCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created passport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Passport"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Insert failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/passports/{id}": {
      "get": {
        "operationId": "getPassport",
        "tags": [
          "Passports"
        ],
        "summary": "Get a passport",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "example": "pp_123"
            },
            "description": "Passport id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The passport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Passport"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updatePassport",
        "tags": [
          "Passports"
        ],
        "summary": "Update a passport",
        "description": "Update fields on a passport. Requires the `write` scope. Server-owned fields are ignored.",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "example": "pp_123"
            },
            "description": "Passport id",
            "required": true
          }
        ],
        "requestBody": {
          "description": "Fields to update",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassportUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated passport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Passport"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Update failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/passports/{id}/compliance": {
      "get": {
        "operationId": "getPassportCompliance",
        "tags": [
          "Passports"
        ],
        "summary": "Compliance readiness for a passport",
        "description": "The EU Battery Regulation readiness of a passport, scored by the compliance engine. Requires the `read` scope.",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "example": "pp_123"
            },
            "description": "Passport id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The compliance result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Compliance"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The stored battery_category is not a known category (fix it via PUT)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Scoring failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/passports/{id}/public": {
      "get": {
        "operationId": "getPublicPassport",
        "tags": [
          "Public"
        ],
        "summary": "Public passport view",
        "description": "The no-auth, field-scoped public read of a passport — only the public Annex XIII fields, the same data behind the QR code. No API key.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "example": "pp_123"
            },
            "description": "Passport id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The public passport fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPassport"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/export": {
      "get": {
        "operationId": "exportAllPassports",
        "tags": [
          "Passports"
        ],
        "summary": "Export the full org dataset (portability)",
        "description": "The portability / continuity exit route (EU 2023/1542 Art. 77(5), no vendor lock-in). Returns your ENTIRE org dataset in one self-describing JSON document — every passport in the owner-tier API shape, plus a field catalogue — as a downloadable attachment. Requires the `read` scope. A customer can trigger this at any time; their data can never be trapped.",
        "security": [
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "A JSON export document (attachment)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Export failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/passports/lookup": {
      "get": {
        "operationId": "lookupPassportByProductId",
        "tags": [
          "Public"
        ],
        "summary": "Look up a passport by product identifier",
        "description": "Resolve a unique product identifier — a GS1 Digital Link URI, a /01/… path, a bare GTIN, or a passport UUID — to its current passport. Responds 307 to the public passport JSON; standard HTTP clients follow it, so a GET returns the DPP. No auth; rate limited per IP; exact match only.",
        "parameters": [
          {
            "in": "query",
            "name": "product_id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "description": "A unique product identifier: a GS1 Digital Link URI, a /01/… path, a bare GTIN, or a passport UUID.",
              "example": "https://vikka.io/01/07312345678909/21/BT-2027-004182"
            },
            "required": true,
            "description": "A unique product identifier: a GS1 Digital Link URI, a /01/… path, a bare GTIN, or a passport UUID."
          }
        ],
        "responses": {
          "307": {
            "description": "Redirect to the public passport JSON (/api/passports/{id}/public)"
          },
          "400": {
            "description": "Unrecognized product identifier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No passport matches this identifier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookup temporarily unavailable (DB outage)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/01/{gs1Path}": {
      "get": {
        "operationId": "resolveGs1DigitalLink",
        "tags": [
          "Public"
        ],
        "summary": "GS1 Digital Link resolver",
        "description": "Resolves a GS1 Digital Link — `/01/{gtin}[/10/{batch}][/21/{serial}]` — the URL a battery QR encodes. By default (a browser) it 307-redirects to the public passport page, forwarding the query string. With `Accept: application/linkset+json` or `?linkType=linkset` (or `all`) it returns an RFC 9264 linkset of the product’s links (default link + product-information page + machine-readable passport data). A malformed GTIN returns 400. No auth; CORS-open.",
        "parameters": [
          {
            "in": "path",
            "name": "gs1Path",
            "schema": {
              "type": "string",
              "example": "07312345678909/21/BT-2027-004182"
            },
            "description": "GTIN, optionally followed by /10/{batch} and /21/{serial}",
            "required": true
          },
          {
            "in": "query",
            "name": "linkType",
            "schema": {
              "description": "`linkset` (or `all`) returns the full linkset; a specific GS1 term (`pip`, `epil`, `defaultLink`) 307-redirects to that link, or 404 if not exposed",
              "example": "linkset",
              "type": "string"
            },
            "description": "`linkset` (or `all`) returns the full linkset; a specific GS1 term (`pip`, `epil`, `defaultLink`) 307-redirects to that link, or 404 if not exposed"
          }
        ],
        "responses": {
          "200": {
            "description": "The RFC 9264 linkset (when a linkset is requested)",
            "content": {
              "application/linkset+json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "307": {
            "description": "Default (or a specific linkType): redirect to the target link"
          },
          "400": {
            "description": "Malformed Digital Link URI (invalid GTIN or qualifier)"
          },
          "404": {
            "description": "No passport matches this code, or the requested linkType is not exposed"
          },
          "503": {
            "description": "Lookup temporarily unavailable (DB outage)"
          }
        }
      }
    },
    "/api/qr": {
      "get": {
        "operationId": "getPassportQrCode",
        "tags": [
          "Public"
        ],
        "summary": "Passport QR code",
        "description": "A PNG QR code encoding the passport’s GS1 Digital Link. No auth; rate limited per IP.",
        "parameters": [
          {
            "in": "query",
            "name": "id",
            "schema": {
              "type": "string",
              "description": "Passport id",
              "example": "pp_123"
            },
            "required": true,
            "description": "Passport id"
          }
        ],
        "responses": {
          "200": {
            "description": "PNG image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Missing id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Passport not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PassportCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Product name (required)",
            "example": "PowerCell EV-200"
          },
          "manufacturer": {
            "type": "string"
          },
          "manufacturer_address": {
            "type": "string"
          },
          "manufacturer_contact": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "description": "Country of origin"
          },
          "battery_category": {
            "type": "string",
            "enum": [
              "EV",
              "Industrial",
              "LMT",
              "Portable",
              "SLI"
            ],
            "description": "Battery category: EV, Industrial, LMT, Portable or SLI",
            "example": "EV"
          },
          "battery_model": {
            "type": "string"
          },
          "serial_number": {
            "type": "string"
          },
          "batch_id": {
            "type": "string"
          },
          "gtin": {
            "type": "string",
            "description": "GTIN / barcode number"
          },
          "chemistry": {
            "type": "string",
            "description": "Cell chemistry (free text; e.g. NMC, LFP, NCA, LTO)",
            "example": "NMC 811"
          },
          "weight_kg": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "capacity": {
            "description": "Energy capacity (kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rated_capacity_ah": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "nominal_voltage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon": {
            "description": "Carbon footprint (kg CO2e/kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon_method": {
            "type": "string"
          },
          "rc_cobalt": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lithium": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_nickel": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lead": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "warranty": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_years": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_cycles": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "soh": {
            "description": "State of health (%)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "dismantling_info": {
            "type": "string"
          },
          "recycling_instructions": {
            "type": "string"
          },
          "due_diligence_policy": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": {},
        "description": "Fields for creating a passport. Server-owned fields are ignored."
      },
      "PassportUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Product name",
            "example": "PowerCell EV-200"
          },
          "manufacturer": {
            "type": "string"
          },
          "manufacturer_address": {
            "type": "string"
          },
          "manufacturer_contact": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "description": "Country of origin"
          },
          "battery_category": {
            "type": "string",
            "enum": [
              "EV",
              "Industrial",
              "LMT",
              "Portable",
              "SLI"
            ],
            "description": "Battery category: EV, Industrial, LMT, Portable or SLI",
            "example": "EV"
          },
          "battery_model": {
            "type": "string"
          },
          "serial_number": {
            "type": "string"
          },
          "batch_id": {
            "type": "string"
          },
          "gtin": {
            "type": "string",
            "description": "GTIN / barcode number"
          },
          "chemistry": {
            "type": "string",
            "description": "Cell chemistry (free text; e.g. NMC, LFP, NCA, LTO)",
            "example": "NMC 811"
          },
          "weight_kg": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "capacity": {
            "description": "Energy capacity (kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rated_capacity_ah": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "nominal_voltage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon": {
            "description": "Carbon footprint (kg CO2e/kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon_method": {
            "type": "string"
          },
          "rc_cobalt": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lithium": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_nickel": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lead": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "warranty": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_years": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_cycles": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "soh": {
            "description": "State of health (%)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "dismantling_info": {
            "type": "string"
          },
          "recycling_instructions": {
            "type": "string"
          },
          "due_diligence_policy": {
            "type": "string"
          }
        },
        "additionalProperties": {},
        "description": "Fields to update. All optional; server-owned fields are ignored."
      },
      "PassportList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Passport"
            }
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Total matching passports"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "additionalProperties": false
      },
      "Passport": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Product name",
            "example": "PowerCell EV-200"
          },
          "manufacturer": {
            "type": "string"
          },
          "manufacturer_address": {
            "type": "string"
          },
          "manufacturer_contact": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "description": "Country of origin"
          },
          "battery_category": {
            "type": "string",
            "enum": [
              "EV",
              "Industrial",
              "LMT",
              "Portable",
              "SLI"
            ],
            "description": "Battery category: EV, Industrial, LMT, Portable or SLI",
            "example": "EV"
          },
          "battery_model": {
            "type": "string"
          },
          "serial_number": {
            "type": "string"
          },
          "batch_id": {
            "type": "string"
          },
          "gtin": {
            "type": "string",
            "description": "GTIN / barcode number"
          },
          "chemistry": {
            "type": "string",
            "description": "Cell chemistry (free text; e.g. NMC, LFP, NCA, LTO)",
            "example": "NMC 811"
          },
          "weight_kg": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "capacity": {
            "description": "Energy capacity (kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rated_capacity_ah": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "nominal_voltage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon": {
            "description": "Carbon footprint (kg CO2e/kWh)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "carbon_method": {
            "type": "string"
          },
          "rc_cobalt": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lithium": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_nickel": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "rc_lead": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "warranty": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_years": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_lifetime_cycles": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "soh": {
            "description": "State of health (%)",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "dismantling_info": {
            "type": "string"
          },
          "recycling_instructions": {
            "type": "string"
          },
          "due_diligence_policy": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "passport"
          },
          "type": {
            "type": "string",
            "const": "battery",
            "description": "Passport type. Battery today; the platform will add more product types."
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "Lifecycle state"
          },
          "created": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 creation timestamp"
          },
          "updated": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 last-update timestamp"
          },
          "links": {
            "$ref": "#/components/schemas/PassportLinks"
          }
        },
        "required": [
          "object",
          "type",
          "id",
          "status",
          "created",
          "updated",
          "links"
        ],
        "additionalProperties": {},
        "description": "A passport, projected to the fields the owning org may read, with a type discriminator and resolvable links."
      },
      "PassportLinks": {
        "type": "object",
        "properties": {
          "self": {
            "type": "string",
            "description": "This passport in the v1 API"
          },
          "public": {
            "type": "string",
            "description": "The no-auth public passport view"
          },
          "qr": {
            "type": "string",
            "description": "PNG QR code for the passport"
          },
          "digital_link": {
            "type": "string",
            "description": "GS1 Digital Link URL encoded by the QR"
          }
        },
        "required": [
          "self",
          "public",
          "qr",
          "digital_link"
        ],
        "additionalProperties": false,
        "description": "Resolvable URLs for this passport."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "rate_limit_error",
                  "api_error"
                ],
                "description": "Broad error class",
                "example": "invalid_request_error"
              },
              "code": {
                "type": "string",
                "description": "Specific machine-readable code",
                "example": "validation_error"
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation"
              },
              "param": {
                "description": "The offending field, when applicable",
                "example": "name",
                "type": "string"
              },
              "request_id": {
                "type": "string",
                "description": "Correlates with the X-Request-Id header",
                "example": "req_8f3c…"
              },
              "issues": {
                "description": "Per-field validation detail (validation_error only)",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "type",
              "code",
              "message",
              "request_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "A standard error response. Every response also carries an X-Request-Id header."
      },
      "Compliance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "compliance"
          },
          "passport_id": {
            "type": "string"
          },
          "battery_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "completeness": {
            "type": "object",
            "properties": {
              "score": {
                "type": "number",
                "description": "Readiness score 0–100"
              },
              "total_required": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "complete": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "partial": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "missing": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "score",
              "total_required",
              "complete",
              "partial",
              "missing"
            ],
            "additionalProperties": {}
          },
          "next_deadline": {
            "anyOf": [
              {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "fields": {
            "description": "Per-rule status from the compliance engine",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "object",
          "passport_id"
        ],
        "additionalProperties": {},
        "description": "EU Battery Regulation readiness, scored by the compliance engine."
      },
      "PublicPassport": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "passport_public"
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id"
        ],
        "additionalProperties": {},
        "description": "The public Annex XIII fields of a passport (the QR-code data)."
      }
    },
    "securitySchemes": {
      "apiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Vikka API key. Send it as: Authorization: Bearer tk_live_..."
      }
    }
  }
}
