{
  "openapi": "3.1.0",
  "info": {
    "title": "IndustryGO External API",
    "version": "1.0.0",
    "description": "Public market prices and read-only personal account exports. One API credit is charged for each distinct personal topic in a successful request."
  },
  "servers": [
    {
      "url": "https://api.industrygo.de"
    }
  ],
  "tags": [
    {
      "name": "Public"
    },
    {
      "name": "Account"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "IndustryGO API key",
        "description": "Create the account-bound key at user.industrygo.de. Never place it in a URL."
      }
    },
    "parameters": {
      "RequestId": {
        "name": "X-Request-Id",
        "in": "header",
        "required": true,
        "description": "Unique idempotency identifier for safe retries.",
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:-]{8,128}$"
        }
      },
      "Language": {
        "name": "lang",
        "in": "query",
        "required": false,
        "description": "Localized labels. Machine identifiers remain unchanged.",
        "schema": {
          "type": "string",
          "enum": [
            "de",
            "en"
          ],
          "default": "de"
        }
      }
    },
    "schemas": {
      "CreditMeta": {
        "type": "object",
        "required": [
          "creditCost",
          "topics",
          "remainingCredits"
        ],
        "properties": {
          "creditCost": {
            "type": "integer",
            "minimum": 1
          },
          "topics": {
            "type": "array",
            "items": {
              "enum": [
                "mines",
                "factories",
                "inventory"
              ]
            }
          },
          "remainingCredits": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "statusCode",
          "message"
        ],
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, invalid, expired or revoked API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InsufficientCredits": {
        "description": "The account has insufficient API credits.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid language, filter, topic or request identifier.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The API key does not have the required topic scope.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "The X-Request-Id was already used or the reservation can no longer complete.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The export exceeds a documented row or byte limit.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "The application or reverse-proxy request limit was exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ServerError": {
        "description": "The request failed before delivery; reserved credits are refunded through the durable recovery path.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/v1/prices.json": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Current public market prices as JSON",
        "parameters": [
          {
            "name": "items",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated ItemType values, maximum 64."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "enum": [
                "de",
                "en"
              ],
              "default": "de"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Price envelope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "0 credits; no API key required",
        "x-rate-limit": "120 requests/minute for JSON; 30 requests/minute for XLSX; reverse proxy may be stricter",
        "x-freshness": "Current persisted market values; each record includes its source update time",
        "x-required-scope": "none"
      }
    },
    "/v1/prices.xlsx": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Current public market prices as Excel",
        "parameters": [
          {
            "name": "items",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "enum": [
                "de",
                "en"
              ],
              "default": "de"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "XLSX workbook",
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "contentEncoding": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "0 credits; no API key required",
        "x-rate-limit": "120 requests/minute for JSON; 30 requests/minute for XLSX; reverse proxy may be stricter",
        "x-freshness": "Current persisted market values; each record includes its source update time",
        "x-required-scope": "none"
      }
    },
    "/v1/account/mines.json": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "All owned mines and their approved details",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "Mine data plus credit metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "mines"
      }
    },
    "/v1/account/mines.xlsx": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "All owned mines as Excel",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "XLSX workbook"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "mines"
      }
    },
    "/v1/account/factories.json": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "All owned factories, status and jobs",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "Factory data plus credit metadata"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "factories"
      }
    },
    "/v1/account/factories.xlsx": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "All owned factories as Excel",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "XLSX workbook"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "factories"
      }
    },
    "/v1/account/inventory.json": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Confirmed general inventory",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "Inventory data plus credit metadata"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "inventory"
      }
    },
    "/v1/account/inventory.xlsx": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Confirmed inventory as Excel",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "XLSX workbook"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "inventory"
      }
    },
    "/v1/account/export.json": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Combined account topics as JSON",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "mines,factories,inventory"
            },
            "description": "Comma-separated unique topics: mines,factories,inventory. Omit to export all three."
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "Combined topic envelope"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit per selected distinct topic (1-3 credits)",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "selected distinct topics"
      }
    },
    "/v1/account/export.xlsx": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Combined account topics as Excel",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "mines,factories,inventory"
            }
          },
          {
            "$ref": "#/components/parameters/Language"
          }
        ],
        "responses": {
          "200": {
            "description": "XLSX workbook with one sheet per topic"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "x-credit-cost": "1 credit per selected distinct topic (1-3 credits)",
        "x-rate-limit": "30 requests/minute per API credential; additionally source-IP limited",
        "x-freshness": "Persisted read-only snapshot at generatedAt; no settlement or materialization is triggered",
        "x-required-scope": "account:read",
        "x-billed-topic": "selected distinct topics"
      }
    }
  }
}
