{
 "openapi": "3.0.3",
 "info": {
  "title": "OfferCube Webservice",
  "version": "2026-11-25",
  "description": "REST-artige Schnittstelle von OfferCube (Kunden, Angebote, Aufträge, Rechnungen, CRM, Zeiten).\n\n* **Adresse:** `https://<server>/<mandant>/s/<modul>/<aktion>/<id>` – oben unter *Servers* die eigene Adresse eintragen.\n* **Parameter:** POST, am besten als JSON-Body. Datumsfelder sind Unixtimestamps.\n* **Anmelden:** `users/login` → `sid`. Danach die `sid` bei jedem Aufruf mitschicken: `?sid=<sid>` in der URL, POST-Parameter `_sid` oder Header `Authorization: Basic <Base64(sid)>`. Hier im Browser: *Authorize → sid*.\n* **API-Token (empfohlen für Schnittstellen):** im Benutzer unter *API-Token* erstellen (wird nur einmal angezeigt) und als Header `Authorization: Bearer <API-Token>` senden – keine Anmeldung nötig. Hier im Browser: *Authorize → bearerApiToken*.\n* **Antwort:** immer `error`, `errormsg`, `loggedin` plus Daten.\n* Statusänderungen (versenden, beauftragen, bezahlen …) immer über die Spezialaktionen, nicht über `save`.\n\nAusführliche Beschreibung und kompletter Ablauf im [OfferCube Wiki](https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice). Für KI-Assistenten gibt es den [MCP-Server](https://wiki.cubic-zebra.net/doku.php?id=offer-cube:mcp)."
 },
 "externalDocs": {
  "description": "Webservice-Dokumentation im Wiki",
  "url": "https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice"
 },
 "servers": [
  {
   "url": "https://{server}/{mandant}",
   "description": "Ihre OfferCube-Adresse (wie im Browser, ohne #/...)",
   "variables": {
    "server": {
     "default": "ihr-server.example"
    },
    "mandant": {
     "default": "ihr-mandant"
    }
   }
  }
 ],
 "security": [
  {
   "bearerApiToken": []
  },
  {
   "sid": []
  },
  {
   "basicSid": []
  }
 ],
 "tags": [
  {
   "name": "Anmeldung"
  },
  {
   "name": "Basis-Operationen"
  },
  {
   "name": "Suche und Übersicht"
  },
  {
   "name": "Belege bearbeiten"
  },
  {
   "name": "Angebot"
  },
  {
   "name": "Auftrag"
  },
  {
   "name": "Rechnung"
  },
  {
   "name": "CRM, Zeiten, Anhänge"
  }
 ],
 "paths": {
  "/s/users/login": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "Anmelden – liefert die Session-ID sid",
    "description": "Benutzername (E-Mail) und Passwort. Die sid aus der Antwort bei allen weiteren Aufrufen mitsenden.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:users",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "loggedin": {
             "type": "boolean"
            },
            "sid": {
             "type": "string",
             "description": "Session-ID"
            },
            "userinfo": {
             "type": "object"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "username": {
          "type": "string",
          "description": "Benutzername, üblicherweise die E-Mail-Adresse"
         },
         "password": {
          "type": "string",
          "description": "Passwort",
          "format": "password"
         }
        },
        "required": [
         "username",
         "password"
        ]
       },
       "example": {
        "username": "api@firma.at",
        "password": "geheim"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "username": {
          "type": "string",
          "description": "Benutzername, üblicherweise die E-Mail-Adresse"
         },
         "password": {
          "type": "string",
          "description": "Passwort",
          "format": "password"
         }
        },
        "required": [
         "username",
         "password"
        ]
       }
      }
     }
    },
    "security": []
   }
  },
  "/s/users/logout": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "Abmelden – Session-ID ungültig machen",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:users",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/users/sessioninfo": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "Infos zur aktuellen Session und zum angemeldeten Benutzer",
    "description": "",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/users/apitokenlist": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "API-Token eines Benutzers auflisten (ohne den Token selbst)",
    "description": "Liefert Name, Kennung (Anfang/Ende), gültig bis, erstellt, zuletzt benutzt. Eigene Token immer, fremde nur als Administrator.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:users",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "userid": {
          "type": "integer",
          "description": "[optional] Benutzer-ID, Standard: angemeldeter Benutzer"
         }
        }
       },
       "example": {}
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "userid": {
          "type": "integer",
          "description": "[optional] Benutzer-ID, Standard: angemeldeter Benutzer"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/users/apitokencreate": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "API-Token erstellen – der Token steht NUR in dieser Antwort",
    "description": "Nur aus einer normalen Anmeldung (nicht mit einem Token). Administratoren für alle Benutzer, sonst nur für sich selbst mit dem Recht „API-Token für sich selbst erstellen“. Den Token danach bei jedem Aufruf als Header `Authorization: Bearer <token>` senden.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:users",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "token": {
             "type": "string",
             "description": "der API-Token (z. B. ocakp_...) – nur hier sichtbar"
            },
            "tokenid": {
             "type": "integer",
             "description": "ID des Tokens (zum Widerrufen)"
            },
            "hint": {
             "type": "string",
             "description": "Kennung zum Wiedererkennen"
            },
            "validuntil": {
             "type": "integer",
             "format": "int64",
             "description": "gültig bis, 0 = unbegrenzt (Unixtimestamp, Sekunden)"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "userid": {
          "type": "integer",
          "description": "[optional] Benutzer-ID, Standard: angemeldeter Benutzer"
         },
         "name": {
          "type": "string",
          "description": "Name des Tokens, max. 100 Zeichen"
         },
         "validdays": {
          "type": "integer",
          "description": "[optional] Gültigkeit in Tagen 1-3650, 0 = unbegrenzt, Standard 365"
         }
        },
        "required": [
         "name"
        ]
       },
       "example": {
        "name": "Telefonanlage",
        "validdays": 365
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "userid": {
          "type": "integer",
          "description": "[optional] Benutzer-ID, Standard: angemeldeter Benutzer"
         },
         "name": {
          "type": "string",
          "description": "Name des Tokens, max. 100 Zeichen"
         },
         "validdays": {
          "type": "integer",
          "description": "[optional] Gültigkeit in Tagen 1-3650, 0 = unbegrenzt, Standard 365"
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    }
   }
  },
  "/s/users/apitokenrevoke": {
   "post": {
    "tags": [
     "Anmeldung"
    ],
    "summary": "API-Token widerrufen (sofort ungültig)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:users",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "tokenid": {
          "type": "integer",
          "description": "ID des Tokens aus apitokenlist/apitokencreate"
         }
        },
        "required": [
         "tokenid"
        ]
       },
       "example": {
        "tokenid": 123
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "tokenid": {
          "type": "integer",
          "description": "ID des Tokens aus apitokenlist/apitokencreate"
         }
        },
        "required": [
         "tokenid"
        ]
       }
      }
     }
    }
   }
  },
  "/s/{module}/list": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Liste und Suche",
    "description": "Weitere POST-Felder mit Feldnamen des Moduls wirken als Filter (UND-verknüpft), z.B. {\"status\": \"1|4\"}, {\"lastname\": \"Muster%\"}, {\"startdate\": \">=1.1.2026&<1.2.2026\"}.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:list",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "$ref": "#/components/parameters/perpage"
     },
     {
      "$ref": "#/components/parameters/p"
     },
     {
      "$ref": "#/components/parameters/o"
     },
     {
      "$ref": "#/components/parameters/d"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "list": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "count": {
             "type": "integer"
            },
            "pages": {
             "type": "integer"
            },
            "perpage": {
             "type": "integer"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "_search": {
          "type": "string",
          "description": "Suchbegriff wie im Suchfeld der Oberfläche"
         },
         "_raw": {
          "type": "integer",
          "description": "1 = nur Felder des Moduls, ohne verknüpfte Objekte (kleine Antwort)",
          "enum": [
           0,
           1
          ]
         },
         "_fields": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "description": "nur diese Felder"
         },
         "_sort": {
          "type": "object",
          "additionalProperties": {
           "type": "integer",
           "enum": [
            0,
            1
           ]
          },
          "description": "Sortierung, z.B. {\"startdate\": 1} (1 = absteigend)"
         },
         "_filter": {
          "$ref": "#/components/schemas/Filter"
         }
        },
        "additionalProperties": true
       },
       "example": {
        "_search": "Mustermann",
        "_raw": 1
       }
      }
     }
    }
   }
  },
  "/s/{module}/count": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Anzahl der Treffer eines Filters",
    "description": "Gleiche Filter wie list.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:count",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "$ref": "#/components/parameters/perpage"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "count": {
             "type": "integer"
            },
            "pages": {
             "type": "integer"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "_filter": {
          "$ref": "#/components/schemas/Filter"
         }
        },
        "additionalProperties": true
       },
       "example": {
        "_filter": {
         "status": {
          "$in": [
           1,
           4,
           16
          ]
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/{module}/get/{id}": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Einen Datensatz holen",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:get",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "object": {
             "type": "array",
             "items": {
              "type": "object"
             },
             "description": "Liste mit einem Eintrag"
            }
           }
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/{module}/getfull/{id}": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Beleg mit Positionen, Artikelzeilen, CRM, Anhängen, Labels",
    "description": "Für offer, order, invoice und weitere Belege.",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "object": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "position": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "articleinstance": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "correspondence": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "attachments": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/{module}/save/{id}": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Speichern – id 0 = neu anlegen",
    "description": "Nur die übergebenen Felder werden geändert. Status, Preise und Belegnummern bitte über die Spezialaktionen ändern.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:save",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "object": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": true
       },
       "example": {
        "lastname": "Mustermann",
        "firstname": "Max",
        "email": "max@example.com"
       }
      }
     }
    }
   }
  },
  "/s/{module}/delete/{id}": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Löschen (in den Papierkorb)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:delete",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "wasteid": {
             "description": "ID im Papierkorb oder false"
            }
           }
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/{module}/schema": {
   "post": {
    "tags": [
     "Basis-Operationen"
    ],
    "summary": "Felder des Moduls mit Typ, Bezeichnung und Auswahlwerten",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:schema",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "customer"
      },
      "description": "Modul, z.B. customer, contact, offer, order, invoice, position, articleinstance, article, todo, timerecord, ticket, opportunity, correspondence, attachment"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "schema": {
             "type": "object",
             "additionalProperties": {
              "type": "object"
             }
            },
            "const": {
             "type": "object"
            }
           }
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/main/searchall": {
   "post": {
    "tags": [
     "Suche und Übersicht"
    ],
    "summary": "Suche über alle Module",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:main",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "list": {
             "type": "array",
             "items": {
              "type": "object"
             },
             "description": "Treffer, Feld _type = Modul"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "_search": {
          "type": "string",
          "description": "Suchbegriff"
         }
        },
        "required": [
         "_search"
        ]
       },
       "example": {
        "_search": "Muster"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "_search": {
          "type": "string",
          "description": "Suchbegriff"
         }
        },
        "required": [
         "_search"
        ]
       }
      }
     }
    }
   }
  },
  "/s/main/myoverview": {
   "post": {
    "tags": [
     "Suche und Übersicht"
    ],
    "summary": "Kennzahlen der Startseite",
    "description": "Zahlen wie countOfferReadyToSendList, countOrderDueList; zu vielen Werten ein Feld ..._usingcpsb mit dem Listen-Filter.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:main",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/filter/schema/{module}": {
   "post": {
    "tags": [
     "Suche und Übersicht"
    ],
    "summary": "Welche Felder, Vergleiche und Zuordnungen der erweiterte Filter kennt",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:list",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "offer"
      },
      "description": "Modul, für das der Filter gilt"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "rel": {
          "type": "string",
          "description": "[optional] verknüpftes Objekt, z.B. customer"
         }
        }
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "rel": {
          "type": "string",
          "description": "[optional] verknüpftes Objekt, z.B. customer"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/filter/check/{module}": {
   "post": {
    "tags": [
     "Suche und Übersicht"
    ],
    "summary": "Filter prüfen ohne Abfrage",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:operation:list",
    "parameters": [
     {
      "name": "module",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "offer"
      },
      "description": "Modul, für das der Filter gilt"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "ok": {
             "type": "integer"
            },
            "filtererror": {
             "type": "object"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "filter": {
          "$ref": "#/components/schemas/Filter"
         }
        },
        "required": [
         "filter"
        ]
       },
       "example": {
        "filter": {
         "status": {
          "$in": [
           1,
           2
          ]
         }
        }
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "filter": {
          "$ref": "#/components/schemas/Filter"
         }
        },
        "required": [
         "filter"
        ]
       }
      }
     }
    }
   }
  },
  "/s/{doctype}/new": {
   "post": {
    "tags": [
     "Belege bearbeiten"
    ],
    "summary": "Neues Angebot, neuer Auftrag oder neue Rechnung",
    "description": "Antwort: object[0] = neuer Beleg, position[0] = erste Position. Titel danach mit <doctype>/save/<id> Feld summary.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_new",
    "parameters": [
     {
      "name": "doctype",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "offer",
        "order",
        "invoice"
       ]
      }
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "object": {
             "type": "array",
             "items": {
              "type": "object"
             }
            },
            "position": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "customer": {
          "type": "integer",
          "description": "Kunden-ID"
         },
         "articlelist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/ArticleListItem"
          }
         }
        },
        "required": [
         "customer"
        ]
       },
       "example": {
        "customer": 356,
        "articlelist": [
         {
          "_type": "article",
          "id": 12,
          "count": 2
         }
        ]
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "customer": {
          "type": "integer",
          "description": "Kunden-ID"
         },
         "articlelist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/ArticleListItem"
          }
         }
        },
        "required": [
         "customer"
        ]
       }
      }
     }
    }
   }
  },
  "/s/article/add2position": {
   "post": {
    "tags": [
     "Belege bearbeiten"
    ],
    "summary": "Artikel in einen Beleg einfügen",
    "description": "Entweder positionid oder createposition=1 + targetmodule + targetid. Preise inkl. Kunden-/Gruppenrabatt kommen aus dem Artikel.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:article#article_add2position",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "list": {
             "type": "array",
             "items": {
              "type": "object"
             },
             "description": "neue Artikelzeilen (articleinstance)"
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "positionid": {
          "type": "integer",
          "description": "Position, in die eingefügt wird"
         },
         "createposition": {
          "type": "integer",
          "description": "1 = neue Position anlegen",
          "enum": [
           0,
           1
          ]
         },
         "targetmodule": {
          "type": "string",
          "description": "offer, order oder invoice"
         },
         "targetid": {
          "type": "integer",
          "description": "Beleg-ID"
         },
         "articlelist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/ArticleListItem"
          }
         }
        },
        "required": [
         "articlelist"
        ]
       },
       "example": {
        "positionid": 812,
        "articlelist": [
         {
          "_type": "article",
          "id": 12,
          "count": 2
         },
         {
          "_type": "article",
          "id": 15,
          "count": 1,
          "record": {
           "price": 95.5
          }
         }
        ]
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "positionid": {
          "type": "integer",
          "description": "Position, in die eingefügt wird"
         },
         "createposition": {
          "type": "integer",
          "description": "1 = neue Position anlegen",
          "enum": [
           0,
           1
          ]
         },
         "targetmodule": {
          "type": "string",
          "description": "offer, order oder invoice"
         },
         "targetid": {
          "type": "integer",
          "description": "Beleg-ID"
         },
         "articlelist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/ArticleListItem"
          }
         }
        },
        "required": [
         "articlelist"
        ]
       }
      }
     }
    }
   }
  },
  "/s/position/createnew": {
   "post": {
    "tags": [
     "Belege bearbeiten"
    ],
    "summary": "Neue Position (Abschnitt) in einem Beleg",
    "description": "Genau eines der Felder offer, order, invoice angeben. Antwort: object[0] = neue Position.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:position#position_createnew",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "object": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "offer": {
          "type": "integer",
          "description": "Angebots-ID"
         },
         "order": {
          "type": "integer",
          "description": "Auftrags-ID"
         },
         "invoice": {
          "type": "integer",
          "description": "Rechnungs-ID"
         }
        }
       },
       "example": {
        "offer": 4711
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "offer": {
          "type": "integer",
          "description": "Angebots-ID"
         },
         "order": {
          "type": "integer",
          "description": "Auftrags-ID"
         },
         "invoice": {
          "type": "integer",
          "description": "Rechnungs-ID"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/offer/setready/{id}": {
   "post": {
    "tags": [
     "Angebot"
    ],
    "summary": "Angebot fertigstellen (Status 1)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_setready",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/offer/setsent/{id}": {
   "post": {
    "tags": [
     "Angebot"
    ],
    "summary": "Angebot versenden (PDF, E-Mail oder Brief, CRM-Eintrag)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_setsent",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "offer_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Angebotsdatum (Unixtimestamp, Sekunden)"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional] eigener E-Mail-Text"
         },
         "projectmgr_user": {
          "type": "integer",
          "description": "[optional] Projektleiter"
         },
         "salesuser": {
          "type": "integer",
          "description": "[optional] Verkäufer"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype"
        ]
       },
       "example": {
        "sendtype": 2,
        "site_email": "office@musterfirma.at",
        "offer_dt": 1795132800
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "offer_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Angebotsdatum (Unixtimestamp, Sekunden)"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional] eigener E-Mail-Text"
         },
         "projectmgr_user": {
          "type": "integer",
          "description": "[optional] Projektleiter"
         },
         "salesuser": {
          "type": "integer",
          "description": "[optional] Verkäufer"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype"
        ]
       }
      }
     }
    }
   }
  },
  "/s/offer/setaccepted/{id}": {
   "post": {
    "tags": [
     "Angebot"
    ],
    "summary": "Beauftragt – erstellt den Auftrag",
    "description": "Antwort: newobject[0] = neuer Auftrag.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_setaccepted",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "newobject": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] geplanter Beginn (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional] interne Notiz"
         },
         "extorderid": {
          "type": "string",
          "description": "[optional] Bestellnummer des Kunden"
         },
         "projectmgr_user": {
          "type": "integer",
          "description": "[optional]"
         },
         "salesuser": {
          "type": "integer",
          "description": "[optional]"
         }
        }
       },
       "example": {
        "extorderid": "Bestellung 2026-118"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] geplanter Beginn (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional] interne Notiz"
         },
         "extorderid": {
          "type": "string",
          "description": "[optional] Bestellnummer des Kunden"
         },
         "projectmgr_user": {
          "type": "integer",
          "description": "[optional]"
         },
         "salesuser": {
          "type": "integer",
          "description": "[optional]"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/offer/setnotaccepted/{id}": {
   "post": {
    "tags": [
     "Angebot"
    ],
    "summary": "Abgelehnt bzw. neue Version",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_setnotaccepted",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "reason": {
          "type": "string",
          "description": "Begründung"
         },
         "declinereason": {
          "type": "integer",
          "description": "1 zu teuer, 2 Mitbewerber, 4 sonstiges, 8 Korrektur, 16 keine Reaktion",
          "enum": [
           0,
           1,
           2,
           4,
           8,
           16
          ]
         },
         "action": {
          "type": "string",
          "description": "save = ablehnen, newversion = ablehnen + neue Version",
          "enum": [
           "save",
           "newversion"
          ]
         }
        },
        "required": [
         "action"
        ]
       },
       "example": {
        "reason": "zu teuer",
        "declinereason": 1,
        "action": "save"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "reason": {
          "type": "string",
          "description": "Begründung"
         },
         "declinereason": {
          "type": "integer",
          "description": "1 zu teuer, 2 Mitbewerber, 4 sonstiges, 8 Korrektur, 16 keine Reaktion",
          "enum": [
           0,
           1,
           2,
           4,
           8,
           16
          ]
         },
         "action": {
          "type": "string",
          "description": "save = ablehnen, newversion = ablehnen + neue Version",
          "enum": [
           "save",
           "newversion"
          ]
         }
        },
        "required": [
         "action"
        ]
       }
      }
     }
    }
   }
  },
  "/s/offer/setreviewdate/{id}": {
   "post": {
    "tags": [
     "Angebot"
    ],
    "summary": "Wiedervorlage und Wahrscheinlichkeit",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:offer#offer_setreviewdate",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "reviewdate": {
          "type": "integer",
          "format": "int64",
          "description": "Wiedervorlage (Unixtimestamp, Sekunden)"
         },
         "probability_perc": {
          "type": "integer",
          "description": "[optional] Wahrscheinlichkeit in %"
         },
         "action": {
          "type": "string",
          "description": "save",
          "enum": [
           "save"
          ]
         }
        },
        "required": [
         "reviewdate",
         "action"
        ]
       },
       "example": {
        "reviewdate": 1795737600,
        "probability_perc": 60,
        "action": "save"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "reviewdate": {
          "type": "integer",
          "format": "int64",
          "description": "Wiedervorlage (Unixtimestamp, Sekunden)"
         },
         "probability_perc": {
          "type": "integer",
          "description": "[optional] Wahrscheinlichkeit in %"
         },
         "action": {
          "type": "string",
          "description": "save",
          "enum": [
           "save"
          ]
         }
        },
        "required": [
         "reviewdate",
         "action"
        ]
       }
      }
     }
    }
   }
  },
  "/s/order/setsent/{id}": {
   "post": {
    "tags": [
     "Auftrag"
    ],
    "summary": "Auftragsbestätigung oder Lieferschein versenden",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:order#order_setsent",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "printtype": {
          "type": "integer",
          "description": "1 = Auftragsbestätigung, 2 = Lieferschein",
          "enum": [
           1,
           2
          ]
         },
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional]"
         },
         "useSelectedPositions": {
          "type": "integer",
          "description": "1 = nur positionlist",
          "enum": [
           0,
           1
          ]
         },
         "positionlist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "[optional] Positionen"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "printtype",
         "sendtype"
        ]
       },
       "example": {
        "printtype": 1,
        "sendtype": 2,
        "site_email": "office@musterfirma.at"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "printtype": {
          "type": "integer",
          "description": "1 = Auftragsbestätigung, 2 = Lieferschein",
          "enum": [
           1,
           2
          ]
         },
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional]"
         },
         "useSelectedPositions": {
          "type": "integer",
          "description": "1 = nur positionlist",
          "enum": [
           0,
           1
          ]
         },
         "positionlist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "[optional] Positionen"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "printtype",
         "sendtype"
        ]
       }
      }
     }
    }
   }
  },
  "/s/order/prepayment/{id}": {
   "post": {
    "tags": [
     "Auftrag"
    ],
    "summary": "Anzahlungsrechnung erstellen",
    "description": "Antwort: invoice[0] = Anzahlungsrechnung.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:order#order_prepayment",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "invoice": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "price": {
          "type": "number",
          "description": "Netto-Betrag der Anzahlung"
         },
         "objtitle": {
          "type": "string",
          "description": "[optional] Titel"
         },
         "articleinstance__name": {
          "type": "string",
          "description": "[optional] Text der Rechnungszeile"
         },
         "act_sendinvoice": {
          "type": "integer",
          "description": "0 = nur anlegen",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "price"
        ]
       },
       "example": {
        "price": 3000,
        "objtitle": "Anzahlungsrechnung",
        "act_sendinvoice": 0
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "price": {
          "type": "number",
          "description": "Netto-Betrag der Anzahlung"
         },
         "objtitle": {
          "type": "string",
          "description": "[optional] Titel"
         },
         "articleinstance__name": {
          "type": "string",
          "description": "[optional] Text der Rechnungszeile"
         },
         "act_sendinvoice": {
          "type": "integer",
          "description": "0 = nur anlegen",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "price"
        ]
       }
      }
     }
    }
   }
  },
  "/s/order/setdone/{id}": {
   "post": {
    "tags": [
     "Auftrag"
    ],
    "summary": "Auftrag bzw. Positionen erledigt",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:order#order_setdone",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "positionlist4done": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "erledigte Positionen"
         },
         "done_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Erledigungsdatum (Unixtimestamp, Sekunden)"
         },
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Beginn (Unixtimestamp, Sekunden)"
         },
         "enddate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Ende (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional]"
         },
         "act_closeorder": {
          "type": "boolean",
          "description": "true = Auftrag abschließen"
         }
        },
        "required": [
         "positionlist4done"
        ]
       },
       "example": {
        "positionlist4done": [
         {
          "id": 9001
         },
         {
          "id": 9002
         }
        ],
        "done_dt": 1796342400
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "positionlist4done": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "erledigte Positionen"
         },
         "done_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Erledigungsdatum (Unixtimestamp, Sekunden)"
         },
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Beginn (Unixtimestamp, Sekunden)"
         },
         "enddate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Ende (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional]"
         },
         "act_closeorder": {
          "type": "boolean",
          "description": "true = Auftrag abschließen"
         }
        },
        "required": [
         "positionlist4done"
        ]
       }
      }
     }
    }
   }
  },
  "/s/order/createinvoice/{id}": {
   "post": {
    "tags": [
     "Auftrag"
    ],
    "summary": "Rechnung aus Auftrag (Schluss- oder Teilrechnung)",
    "description": "Noch nicht verrechnete Positionen: position/list mit {\"order\": <id>, \"invoicedbyid\": 0}. Antwort: newobject[0] = Rechnung.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:order#order_createinvoice",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "newobject": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "positionlist4invoice": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "zu verrechnende Positionen"
         },
         "objtitle": {
          "type": "string",
          "description": "[optional] Titel"
         },
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Leistungsbeginn (Unixtimestamp, Sekunden)"
         },
         "enddate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Leistungsende (Unixtimestamp, Sekunden)"
         },
         "act_closeorder": {
          "type": "boolean"
         },
         "copyinternal": {
          "type": "integer",
          "description": "1 = interne Positionen übernehmen",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "positionlist4invoice"
        ]
       },
       "example": {
        "positionlist4invoice": [
         {
          "id": 9001
         },
         {
          "id": 9002
         }
        ],
        "objtitle": "Rechnung",
        "enddate": 1796342400,
        "act_closeorder": true
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "positionlist4invoice": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "zu verrechnende Positionen"
         },
         "objtitle": {
          "type": "string",
          "description": "[optional] Titel"
         },
         "startdate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Leistungsbeginn (Unixtimestamp, Sekunden)"
         },
         "enddate": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Leistungsende (Unixtimestamp, Sekunden)"
         },
         "act_closeorder": {
          "type": "boolean"
         },
         "copyinternal": {
          "type": "integer",
          "description": "1 = interne Positionen übernehmen",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "positionlist4invoice"
        ]
       }
      }
     }
    }
   }
  },
  "/s/invoice/setsent/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Rechnung versenden (PDF, E-Mail oder Brief, CRM-Eintrag)",
    "description": "PDF danach im Feld invoicepdf.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_setsent",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "invoice_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Rechnungsdatum (Unixtimestamp, Sekunden)"
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Zahlungsziel, 0 = aus Zahlungsbedingungen (Unixtimestamp, Sekunden)"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional]"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype"
        ]
       },
       "example": {
        "sendtype": 2,
        "site_email": "buchhaltung@musterfirma.at",
        "invoice_dt": 1796342400,
        "duepayment_dt": 0
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger bei E-Mail"
         },
         "invoice_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Rechnungsdatum (Unixtimestamp, Sekunden)"
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Zahlungsziel, 0 = aus Zahlungsbedingungen (Unixtimestamp, Sekunden)"
         },
         "ownemailtext": {
          "type": "string",
          "description": "[optional]"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype"
        ]
       }
      }
     }
    }
   }
  },
  "/s/invoice/setpaid/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Zahlung buchen (ganz oder teilweise)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_setpaid",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "price_wtax_paid": {
          "type": "number",
          "description": "bezahlter Betrag brutto"
         },
         "price_wtax": {
          "type": "number",
          "description": "Rechnungsbetrag brutto"
         },
         "paid_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Zahlungsdatum (Unixtimestamp, Sekunden)"
         },
         "paytype": {
          "type": "integer",
          "description": "0 Überweisung, 1 bar, 2 Bankomat/EC, 3 Kreditkarte, 4 SEPA, 5 PayPal, 255 sonstige",
          "enum": [
           0,
           1,
           2,
           3,
           4,
           5,
           255
          ]
         },
         "force_set_paid": {
          "type": "integer",
          "description": "1 = vollständig bezahlt (z.B. Skonto)",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "price_wtax_paid"
        ]
       },
       "example": {
        "price_wtax": 8400,
        "price_wtax_paid": 8400,
        "paid_dt": 1797552000,
        "paytype": 0
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "price_wtax_paid": {
          "type": "number",
          "description": "bezahlter Betrag brutto"
         },
         "price_wtax": {
          "type": "number",
          "description": "Rechnungsbetrag brutto"
         },
         "paid_dt": {
          "type": "integer",
          "format": "int64",
          "description": "Zahlungsdatum (Unixtimestamp, Sekunden)"
         },
         "paytype": {
          "type": "integer",
          "description": "0 Überweisung, 1 bar, 2 Bankomat/EC, 3 Kreditkarte, 4 SEPA, 5 PayPal, 255 sonstige",
          "enum": [
           0,
           1,
           2,
           3,
           4,
           5,
           255
          ]
         },
         "force_set_paid": {
          "type": "integer",
          "description": "1 = vollständig bezahlt (z.B. Skonto)",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "price_wtax_paid"
        ]
       }
      }
     }
    }
   }
  },
  "/s/invoice/setinactive/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Stornieren (optional Storno-Rechnung, neue Version)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_setinactive",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "reason": {
          "type": "string",
          "description": "Grund"
         },
         "_createCancellationInvoice": {
          "type": "integer",
          "description": "1 = Storno-Rechnung erstellen",
          "enum": [
           0,
           1
          ]
         },
         "action": {
          "type": "string",
          "description": "save oder createnew (neue Version)",
          "enum": [
           "save",
           "createnew"
          ]
         }
        },
        "required": [
         "reason"
        ]
       },
       "example": {
        "reason": "falscher Betrag",
        "_createCancellationInvoice": 1,
        "action": "createnew"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "reason": {
          "type": "string",
          "description": "Grund"
         },
         "_createCancellationInvoice": {
          "type": "integer",
          "description": "1 = Storno-Rechnung erstellen",
          "enum": [
           0,
           1
          ]
         },
         "action": {
          "type": "string",
          "description": "save oder createnew (neue Version)",
          "enum": [
           "save",
           "createnew"
          ]
         }
        },
        "required": [
         "reason"
        ]
       }
      }
     }
    }
   }
  },
  "/s/invoice/createdunning/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Nächste Mahnstufe anlegen",
    "description": "Danach dunning/setsent. Antwort: dunning[0].\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_createdunning",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          },
          {
           "type": "object",
           "properties": {
            "dunning": {
             "type": "array",
             "items": {
              "type": "object"
             }
            }
           }
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] neues Zahlungsziel (Unixtimestamp, Sekunden)"
         }
        }
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] neues Zahlungsziel (Unixtimestamp, Sekunden)"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/dunning/setsent/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Mahnung versenden – id = Rechnungs-ID!",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:dunning#dunning_setsent",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID der Rechnung"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger"
         },
         "action": {
          "type": "string",
          "description": "sendemail bei E-Mail, sonst save",
          "enum": [
           "sendemail",
           "save"
          ]
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Zahlungsziel (Unixtimestamp, Sekunden)"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype",
         "action"
        ]
       },
       "example": {
        "sendtype": 2,
        "site_email": "buchhaltung@musterfirma.at",
        "action": "sendemail"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "site_email": {
          "type": "string",
          "description": "Empfänger"
         },
         "action": {
          "type": "string",
          "description": "sendemail bei E-Mail, sonst save",
          "enum": [
           "sendemail",
           "save"
          ]
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] Zahlungsziel (Unixtimestamp, Sekunden)"
         },
         "correspondence_type": {
          "type": "integer",
          "description": "[optional] Art des CRM-Eintrags; 20 = nur 'PDF erstellt' (PDF selbst versenden)"
         }
        },
        "required": [
         "sendtype",
         "action"
        ]
       }
      }
     }
    }
   }
  },
  "/s/invoice/send/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Vereinfachter Versand (ältere Aktion)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_send",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "email": {
          "type": "string",
          "description": "[optional]"
         },
         "invoice_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         }
        }
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "sendtype": {
          "type": "integer",
          "description": "1 = Brief (nur PDF erzeugen), 2 = E-Mail",
          "enum": [
           1,
           2
          ]
         },
         "email": {
          "type": "string",
          "description": "[optional]"
         },
         "invoice_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         },
         "duepayment_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/invoice/pay/{id}": {
   "post": {
    "tags": [
     "Rechnung"
    ],
    "summary": "Vereinfacht als bezahlt markieren (ältere Aktion)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#invoice_pay",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "paid_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional]"
         }
        }
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "paid_dt": {
          "type": "integer",
          "format": "int64",
          "description": "[optional] (Unixtimestamp, Sekunden)"
         },
         "annotation": {
          "type": "string",
          "description": "[optional]"
         }
        }
       }
      }
     }
    }
   }
  },
  "/p/invoice/exportzugferd/{id}/{filename}": {
   "get": {
    "tags": [
     "Rechnung"
    ],
    "summary": "E-Rechnung ZUGFeRD / Factur-X / XRechnung / PEPPOL",
    "description": "Antwort ist direkt die Datei.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:invoice#e-rechnung_exportieren",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "name": "filename",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "rechnung.xml"
      }
     },
     {
      "name": "export",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "xml",
        "pdf"
       ],
       "default": "xml"
      },
      "description": "xml oder pdf (PDF mit eingebetteter XML)"
     },
     {
      "name": "profile",
      "in": "query",
      "schema": {
       "type": "string",
       "default": "auto",
       "enum": [
        "auto",
        "zffxbasic",
        "zffxcomfort",
        "zffxextended",
        "xrechnungcii",
        "xrechnungublinvoice",
        "peppol30invoice"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Datei",
      "content": {
       "application/xml": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     }
    }
   }
  },
  "/p/invoice/exportebinterface/{id}/{filename}": {
   "get": {
    "tags": [
     "Rechnung"
    ],
    "summary": "E-Rechnung ebInterface (Österreich)",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "name": "filename",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "rechnung.xml"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Datei",
      "content": {
       "application/xml": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     }
    }
   }
  },
  "/s/correspondence/add": {
   "post": {
    "tags": [
     "CRM, Zeiten, Anhänge"
    ],
    "summary": "CRM-Eintrag (Notiz, Telefonat …) zu Kunde oder Beleg",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:correspondence#correspondence_add",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "module": {
          "type": "string",
          "description": "Zielmodul, z.B. customer"
         },
         "recordid": {
          "type": "integer",
          "description": "ID des Ziels"
         },
         "customer": {
          "type": "integer",
          "description": "[optional] Kunden-ID"
         },
         "type": {
          "type": "integer",
          "description": "1 Notiz, 2 intern, 11 nicht erreicht, 12 angerufen, 13 Anruf vom Kunden, 14 E-Mail vom Kunden, 15 E-Mail an Kunden, 17 Termin"
         },
         "description": {
          "type": "string",
          "description": "Text"
         },
         "public": {
          "type": "integer",
          "description": "0 = intern",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "module",
         "recordid",
         "type"
        ]
       },
       "example": {
        "module": "customer",
        "recordid": 356,
        "customer": 356,
        "type": 12,
        "description": "Termin für Montag vereinbart",
        "public": 0
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "module": {
          "type": "string",
          "description": "Zielmodul, z.B. customer"
         },
         "recordid": {
          "type": "integer",
          "description": "ID des Ziels"
         },
         "customer": {
          "type": "integer",
          "description": "[optional] Kunden-ID"
         },
         "type": {
          "type": "integer",
          "description": "1 Notiz, 2 intern, 11 nicht erreicht, 12 angerufen, 13 Anruf vom Kunden, 14 E-Mail vom Kunden, 15 E-Mail an Kunden, 17 Termin"
         },
         "description": {
          "type": "string",
          "description": "Text"
         },
         "public": {
          "type": "integer",
          "description": "0 = intern",
          "enum": [
           0,
           1
          ]
         }
        },
        "required": [
         "module",
         "recordid",
         "type"
        ]
       }
      }
     }
    }
   }
  },
  "/s/timerecord/getcurrent": {
   "post": {
    "tags": [
     "CRM, Zeiten, Anhänge"
    ],
    "summary": "Laufende Stoppuhr des Benutzers",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:timerecord",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/s/timerecord/setcurrent/{id}": {
   "post": {
    "tags": [
     "CRM, Zeiten, Anhänge"
    ],
    "summary": "Stoppuhr starten (id 0) oder stoppen (id)",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:timerecord",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Datensatzes"
     },
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "module": {
          "type": "string",
          "description": "z.B. order"
         },
         "recordid": {
          "type": "integer",
          "description": "ID"
         },
         "timerecordtype": {
          "type": "integer",
          "description": "Tätigkeit"
         },
         "name": {
          "type": "string",
          "description": "Beschreibung"
         },
         "startut": {
          "type": "integer",
          "format": "int64",
          "description": "Start (Unixtimestamp, Sekunden)"
         },
         "endut": {
          "type": "integer",
          "format": "int64",
          "description": "Ende (beim Stoppen) (Unixtimestamp, Sekunden)"
         },
         "workingtime": {
          "type": "integer",
          "description": "Sekunden (beim Stoppen)"
         },
         "status": {
          "type": "integer",
          "description": "2 = läuft (Start), 4 = erfasst (Stopp)",
          "enum": [
           2,
           4
          ]
         }
        }
       },
       "example": {
        "module": "order",
        "recordid": 815,
        "timerecordtype": 3,
        "name": "Montage",
        "startut": 1795075200,
        "status": 2
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "module": {
          "type": "string",
          "description": "z.B. order"
         },
         "recordid": {
          "type": "integer",
          "description": "ID"
         },
         "timerecordtype": {
          "type": "integer",
          "description": "Tätigkeit"
         },
         "name": {
          "type": "string",
          "description": "Beschreibung"
         },
         "startut": {
          "type": "integer",
          "format": "int64",
          "description": "Start (Unixtimestamp, Sekunden)"
         },
         "endut": {
          "type": "integer",
          "format": "int64",
          "description": "Ende (beim Stoppen) (Unixtimestamp, Sekunden)"
         },
         "workingtime": {
          "type": "integer",
          "description": "Sekunden (beim Stoppen)"
         },
         "status": {
          "type": "integer",
          "description": "2 = läuft (Start), 4 = erfasst (Stopp)",
          "enum": [
           2,
           4
          ]
         }
        }
       }
      }
     }
    }
   }
  },
  "/s/timerecord/book": {
   "post": {
    "tags": [
     "CRM, Zeiten, Anhänge"
    ],
    "summary": "Erfasste Zeiten in einen Beleg verrechnen",
    "description": "\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:timerecord",
    "parameters": [
     {
      "$ref": "#/components/parameters/output"
     }
    ],
    "responses": {
     "200": {
      "description": "Antwort (JSON)",
      "content": {
       "application/json": {
        "schema": {
         "allOf": [
          {
           "$ref": "#/components/schemas/BaseResponse"
          }
         ]
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "targetmodule": {
          "type": "string",
          "description": "z.B. order"
         },
         "targetid": {
          "type": "integer",
          "description": "Beleg-ID"
         },
         "timerecordlist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "Zeiten"
         },
         "status": {
          "type": "integer",
          "description": "8 = verrechnen, 16 = nicht verrechenbar",
          "enum": [
           8,
           16
          ]
         },
         "position": {
          "type": "integer",
          "description": "[optional] bestehende Position, sonst 0"
         },
         "positionName": {
          "type": "string",
          "description": "[optional] Name der neuen Position"
         }
        },
        "required": [
         "targetmodule",
         "targetid",
         "timerecordlist",
         "status"
        ]
       },
       "example": {
        "targetmodule": "order",
        "targetid": 815,
        "timerecordlist": [
         {
          "id": 501
         }
        ],
        "status": 8,
        "position": 0,
        "positionName": "Arbeitszeit"
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "targetmodule": {
          "type": "string",
          "description": "z.B. order"
         },
         "targetid": {
          "type": "integer",
          "description": "Beleg-ID"
         },
         "timerecordlist": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/IdRef"
          },
          "description": "Zeiten"
         },
         "status": {
          "type": "integer",
          "description": "8 = verrechnen, 16 = nicht verrechenbar",
          "enum": [
           8,
           16
          ]
         },
         "position": {
          "type": "integer",
          "description": "[optional] bestehende Position, sonst 0"
         },
         "positionName": {
          "type": "string",
          "description": "[optional] Name der neuen Position"
         }
        },
        "required": [
         "targetmodule",
         "targetid",
         "timerecordlist",
         "status"
        ]
       }
      }
     }
    }
   }
  },
  "/a/{filename}": {
   "get": {
    "tags": [
     "CRM, Zeiten, Anhänge"
    ],
    "summary": "Anhang / PDF herunterladen",
    "description": "Antwort ist direkt die Datei. filename dient nur der Anzeige.\n\nWiki: https://wiki.cubic-zebra.net/doku.php?id=offer-cube:webservice:modules:attachment",
    "parameters": [
     {
      "name": "filename",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "rechnung.pdf"
      }
     },
     {
      "name": "att",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "ID des Anhangs (z.B. invoice.invoicepdf)"
     }
    ],
    "responses": {
     "200": {
      "description": "Datei",
      "content": {
       "application/octet-stream": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "sid": {
    "type": "apiKey",
    "in": "query",
    "name": "sid",
    "description": "Session-ID aus users/login als URL-Parameter ?sid=<sid> (alternativ POST-Parameter _sid)"
   },
   "basicSid": {
    "type": "apiKey",
    "in": "header",
    "name": "Authorization",
    "description": "Header-Wert `Basic <Base64(sid)>` eintragen."
   },
   "bearerApiToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "API-Token (beginnt mit ocak, z. B. ocakp_) aus der Karte *API-Token* im Benutzer bzw. users/apitokencreate"
   }
  },
  "parameters": {
   "output": {
    "name": "output",
    "in": "query",
    "schema": {
     "type": "string",
     "enum": [
      "json",
      "xml"
     ],
     "default": "json"
    },
    "description": "Antwortformat"
   },
   "perpage": {
    "name": "perpage",
    "in": "query",
    "schema": {
     "type": "integer",
     "default": 12,
     "minimum": 1,
     "maximum": 500
    },
    "description": "Einträge pro Seite"
   },
   "p": {
    "name": "p",
    "in": "query",
    "schema": {
     "type": "integer",
     "default": 0
    },
    "description": "Seite, 0 = erste"
   },
   "o": {
    "name": "o",
    "in": "query",
    "schema": {
     "type": "string"
    },
    "description": "Sortierfeld"
   },
   "d": {
    "name": "d",
    "in": "query",
    "schema": {
     "type": "integer",
     "enum": [
      0,
      1
     ]
    },
    "description": "0 = aufsteigend, 1 = absteigend"
   }
  },
  "schemas": {
   "BaseResponse": {
    "type": "object",
    "properties": {
     "module": {
      "type": "string"
     },
     "error": {
      "description": "0/false = OK, 1/true = Fehler",
      "oneOf": [
       {
        "type": "integer"
       },
       {
        "type": "boolean"
       }
      ]
     },
     "errormsg": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ErrorMsg"
      }
     },
     "loggedin": {
      "type": "boolean",
      "description": "false = Session ungültig, neu anmelden"
     }
    }
   },
   "ErrorMsg": {
    "type": "object",
    "properties": {
     "message": {
      "type": "string"
     },
     "code": {
      "type": "string",
      "example": "not-found"
     },
     "method": {
      "type": "string"
     }
    }
   },
   "IdRef": {
    "type": "object",
    "required": [
     "id"
    ],
    "properties": {
     "id": {
      "type": "integer"
     }
    }
   },
   "ArticleListItem": {
    "type": "object",
    "required": [
     "_type",
     "id",
     "count"
    ],
    "properties": {
     "_type": {
      "type": "string",
      "enum": [
       "article"
      ]
     },
     "id": {
      "type": "integer",
      "description": "Artikel-ID"
     },
     "count": {
      "type": "number",
      "description": "Menge"
     },
     "record": {
      "type": "object",
      "description": "abweichende Werte, z.B. {\"price\": 95.5, \"name\": \"...\"}",
      "additionalProperties": true
     }
    }
   },
   "Filter": {
    "type": "object",
    "additionalProperties": true,
    "description": "Erweiterter Filter im MongoDB-Stil: Felder (UND), $and/$or/$nor/$not, $eq $ne $gt $gte $lt $lte $in $nin $between, $contains $startsWith $endsWith $like, $empty $exists, $relative (thisMonth, lastYear, last30days …), $label/$user/$articlefeature/$resource mit $any/$all/$none, $fulltext, Felder verknüpfter Objekte mit kunde__feld.",
    "example": {
     "status": {
      "$in": [
       1,
       2
      ]
     },
     "customer__city": {
      "$contains": "Wien"
     },
     "$label": {
      "$none": [
       "VIP"
      ]
     }
    }
   }
  }
 }
}