{
  "openapi": "3.0.3",
  "info": {
    "title": "Reimann Logistics Demo TMS",
    "version": "1.1.0",
    "description": "Demonstration API. Fake credentials. Original Pape inputs; no production tenant writes. The original PDFs are supplied locally and may be uploaded to individual cases."
  },
  "servers": [
    {
      "url": "https://reimann-logistics.pages.dev"
    }
  ],
  "components": {
    "securitySchemes": {
      "DemoApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "paths": {
    "/api/v1/cases": {
      "get": {
        "operationId": "listCases",
        "summary": "Pull cases and current persisted results",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "Created",
                "Reviewed"
              ]
            }
          },
          {
            "name": "documentNumber",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Exact input.document_number match; use Fahrt-Nr. for Tevex and the full OPG Gutschrift-Nr. for DPL credit notes issued by Kaufland. Never match using the RL case ID."
          },
          {
            "name": "customerGroup",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Exact customer group, e.g. Tevex or DPL; issuer Kaufland is distinct from customer DPL."
          }
        ]
      },
      "post": {
        "operationId": "createCase",
        "summary": "Create a demo case without exchange data",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Use a unique stable key for retries of the same create request. Reuse with different content returns 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerGroup": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "input": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "customerGroup",
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}": {
      "get": {
        "operationId": "getCase",
        "summary": "Read a case and its documents",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "operationId": "correctCaseInput",
        "summary": "Replace complete non-exchange input while preserving status, exchange results, and documents",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "customerGroup": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}/reviewed-data": {
      "put": {
        "operationId": "syncReviewedSnapshot",
        "summary": "Replace current input, exchange data (or null), exact document IDs, and Reviewed state together",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "logisticaCaseId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "logisticaCaseUrl": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  },
                  "input": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "customerGroup": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "exchangeData": {
                    "nullable": true,
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "in": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "out": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000
                        }
                      },
                      "required": [
                        "in",
                        "out"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "documentIds": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    }
                  }
                },
                "required": [
                  "input",
                  "exchangeData",
                  "documentIds"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}/exchange-data": {
      "put": {
        "operationId": "pushExchangeData",
        "summary": "Store returned exchange JSON and set Reviewed",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Use a stable unique key when retrying the same logical push."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "logisticaCaseId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "logisticaCaseUrl": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  },
                  "exchangeData": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "in": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "out": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000
                        }
                      },
                      "required": [
                        "in",
                        "out"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "exchangeData"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}/logistica-case": {
      "patch": {
        "operationId": "linkLogisticaCase",
        "summary": "Store external Logistica case ID and HTTPS URL",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "logisticaCaseId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "logisticaCaseUrl": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}/documents": {
      "post": {
        "operationId": "uploadCaseDocument",
        "summary": "Attach an original PDF, PNG, JPEG, or WebP; same case, filename, and bytes reuse the document ID (20 MB maximum)",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cases/{id}/documents/{documentId}": {
      "get": {
        "operationId": "downloadCaseDocument",
        "summary": "Retrieve a case-bound document",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Original file bytes",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/activity": {
      "get": {
        "operationId": "listActivity",
        "summary": "Read recent demo activity",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        }
      }
    },
    "/api/demo/seed": {
      "post": {
        "operationId": "loadDemoData",
        "summary": "Add sample inputs. Existing cases and returned results are preserved.",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        }
      }
    },
    "/api/demo/clear": {
      "delete": {
        "operationId": "clearDemoData",
        "summary": "Clear only this demo database and demo attachments",
        "security": [
          {
            "DemoApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success. JSON response; see the integration guide for examples."
          },
          "400": {
            "description": "Invalid JSON, file, field, URL, or exchange counts"
          },
          "401": {
            "description": "Missing or invalid demo API key or session"
          },
          "404": {
            "description": "Case, document, or endpoint does not exist"
          },
          "409": {
            "description": "Idempotency-Key reused with another payload, or case/documents changed during reviewed snapshot synchronization"
          },
          "413": {
            "description": "Input or file exceeds the demo size limit"
          }
        }
      }
    }
  }
}