{"openapi":"3.1.0","info":{"title":"nxva.base API","version":"1","description":"The API for third-party systems. Authenticate with an integration's API key: `Authorization: Bearer wm_live_…`. Refusals are RFC 9457 problems with a stable `code`; `detail` is a German sentence for people."},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"code":{"type":"string","enum":["invalid","not_found","forbidden","conflict","limited","unauthorized","unavailable","method_not_allowed","invalid_json","idempotency_key_reused","module_not_booked"]},"detail":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}},"required":["type","title","status","code"]}}},"paths":{"/api/v1/attachments":{"post":{"operationId":"upload_attachment","summary":"Anhang hochladen","description":"Uploads one file, as base64, to attach to a comment: pass the returned id in add_task_comment's attachments within a day, or it is removed. PNG, JPEG, WebP, PDF, DOCX and XLSX, recognised by their content, and Markdown: a file_name ending in .md and UTF-8 text; at most 10 MB. With finance.manage and the finance:write scope an XML e-invoice (XRechnung, UBL or CII) is accepted as well, to pass as attachment_id to create_incoming_invoice_draft; its fields then fill the draft. Every file is scanned for malware and shown to nobody -- nor to the customer -- until it is found clean.","x-scope":"tasks:comment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"file_name":{"type":"string","minLength":1,"maxLength":200,"description":"The name people see, e.g. \"fehler.png\"."},"content_base64":{"type":"string","minLength":1,"maxLength":13981016,"description":"The file, base64-encoded."}},"required":["file_name","content_base64"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"file_name":{"type":"string"},"content_type":{"type":"string"},"scan_state":{"type":"string","const":"pending"}},"required":["id","file_name","content_type","scan_state"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/attachments/{id}":{"get":{"operationId":"get_attachment","summary":"Anhang lesen","description":"One attachment's content, by the id get_task lists. Images come back as images, Markdown as text, other files as a document. Only files the malware scan found clean; one still pending can be asked for again later.","x-scope":"tasks:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The attachment's id, from get_task."}}],"responses":{"200":{"description":"The file","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/bank-accounts":{"get":{"operationId":"list_bank_accounts","summary":"Bankkonten lesen","description":"The bank accounts a balance can be recorded for (record_bank_balance), with whether each is in use and its latest balance in cents. Only an active account takes a new balance.","x-scope":"finance:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"latest_balance":{"anyOf":[{"type":"object","properties":{"date":{"type":"string"},"balance_cents":{"type":"number"},"source":{"type":"string"}},"required":["date","balance_cents","source"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","active","latest_balance"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/bank-accounts/{id}/balances":{"post":{"operationId":"record_bank_balance","summary":"Kontostand erfassen","description":"Records a bank account's balance on a day, as the manual entry on /finanzen/liquiditaet does; the liquidity forecast starts from the latest one. The day is never in the future; the balance may be negative. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The account's id or its exact name (list_bank_accounts)."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"The day the balance was held."},"balance_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"The balance in cents; negative for an overdrawn account."},"comment":{"type":"string"}},"required":["date","balance_cents"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"bank_account":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"date":{"type":"string"},"balance_cents":{"type":"number"},"comment":{"type":["string","null"]},"url":{"type":"string"}},"required":["id","bank_account","date","balance_cents","comment","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/bank-transactions":{"get":{"operationId":"list_bank_transactions","summary":"Umsätze lesen","description":"Bank transactions of every own account, newest first, as on /finanzen/umsaetze: date, account, counterparty, remittance, amount in cents (negative = debit), status and what a standing allocation assigns it to. Open ones also carry nxva.base's suggestions (label, reason), best first. Without a status it lists the open ones while there are any, else all. Read only: matching is confirmed by a person on the page. finance.manage only.","x-scope":"finance:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"offen, zugeordnet, ignoriert or alle.","type":"string","enum":["offen","zugeordnet","ignoriert","alle"]}},{"name":"account_id","in":"query","required":false,"schema":{"description":"Only this bank account (list_bank_accounts).","type":"string"}},{"name":"from","in":"query","required":false,"schema":{"description":"First booking day, YYYY-MM-DD.","type":"string"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last booking day, YYYY-MM-DD.","type":"string"}},{"name":"query","in":"query","required":false,"schema":{"description":"Part of the counterparty, remittance, IBAN or an invoice number.","type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"description":"Default 50, at most 200.","type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["offen","zugeordnet","ignoriert","alle"]},"open_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"booking_date":{"type":"string"},"account_id":{"type":["string","null"]},"account":{"type":"string"},"counterparty":{"type":["string","null"]},"counterparty_iban":{"type":["string","null"]},"purpose":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["open","matched","ignored"]},"assignment":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"}},"required":["label"],"additionalProperties":false}},"suggestions":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"reason":{"type":"string"}},"required":["label","reason"],"additionalProperties":false}}},"required":["id","booking_date","account_id","account","counterparty","counterparty_iban","purpose","amount_cents","status","assignment"],"additionalProperties":false}}},"required":["status","open_count","items"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/billing-roles":{"get":{"operationId":"list_billing_roles","summary":"Rollen und Stundensätze lesen","description":"Every billing role with its hourly list rate (net, in cents), inactive ones too, as /einstellungen/saetze shows them. Rates agreed with one customer are not here; they are the company's. catalog.manage only.","x-scope":"catalog","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"list_rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","list_rate_cents","position","active","url"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_billing_role","summary":"Rolle mit Stundensatz anlegen oder ändern","description":"Creates a billing role (omit role; key, name and list_rate_cents are required) or edits one: only the fields given change. The list rate is net per hour, in cents. A quote's effort line and an order's rates copy the role's rate when they are saved, so a new list rate never changes a quote or an order that already exists -- only lines and orders made from now on, and only where no customer rate is agreed. Role ids and keys come from list_billing_roles. catalog.manage only.","x-scope":"catalog","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"description":"The role's id or key, from list_billing_roles. Omit to create one.","type":"string"},"key":{"type":"string","maxLength":60,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","maxLength":120},"list_rate_cents":{"description":"Hourly list rate, net, in cents: 14000 is 140,00 €.","type":"integer","minimum":1,"maximum":100000000},"position":{"description":"Order in every list. Default for a new one: 0.","type":"integer","minimum":-99999,"maximum":999999}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"role":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"list_rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","list_rate_cents","position","active","url"],"additionalProperties":false}},"required":["created","role"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/billing-roles/{id}/active":{"post":{"operationId":"set_billing_role_active","summary":"Rolle aktivieren oder deaktivieren","description":"Deactivates a billing role -- nobody can pick it for a new effort line or book against it from now on -- or activates it again. Roles are never deleted: orders carry frozen copies that name them. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The role's id or key, from list_billing_roles."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"list_rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","list_rate_cents","position","active","url"],"additionalProperties":false}},"required":["role"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/business-units":{"get":{"operationId":"list_business_units","summary":"Bereiche auflisten","description":"The business units, in the order the settings give them: name, id, whether active and the default, and the cost center proposed for new contracts. Every business_unit argument takes a name or an id from here; an inactive unit is only kept on the records that already have it.","x-scope":"finance:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"business_units":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"id":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"cost_center":{"type":["string","null"]}},"required":["name","id","active","default","cost_center"],"additionalProperties":false}},"url":{"type":"string"}},"required":["business_units","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/catalog":{"get":{"operationId":"list_catalog","summary":"Katalog zum Pflegen lesen","description":"Every catalogue item as /katalog shows it to whoever maintains it -- inactive and out-of-validity ones too -- with every field save_catalog_item edits. Prices are net, in cents; a credit (category credit) has negative ones. To build a quote use list_catalog_items, which shows only what can be chosen today. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"category","in":"query","required":false,"schema":{"description":"Only this category: platform, edition, connectivity, process, service, ai_package, one_time, credit. Default: all.","type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"]}},{"name":"include_inactive","in":"query","required":false,"schema":{"description":"Default: true. false leaves out deactivated items.","type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"description_short":{"type":["string","null"]},"offer_text":{"type":["string","null"]},"price_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"selection_rule":{"type":"string"},"requires_item_key":{"type":["string","null"]},"process_class":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"provisioning_flow":{"type":["string","null"]},"modules":{"type":"array","items":{"type":"string"}},"per_user":{"type":"boolean"},"min_quantity":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ai_quota_eur":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"valid_from":{"type":["string","null"]},"valid_to":{"type":["string","null"]},"active":{"type":"boolean"},"selectable_today":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","category","description_short","offer_text","price_one_time_cents","price_monthly_cents","selection_rule","requires_item_key","process_class","sort_order","provisioning_flow","valid_from","valid_to","active","selectable_today","url"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/catalog-items":{"get":{"operationId":"list_catalog_items","summary":"Katalog lesen","description":"The catalogue a quote is built from: every item that can be chosen today -- each alternative of a category is an item of its own -- with its key, prices in cents, the text printed on the quote and its selection rule, and the billing roles an effort line is priced by. Pass item keys and role keys to create_quote.","x-scope":"quotes:read","parameters":[{"name":"category","in":"query","required":false,"schema":{"description":"Only this category: platform, edition, connectivity, process, service, ai_package, one_time, credit. Default: all.","type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"]}},{"name":"company","in":"query","required":false,"schema":{"description":"A company id: the effort rates then show what is agreed with that customer.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"price_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"selection_rule":{"type":"string"},"requires":{"type":["string","null"]},"process_class":{"type":["string","null"]},"provisioning_flow":{"type":["string","null"]}},"required":["key","category","name","description","price_one_time_cents","price_monthly_cents","offer_text","selection_rule","requires","process_class","provisioning_flow"],"additionalProperties":false}},"effort_roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"agreed_with_company":{"type":"boolean"}},"required":["key","name","rate_cents","agreed_with_company"],"additionalProperties":false}},"rules":{"type":"string"}},"required":["items","effort_roles","rules"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_catalog_item","summary":"Katalogposition anlegen oder ändern","description":"Creates a catalogue item (omit item; key, name and category are required) or edits one: only the fields given change. Prices are net, in cents; only a credit (category credit) may have negative ones. A quote line copies the item's name, text and prices when the quote is saved, so a change here -- a new price above all -- never changes a quote already saved; it applies to lines added from now on. Item ids and keys come from list_catalog. catalog.manage only.","x-scope":"catalog","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"item":{"description":"The item's id or key, from list_catalog. Omit to create one.","type":"string"},"key":{"description":"Unique technical key, e.g. platform_shared.","type":"string","maxLength":60},"name":{"type":"string","maxLength":200},"category":{"description":"The catalogue section: platform, edition, connectivity, process, service, ai_package, one_time, credit.","type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"]},"description_short":{"description":"Shown in the quote editor's picker. null or an empty string clears it.","anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"offer_text":{"description":"The text printed on the quote. null or an empty string clears it.","anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]},"price_one_time_cents":{"description":"One-time net price in cents. Default for a new one: 0.","type":"integer","minimum":-100000000,"maximum":100000000},"price_monthly_cents":{"description":"Monthly net price in cents. Default for a new one: 0.","type":"integer","minimum":-100000000,"maximum":100000000},"selection_rule":{"description":"How many items of the category a quote may take: exactly_one, at_most_one or multiple. Default for a new one: multiple.","type":"string","enum":["exactly_one","at_most_one","multiple"]},"requires_item_key":{"description":"Key of an item this one requires, or null for none.","anyOf":[{"type":"string","maxLength":60},{"type":"null"}]},"process_class":{"description":"S, M or L, for a process item; null for none.","anyOf":[{"type":"string","enum":["S","M","L"]},{"type":"null"}]},"sort_order":{"description":"Default for a new one: 0.","type":"integer","minimum":-1000000,"maximum":1000000},"provisioning_flow":{"description":"Flow key that provisions an instance when this item is accepted, e.g. wingman; empty for none.","type":"string"},"modules":{"description":"Modules an instance gets when this item is in the accepted package (orders, sales, marketing, billing, finance, banking, support, github, mcp, api, document_intake, agents, chat; core is always on). Replaces the list; [] for none. Only the operator instance keeps it; a customer instance leaves it unchanged.","type":"array","items":{"type":"string","enum":["orders","sales","marketing","billing","finance","banking","support","github","mcp","api","document_intake","agents","chat"]}},"per_user":{"description":"Billed per counted user of the instance (an edition). Only the operator instance keeps it.","type":"boolean"},"min_quantity":{"description":"With per_user: the fewest users billed; null for none. Only the operator instance keeps it.","anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]},"ai_quota_eur":{"description":"Monthly AI quota in EUR this item adds to an instance, per unit (an AI package); null for none. Only the operator instance keeps it.","anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]},"valid_from":{"description":"First day it can be chosen, YYYY-MM-DD; null for no start.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"valid_to":{"description":"Last day it can be chosen, YYYY-MM-DD; null for no end.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"active":{"description":"Default for a new one: true.","type":"boolean"}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"item":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"description_short":{"type":["string","null"]},"offer_text":{"type":["string","null"]},"price_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"selection_rule":{"type":"string"},"requires_item_key":{"type":["string","null"]},"process_class":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"provisioning_flow":{"type":["string","null"]},"modules":{"type":"array","items":{"type":"string"}},"per_user":{"type":"boolean"},"min_quantity":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ai_quota_eur":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"valid_from":{"type":["string","null"]},"valid_to":{"type":["string","null"]},"active":{"type":"boolean"},"selectable_today":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","category","description_short","offer_text","price_one_time_cents","price_monthly_cents","selection_rule","requires_item_key","process_class","sort_order","provisioning_flow","valid_from","valid_to","active","selectable_today","url"],"additionalProperties":false}},"required":["created","item"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/catalog-items/{id}/active":{"post":{"operationId":"set_catalog_item_active","summary":"Katalogposition aktivieren oder deaktivieren","description":"Deactivates a catalogue item -- the quote editor and list_catalog_items no longer offer it -- or activates it again. Nothing is deleted, and quotes already saved keep their lines. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The item's id or key, from list_catalog."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"description_short":{"type":["string","null"]},"offer_text":{"type":["string","null"]},"price_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"selection_rule":{"type":"string"},"requires_item_key":{"type":["string","null"]},"process_class":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"provisioning_flow":{"type":["string","null"]},"modules":{"type":"array","items":{"type":"string"}},"per_user":{"type":"boolean"},"min_quantity":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ai_quota_eur":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"valid_from":{"type":["string","null"]},"valid_to":{"type":["string","null"]},"active":{"type":"boolean"},"selectable_today":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","name","category","description_short","offer_text","price_one_time_cents","price_monthly_cents","selection_rule","requires_item_key","process_class","sort_order","provisioning_flow","valid_from","valid_to","active","selectable_today","url"],"additionalProperties":false}},"required":["item"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/companies":{"get":{"operationId":"search_companies","summary":"Firmen suchen","description":"Finds companies by name or city, 50 per page, alphabetically. Use get_company for one company's details, people and orders.","x-scope":"customers:read","parameters":[{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in the name or city.","type":"string","maxLength":120}},{"name":"role","in":"query","required":false,"schema":{"type":"string","enum":["customer","supplier"]}},{"name":"include_inactive","in":"query","required":false,"schema":{"description":"Include deactivated rows. Default: only active ones, as the lists in nxva.base show.","type":"boolean"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"city":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"people":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","name","city","is_customer","is_supplier","is_active","people","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_company","summary":"Firma anlegen","description":"Creates a company -- a customer by default. Refused when an active company of the same name exists, with its id: use that one, or pass allow_duplicate when it really is a different company. Search first with search_companies.","x-scope":"customers:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"is_customer":{"description":"Default: true.","type":"boolean"},"is_supplier":{"description":"Default: false. A company can be both.","type":"boolean"},"street":{"description":"Street and number. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":200},"zip":{"description":"Postcode. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":20},"city":{"description":"City. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"vat_id":{"description":"VAT id, e.g. DE123456789. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":30},"country_code":{"description":"ISO 3166-1 alpha-2, e.g. \"DE\". Decides reverse charge on invoices. Default for a new company: DE.","type":"string","minLength":2,"maxLength":2},"document_language":{"description":"The language quotes and invoices to this company are written in. Default for a new company: de.","type":"string","enum":["de","en"]},"avv_signed_on":{"description":"The day the data processing agreement (AVV) was signed, YYYY-MM-DD, not in the future. An empty string clears it. Without it, provisioning does not start an instance for this company.","type":"string","maxLength":10},"business_evidence_note":{"description":"Why this company counts as a business for VAT, as evidence. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":2000},"payment_term_days":{"description":"Days an invoice to this company is due in, proposed on its quotes and used on its free invoices. null clears it: the billing settings' default applies. Omit it to leave it as it is.","anyOf":[{"type":"integer","minimum":0,"maximum":120},{"type":"null"}]},"allow_duplicate":{"description":"Create it even though an active company has this name.","type":"boolean"}},"required":["name"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"vat_id":{"type":["string","null"]},"country_code":{"type":"string"},"document_language":{"type":"string"},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"active":{"type":"boolean"}},"required":["id","label","kind","address","active"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created","name","street","zip","city","vat_id","country_code","document_language","payment_term_days","avv_signed_on","is_customer","is_supplier","is_active","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/companies/{id}":{"get":{"operationId":"get_company","summary":"Firma lesen","description":"One company: address, VAT id, note, its people, its orders, how many of its tasks are still open, who receives its invoices and order documents, and the ticket systems its mails come from.","x-scope":"customers:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The company's id, from search_companies."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"country_code":{"type":"string"},"vat_id":{"type":["string","null"]},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"note":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"people":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"is_active":{"type":"boolean"}},"required":["id","name","email","phone","position","is_active"],"additionalProperties":false}},"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"}},"required":["id","number","title","status"],"additionalProperties":false}},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"key_pattern":{"type":["string","null"]},"active":{"type":"boolean"},"default_order":{"type":["string","null"]},"fallback_person":{"type":["string","null"]},"answer_mode":{"type":"string"},"answer_address":{"type":["string","null"]}},"required":["id","label","kind","address","key_pattern","active","default_order","fallback_person","answer_mode","answer_address"],"additionalProperties":false}},"open_tasks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","name","street","zip","city","country_code","vat_id","payment_term_days","avv_signed_on","note","is_customer","is_supplier","is_active","people","open_tasks","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_company","summary":"Firma ändern","description":"Changes a company's name, roles, address, VAT id, country, document language, payment term or AVV date. Only the fields given change. A role stays while quotes or contracts rely on it.","x-scope":"customers:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The company's id, from search_companies."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"active":{"description":"false deactivates the company: it stays, with its quotes and orders, but is no longer offered. true activates it again.","type":"boolean"},"street":{"description":"Street and number. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":200},"zip":{"description":"Postcode. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":20},"city":{"description":"City. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"vat_id":{"description":"VAT id, e.g. DE123456789. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":30},"country_code":{"description":"ISO 3166-1 alpha-2, e.g. \"DE\". Decides reverse charge on invoices. Default for a new company: DE.","type":"string","minLength":2,"maxLength":2},"document_language":{"description":"The language quotes and invoices to this company are written in. Default for a new company: de.","type":"string","enum":["de","en"]},"avv_signed_on":{"description":"The day the data processing agreement (AVV) was signed, YYYY-MM-DD, not in the future. An empty string clears it. Without it, provisioning does not start an instance for this company.","type":"string","maxLength":10},"business_evidence_note":{"description":"Why this company counts as a business for VAT, as evidence. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":2000},"payment_term_days":{"description":"Days an invoice to this company is due in, proposed on its quotes and used on its free invoices. null clears it: the billing settings' default applies. Omit it to leave it as it is.","anyOf":[{"type":"integer","minimum":0,"maximum":120},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"vat_id":{"type":["string","null"]},"country_code":{"type":"string"},"document_language":{"type":"string"},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"active":{"type":"boolean"}},"required":["id","label","kind","address","active"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created","name","street","zip","city","vat_id","country_code","document_language","payment_term_days","avv_signed_on","is_customer","is_supplier","is_active","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contract-suggestions":{"get":{"operationId":"list_contract_suggestions","summary":"Vertragsvorschläge lesen","description":"Purchase contracts nxva.base suggests from recurring bank debits, as on /finanzen/vertraege?richtung=vorschlaege: a supplier paid monthly (at least 3 debits, 25-35 days apart) or yearly (2 debits about a year apart) in about the same amount, with no active purchase contract for that interval yet. Salaries and the like are never suggested; a dismissed or confirmed series stays away. Each item has a key, supplier, interval, latest gross amount in cents, first and last debit day, category, VAT and the number of debits. Read only: creating the contract from a suggestion is a person's decision on the page. finance.manage only.","x-scope":"finance:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"supplier":{"type":"string"},"company_id":{"type":["string","null"]},"interval":{"type":"string","enum":["monthly","yearly"]},"latest_gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_rate_bp":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reverse_charge":{"type":"boolean"},"first_date":{"type":"string"},"last_date":{"type":"string"},"category_key":{"type":["string","null"]},"transaction_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"accounts":{"type":"array","items":{"type":"string"}}},"required":["key","supplier","company_id","interval","latest_gross_cents","net_cents","vat_rate_bp","reverse_charge","first_date","last_date","category_key","transaction_count","accounts"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contracts":{"post":{"operationId":"save_contract","summary":"Vertrag anlegen oder ändern","description":"Edits the terms of an order's sales contract -- title, business unit, cost center, payment term -- or, for an order that has none, creates it: then company is required, and an order from a quote gets the quote's lines, as acceptance would have given. finance.manage only.","x-scope":"contracts","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."},"title":{"type":"string","minLength":1,"maxLength":200},"business_unit":{"description":"Name or id of a business unit (list_business_units). Default: the contract's own, or for a new contract the order's.","type":"string","minLength":1,"maxLength":100},"cost_center":{"description":"DATEV KOST1: up to 8 letters or digits.","type":"string","maxLength":8},"payment_term_days":{"type":"integer","minimum":0,"maximum":365},"company":{"description":"Only for a new contract: the customer's company id.","type":"string"}},"required":["order","title","payment_term_days"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string"},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"invoiced":{"type":"boolean"}},"required":["id","position","label","kind","category","vat_rate_pct","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values","invoiced"],"additionalProperties":false}}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines"],"additionalProperties":false},{"type":"null"}]},"revenue_categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"},"created":{"type":"boolean"}},"required":["order","delivery_from","delivery_to","contract","revenue_categories","url","created"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"list_contracts","summary":"Verträge auflisten","description":"Contracts in both directions -- sales contracts of orders and purchase contracts with suppliers -- with company, business unit, status, the running monthly amount, and the earliest end notice given today could reach. get_contract reads a sales contract by its order, get_purchase_contract a purchase contract.","x-scope":"finance:read","parameters":[{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["sales","purchase"]}},{"name":"status","in":"query","required":false,"schema":{"description":"E.g. active, ended, cancelled. Default: all.","type":"string"}},{"name":"query","in":"query","required":false,"schema":{"description":"Words in the title or company.","type":"string","maxLength":120}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"contracts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"direction":{"type":"string","enum":["sales","purchase"]},"directionLabel":{"type":"string","enum":["Verkauf","Einkauf"]},"companyName":{"type":"string"},"businessUnit":{"type":"string"},"businessUnitId":{"type":["string","null"]},"businessUnitSort":{"type":"number"},"status":{"type":"string"},"statusLabel":{"type":"string"},"monthlyCents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"earliestEnd":{"type":["string","null"]},"endNote":{"type":["string","null"]},"href":{"type":["string","null"]},"orderNumber":{"type":["string","null"]}},"required":["id","title","direction","directionLabel","companyName","businessUnit","businessUnitId","businessUnitSort","status","statusLabel","monthlyCents","earliestEnd","endNote","href","orderNumber"],"additionalProperties":false}},"url":{"type":"string"}},"required":["contracts","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contracts/{id}":{"get":{"operationId":"get_contract","summary":"Vertrag eines Auftrags lesen","description":"An order's sales contract: its terms and every line -- instalments, recurring charges, time and material, forecasts, month values -- with amounts in cents, dates, term and notice, and whether an invoice bills it. Also the revenue categories a line can book to. finance.manage only.","x-scope":"contracts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string"},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"invoiced":{"type":"boolean"}},"required":["id","position","label","kind","category","vat_rate_pct","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values","invoiced"],"additionalProperties":false}}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines"],"additionalProperties":false},{"type":"null"}]},"revenue_categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"}},"required":["order","delivery_from","delivery_to","contract","revenue_categories","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contracts/{id}/lines":{"post":{"operationId":"add_contract_line","summary":"Vertragsposition anlegen","description":"Adds a line to an order's sales contract: what it bills and when. label, kind and category are required, and each kind needs its own fields (see the field descriptions). finance.manage only. Nothing is invoiced by this.","x-scope":"contracts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"kind":{"description":"instalment (a part delivered once), recurring, time_material, forecast, or monthly_values (a year of month amounts).","type":"string","enum":["instalment","recurring","time_material","forecast","monthly_values"]},"category":{"description":"A revenue category key, from get_contract.","type":"string"},"vat_rate_pct":{"description":"Default for a new line: 19.","type":"number","minimum":0,"maximum":100},"amount_cents":{"description":"Every kind but time_material and monthly_values.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"instalment and forecast.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completed_on":{"description":"instalment: the day it was delivered.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"timing":{"description":"recurring: in advance or in arrears.","type":"string","enum":["advance","arrears"]},"start_date":{"description":"recurring and time_material.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":1,"maximum":52},{"type":"null"}]},"notice_unit":{"anyOf":[{"type":"string","enum":["weeks","months"]},{"type":"null"}]},"notice_effective":{"anyOf":[{"type":"string","enum":["month_end","term_end"]},{"type":"null"}]},"notice_given_on":{"description":"Recorded notice; without an end, the earliest end the term allows is set.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2026-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string"},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"invoiced":{"type":"boolean"}},"required":["id","position","label","kind","category","vat_rate_pct","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values","invoiced"],"additionalProperties":false}}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines"],"additionalProperties":false},{"type":"null"}]},"revenue_categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"},"line":{"type":"string"}},"required":["order","delivery_from","delivery_to","contract","revenue_categories","url","line"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contracts/{id}/lines/{line_id}":{"patch":{"operationId":"update_contract_line","summary":"Vertragsposition ändern","description":"Changes a line of an order's sales contract: only the fields given, the rest stays as the line holds it. For monthly_values, values_year with values replaces that year's months. finance.manage only.","x-scope":"contracts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}},{"name":"line_id","in":"path","required":true,"schema":{"type":"string","description":"The line's id, from get_contract."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"kind":{"description":"instalment (a part delivered once), recurring, time_material, forecast, or monthly_values (a year of month amounts).","type":"string","enum":["instalment","recurring","time_material","forecast","monthly_values"]},"category":{"description":"A revenue category key, from get_contract.","type":"string"},"vat_rate_pct":{"description":"Default for a new line: 19.","type":"number","minimum":0,"maximum":100},"amount_cents":{"description":"Every kind but time_material and monthly_values.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"instalment and forecast.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completed_on":{"description":"instalment: the day it was delivered.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"timing":{"description":"recurring: in advance or in arrears.","type":"string","enum":["advance","arrears"]},"start_date":{"description":"recurring and time_material.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":1,"maximum":52},{"type":"null"}]},"notice_unit":{"anyOf":[{"type":"string","enum":["weeks","months"]},{"type":"null"}]},"notice_effective":{"anyOf":[{"type":"string","enum":["month_end","term_end"]},{"type":"null"}]},"notice_given_on":{"description":"Recorded notice; without an end, the earliest end the term allows is set.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2026-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string"},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"invoiced":{"type":"boolean"}},"required":["id","position","label","kind","category","vat_rate_pct","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values","invoiced"],"additionalProperties":false}}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines"],"additionalProperties":false},{"type":"null"}]},"revenue_categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"},"line":{"type":"string"}},"required":["order","delivery_from","delivery_to","contract","revenue_categories","url","line"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_contract_line","summary":"Vertragsposition löschen","description":"Deletes a line typed by mistake. A line an invoice bills, or one a bank transaction is allocated to, stays. finance.manage only.","x-scope":"contracts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}},{"name":"line_id","in":"path","required":true,"schema":{"type":"string","description":"The line's id, from get_contract."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/contracts/{id}/lines/{line_id}/reseed":{"post":{"operationId":"reseed_contract_line","summary":"Monatswerte neu verteilen","description":"Spreads a monthly_values line evenly over the order's delivery period again, replacing every month it had. It redistributes the line's current total; it does not bring back an estimate that months were edited away from. finance.manage only.","x-scope":"contracts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}},{"name":"line_id","in":"path","required":true,"schema":{"type":"string","description":"The line's id, from get_contract."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string"},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"invoiced":{"type":"boolean"}},"required":["id","position","label","kind","category","vat_rate_pct","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values","invoiced"],"additionalProperties":false}}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines"],"additionalProperties":false},{"type":"null"}]},"revenue_categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"},"total_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["order","delivery_from","delivery_to","contract","revenue_categories","url","total_cents"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/datev-exports":{"get":{"operationId":"list_datev_exports","summary":"DATEV-Pakete lesen","description":"The DATEV hand-off as on /finanzen/datev: the way invoices go to DATEV (mode off, mail or xml) and the start date, how many incoming and outgoing invoices wait for the next package or mail run (waiting) and how many cannot go yet (blocked, e.g. a missing file or city), and the newest packages with number, status (building, built, uploaded, discarded, reversed), creation time, invoice count and gross in cents. Read only; building, uploading and taking back packages are done by a person on the page. finance.manage only.","x-scope":"finance:read","parameters":[{"name":"limit","in":"query","required":false,"schema":{"description":"How many packages, newest first. Default 20, at most 50.","type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["off","mail","xml"]},"startDate":{"type":["string","null"]},"waiting":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"blocked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"exports":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string","enum":["building","built","uploaded","discarded","reversed"]},"createdAt":{"type":"string"},"invoices":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"grossCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["number","status","createdAt","invoices","grossCents"],"additionalProperties":false}}},"required":["mode","startDate","waiting","blocked","exports"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/discount-thresholds":{"get":{"operationId":"get_discount_thresholds","summary":"Rabatt-Schwellwerte lesen","description":"The discount thresholds in percent: a quote whose effective one-time or monthly discount is above its threshold needs approval (discounts.approve) before it can be sent. catalog.manage only.","x-scope":"catalog","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"one_time_pct":{"type":"number"},"monthly_pct":{"type":"number"},"url":{"type":"string"}},"required":["one_time_pct","monthly_pct","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"set_discount_thresholds","summary":"Rabatt-Schwellwerte ändern","description":"Sets the discount thresholds in percent (0 to 100, e.g. 10 or 12.5); a threshold left out keeps its value. A quote whose effective discount is above a threshold needs approval, and that is decided when the quote is saved: a new threshold changes which quotes saved from now on need approval -- raising one lets bigger discounts through without it -- while a quote already saved keeps its answer until it is saved again. catalog.manage only.","x-scope":"catalog","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"one_time_pct":{"description":"Threshold for the one-time discount, in percent.","type":"number","minimum":0,"maximum":100},"monthly_pct":{"description":"Threshold for the monthly discount, in percent.","type":"number","minimum":0,"maximum":100}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"before":{"type":"object","properties":{"one_time_pct":{"type":"number"},"monthly_pct":{"type":"number"},"url":{"type":"string"}},"required":["one_time_pct","monthly_pct","url"],"additionalProperties":false},"thresholds":{"type":"object","properties":{"one_time_pct":{"type":"number"},"monthly_pct":{"type":"number"},"url":{"type":"string"}},"required":["one_time_pct","monthly_pct","url"],"additionalProperties":false}},"required":["before","thresholds"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-template-variants":{"post":{"operationId":"add_document_template_variant","summary":"Layout einer Dokumentenvorlage anlegen","description":"Adds a further variant (layout) to a document type. Version 1 is a copy of copy_from's active version, or of the built-in layout when copy_from is omitted. The key is made from the name; a name whose key the document type already has is refused. A new variant serves no project type and is not the default until assign_document_template_project_types or make_default_document_template_variant says so -- so it changes no document yet. catalog.manage only.","x-scope":"catalog","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"document_type":{"type":"string","enum":["quote","order_confirmation","service_spec","terms","dpa","service_report","invoice","sepa_mandate","commission_statement","credit_note"]},"name":{"type":"string","maxLength":120,"description":"e.g. \"Kurzfassung\"."},"copy_from":{"description":"A variant of the same document type to copy, from list_document_templates.","type":"string"}},"required":["document_type","name"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-template-variants/{id}":{"patch":{"operationId":"rename_document_template_variant","summary":"Layout einer Dokumentenvorlage umbenennen","description":"Renames a variant. Only its display name changes; its key, versions and routing stay. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The variant's id, from list_document_templates."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"remove_document_template_variant","summary":"Layout einer Dokumentenvorlage löschen","description":"Deletes a variant with all its versions, for good. Refused once any document was rendered from one of its versions, and for the default variant -- make another one the default first. Project types routed to it fall back to the default. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The variant's id, from list_document_templates."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"variant":{"type":"string"}},"required":["deleted","variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-template-variants/{id}/default":{"post":{"operationId":"make_default_document_template_variant","summary":"Layout zum Standard machen","description":"Makes a variant its document type's default: the one used for documents whose project type has no variant of its own, or that have no project type. The previous default stops being it. A change applies to documents created from then on; quotes, order confirmations, service reports and invoices already sent or issued keep the version they were frozen with. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The variant's id, from list_document_templates."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-template-variants/{id}/project-types":{"post":{"operationId":"assign_document_template_project_types","summary":"Projektarten einem Layout zuordnen","description":"Sets which project types use this variant for its document type. The list replaces the current assignment; an empty list removes them all. A project type assigned here leaves whichever other variant of the same document type had it. Project types by key (list_project_types) or id. A change applies to documents created from then on; quotes, order confirmations, service reports and invoices already sent or issued keep the version they were frozen with. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The variant's id, from list_document_templates."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"project_types":{"maxItems":100,"type":"array","items":{"type":"string"},"description":"Project type keys or ids. [] for none."}},"required":["project_types"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-templates":{"get":{"operationId":"list_document_templates","summary":"Dokumentenvorlagen auflisten","description":"Per document type (quote, order_confirmation, service_spec, terms, dpa, service_report, invoice, sepa_mandate, commission_statement, credit_note) its variants (layouts): which is the default, which project types are routed to it, and its active version. New documents use the variant their project type is routed to, otherwise the default. Like opening the page, the first look at a document type stores its built-in layout as version 1 of the default variant. get_document_template reads a version's definition. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"document_type","in":"query","required":false,"schema":{"description":"Only this document type. Default: all.","type":"string","enum":["quote","order_confirmation","service_spec","terms","dpa","service_report","invoice","sepa_mandate","commission_statement","credit_note"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string"},"label":{"type":"string"},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}}},"required":["document_type","label","variants"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_document_template","summary":"Dokumentenvorlage speichern","description":"Saves a definition as the variant's next version, as the editor does: versions are never overwritten. By default the new version is activated at once, as the editor's save does; with activate: false it is stored as a draft that activate_document_template can switch on later. Start from get_document_template's definition and send the whole tree back changed -- blocks and pageFooter must both be lists. The definition is normalised like the editor's: unknown block kinds and unreadable properties are dropped (the answer counts dropped blocks), blocks without an id get one. A change applies to documents created from then on; quotes, order confirmations, service reports and invoices already sent or issued keep the version they were frozen with. catalog.manage only.","x-scope":"catalog","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"string","description":"The variant's id, from list_document_templates."},"name":{"type":"string","maxLength":200,"description":"What changed, in a few words; shown in the version history. Empty: \"Fassung <n>\"."},"definition":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"The whole definition: { page, theme, blocks, pageFooter }, as get_document_template returns it."},"activate":{"description":"Default: true. false stores the version without using it yet.","type":"boolean"}},"required":["variant","name","definition"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"is_active":{"type":"boolean"}},"required":["template","version","name","is_active"],"additionalProperties":false},"dropped_blocks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":"string"},"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["version","variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-templates/{id}":{"get":{"operationId":"get_document_template","summary":"Dokumentenvorlage lesen","description":"One version of a variant with its definition exactly as save_document_template takes it, plus the variant's version history and the fields a text block may bind to. Default: the active version. The definition is { page: { marginTop, marginRight, marginBottom, marginLeft, footerTop } in points, theme, blocks: [...], pageFooter: [...] }. Each block has an id, a kind (stack, row, frame, text, divider, spacer, image, wordmark, pageBreak, repeat, table), optional style, label, when (a condition), keepTogether, minPresenceAhead; stack/row/frame/repeat have children, a table has columns with cell blocks. A text block's content may hold {{field.path}} bindings and **bold**. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The variant's id, from list_document_templates."}},{"name":"version","in":"query","required":false,"schema":{"description":"The version number. Default: the active one.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false},"version":{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"is_active":{"type":"boolean"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]},"documents_sent_with_it":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["template","version","name","is_active","created_at","created_by","documents_sent_with_it"],"additionalProperties":false},"definition":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"versions":{"type":"array","items":{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"is_active":{"type":"boolean"},"created_at":{"type":"string"},"documents_sent_with_it":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["template","version","name","is_active","created_at","documents_sent_with_it"],"additionalProperties":false}},"bindable_fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"scope":{"type":"string"},"formatter":{"type":"string"}},"required":["path","label","kind"],"additionalProperties":false}}},"required":["variant","version","definition","versions","bindable_fields"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/document-templates/{id}/activate":{"post":{"operationId":"activate_document_template","summary":"Fassung einer Dokumentenvorlage aktivieren","description":"Makes an existing version the one new documents of its variant are rendered with -- an earlier one to go back, or a draft saved with activate: false. The version's template id comes from get_document_template. A change applies to documents created from then on; quotes, order confirmations, service reports and invoices already sent or issued keep the version they were frozen with. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The version's template id, from get_document_template."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activated_version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"variant":{"type":"object","properties":{"id":{"type":"string"},"document_type":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"is_default":{"type":"boolean"},"language":{"type":["string","null"]},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"active_version":{"anyOf":[{"type":"object","properties":{"template":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"]}},"required":["template","version","name","created_at","created_by"],"additionalProperties":false},{"type":"null"}]},"version_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latest_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":"string"}},"required":["id","document_type","key","name","is_default","language","project_types","active_version","version_count","latest_version","url"],"additionalProperties":false}},"required":["activated_version","variant"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/documents":{"get":{"operationId":"search_documents","summary":"Dokumente suchen","description":"Searches filed documents (invoices, contracts, minutes, …) by meaning and by exact terms such as invoice numbers. Returns the best documents with matching passages and SharePoint links. Use get_document for the full text of one.","x-scope":"documents:read","parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":500,"description":"A question or words to find."}},{"name":"document_type","in":"query","required":false,"schema":{"description":"E.g. Eingangsrechnung, Vertrag, Protokoll.","type":"string","maxLength":80}},{"name":"company_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"order_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"schema":{"description":"Document date from, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Document date to, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":25}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"file_name":{"type":"string"},"url":{"type":["string","null"]},"document_type":{"type":["string","null"]},"document_date":{"type":["string","null"]},"company":{"type":["string","null"]},"order":{"type":["string","null"]},"passages":{"type":"array","items":{"type":"string"}}},"required":["id","file_name","url","document_type","document_date","company","order","passages"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/documents/{id}":{"get":{"operationId":"get_document","summary":"Dokument lesen","description":"The full text, metadata and SharePoint link of one filed document, by the id search_documents returned.","x-scope":"documents:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"file_name":{"type":["string","null"]},"path":{"type":["string","null"]},"url":{"type":["string","null"]},"document_type":{"type":["string","null"]},"document_date":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"metadata":{},"tasks":{"type":"array","items":{"type":"string"}},"text":{"type":["string","null"]}},"required":["id","file_name","path","url","document_type","document_date","company","order","metadata","tasks","text"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/actuals":{"get":{"operationId":"get_actuals","summary":"Plan und Ist lesen","description":"Plan against actuals per BWA line for a year, as /finanzen/ist shows it, up to the last month a BWA was imported for; and the recent BWA imports with their state. The BWA carries no business unit, so with business_unit the actuals are not compared.","x-scope":"finance:read","parameters":[{"name":"year","in":"query","required":false,"schema":{"description":"Default: this year.","type":"integer","minimum":2000,"maximum":2100}},{"name":"business_unit","in":"query","required":false,"schema":{"description":"Name or id of a business unit (list_business_units). Default: every unit.","type":"string","minLength":1,"maxLength":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"year":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"business_unit":{"type":["string","null"]},"reporting_month":{"type":["string","null"]},"months":{"type":"array","items":{"type":"string"}},"compared":{"type":"boolean"},"rows":{"type":"array","items":{"type":"object","properties":{"bwaLineKey":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"planCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"actualCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"deltaCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"deltaPercent":{"type":["number","null"]},"contributors":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["key","name","cents"],"additionalProperties":false}}},"required":["bwaLineKey","label","type","planCents","actualCents","deltaCents","deltaPercent","contributors"],"additionalProperties":false}},"imports":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"month":{"type":"string"},"status":{"type":"string"},"file":{"type":["string","null"]},"uploaded_at":{"type":"string"}},"required":["id","month","status","file","uploaded_at"],"additionalProperties":false}},"url":{"type":"string"}},"required":["year","business_unit","reporting_month","months","compared","rows","imports","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/blocks":{"post":{"operationId":"save_finance_block","summary":"Finanzblock anlegen oder ändern","description":"Creates a block that groups finance categories (omit key; name and direction are required; the key is the name in capitals) or edits one: only the fields given change, and the direction is fixed once it exists, since its categories share it. finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"description":"The block's key, from list_finance_categories. Omit to create one.","type":"string"},"name":{"type":"string","maxLength":120},"direction":{"description":"Only for a new block.","type":"string","enum":["cost","revenue"]},"sort":{"description":"Default for a new one: after the others.","type":"integer","minimum":-1000000,"maximum":1000000}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"block":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"direction":{"type":"string"},"sort":{"type":"number"},"url":{"type":"string"}},"required":["key","name","direction","sort","url"],"additionalProperties":false}},"required":["created","block"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/bwa-imports":{"post":{"operationId":"upload_bwa","summary":"BWA hochladen (Vorschau)","description":"Reads a DATEV BWA (the text of its CSV or XLSX export) into a preview, as the upload on /finanzen/ist does: the lines it matched with month and year-to-date amounts in cents, the lines it could not place, and the plausibility warnings. The preview counts for nothing until confirm_bwa_import; discard_bwa_import throws it away. Show the person the preview and the warnings before confirming. PDF is refused. finance.manage only.","x-scope":"finance:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"The BWA as text (CSV / exported table, German number format)."},"month":{"description":"The month the BWA is for. Omit to take the month named in the document.","type":"string","pattern":"^\\d{4}-\\d{2}$"},"file_name":{"description":"Name of the source file, kept with the import. Default \"bwa.csv\".","type":"string"}},"required":["text"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"import":{"type":"string"},"status":{"type":"string","const":"PARSED"},"counts":{"type":"boolean","const":false},"month":{"type":"string"},"file_name":{"type":"string"},"matched":{"type":"number"},"rows":{"type":"array","items":{"type":"object","properties":{"bwa_line":{"type":"string"},"label":{"type":"string"},"amount_month_cents":{"type":"number"},"amount_ytd_cents":{"type":"number"}},"required":["bwa_line","label","amount_month_cents","amount_ytd_cents"],"additionalProperties":false}},"unmatched":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"next":{"type":"string"},"url":{"type":"string"}},"required":["import","status","counts","month","file_name","matched","rows","unmatched","warnings","next","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/bwa-imports/{id}/confirm":{"post":{"operationId":"confirm_bwa_import","summary":"BWA-Import übernehmen","description":"Takes a previewed BWA import into the actuals. Whatever was confirmed for that month before becomes SUPERSEDED (kept, no longer counted). Only a preview (status PARSED) can be confirmed. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The import's id, as upload_bwa or get_actuals give it."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"import":{"type":"string"},"status":{"type":"string","const":"CONFIRMED"},"month":{"type":"string"},"superseded":{"type":"number"},"url":{"type":"string"}},"required":["import","status","month","superseded","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/bwa-imports/{id}/discard":{"post":{"operationId":"discard_bwa_import","summary":"BWA-Vorschau verwerfen","description":"Deletes a BWA preview nobody wants, with its figures. Only a preview (status PARSED); a confirmed import stays. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The import's id, as upload_bwa or get_actuals give it."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"import":{"type":"string"},"discarded":{"type":"boolean","const":true}},"required":["import","discarded"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/categories":{"get":{"operationId":"list_finance_categories","summary":"Finanz-Stammdaten lesen","description":"The categories plan items and contract lines book to -- revenue or cost, with their block, BWA line, scaling and whether they reach the P&L -- and the blocks and BWA lines themselves.","x-scope":"finance:read","parameters":[{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"direction":{"type":"string"},"block":{"type":"string"},"bwa_line":{"type":["string","null"]},"scaling":{"type":"string"},"affects_pnl":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["key","name","direction","block","bwa_line","scaling","affects_pnl","archived"],"additionalProperties":false}},"blocks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"sort":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"direction":{"type":"string"}},"required":["key","name","sort","direction"],"additionalProperties":false}},"bwa_lines":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"}},"required":["key","label","type"],"additionalProperties":false}},"url":{"type":"string"}},"required":["categories","blocks","bwa_lines","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_finance_category","summary":"Finanzkategorie anlegen oder ändern","description":"Creates a finance category (omit key; name, direction and block are required; the key is made from the name) or edits one: only the fields given change, and the direction is fixed once it exists. A new cost category comes with one lump-sum plan item per business unit in the scenario BEAUFTRAGT, which carries the category's name and VAT proposal; a revenue category gets none. Blocks and BWA lines come from list_finance_categories, and must match the direction. finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"description":"The category's key, from list_finance_categories. Omit to create one.","type":"string"},"name":{"type":"string","maxLength":120},"direction":{"description":"Only for a new category.","type":"string","enum":["cost","revenue"]},"block":{"description":"A block key of the same direction.","type":"string"},"scaling":{"description":"FIX, SEMI_FIX or VARIABLE. Default for a new one: FIX.","type":"string","enum":["FIX","SEMI_FIX","VARIABLE"]},"bwa_line":{"description":"A BWA line key of the matching type, or null for none. Dropped when affects_pnl is false.","type":["string","null"]},"affects_pnl":{"description":"false for money that only moves liquidity, e.g. a repayment. Default for a new one: true.","type":"boolean"},"sort":{"description":"Default for a new one: after the others.","type":"integer","minimum":-1000000,"maximum":1000000},"default_vat_rate_pct":{"description":"VAT proposal for new plan items and contract lines, e.g. 19, 7, 0. Default for a new one: 19.","type":"number","minimum":0,"maximum":100}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"direction":{"type":"string"},"block":{"type":"string"},"bwa_line":{"type":["string","null"]},"scaling":{"type":"string"},"affects_pnl":{"type":"boolean"},"sort":{"type":"number"},"default_vat_rate_pct":{"type":"number"},"archived":{"type":"boolean"},"lump_sums":{"type":"array","items":{"type":"object","properties":{"plan_item":{"type":"string"},"business_unit":{"type":["string","null"]},"archived":{"type":"boolean"}},"required":["plan_item","business_unit","archived"],"additionalProperties":false}},"url":{"type":"string"}},"required":["key","name","direction","block","bwa_line","scaling","affects_pnl","sort","default_vat_rate_pct","archived","lump_sums","url"],"additionalProperties":false}},"required":["created","category"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/categories/{id}/archive":{"post":{"operationId":"archive_finance_category","summary":"Finanzkategorie archivieren","description":"Archives a finance category and its lump sums. Never deletes: amounts planned against it stay readable. Refused while plan items of its own (not the lump sums) are still active in it. restore_finance_category brings it back. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The category's key, from list_finance_categories."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"direction":{"type":"string"},"block":{"type":"string"},"bwa_line":{"type":["string","null"]},"scaling":{"type":"string"},"affects_pnl":{"type":"boolean"},"sort":{"type":"number"},"default_vat_rate_pct":{"type":"number"},"archived":{"type":"boolean"},"lump_sums":{"type":"array","items":{"type":"object","properties":{"plan_item":{"type":"string"},"business_unit":{"type":["string","null"]},"archived":{"type":"boolean"}},"required":["plan_item","business_unit","archived"],"additionalProperties":false}},"url":{"type":"string"}},"required":["key","name","direction","block","bwa_line","scaling","affects_pnl","sort","default_vat_rate_pct","archived","lump_sums","url"],"additionalProperties":false}},"required":["category"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/categories/{id}/restore":{"post":{"operationId":"restore_finance_category","summary":"Finanzkategorie wiederherstellen","description":"Brings an archived finance category back with its lump sums; plan items archived for their own reasons stay archived. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The category's key, from list_finance_categories with include_archived."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"direction":{"type":"string"},"block":{"type":"string"},"bwa_line":{"type":["string","null"]},"scaling":{"type":"string"},"affects_pnl":{"type":"boolean"},"sort":{"type":"number"},"default_vat_rate_pct":{"type":"number"},"archived":{"type":"boolean"},"lump_sums":{"type":"array","items":{"type":"object","properties":{"plan_item":{"type":"string"},"business_unit":{"type":["string","null"]},"archived":{"type":"boolean"}},"required":["plan_item","business_unit","archived"],"additionalProperties":false}},"url":{"type":"string"}},"required":["key","name","direction","block","bwa_line","scaling","affects_pnl","sort","default_vat_rate_pct","archived","lump_sums","url"],"additionalProperties":false}},"required":["category"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/cost-centers/fill":{"post":{"operationId":"fill_cost_centers","summary":"Kostenstelle in Verträge eintragen","description":"Writes a business unit's cost center into every contract of that unit -- sales and purchase, ended ones too -- that has none yet. A cost center already set is never overwritten. For contracts from before the setting existed; get_finance_settings counts them. finance.manage only.","x-scope":"finance:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"type":"string","minLength":1,"maxLength":100,"description":"Name or id of a business unit (list_business_units)."}},"required":["business_unit"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"type":"string"},"cost_center":{"type":"string"},"contracts_filled":{"type":"number"}},"required":["business_unit","cost_center","contracts_filled"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/liquidity":{"get":{"operationId":"get_liquidity","summary":"Liquidität lesen","description":"The gross liquidity forecast, as /finanzen/liquiditaet shows it: the opening balance from the latest bank balances, then per month money in and out with VAT and the balance at its end, the lowest month and whether it goes negative. The contracted scenario is always on; others by their ids, else those on by default.","x-scope":"finance:read","parameters":[{"name":"months","in":"query","required":false,"schema":{"description":"Default: 12.","anyOf":[{"type":"number","const":12},{"type":"number","const":18},{"type":"number","const":24}]}},{"name":"business_unit","in":"query","required":false,"schema":{"description":"Name or id of a business unit (list_business_units). Default: every unit.","type":"string","minLength":1,"maxLength":100}},{"name":"scenarios","in":"query","required":false,"schema":{"description":"Scenario ids switched on. Default: those active by default.","type":"array","items":{"type":"string"}},"style":"form","explode":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"months":{"type":"array","items":{"type":"string"}},"scenarios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"locked":{"type":"boolean"},"on":{"type":"boolean"},"toggleIds":{"type":"array","items":{"type":"string"}}},"required":["id","name","locked","on","toggleIds"],"additionalProperties":false}},"onIds":{"type":"array","items":{"type":"string"}},"forecast":{"type":"object","properties":{"months":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"openingCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inflowCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inflowByScenario":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"outflowCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"outflowByBlock":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"vatCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"netCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"closingCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["month","openingCents","inflowCents","inflowByScenario","outflowCents","outflowByBlock","vatCents","netCents","closingCents"],"additionalProperties":false}},"lowest":{"anyOf":[{"type":"object","properties":{"month":{"type":"string"},"openingCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inflowCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inflowByScenario":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"outflowCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"outflowByBlock":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"vatCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"netCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"closingCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["month","openingCents","inflowCents","inflowByScenario","outflowCents","outflowByBlock","vatCents","netCents","closingCents"],"additionalProperties":false},{"type":"null"}]},"goesNegative":{"type":"boolean"}},"required":["months","lowest","goesNegative"],"additionalProperties":false},"opening":{"type":"object","properties":{"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"date":{"type":["string","null"]},"accounts":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":["string","null"]},"name":{"type":["string","null"]},"date":{"type":"string"},"balanceCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountId","name","date","balanceCents"],"additionalProperties":false}}},"required":["totalCents","date","accounts"],"additionalProperties":false},"inflowColumns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"outflowColumns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"unplanned":{"type":"object","properties":{"sales":{"type":"object","properties":{"oneOffCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["oneOffCents","monthlyCents","yearlyCents"],"additionalProperties":false},"purchase":{"type":"object","properties":{"oneOffCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["oneOffCents","monthlyCents","yearlyCents"],"additionalProperties":false}},"required":["sales","purchase"],"additionalProperties":false},"problems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"message":{"type":"string"},"href":{"type":["string","null"]}},"required":["key","label","message","href"],"additionalProperties":false}},"missingScenarios":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"endedLines":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"message":{"type":"string"},"href":{"type":["string","null"]}},"required":["key","label","message","href"],"additionalProperties":false}},"accuracy":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"forecastCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"actualCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"deltaCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["month","forecastCents","actualCents","deltaCents"],"additionalProperties":false}},"ignoresUnassignedSnapshots":{"type":"boolean"},"url":{"type":"string"}},"required":["months","scenarios","onIds","forecast","opening","inflowColumns","outflowColumns","unplanned","problems","missingScenarios","endedLines","accuracy","ignoresUnassignedSnapshots","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/plan-items":{"get":{"operationId":"list_plan_items","summary":"Planposten auflisten","description":"Plan items -- what is planned without a contract: one-off, recurring or month-by-month amounts per scenario, business unit and category -- with every field the item form has, month values in cents per \"YYYY-MM\", and whether it is a category's lump sum (typed into the planning grid) or an item with its own page. Archived items only when asked.","x-scope":"finance:read","parameters":[{"name":"business_unit","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100,"description":"Name or id of a business unit (list_business_units)."}},{"name":"scenario","in":"query","required":false,"schema":{"description":"A scenario id from list_scenarios.","type":"string"}},{"name":"category","in":"query","required":false,"schema":{"description":"A category key from list_finance_categories.","type":"string"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["one_off","recurring","monthly_values"]}},{"name":"lump_sum","in":"query","required":false,"schema":{"description":"true: only lump sums; false: only items with their own page.","type":"boolean"}},{"name":"search","in":"query","required":false,"schema":{"description":"Part of the label.","type":"string"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"business_unit":{"type":["string","null"]},"direction":{"type":"string","enum":["revenue","cost"]},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},"scenario":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"kind":{"type":"string"},"lump_sum":{"type":"boolean"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"probability_pct":{"type":"number"},"payment_term_days":{"type":"number"},"amount_cents":{"type":["number","null"]},"planned_date":{"type":["string","null"]},"interval":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"comment":{"type":["string","null"]},"archived":{"type":"boolean"},"contract":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["id","label","business_unit","direction","category","scenario","company","kind","lump_sum","vat_rate_pct","reverse_charge","probability_pct","payment_term_days","amount_cents","planned_date","interval","start_date","end_date","values","comment","archived","contract","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_plan_item","summary":"Planposten anlegen","description":"Plans revenue or a cost without a contract, as the form on /finanzen/planung/neu does. label, scenario, category and kind are required -- business_unit defaults to the default unit -- and each kind needs its own fields (see the field descriptions). Never a category's lump sum: that is typed into the grid with set_plan_month_values. finance.manage only.","x-scope":"finance:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"scenario":{"type":"string","description":"A scenario id from list_scenarios; not the CRM pipeline."},"business_unit":{"description":"Name or id of a business unit (list_business_units). Default: the default unit.","type":"string","minLength":1,"maxLength":100},"category":{"type":"string","description":"A category key from list_finance_categories. Its direction makes the item revenue or a cost."},"company":{"description":"A company id. Revenue needs a customer; a cost may name a supplier or none.","type":["string","null"]},"kind":{"type":"string","enum":["one_off","recurring","monthly_values"]},"vat_rate_pct":{"description":"Default for a new item: the category's rate.","type":"number","minimum":0,"maximum":100},"reverse_charge":{"type":"boolean"},"probability_pct":{"description":"Revenue only, rounded to steps of five; a cost is always certain. Default for a new item: 100.","type":"number","minimum":0,"maximum":100},"payment_term_days":{"description":"Default for a new item: 14 for revenue, 0 for a cost.","type":"integer","minimum":0,"maximum":365},"amount_cents":{"description":"one_off: the amount; recurring: the amount per interval. Net, in cents.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"one_off.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"start_date":{"description":"recurring.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"description":"recurring, optional.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2027-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"required":["label","scenario","category","kind"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"business_unit":{"type":["string","null"]},"direction":{"type":"string","enum":["revenue","cost"]},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},"scenario":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"kind":{"type":"string"},"lump_sum":{"type":"boolean"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"probability_pct":{"type":"number"},"payment_term_days":{"type":"number"},"amount_cents":{"type":["number","null"]},"planned_date":{"type":["string","null"]},"interval":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"comment":{"type":["string","null"]},"archived":{"type":"boolean"},"contract":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["id","label","business_unit","direction","category","scenario","company","kind","lump_sum","vat_rate_pct","reverse_charge","probability_pct","payment_term_days","amount_cents","planned_date","interval","start_date","end_date","values","comment","archived","contract","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/plan-items/{id}":{"patch":{"operationId":"update_plan_item","summary":"Planposten ändern","description":"Changes a plan item with its own page: only the fields given, the rest stays as the item holds it. For monthly_values, values_year with values replaces that year's months (other years stay); switching to another kind drops every month value, recorded in the value history. An item does not switch between revenue and costs, and a category's lump sum is not edited here. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The plan item's id, from list_plan_items or get_planning (whose grid rows key it as \"planItem:<id>\"; either form is accepted)."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"scenario":{"description":"A scenario id from list_scenarios; not the CRM pipeline.","type":"string"},"business_unit":{"type":"string","minLength":1,"maxLength":100,"description":"Name or id of a business unit (list_business_units)."},"category":{"description":"A category key from list_finance_categories. Its direction makes the item revenue or a cost; an item keeps its direction.","type":"string"},"company":{"description":"A company id. Revenue needs a customer; a cost may name a supplier or none.","type":["string","null"]},"kind":{"description":"one_off (amount_cents on planned_date), recurring (amount_cents per interval from start_date), or monthly_values (values for values_year).","type":"string","enum":["one_off","recurring","monthly_values"]},"vat_rate_pct":{"description":"Default for a new item: the category's rate.","type":"number","minimum":0,"maximum":100},"reverse_charge":{"type":"boolean"},"probability_pct":{"description":"Revenue only, rounded to steps of five; a cost is always certain. Default for a new item: 100.","type":"number","minimum":0,"maximum":100},"payment_term_days":{"description":"Default for a new item: 14 for revenue, 0 for a cost.","type":"integer","minimum":0,"maximum":365},"amount_cents":{"description":"one_off: the amount; recurring: the amount per interval. Net, in cents.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"one_off.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"start_date":{"description":"recurring.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"description":"recurring, optional.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2027-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}},"comment":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"business_unit":{"type":["string","null"]},"direction":{"type":"string","enum":["revenue","cost"]},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},"scenario":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"kind":{"type":"string"},"lump_sum":{"type":"boolean"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"probability_pct":{"type":"number"},"payment_term_days":{"type":"number"},"amount_cents":{"type":["number","null"]},"planned_date":{"type":["string","null"]},"interval":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"comment":{"type":["string","null"]},"archived":{"type":"boolean"},"contract":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["id","label","business_unit","direction","category","scenario","company","kind","lump_sum","vat_rate_pct","reverse_charge","probability_pct","payment_term_days","amount_cents","planned_date","interval","start_date","end_date","values","comment","archived","contract","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/plan-items/{id}/archive":{"post":{"operationId":"archive_plan_item","summary":"Planposten archivieren","description":"Archives a plan item with its own page: it no longer counts in planning or the forecast. Nothing is deleted, so a past month's plan stays as it was. A category's lump sum is not archived. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The plan item's id, from list_plan_items or get_planning (whose grid rows key it as \"planItem:<id>\"; either form is accepted)."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"business_unit":{"type":["string","null"]},"direction":{"type":"string","enum":["revenue","cost"]},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},"scenario":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"kind":{"type":"string"},"lump_sum":{"type":"boolean"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"probability_pct":{"type":"number"},"payment_term_days":{"type":"number"},"amount_cents":{"type":["number","null"]},"planned_date":{"type":["string","null"]},"interval":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"comment":{"type":["string","null"]},"archived":{"type":"boolean"},"contract":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["id","label","business_unit","direction","category","scenario","company","kind","lump_sum","vat_rate_pct","reverse_charge","probability_pct","payment_term_days","amount_cents","planned_date","interval","start_date","end_date","values","comment","archived","contract","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/plan-items/{id}/months":{"patch":{"operationId":"set_plan_month_values","summary":"Planwert im Raster setzen","description":"Types an amount into a cell of the planning grid: one month of a category's lump sum (a monthly_values plan item with lump_sum true), or with to_year_end that month and every month to December. 0 empties the month. Every change is recorded in the value history. Items with their own page are changed with update_plan_item. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The plan item's id, from list_plan_items or get_planning (whose grid rows key it as \"planItem:<id>\"; either form is accepted)."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from_month":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$","description":"The month, \"YYYY-MM\"."},"amount_cents":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Net amount in cents; the category gives the sign."},"to_year_end":{"description":"Also every following month to December of the same year.","type":"boolean"}},"required":["from_month","amount_cents"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"months_set":{"type":"array","items":{"type":"string"}},"amount_cents":{"type":"number"},"plan_item":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"business_unit":{"type":["string","null"]},"direction":{"type":"string","enum":["revenue","cost"]},"category":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},"scenario":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"kind":{"type":"string"},"lump_sum":{"type":"boolean"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"probability_pct":{"type":"number"},"payment_term_days":{"type":"number"},"amount_cents":{"type":["number","null"]},"planned_date":{"type":["string","null"]},"interval":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"comment":{"type":["string","null"]},"archived":{"type":"boolean"},"contract":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["id","label","business_unit","direction","category","scenario","company","kind","lump_sum","vat_rate_pct","reverse_charge","probability_pct","payment_term_days","amount_cents","planned_date","interval","start_date","end_date","values","comment","archived","contract","url"],"additionalProperties":false}},"required":["months_set","amount_cents","plan_item"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/plan-years/copy":{"post":{"operationId":"copy_plan_year","summary":"Planjahr kopieren","description":"Copies the month values of one business unit's year into another year, scaled by factor_pct (103 raises everything by three per cent): every active monthly_values plan item, lump sums and items with their own page alike. The target year is replaced, not merged -- months it held are overwritten or emptied, and every change is recorded in the value history. finance.manage only.","x-scope":"finance:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"description":"Name or id of a business unit (list_business_units). Default: the default unit.","type":"string","minLength":1,"maxLength":100},"from_year":{"type":"integer","minimum":2000,"maximum":2100},"to_year":{"type":"integer","minimum":2000,"maximum":2100},"factor_pct":{"description":"Default: 100, an unchanged copy.","type":"number","minimum":0,"maximum":1000}},"required":["from_year","to_year"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"type":"string"},"from_year":{"type":"number"},"to_year":{"type":"number"},"items":{"type":"number"},"url":{"type":"string"}},"required":["business_unit","from_year","to_year","items","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/planning":{"get":{"operationId":"get_planning","summary":"Finanzplanung lesen","description":"The plan of one business unit and year, as /finanzen/planung shows it: per category the monthly costs and revenue of contracts, plan items and (weighted) pipeline, the totals and the year's result, what is not planned yet, and pricing problems. Without scenario: every scenario but the CRM pipeline. Plan item rows carry their id for the planning tools.","x-scope":"finance:read","parameters":[{"name":"year","in":"query","required":false,"schema":{"description":"Default: this year.","type":"integer","minimum":2000,"maximum":2100}},{"name":"business_unit","in":"query","required":false,"schema":{"description":"Name or id of a business unit (list_business_units). Default: the default unit.","type":"string","minLength":1,"maxLength":100}},{"name":"scenario","in":"query","required":false,"schema":{"description":"A scenario id from list_scenarios: only that one.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"year":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"business_unit":{"type":"string"},"grid":{"type":"object","properties":{"year":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"businessUnit":{"type":"string"},"months":{"type":"array","items":{"type":"string"}},"costSections":{"type":"array","items":{"type":"object","properties":{"monthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedMonthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"blockKey":{"type":"string"},"blockName":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"categoryKey":{"type":"string"},"name":{"type":"string"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedValues":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"owner":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"contract"},"id":{"type":"string"},"title":{"type":"string"},"lineLabel":{"type":"string"},"effort":{"type":"boolean"}},"required":["kind","id","title","lineLabel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"planItem"},"id":{"type":"string"},"label":{"type":"string"},"isLumpSum":{"type":"boolean"}},"required":["kind","id","label","isLumpSum"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["quote","invoice","payable"]},"id":{"type":"string"},"label":{"type":"string"}},"required":["kind","id","label"],"additionalProperties":false}]},"label":{"type":"string"},"editable":{"type":"boolean"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedValues":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["key","owner","label","editable","values","weightedValues","totalCents","weightedTotalCents"],"additionalProperties":false}}},"required":["categoryKey","name","values","weightedValues","totalCents","weightedTotalCents","items"],"additionalProperties":false}}},"required":["monthTotals","weightedMonthTotals","totalCents","weightedTotalCents","blockKey","blockName","rows"],"additionalProperties":false}},"revenueSections":{"type":"array","items":{"type":"object","properties":{"monthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedMonthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"blockKey":{"type":"string"},"blockName":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"categoryKey":{"type":"string"},"name":{"type":"string"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedValues":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"owner":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"contract"},"id":{"type":"string"},"title":{"type":"string"},"lineLabel":{"type":"string"},"effort":{"type":"boolean"}},"required":["kind","id","title","lineLabel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"planItem"},"id":{"type":"string"},"label":{"type":"string"},"isLumpSum":{"type":"boolean"}},"required":["kind","id","label","isLumpSum"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["quote","invoice","payable"]},"id":{"type":"string"},"label":{"type":"string"}},"required":["kind","id","label"],"additionalProperties":false}]},"label":{"type":"string"},"editable":{"type":"boolean"},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedValues":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["key","owner","label","editable","values","weightedValues","totalCents","weightedTotalCents"],"additionalProperties":false}}},"required":["categoryKey","name","values","weightedValues","totalCents","weightedTotalCents","items"],"additionalProperties":false}}},"required":["monthTotals","weightedMonthTotals","totalCents","weightedTotalCents","blockKey","blockName","rows"],"additionalProperties":false}},"costTotal":{"type":"object","properties":{"monthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedMonthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["monthTotals","weightedMonthTotals","totalCents","weightedTotalCents"],"additionalProperties":false},"revenueTotal":{"type":"object","properties":{"monthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"weightedMonthTotals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"weightedTotalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["monthTotals","weightedMonthTotals","totalCents","weightedTotalCents"],"additionalProperties":false}},"required":["year","businessUnit","months","costSections","revenueSections","costTotal","revenueTotal"],"additionalProperties":false},"scenarios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"}},"required":["id","name","active"],"additionalProperties":false}},"showsAll":{"type":"boolean"},"figures":{"type":"object","properties":{"costCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"revenueCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"revenueWeightedCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"resultCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["costCents","revenueCents","revenueWeightedCents","resultCents"],"additionalProperties":false},"unplanned":{"type":"object","properties":{"sales":{"type":"object","properties":{"oneOffCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["oneOffCents","monthlyCents","yearlyCents"],"additionalProperties":false},"purchase":{"type":"object","properties":{"oneOffCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearlyCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["oneOffCents","monthlyCents","yearlyCents"],"additionalProperties":false}},"required":["sales","purchase"],"additionalProperties":false},"problems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"message":{"type":"string"},"href":{"type":["string","null"]}},"required":["key","label","message","href"],"additionalProperties":false}},"missingScenarios":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"endedLines":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"message":{"type":"string"},"href":{"type":["string","null"]}},"required":["key","label","message","href"],"additionalProperties":false}},"itemHrefs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"url":{"type":"string"}},"required":["year","business_unit","grid","scenarios","showsAll","figures","unplanned","problems","missingScenarios","endedLines","itemHrefs","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/scenarios":{"get":{"operationId":"list_scenarios","summary":"Szenarien auflisten","description":"Every scenario with its kind, whether it is on by default, archived or locked, how many plan items it holds, and its weighted revenue and costs in the year. System scenarios missing from the database are named.","x-scope":"finance:read","parameters":[{"name":"year","in":"query","required":false,"schema":{"description":"Default: this year.","type":"integer","minimum":2000,"maximum":2100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"year":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scenarios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":["string","null"]},"name":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string"},"locked":{"type":"boolean"},"activeByDefault":{"type":"boolean"},"archived":{"type":"boolean"},"planItemCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"derived":{"type":"boolean"},"revenueCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"costCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","key","name","description","type","locked","activeByDefault","archived","planItemCount","derived","revenueCents","costCents"],"additionalProperties":false}},"missing_system_scenarios":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false}},"url":{"type":"string"}},"required":["year","scenarios","missing_system_scenarios","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_scenario","summary":"Szenario anlegen oder ändern","description":"Creates a planning scenario (omit scenario; name is required) or edits one: only the fields given change. A system scenario keeps its name and description -- the calculation refers to it by key -- and only whether it is on by default in the liquidity forecast can change. Scenario ids come from list_scenarios. finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"scenario":{"description":"The scenario's id, from list_scenarios. Omit to create one.","type":"string"},"name":{"type":"string","maxLength":120},"description":{"description":"An empty string clears it.","type":"string","maxLength":500},"active_by_default":{"description":"Whether the liquidity forecast starts with it ticked. Default for a new one: false.","type":"boolean"}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"note":{"type":"string"},"scenario":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":["string","null"]},"name":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string"},"locked":{"type":"boolean"},"active_by_default":{"type":"boolean"},"archived":{"type":"boolean"},"plan_items":{"type":"number"},"url":{"type":"string"}},"required":["id","key","name","description","type","locked","active_by_default","archived","plan_items","url"],"additionalProperties":false}},"required":["created","scenario"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/scenarios/{id}/remove":{"post":{"operationId":"remove_scenario","summary":"Szenario entfernen","description":"Removes a scenario as the page does: one that never held a plan item is deleted, any other is archived, which keeps its plan items' amounts (restore_scenario brings it back). The answer says which happened. System scenarios cannot be removed. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The scenario's id, from list_scenarios."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"outcome":{"type":"string","const":"deleted"},"message":{"type":"string"}},"required":["outcome","message"],"additionalProperties":false},{"type":"object","properties":{"outcome":{"type":"string","const":"archived"},"message":{"type":"string"},"scenario":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":["string","null"]},"name":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string"},"locked":{"type":"boolean"},"active_by_default":{"type":"boolean"},"archived":{"type":"boolean"},"plan_items":{"type":"number"},"url":{"type":"string"}},"required":["id","key","name","description","type","locked","active_by_default","archived","plan_items","url"],"additionalProperties":false}},"required":["outcome","message","scenario"],"additionalProperties":false}]}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/scenarios/{id}/restore":{"post":{"operationId":"restore_scenario","summary":"Szenario wiederherstellen","description":"Brings an archived scenario back. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The scenario's id, from list_scenarios with archived ones."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"scenario":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":["string","null"]},"name":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string"},"locked":{"type":"boolean"},"active_by_default":{"type":"boolean"},"archived":{"type":"boolean"},"plan_items":{"type":"number"},"url":{"type":"string"}},"required":["id","key","name","description","type","locked","active_by_default","archived","plan_items","url"],"additionalProperties":false}},"required":["scenario"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/settings":{"get":{"operationId":"get_finance_settings","summary":"Abrechnungs- und USt-Einstellungen lesen","description":"The billing settings -- notice proposals of § 6 (months for maintenance and support, weeks for ongoing consulting), the payment term of § 5 (8), the cost center of each business unit by name, and how many contracts of each unit have no cost center -- and the VAT settings: accrual or cash, monthly or quarterly, permanent extension, due day.","x-scope":"finance:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"billing":{"type":"object","properties":{"notice_months_recurring":{"type":"number"},"notice_weeks_time_material":{"type":"number"},"payment_term_days":{"type":"number"},"cost_centers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"contracts_without_cost_center":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"url":{"type":"string"},"cost_centers_url":{"type":"string"}},"required":["notice_months_recurring","notice_weeks_time_material","payment_term_days","cost_centers","contracts_without_cost_center","url","cost_centers_url"],"additionalProperties":false},"vat":{"type":"object","properties":{"method":{"type":"string","enum":["accrual","cash"]},"period":{"type":"string","enum":["monthly","quarterly"]},"permanent_extension":{"type":"boolean"},"due_day":{"type":"number"},"url":{"type":"string"}},"required":["method","period","permanent_extension","due_day","url"],"additionalProperties":false}},"required":["billing","vat"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/settings/billing":{"patch":{"operationId":"save_billing_settings","summary":"Abrechnungseinstellungen ändern","description":"Changes the billing settings and business units' cost centers: only the fields given, the rest stays. They are proposals for new customer orders and contracts; existing contracts do not change. finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"notice_months_recurring":{"description":"§ 6 (2), maintenance and support: 1 to 24 months.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notice_weeks_time_material":{"description":"§ 6 (3), ongoing consulting: 1 to 52 weeks.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"payment_term_days":{"description":"§ 5 (8), for companies without their own: 0 to 120 days.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"cost_centers":{"description":"Per business unit by name or id (list_business_units), e.g. {\"ITS\": \"200\"}: 1 to 8 letters or digits, or null for none. A unit left out keeps its own.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}]}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notice_months_recurring":{"type":"number"},"notice_weeks_time_material":{"type":"number"},"payment_term_days":{"type":"number"},"cost_centers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"contracts_without_cost_center":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"url":{"type":"string"},"cost_centers_url":{"type":"string"}},"required":["notice_months_recurring","notice_weeks_time_material","payment_term_days","cost_centers","contracts_without_cost_center","url","cost_centers_url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/finance/settings/vat":{"patch":{"operationId":"save_vat_settings","summary":"USt-Einstellungen ändern","description":"Changes how VAT is owed, as the company is registered: only the fields given, the rest stays. It moves the VAT payments in the liquidity forecast. finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"description":"accrual (Sollversteuerung) or cash (Istversteuerung).","type":"string","enum":["accrual","cash"]},"period":{"description":"monthly or quarterly returns.","type":"string","enum":["monthly","quarterly"]},"permanent_extension":{"description":"Dauerfristverlängerung: every due date one month later.","type":"boolean"},"due_day":{"description":"Day of the month the payment is due: 1 to 28.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["accrual","cash"]},"period":{"type":"string","enum":["monthly","quarterly"]},"permanent_extension":{"type":"boolean"},"due_day":{"type":"number"},"url":{"type":"string"}},"required":["method","period","permanent_extension","due_day","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/incoming-invoices":{"get":{"operationId":"list_incoming_invoices","summary":"Eingangsrechnungen lesen","description":"Incoming (supplier) invoices as on /finanzen/eingangsrechnungen: supplier, their invoice number, invoice and due date, gross and still open in cents, the state (draft, open, partially_paid, overdue, paid), the areas (Bereiche, with their KOST) the cost shares name, and the DATEV hand-off state (offen, blockiert, uebergeben, im_paket or aus, with a reason where there is one). Without a status it lists the ones still to be paid. Drafts are proposals from the document intake or from an agent, waiting for a person to confirm them. Each item carries einvoice, null unless its file is an e-invoice: { format, legal, validation (pending, valid, invalid or unavailable), deviations } where deviations lists the saved values that differ from the e-invoice. Read only. finance.manage only.","x-scope":"finance:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"entwurf, offen (still to be paid, incl. overdue), ueberfaellig, bezahlt or alle. Default offen.","type":"string","enum":["entwurf","offen","ueberfaellig","bezahlt","alle"]}},{"name":"company_id","in":"query","required":false,"schema":{"description":"Only this supplier (search_companies).","type":"string"}},{"name":"query","in":"query","required":false,"schema":{"description":"Part of the supplier, its name on a draft, or the invoice number.","type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"description":"Default 50, at most 200.","type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"type":"string"},"legal":{"type":"boolean"},"validation":{"type":"string","enum":["pending","valid","invalid","unavailable"]},"deviations":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["grossCents","netCents","vatCents","supplierInvoiceNumber","invoiceDate","dueDate"]},"stored":{"type":["string","number","null"]},"eInvoice":{"type":["string","number","null"]}},"required":["field","stored","eInvoice"],"additionalProperties":false}}},"required":["format","legal","validation","deviations"],"additionalProperties":false},{"type":"null"}]},"supplier":{"type":["string","null"]},"supplier_invoice_number":{"type":["string","null"]},"invoice_date":{"type":"string"},"due_date":{"type":"string"},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["draft","open","partially_paid","paid","initiated","overdue","cancelled"]},"document_url":{"type":["string","null"]},"areas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"cost_center":{"type":["string","null"]}},"required":["id","name","cost_center"],"additionalProperties":false}},"datev":{"type":"object","properties":{"state":{"type":"string","enum":["offen","blockiert","uebergeben","im_paket","aus"]},"reason":{"type":"string"}},"required":["state"],"additionalProperties":false}},"required":["id","einvoice","supplier","supplier_invoice_number","invoice_date","due_date","gross_cents","open_cents","state","document_url","areas","datev"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_incoming_invoice_draft","summary":"Eingangsrechnung als Entwurf anlegen","description":"Proposes an incoming (supplier) invoice as a draft (optionally from an uploaded XML e-invoice, see attachment_id) for a person to check and confirm on /finanzen/eingangsrechnungen. A draft is not payable, books nothing and is not in the liquidity forecast until it is confirmed; confirming, cancelling, payments and matching bank transactions are not available here. Name the supplier by company_id or, when it is not a Firma yet, by supplier_name; on confirmation a name is matched to the Firma of that name or becomes a new supplier Firma. Give a cost category, or a purchase contract line with the period it bills. Amounts in cents (the gross of a share in euros); the area is business_unit_id or a split in shares, kept on confirmation; due_date defaults to the supplier's payment term.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"description":"The supplier Firma, if it exists.","type":"string"},"supplier_name":{"description":"The supplier's name when it is not a Firma yet; confirming makes it one.","type":"string","maxLength":200},"attachment_id":{"description":"An XML e-invoice or other invoice file from upload_attachment. Missing fields default from an e-invoice; explicit arguments win and differences are listed in the result.","type":"string"},"supplier_invoice_number":{"description":"The number printed on the supplier's invoice. Required without an e-invoice in attachment_id.","type":"string","minLength":1,"maxLength":200},"invoice_date":{"description":"Required without an e-invoice in attachment_id.","type":"string"},"due_date":{"description":"Default: invoice date plus the supplier's payment term.","type":"string"},"gross_cents":{"description":"Required without an e-invoice in attachment_id.","type":"integer","exclusiveMinimum":0,"maximum":100000000000},"net_cents":{"description":"Give net and vat together; they add up to gross.","type":"integer","minimum":0,"maximum":100000000000},"vat_cents":{"type":"integer","minimum":0,"maximum":100000000000},"iban":{"description":"The supplier's IBAN as printed.","type":"string","maxLength":50},"category_key":{"description":"A cost category (list_finance_categories). Not needed with a contract period.","type":"string"},"contract_line_id":{"description":"A purchase contract line of the supplier, with period_from.","type":"string"},"period_from":{"description":"First day of the period the invoice bills.","type":"string"},"business_unit_id":{"description":"The area (Bereich) the whole invoice belongs to: its id or name (list_business_units). Give this or shares. Without either the area is derived from the supplier and contract.","type":"string"},"shares":{"description":"A split over several areas, one entry per area; the gross amounts must add up to the invoice's gross.","minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"business_unit_id":{"type":"string"},"gross":{"type":"number","exclusiveMinimum":0,"maximum":1000000000,"description":"Gross of this share in euros."}},"required":["business_unit_id","gross"]}}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","const":"draft"},"supplier":{"type":["string","null"]},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"einvoice":{"anyOf":[{"type":"object","properties":{"format":{"type":"string"},"legal":{"type":"boolean"},"validation":{"type":"string","enum":["pending","valid","invalid","unavailable"]},"deviations":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["grossCents","netCents","vatCents","supplierInvoiceNumber","invoiceDate","dueDate"]},"stored":{"type":["string","number","null"]},"eInvoice":{"type":["string","number","null"]}},"required":["field","stored","eInvoice"],"additionalProperties":false}}},"required":["format","legal","validation","deviations"],"additionalProperties":false},{"type":"null"}]},"url":{"type":"string"},"next":{"type":"string"}},"required":["id","state","supplier","gross_cents","einvoice","url","next"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/incoming-invoices/{id}":{"get":{"operationId":"get_incoming_invoice","summary":"Eingangsrechnung lesen","description":"One incoming (supplier) invoice by id (from list_incoming_invoices): supplier, their number, dates, gross and open in cents, the state, and its payments -- id, paid_on, amount_cents, note, origin (hand: recorded by hand; bank: from a bank transaction; reversal: an undone bank booking), bank_transaction_id (the transaction behind it or coupled to it, else null) and cancelled ({ on, by, reason } or null). payment_order is the initiated SEPA payment order, or null. Read only. finance.manage only.","x-scope":"finance:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The incoming invoice's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"supplier":{"type":["string","null"]},"supplier_invoice_number":{"type":["string","null"]},"invoice_date":{"type":"string"},"due_date":{"type":"string"},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["draft","open","partially_paid","paid","initiated","overdue","cancelled"]},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":"string"},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"payment_order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","const":"initiated"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_on":{"type":"string"}},"required":["id","status","amount_cents","created_on"],"additionalProperties":false},{"type":"null"}]}},"required":["id","supplier","supplier_invoice_number","invoice_date","due_date","gross_cents","open_cents","state","payments","payment_order"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/incoming-payments/{id}/cancel":{"post":{"operationId":"cancel_incoming_payment","summary":"Zahlung auf Eingangsrechnung aufheben","description":"Cancels a payment recorded by hand on an incoming invoice, e.g. one typed wrong or a transfer that did not go out, with a reason: a counter-entry is booked, the payment stays listed as cancelled and no longer counts as paid. The SEPA payment order the payment executed is initiated again, or withdrawn when a newer one is initiated meanwhile (payment_order_effect: reopened, withdrawn or none). The payment ids are in get_incoming_invoice. A payment from a bank transaction, or one coupled to a bank transaction, is undone on the transaction instead and is refused here.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The payment's id, from get_incoming_invoice's payments."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"description":"Why it is cancelled; stays visible at the payment."}},"required":["reason"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"supplier":{"type":["string","null"]},"supplier_invoice_number":{"type":["string","null"]},"invoice_date":{"type":"string"},"due_date":{"type":"string"},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["draft","open","partially_paid","paid","initiated","overdue","cancelled"]},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":"string"},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"payment_order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","const":"initiated"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_on":{"type":"string"}},"required":["id","status","amount_cents","created_on"],"additionalProperties":false},{"type":"null"}]},"payment_order_effect":{"type":"string"}},"required":["id","supplier","supplier_invoice_number","invoice_date","due_date","gross_cents","open_cents","state","payments","payment_order","payment_order_effect"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/instances":{"get":{"operationId":"list_instances","summary":"Instanzen auflisten","description":"Lists the customer instances nxva.base provisions, by company name, with state and release. Deleted instances only when state is \"deleted\". Use get_instance for one by id or subdomain.","x-scope":"tasks:read","parameters":[{"name":"state","in":"query","required":false,"schema":{"description":"Only instances in this state, e.g. running, failed, pending.","type":"string","enum":["pending","provisioning","running","failed","decommissioning","decommissioned","deleting","deleted"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"subdomain":{"type":["string","null"]},"url":{"type":["string","null"]},"state":{"type":"string"},"release":{"type":["string","null"]},"is_test":{"type":"boolean"},"company":{"type":"string"},"flow":{"type":"string"},"order_number":{"type":["string","null"]},"task_number":{"type":["string","null"]},"task_url":{"type":["string","null"]},"account_email_domain":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["id","subdomain","url","state","release","is_test","company","flow","order_number","task_number","task_url","account_email_domain","created_at"],"additionalProperties":false}},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["items","total"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/instances/{id}":{"get":{"operationId":"get_instance","summary":"Instanz lesen","description":"One customer instance by its id or its subdomain (e.g. \"musterbau\"): state, release, company, order and provisioning task.","x-scope":"tasks:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"description":"The instance's id or subdomain."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"subdomain":{"type":["string","null"]},"url":{"type":["string","null"]},"state":{"type":"string"},"release":{"type":["string","null"]},"is_test":{"type":"boolean"},"company":{"type":"string"},"flow":{"type":"string"},"order_number":{"type":["string","null"]},"task_number":{"type":["string","null"]},"task_url":{"type":["string","null"]},"account_email_domain":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["id","subdomain","url","state","release","is_test","company","flow","order_number","task_number","task_url","account_email_domain","created_at"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/intake-items":{"get":{"operationId":"list_intake_items","summary":"Dokumenteneingang auflisten","description":"Documents mailed to the document intake, newest first, 50 per page: file, state, where it was filed or the question the intake asks, and the numbers of the tasks it created. A mail item (kind mail) is a mail without attachments that can only produce tasks; its file is the subject. Default: the ones waiting for a person (review, failed). A failure carries error_label in words and error_detail with the step, the service's answer and its request-id; a queued item that failed waits until next_try_at. The caller's own, or all with documentIntake.manage.","x-scope":"documents:read","parameters":[{"name":"state","in":"query","required":false,"schema":{"description":"Default: review and failed.","type":"array","items":{"type":"string","enum":["queued","processing","review","failed","filed","handled"]}},"style":"form","explode":true},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"file":{"type":"string"},"kind":{"type":"string"},"state":{"type":"string"},"received_at":{"type":"string"},"sender":{"type":["string","null"]},"question":{"type":["string","null"]},"error":{"type":["string","null"]},"error_label":{"type":["string","null"]},"error_detail":{"type":["string","null"]},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"next_try_at":{"type":["string","null"]},"document_type":{"type":["string","null"]},"path":{"type":["string","null"]},"url":{"type":["string","null"]},"tasks":{"type":"array","items":{"type":"string"}},"page_url":{"type":"string"}},"required":["id","file","kind","state","received_at","sender","question","error","error_label","error_detail","attempts","next_try_at","document_type","path","url","tasks","page_url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/intake-items/{id}/handled":{"post":{"operationId":"mark_intake_item_handled","summary":"Eingang als erledigt markieren","description":"Says a document waiting for review, or one that failed, was filed by hand. The sender is told with the next answer to that mail.","x-scope":"documents:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The item's id, from list_intake_items."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","const":"handled"}},"required":["id","state"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/intake-items/{id}/rerun":{"post":{"operationId":"rerun_intake_item","summary":"Eingang neu anstoßen","description":"Sends a document waiting for review, or one that failed, through the intake again, with a hint added -- e.g. which company or order it belongs to, or where it should go. The intake then files it and answers the sender.","x-scope":"documents:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The item's id, from list_intake_items."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hint":{"type":"string","minLength":1,"maxLength":2000}},"required":["hint"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","const":"queued"}},"required":["id","state"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/invoice-sources":{"get":{"operationId":"list_invoice_sources","summary":"Abrechenbares","description":"What can be invoiced now: for an order, or every active order, the contract charges that are due (each with the key create_invoice_draft takes) and the issued service reports not yet invoiced. finance.manage only.","x-scope":"invoices","parameters":[{"name":"order","in":"query","required":false,"schema":{"description":"An order's id or number, e.g. \"AB-2026-0007\". Omit for every active order.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"order":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customer":{"type":"string"}},"required":["id","number","customer"],"additionalProperties":false},"due":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"quantity":{"type":"string"},"unit":{"type":"string"},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["key","name","period_from","period_to","quantity","unit","net_cents"],"additionalProperties":false}},"problem":{"type":["string","null"]},"service_reports":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","number","period_from","period_to","amount_cents"],"additionalProperties":false}}},"required":["order","due","service_reports"],"additionalProperties":false}},"date":{"type":"string"}},"required":["items","date"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/invoices":{"get":{"operationId":"list_invoices","summary":"Rechnungen auflisten","description":"Lists invoices and drafts the way the invoice list does, newest first, 50 per page: number, company, order, date, gross, status and payment state. finance.manage only.","x-scope":"invoices","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["draft","issuing","issued","cancelled"]}},"style":"form","explode":true},{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in number, company, order or customer reference.","type":"string","maxLength":120}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"invoice_date":{"type":["string","null"]},"gross_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"url":{"type":"string"}},"required":["id","number","company","order","invoice_date","gross_cents","status","payment","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_invoice_draft","summary":"Rechnungsentwurf anlegen","description":"Creates an invoice draft, as the signed-in person -- never issued; a person reviews and issues it on the page the answer links. source \"contract\": the due charges of an order's sales contract, all of them or the keys from list_invoice_sources. source \"service_report\": one issued service report, as a whole. source \"free\": an empty draft for a company (an active customer), with a business unit and optionally an order of that company; add its lines with update_invoice_draft. finance.manage only.","x-scope":"invoices","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["contract","service_report","free"]},"order":{"description":"Order id or number. Required for \"contract\"; optional for \"free\".","type":"string"},"keys":{"description":"\"contract\" only: charge keys from list_invoice_sources. Default: every due charge.","type":"array","items":{"type":"string"}},"service_report":{"description":"\"service_report\" only: the report's id or number.","type":"string"},"company":{"description":"\"free\" only: the company's id (search_companies).","type":"string"},"business_unit":{"description":"\"free\" only: name or id of a business unit (list_business_units). Default: the default unit.","type":"string","minLength":1,"maxLength":100}},"required":["source"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"kind":{"type":"string"},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"invoice_date":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"business_unit":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"period_from":{"type":["string","null"]},"period_to":{"type":["string","null"]},"quantity":{"type":"string"},"unit":{"type":"string"},"unit_price_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","position","source","name","description","period_from","period_to","quantity","unit","unit_price_cents","net_cents"],"additionalProperties":false}},"totals":{"type":"object","properties":{"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["net_cents","vat_cents","gross_cents"],"additionalProperties":false},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":["string","null"]},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","kind","status","payment","invoice_date","company","order","business_unit","customer_reference","lines","totals","payments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/invoices/{id}":{"get":{"operationId":"get_invoice","summary":"Rechnung lesen","description":"One invoice or draft with its lines, totals, status and payment state, and the page to review it on. finance.manage only.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The invoice's id, or its number once issued."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"kind":{"type":"string"},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"invoice_date":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"business_unit":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"period_from":{"type":["string","null"]},"period_to":{"type":["string","null"]},"quantity":{"type":"string"},"unit":{"type":"string"},"unit_price_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","position","source","name","description","period_from","period_to","quantity","unit","unit_price_cents","net_cents"],"additionalProperties":false}},"totals":{"type":"object","properties":{"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["net_cents","vat_cents","gross_cents"],"additionalProperties":false},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":["string","null"]},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","kind","status","payment","invoice_date","company","order","business_unit","customer_reference","lines","totals","payments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_invoice_draft","summary":"Rechnungsentwurf ändern","description":"Changes a draft: adds free lines, removes lines, sets the customer reference, and on a free draft the business unit -- any of them, at least one. Every new line is checked first; if one is refused, nothing is written. Drafts only; a cancellation draft takes only a customer reference. finance.manage only.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The draft's id."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"add_lines":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":1000},"period_from":{"type":"string","description":"YYYY-MM-DD."},"period_to":{"type":"string","description":"YYYY-MM-DD, not before period_from."},"quantity":{"type":"string","description":"Decimal, at most two places, e.g. \"2\" or \"7.5\"; hours only in quarter hours."},"unit":{"type":"string","enum":["HUR","C62","MON","DAY"]},"unit_price":{"type":"string","description":"Net euros per unit, e.g. \"750.00\" or \"750,00\"."}},"required":["name","period_from","period_to","quantity","unit","unit_price"]}},"remove_lines":{"description":"Line ids from get_invoice.","maxItems":50,"type":"array","items":{"type":"string"}},"customer_reference":{"description":"The customer's own reference; empty clears it.","type":"string"},"business_unit":{"description":"A free draft's business unit: name or id (list_business_units).","type":"string","minLength":1,"maxLength":100}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"kind":{"type":"string"},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"invoice_date":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"business_unit":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"period_from":{"type":["string","null"]},"period_to":{"type":["string","null"]},"quantity":{"type":"string"},"unit":{"type":"string"},"unit_price_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","position","source","name","description","period_from","period_to","quantity","unit","unit_price_cents","net_cents"],"additionalProperties":false}},"totals":{"type":"object","properties":{"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["net_cents","vat_cents","gross_cents"],"additionalProperties":false},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":["string","null"]},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","kind","status","payment","invoice_date","company","order","business_unit","customer_reference","lines","totals","payments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_invoice_draft","summary":"Rechnungsentwurf löschen","description":"Deletes a draft outright. An issued invoice is never deleted: it is cancelled, by a person, in nxva.base. finance.manage only.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The draft's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/invoices/{id}/check":{"get":{"operationId":"check_invoice","summary":"Rechnungsentwurf prüfen","description":"Runs the check the draft page runs before issuing: what is missing on the company profile, the customer or the lines (problems, which block issuing), what a person should look at (warnings), and the e-invoice validation of the rendered document. Changes nothing; takes a few seconds. A clean result is what a person needs before issuing on the page.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The draft's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ready":{"type":"boolean"},"problems":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"validation":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["valid","invalid","unavailable"]},"errors":{"type":"array","items":{"type":"string"}},"notices":{"type":"array","items":{"type":"string"}}},"required":["status","errors","notices"],"additionalProperties":false},{"type":"null"}]},"url":{"type":"string"}},"required":["ready","problems","warnings","validation","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/invoices/{id}/payments":{"post":{"operationId":"record_payment","summary":"Zahlung erfassen","description":"Records a payment received for an issued invoice: the day, the gross amount in cents (negative for a refund), and a note. Payments are recorded by hand and are never deducted automatically; a recorded one is corrected by cancel_payment and recording it again. Only an issued invoice that no cancellation corrects.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The invoice's id or number, e.g. \"RE-2026-0042\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paid_on":{"type":"string","description":"YYYY-MM-DD, not in the future."},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Gross, in cents; negative for a refund."},"note":{"type":"string","maxLength":500}},"required":["paid_on","amount_cents"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"kind":{"type":"string"},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"invoice_date":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"business_unit":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"period_from":{"type":["string","null"]},"period_to":{"type":["string","null"]},"quantity":{"type":"string"},"unit":{"type":"string"},"unit_price_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","position","source","name","description","period_from","period_to","quantity","unit","unit_price_cents","net_cents"],"additionalProperties":false}},"totals":{"type":"object","properties":{"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["net_cents","vat_cents","gross_cents"],"additionalProperties":false},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":["string","null"]},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","kind","status","payment","invoice_date","company","order","business_unit","customer_reference","lines","totals","payments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/leads":{"get":{"operationId":"list_leads","summary":"Anfragen auflisten","description":"Lists inquiries (leads), newest first, 50 per page, with who they are from, their channel and their derived status. person and company are the adopted person and their company (null before adoption); company_name is that company's name, else the company as typed (company_as_typed). Use get_lead for one inquiry's answers, result and quotes.","x-scope":"leads:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Derived statuses to include; open = new and in_progress, active = in_progress. Default: all.","type":"array","items":{"type":"string","enum":["new","in_progress","quoted","won","lost","discarded","open","active"]}},"style":"form","explode":true},{"name":"channel","in":"query","required":false,"schema":{"description":"How the inquiry arrived. Default: all.","type":"array","items":{"type":"string","enum":["assistant","contact_form","configurator","tool","download","manual"]}},"style":"form","explode":true},{"name":"source","in":"query","required":false,"schema":{"description":"Deprecated, use channel: assistant, contact (= contact_form) or manual.","type":"array","items":{"type":"string","enum":["assistant","contact","manual"]}},"style":"form","explode":true},{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in the contact, the company, the message, the summary, the answers or a quote.","type":"string","maxLength":120}},{"name":"profile","in":"query","required":false,"schema":{"description":"Assistant or configurator profile ids (profile_id of an inquiry); only inquiries captured by one of them. Default: all.","type":"array","items":{"type":"string"}},"style":"form","explode":true},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"channel":{"type":"string","enum":["assistant","contact_form","configurator","tool","download","manual"]},"source":{"type":"string"},"profile_id":{"type":["string","null"]},"status":{"type":"string","enum":["new","in_progress","quoted","won","lost","discarded"]},"stored_status":{"type":"string","enum":["new","in_progress","quoted","discarded"]},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["id","name","email","phone"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"company_name":{"type":["string","null"]},"company_as_typed":{"type":["string","null"]},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"short":{"type":["string","null"]},"quotes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","created_at","channel","source","profile_id","status","stored_status","person","company","company_name","company_as_typed","name","email","phone","short","quotes","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_lead","summary":"Anfrage erfassen","description":"Records an inquiry by hand (channel manual). Name an existing person (person): the inquiry is adopted at once. Or give a name: it is kept as the contact typed, without a person -- known_person in the answer names the person that e-mail already belongs to; update_lead with adopt links or creates the person. The company as typed is kept as text.","x-scope":"leads:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"person":{"description":"An existing person's id, from search_people.","type":"string"},"name":{"description":"Who the inquiry is from, when there is no person.","type":"string","minLength":1,"maxLength":100},"email":{"type":"string","maxLength":200},"phone":{"type":"string","maxLength":30},"company":{"description":"The company as the contact named it.","type":"string","maxLength":120},"message":{"description":"What they asked for.","type":"string","maxLength":2000}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"channel":{"type":"string","enum":["assistant","contact_form","configurator","tool","download","manual"]},"source":{"type":"string"},"profile_id":{"type":["string","null"]},"profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_selection":{"anyOf":[{"type":"object","properties":{"profile_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"term":{"type":"string","enum":["monthly","annual"]},"needs":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"item_key":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"per_user":{"type":"boolean"},"suggested":{"type":"boolean"},"unit_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["item_key","name","quantity","per_user","suggested","unit_monthly_cents","unit_one_time_cents"],"additionalProperties":false}},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"prices_shown":{"type":"boolean"},"at":{"type":"string"}},"required":["profile_version","term","needs","lines","monthly_net_cents","one_time_net_cents","prices_shown","at"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["new","in_progress","quoted","won","lost","discarded"]},"stored_status":{"type":"string","enum":["new","in_progress","quoted","discarded"]},"outcome":{"anyOf":[{"type":"string","enum":["won","lost"]},{"type":"null"}]},"contact":{"type":"object","properties":{"name":{"type":"string"},"company":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"privacy_accepted":{"type":"boolean"},"whatsapp_opt_in":{"type":"boolean"},"consent_at":{"type":["string","null"]},"consent_text_version":{"type":["string","null"]}},"required":["name","company","email","phone","preferred_contact","callback_requested","appointment_requested","privacy_accepted","whatsapp_opt_in","consent_at","consent_text_version"],"additionalProperties":false},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["id","name","email","phone"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"known_person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"company_name":{"type":["string","null"]}},"required":["id","name","company_name"],"additionalProperties":false},{"type":"null"}]},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"company_as_typed":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"answers":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"value":{"type":"string"}},"required":["key","label","value"],"additionalProperties":false}},"summary":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["recommendation","summary"]},"title":{"type":["string","null"]},"text":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}},"required":["kind","title","text","steps"],"additionalProperties":false},{"type":"null"}]},"conversation_messages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":["string","null"]},"use_case":{"anyOf":[{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"string"}},"systems":{"type":"array","items":{"type":"string"}},"fit":{"type":["string","null"]},"fit_note":{"type":["string","null"]}},"required":["title","description","steps","systems","fit","fit_note"],"additionalProperties":false},{"type":"null"}]},"discard_reason":{"type":["string","null"]},"discarded_at":{"type":["string","null"]},"adopted_at":{"type":["string","null"]},"adopted_by":{"type":["string","null"]},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"title":{"type":"string"},"status":{"type":"string"},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","number","version","title","status","one_off_net_cents","monthly_net_cents"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"author":{"type":"string"},"agent":{"type":"string"},"created_at":{"type":"string"},"body":{"type":"string"}},"required":["id","author","created_at","body"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created_at","channel","source","profile_id","profile","configurator_profile","configurator_selection","status","stored_status","outcome","contact","person","company","known_person","name","email","phone","company_as_typed","preferred_contact","callback_requested","appointment_requested","answers","summary","result","conversation_messages","message","use_case","discard_reason","discarded_at","adopted_at","adopted_by","quotes","notes","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/leads/{id}":{"get":{"operationId":"get_lead","summary":"Anfrage lesen","description":"One inquiry (lead): configurator_selection holds what a configurator visitor chose (lines, needs, term, sums in net cents as they saw them); the contact as typed (contact) and, once adopted, the person and company; known_person is the person its e-mail already belongs to before adoption; the questions as answered (answers), summary and result; its quotes (create_quote with lead answers it) and notes. status is derived (quotes decide won/lost), stored_status is what was set. use_case is the old shape, kept for compatibility -- read answers instead.","x-scope":"leads:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The inquiry's (lead's) id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"channel":{"type":"string","enum":["assistant","contact_form","configurator","tool","download","manual"]},"source":{"type":"string"},"profile_id":{"type":["string","null"]},"profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_selection":{"anyOf":[{"type":"object","properties":{"profile_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"term":{"type":"string","enum":["monthly","annual"]},"needs":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"item_key":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"per_user":{"type":"boolean"},"suggested":{"type":"boolean"},"unit_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["item_key","name","quantity","per_user","suggested","unit_monthly_cents","unit_one_time_cents"],"additionalProperties":false}},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"prices_shown":{"type":"boolean"},"at":{"type":"string"}},"required":["profile_version","term","needs","lines","monthly_net_cents","one_time_net_cents","prices_shown","at"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["new","in_progress","quoted","won","lost","discarded"]},"stored_status":{"type":"string","enum":["new","in_progress","quoted","discarded"]},"outcome":{"anyOf":[{"type":"string","enum":["won","lost"]},{"type":"null"}]},"contact":{"type":"object","properties":{"name":{"type":"string"},"company":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"privacy_accepted":{"type":"boolean"},"whatsapp_opt_in":{"type":"boolean"},"consent_at":{"type":["string","null"]},"consent_text_version":{"type":["string","null"]}},"required":["name","company","email","phone","preferred_contact","callback_requested","appointment_requested","privacy_accepted","whatsapp_opt_in","consent_at","consent_text_version"],"additionalProperties":false},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["id","name","email","phone"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"known_person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"company_name":{"type":["string","null"]}},"required":["id","name","company_name"],"additionalProperties":false},{"type":"null"}]},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"company_as_typed":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"answers":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"value":{"type":"string"}},"required":["key","label","value"],"additionalProperties":false}},"summary":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["recommendation","summary"]},"title":{"type":["string","null"]},"text":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}},"required":["kind","title","text","steps"],"additionalProperties":false},{"type":"null"}]},"conversation_messages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":["string","null"]},"use_case":{"anyOf":[{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"string"}},"systems":{"type":"array","items":{"type":"string"}},"fit":{"type":["string","null"]},"fit_note":{"type":["string","null"]}},"required":["title","description","steps","systems","fit","fit_note"],"additionalProperties":false},{"type":"null"}]},"discard_reason":{"type":["string","null"]},"discarded_at":{"type":["string","null"]},"adopted_at":{"type":["string","null"]},"adopted_by":{"type":["string","null"]},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"title":{"type":"string"},"status":{"type":"string"},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","number","version","title","status","one_off_net_cents","monthly_net_cents"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"author":{"type":"string"},"agent":{"type":"string"},"created_at":{"type":"string"},"body":{"type":"string"}},"required":["id","author","created_at","body"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created_at","channel","source","profile_id","profile","configurator_profile","configurator_selection","status","stored_status","outcome","contact","person","company","known_person","name","email","phone","company_as_typed","preferred_contact","callback_requested","appointment_requested","answers","summary","result","conversation_messages","message","use_case","discard_reason","discarded_at","adopted_at","adopted_by","quotes","notes","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_lead","summary":"Anfrage ändern","description":"Changes an inquiry, in this order: adopt (links the person its e-mail belongs to, or creates one from the contact typed; company or new_company_name puts that person at a company when they have none), status (new or in_progress -- on a discarded inquiry they reopen it; discarded with an optional discard_reason), outcome (won or lost by hand, none clears it; only without quotes), and -- without adopt -- company or new_company_name, written to the adopted person so their next inquiry arrives knowing it. Old status values are still accepted: active means in_progress; won and lost set the outcome, which is refused once the inquiry has quotes — their status decides. quoted is set by create_quote. new on an adopted inquiry is stored as in_progress. When a status was stored differently from how it was given, the reply carries a note saying so.","x-scope":"leads:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The inquiry's (lead's) id."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","in_progress","discarded","active","won","lost"]},"adopt":{"description":"true adopts the inquiry („Übernehmen“).","type":"boolean"},"company":{"description":"An existing company's id, from search_companies.","type":"string"},"new_company_name":{"description":"Creates this company and puts the person there.","type":"string","minLength":1,"maxLength":200},"discard_reason":{"description":"Why, with status discarded.","type":"string","maxLength":200},"outcome":{"description":"A manual won/lost for an inquiry without quotes; none clears it.","type":"string","enum":["won","lost","none"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"channel":{"type":"string","enum":["assistant","contact_form","configurator","tool","download","manual"]},"source":{"type":"string"},"profile_id":{"type":["string","null"]},"profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","version"],"additionalProperties":false},{"type":"null"}]},"configurator_selection":{"anyOf":[{"type":"object","properties":{"profile_version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"term":{"type":"string","enum":["monthly","annual"]},"needs":{"type":"array","items":{"type":"string"}},"lines":{"type":"array","items":{"type":"object","properties":{"item_key":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"per_user":{"type":"boolean"},"suggested":{"type":"boolean"},"unit_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["item_key","name","quantity","per_user","suggested","unit_monthly_cents","unit_one_time_cents"],"additionalProperties":false}},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"prices_shown":{"type":"boolean"},"at":{"type":"string"}},"required":["profile_version","term","needs","lines","monthly_net_cents","one_time_net_cents","prices_shown","at"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["new","in_progress","quoted","won","lost","discarded"]},"stored_status":{"type":"string","enum":["new","in_progress","quoted","discarded"]},"outcome":{"anyOf":[{"type":"string","enum":["won","lost"]},{"type":"null"}]},"contact":{"type":"object","properties":{"name":{"type":"string"},"company":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"privacy_accepted":{"type":"boolean"},"whatsapp_opt_in":{"type":"boolean"},"consent_at":{"type":["string","null"]},"consent_text_version":{"type":["string","null"]}},"required":["name","company","email","phone","preferred_contact","callback_requested","appointment_requested","privacy_accepted","whatsapp_opt_in","consent_at","consent_text_version"],"additionalProperties":false},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["id","name","email","phone"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"known_person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"company_name":{"type":["string","null"]}},"required":["id","name","company_name"],"additionalProperties":false},{"type":"null"}]},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"company_as_typed":{"type":["string","null"]},"preferred_contact":{"type":["string","null"]},"callback_requested":{"type":"boolean"},"appointment_requested":{"type":"boolean"},"answers":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"value":{"type":"string"}},"required":["key","label","value"],"additionalProperties":false}},"summary":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["recommendation","summary"]},"title":{"type":["string","null"]},"text":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}},"required":["kind","title","text","steps"],"additionalProperties":false},{"type":"null"}]},"conversation_messages":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"message":{"type":["string","null"]},"use_case":{"anyOf":[{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"string"}},"systems":{"type":"array","items":{"type":"string"}},"fit":{"type":["string","null"]},"fit_note":{"type":["string","null"]}},"required":["title","description","steps","systems","fit","fit_note"],"additionalProperties":false},{"type":"null"}]},"discard_reason":{"type":["string","null"]},"discarded_at":{"type":["string","null"]},"adopted_at":{"type":["string","null"]},"adopted_by":{"type":["string","null"]},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"title":{"type":"string"},"status":{"type":"string"},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","number","version","title","status","one_off_net_cents","monthly_net_cents"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"author":{"type":"string"},"agent":{"type":"string"},"created_at":{"type":"string"},"body":{"type":"string"}},"required":["id","author","created_at","body"],"additionalProperties":false}},"url":{"type":"string"},"note":{"type":"string"}},"required":["id","created_at","channel","source","profile_id","profile","configurator_profile","configurator_selection","status","stored_status","outcome","contact","person","company","known_person","name","email","phone","company_as_typed","preferred_contact","callback_requested","appointment_requested","answers","summary","result","conversation_messages","message","use_case","discard_reason","discarded_at","adopted_at","adopted_by","quotes","notes","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/mail-recipients":{"post":{"operationId":"set_mail_recipient","summary":"Mail-Empfänger einer Firma","description":"Says who at a company is addressed -- as An (to) or CC -- when a person sends it an invoice (kind invoice) or an order's documents (kind order), or takes them off with role null. Name a person of the company, or an e-mail address such as a shared mailbox. Nothing is sent by this.","x-scope":"customers:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string","description":"The company's id."},"kind":{"type":"string","enum":["invoice","order"]},"person":{"description":"A person of the company, by id.","type":"string"},"email":{"description":"An address without a person, e.g. rechnung@kunde.de.","type":"string"},"role":{"anyOf":[{"type":"string","enum":["to","cc"]},{"type":"null"}]}},"required":["company","kind","role"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"vat_id":{"type":["string","null"]},"country_code":{"type":"string"},"document_language":{"type":"string"},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"active":{"type":"boolean"}},"required":["id","label","kind","address","active"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created","name","street","zip","city","vat_id","country_code","document_language","payment_term_days","avv_signed_on","is_customer","is_supplier","is_active","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/ai-visibility":{"get":{"operationId":"get_ai_visibility","summary":"KI-Sichtbarkeit lesen","description":"Whether AI assistants and search engines read one registered website, and whether people arrive from AI assistants, for a period: crawler totals per bot (kind ai or search, hits), crawler_hits, ai_sessions, ai_inquiries and their conversion, the pages of the latest sitemap no crawler has read (never_crawled, first 50), the busiest crawled pages and the AI sources people came from. Visitors are counted per day: in cookieless mode one person on three days counts 3, in consent mode only visitors who allowed „Statistik“ are counted; in combined mode visitors who allowed „Statistik“ are recognised across days and all others are counted per day without cookies. revenue_cents is the net of issued invoices of the inquiries received in the period (gestellte Rechnungen, netto), so it keeps growing after the period. Inquiries without a matched visit count as „Unbekannt“ (unknown). Figures exclude bots.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"compare","in":"query","required":false,"schema":{"description":"Also return the previous period of the same length. Default true.","type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"consent_mode":{"type":"string","enum":["cookieless","consent","combined"]},"consent_rate":{"type":["number","null"]},"consent_note":{"type":"string"},"totals":{"type":"object","properties":{"crawler_hits":{"type":"number"},"bots":{"type":"number"},"ai_sessions":{"type":"number"},"ai_inquiries":{"type":"number"},"ai_conversion":{"type":["number","null"]},"never_crawled":{"type":"number"},"sitemap_pages":{"type":"number"}},"required":["crawler_hits","bots","ai_sessions","ai_inquiries","ai_conversion","never_crawled","sitemap_pages"],"additionalProperties":false},"previous":{"type":"object","properties":{"crawler_hits":{"type":"number"},"ai_sessions":{"type":"number"},"ai_inquiries":{"type":"number"}},"required":["crawler_hits","ai_sessions","ai_inquiries"],"additionalProperties":false},"bots":{"type":"array","items":{"type":"object","properties":{"bot":{"type":"string"},"kind":{"type":"string"},"hits":{"type":"number"}},"required":["bot","kind","hits"],"additionalProperties":false}},"top_pages":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"hits":{"type":"number"},"ai_hits":{"type":"number"},"last_day":{"type":"string"}},"required":["path","hits","ai_hits","last_day"],"additionalProperties":false}},"never_crawled":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"first_seen_at":{"type":"string"}},"required":["path","first_seen_at"],"additionalProperties":false}},"ai_sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"sessions":{"type":"number"},"inquiries":{"type":"number"},"conversion":{"type":["number","null"]},"top_landing":{"type":["string","null"]}},"required":["source","sessions","inquiries","conversion","top_landing"],"additionalProperties":false}},"sitemap_read_at":{"type":["string","null"]}},"required":["site","period","consent_mode","totals","bots","top_pages","never_crawled","ai_sources","sitemap_read_at"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/assistant-stats":{"get":{"operationId":"get_assistant_stats","summary":"Assistenten-Zahlen lesen","description":"Website assistant figures of one registered website for a period: totals (started, qualified, inquiries, quotes, revenue_cents), the previous period of equal length (previous, with compare), the same per assistant profile (version, conversion = inquiries / started), the most frequent answers per question of one profile (profile, default the one with most conversations) and how many conversations ended without contact details, before or after the result. started = conversations with at least one visitor message; qualified = the assistant finished its questions; inquiries = inquiries captured by the assistant, received in the period; revenue = net of issued invoices of those inquiries, so it grows after the period; free-text answers come from inquiries only — conversation text is deleted after 24 hours; test conversations never count.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"compare","in":"query","required":false,"schema":{"description":"Also return the previous period of the same length. Default true.","type":"boolean"}},{"name":"profile","in":"query","required":false,"schema":{"description":"Profile id or exact name; selects the profile whose answers are returned. Default: the profile with most conversations.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"revenue_note":{"type":"string"},"totals":{"type":"object","properties":{"started":{"type":"number"},"qualified":{"type":"number"},"inquiries":{"type":"number"},"quotes":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["started","qualified","inquiries","quotes","revenue_cents"],"additionalProperties":false},"previous":{"type":"object","properties":{"started":{"type":"number"},"qualified":{"type":"number"},"inquiries":{"type":"number"},"quotes":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["started","qualified","inquiries","quotes","revenue_cents"],"additionalProperties":false},"profiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"type":["number","null"]},"started":{"type":"number"},"qualified":{"type":"number"},"inquiries":{"type":"number"},"conversion":{"type":["number","null"]},"quotes":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["id","name","version","started","qualified","inquiries","conversion","quotes","revenue_cents"],"additionalProperties":false}},"answers":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"type":{"type":"string"},"source":{"type":"string","enum":["conversations","inquiries"]},"total":{"type":"number"},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"}},"required":["value","count"],"additionalProperties":false}}},"required":["question","type","source","total","values"],"additionalProperties":false}},"ended_without_contact":{"type":"object","properties":{"total":{"type":"number"},"before_result":{"type":"number"},"after_result":{"type":"number"}},"required":["total","before_result","after_result"],"additionalProperties":false}},"required":["site","period","revenue_note","totals","profiles","answers","ended_without_contact"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/campaign-links":{"post":{"operationId":"build_campaign_link","summary":"Kampagnen-Link bauen","description":"Builds and saves the tracked link of a campaign: target_url on a registered website plus utm_source, utm_medium, utm_campaign (the campaign's slug) and optional utm_content. Use it for every post and mail you draft for a campaign, so the traffic is attributed to it. Give a preset (linkedin, newsletter or ai) or source and medium. The same link asked twice is not duplicated (created false). Returns link_id, url and created; put url into the text.","x-scope":"leads:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"string","minLength":1,"maxLength":200,"description":"The campaign's id or slug."},"target_url":{"type":"string","minLength":1,"maxLength":2000,"description":"The page the link leads to, on a registered website."},"preset":{"type":"string","enum":["linkedin","newsletter","ai"]},"source":{"description":"utm_source, when no preset is given.","type":"string","maxLength":60},"medium":{"description":"utm_medium, when no preset is given.","type":"string","maxLength":60},"content":{"description":"utm_content, to tell several posts apart.","type":"string","maxLength":100},"label":{"type":"string","minLength":1,"maxLength":100,"description":"What the link is for, like „LinkedIn-Post 12.11.“"}},"required":["campaign","target_url","label"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"link_id":{"type":"string"},"url":{"type":"string"},"created":{"type":"boolean"}},"required":["link_id","url","created"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/campaigns":{"get":{"operationId":"list_campaigns","summary":"Kampagnen auflisten","description":"Marketing campaigns with their results, 50 per page: id, name, slug (the utm_campaign value), goal, channels, status (planned, active, ended), starts_on, ends_on, budget_cents, owner, link_count and the results (sessions, inquiries, quotes, won, revenue_cents, cost_cents, cost_per_inquiry_cents, roi). Without status it lists planned and active ones; give status to see ended ones. q searches name, slug and goal. Campaign figures are all-time since the first session (not limited to a period). Revenue = net of issued invoices of the campaign's inquiries. Costs = open incoming invoices assigned to the campaign, net.","x-scope":"leads:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Default planned and active.","type":"array","items":{"type":"string","enum":["planned","active","ended"]}},"style":"form","explode":true},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"goal":{"type":["string","null"]},"channels":{"type":"array","items":{"type":"string","enum":["linkedin","email","search","ai","paid","other"]}},"status":{"type":"string","enum":["planned","active","ended"]},"starts_on":{"type":["string","null"]},"ends_on":{"type":["string","null"]},"budget_cents":{"type":["number","null"]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"link_count":{"type":"number"},"results":{"type":"object","properties":{"sessions":{"type":"number"},"sessions_without_link":{"type":"number"},"inquiries":{"type":"number"},"inquiries_with_quotes":{"type":"number"},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"},"cost_cents":{"type":"number"},"cost_per_inquiry_cents":{"type":["number","null"]},"roi":{"type":["number","null"]}},"required":["sessions","sessions_without_link","inquiries","inquiries_with_quotes","quotes","won","revenue_cents","cost_cents","cost_per_inquiry_cents","roi"],"additionalProperties":false}},"required":["id","name","slug","goal","channels","status","starts_on","ends_on","budget_cents","owner","link_count","results"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"},"hidden_ended":{"type":"number"},"note":{"type":"string"}},"required":["items","page","total","has_more","hidden_ended","note"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_campaign","summary":"Kampagne speichern","description":"Creates a campaign, or changes one when id is given (fields left out stay as they are). name is required for a new one. slug is the utm_campaign value (lower case letters, digits, hyphens; default derived from the name); it cannot change once links or sessions exist. status is planned, active or ended (default: planned with a future starts_on, else active). Dates are YYYY-MM-DD, budget_cents is in cents. owner is a user id; a person acting leaves it out to own the campaign, an agent acting as itself must give it. assistant_profile and configurator_profile are the profiles (id or exact name) the landing pages use. Saving a slug adopts earlier sessions and inquiries that already carry it as utm_campaign.","x-scope":"leads:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"The campaign to change; leave out to create one.","type":"string","maxLength":200},"name":{"type":"string","maxLength":200},"slug":{"type":"string","maxLength":100},"goal":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"channels":{"type":"array","items":{"type":"string","enum":["linkedin","email","search","ai","paid","other"]}},"starts_on":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"ends_on":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"budget_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"owner":{"description":"User id of the person responsible.","type":"string","maxLength":200},"assistant_profile":{"description":"Assistant profile id or exact name.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"configurator_profile":{"description":"Configurator profile id or exact name.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"status":{"type":"string","enum":["planned","active","ended"]}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["planned","active","ended"]},"created":{"type":"boolean"},"url":{"type":"string"}},"required":["id","name","slug","status","created","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/campaigns/{id}":{"get":{"operationId":"get_campaign","summary":"Kampagne lesen","description":"One campaign: its fields, results, saved tracking links with their sessions, inquiries and ready-to-use urls, the costs booked on it (open incoming invoices) and its newest 10 inquiries, plus the assistant and configurator profile of its landing pages (id, name, site_key). Campaign figures are all-time since the first session (not limited to a period). Revenue = net of issued invoices of the campaign's inquiries. Costs = open incoming invoices assigned to the campaign, net. Link sessions cover raw retention only. costs.total_cents is for everyone; costs.invoices (supplier, date, amount per invoice) only with finance.manage, else null.","x-scope":"leads:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The campaign's id or slug."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"goal":{"type":["string","null"]},"channels":{"type":"array","items":{"type":"string","enum":["linkedin","email","search","ai","paid","other"]}},"status":{"type":"string","enum":["planned","active","ended"]},"starts_on":{"type":["string","null"]},"ends_on":{"type":["string","null"]},"budget_cents":{"type":["number","null"]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assistant_profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"site_key":{"type":"string"}},"required":["id","name","site_key"],"additionalProperties":false},{"type":"null"}]},"configurator_profile":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"site_key":{"type":"string"}},"required":["id","name","site_key"],"additionalProperties":false},{"type":"null"}]},"results":{"type":"object","properties":{"sessions":{"type":"number"},"sessions_without_link":{"type":"number"},"inquiries":{"type":"number"},"inquiries_with_quotes":{"type":"number"},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"},"cost_cents":{"type":"number"},"cost_per_inquiry_cents":{"type":["number","null"]},"roi":{"type":["number","null"]}},"required":["sessions","sessions_without_link","inquiries","inquiries_with_quotes","quotes","won","revenue_cents","cost_cents","cost_per_inquiry_cents","roi"],"additionalProperties":false},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"site":{"type":"string"},"target_url":{"type":"string"},"utm_source":{"type":"string"},"utm_medium":{"type":"string"},"utm_content":{"type":["string","null"]},"url":{"type":"string"},"sessions":{"type":"number"},"inquiries":{"type":"number"}},"required":["id","label","site","target_url","utm_source","utm_medium","utm_content","url","sessions","inquiries"],"additionalProperties":false}},"costs":{"type":"object","properties":{"total_cents":{"type":"number"},"invoices":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"supplier":{"type":"string"},"invoice_date":{"type":"string"},"net_cents":{"type":"number"},"gross_fallback":{"type":"boolean"}},"required":["id","supplier","invoice_date","net_cents","gross_fallback"],"additionalProperties":false}},{"type":"null"}]}},"required":["total_cents","invoices"],"additionalProperties":false},"inquiries":{"type":"object","properties":{"total":{"type":"number"},"latest":{"type":"array","items":{"type":"object","properties":{"lead_id":{"type":"string"},"name":{"type":"string"},"company":{"type":["string","null"]},"captured_by":{"type":"string"},"created_at":{"type":"string"},"status":{"type":"string"}},"required":["lead_id","name","company","captured_by","created_at","status"],"additionalProperties":false}}},"required":["total","latest"],"additionalProperties":false},"note":{"type":"string"}},"required":["id","name","slug","goal","channels","status","starts_on","ends_on","budget_cents","owner","assistant_profile","configurator_profile","results","links","costs","inquiries","note"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/configurator-stats":{"get":{"operationId":"get_configurator_stats","summary":"Konfigurator-Zahlen lesen","description":"Configurator figures of one registered website for a period: totals (views, started, started_share, requests, quotes_sent, orders, revenue_cents, orders_monthly_net_cents), the previous period of equal length (previous, with compare), the chosen positions per group (in_runs = configurations, in_requests, in_quotes, in_orders; none = no position of an optional group), term and number of users, the ticked needs and the funnel of one profile (profile, default the first). views = widget loads on allowed domains; started = configurations with a first change; requests = inquiries received in the period; revenue = net of issued invoices of those inquiries, so it grows after the period; no visitor is identified.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"compare","in":"query","required":false,"schema":{"description":"Also return the previous period of the same length. Default true.","type":"boolean"}},{"name":"profile","in":"query","required":false,"schema":{"description":"Configurator profile id or exact name. Default: the first profile of the website.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"revenue_note":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"profiles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"totals":{"type":"object","properties":{"views":{"type":"number"},"started":{"type":"number"},"started_share":{"type":["number","null"]},"requests":{"type":"number"},"quotes_sent":{"type":"number"},"orders":{"type":"number"},"revenue_cents":{"type":"number"},"orders_monthly_net_cents":{"type":"number"}},"required":["views","started","started_share","requests","quotes_sent","orders","revenue_cents","orders_monthly_net_cents"],"additionalProperties":false},"previous":{"type":"object","properties":{"views":{"type":"number"},"started":{"type":"number"},"started_share":{"type":["number","null"]},"requests":{"type":"number"},"quotes_sent":{"type":"number"},"orders":{"type":"number"},"revenue_cents":{"type":"number"},"orders_monthly_net_cents":{"type":"number"}},"required":["views","started","started_share","requests","quotes_sent","orders","revenue_cents","orders_monthly_net_cents"],"additionalProperties":false},"groups":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"rule":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"slot":{"type":"string"},"label":{"type":"string"},"in_runs":{"type":"number"},"run_share":{"type":"number"},"in_requests":{"type":"number"},"in_quotes":{"type":"number"},"in_orders":{"type":"number"}},"required":["slot","label","in_runs","run_share","in_requests","in_quotes","in_orders"],"additionalProperties":false}}},"required":["key","label","rule","rows"],"additionalProperties":false}},"term":{"anyOf":[{"type":"object","properties":{"annual":{"type":"array","items":{"type":"number"}},"monthly":{"type":"array","items":{"type":"number"}}},"required":["annual","monthly"],"additionalProperties":false},{"type":"null"}]},"users":{"anyOf":[{"type":"object","properties":{"runs":{"anyOf":[{"type":"object","properties":{"median":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"}},"required":["median","min","max"],"additionalProperties":false},{"type":"null"}]},"requests":{"anyOf":[{"type":"object","properties":{"median":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"}},"required":["median","min","max"],"additionalProperties":false},{"type":"null"}]},"quotes":{"anyOf":[{"type":"object","properties":{"median":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"}},"required":["median","min","max"],"additionalProperties":false},{"type":"null"}]},"orders":{"anyOf":[{"type":"object","properties":{"median":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"}},"required":["median","min","max"],"additionalProperties":false},{"type":"null"}]}},"required":["runs","requests","quotes","orders"],"additionalProperties":false},{"type":"null"}]},"needs":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"share":{"type":"number"},"in_requests":{"type":"number"}},"required":["key","label","share","in_requests"],"additionalProperties":false}},"funnel":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string","enum":["views","started","requests","quotes","orders"]},"count":{"type":"number"},"of_previous":{"type":["number","null"]}},"required":["step","count","of_previous"],"additionalProperties":false}}},"required":["site","period","revenue_note","profiles","totals","groups","term","users","needs","funnel"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/inquiry-origin":{"get":{"operationId":"get_inquiry_origin","summary":"Herkunft einer Anfrage lesen","description":"Where one inquiry (lead) came from: the snapshot of the website visit it was created from (channel, referrer, UTM fields, landing page, pages read with marks) as origin, null when the origin is unknown (such an inquiry counts as „Unbekannt“ in the figures). manual is true when the channel was set by hand (then origin has no site, landing page or pages), heard_about is what the sender answered to „Wie haben Sie von uns erfahren?“.","x-scope":"leads:read","parameters":[{"name":"lead","in":"query","required":true,"schema":{"type":"string","description":"The inquiry's (lead's) id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"origin":{"anyOf":[{"type":"object","properties":{"site_id":{"type":["string","null"]},"channel":{"type":"string"},"referrer_host":{"type":["string","null"]},"utm_source":{"type":["string","null"]},"utm_medium":{"type":["string","null"]},"utm_campaign":{"type":["string","null"]},"utm_content":{"type":["string","null"]},"utm_term":{"type":["string","null"]},"partner_token":{"type":["string","null"]},"landing_path":{"type":["string","null"]},"campaign_id":{"type":["string","null"]},"from_ref":{"type":"boolean"},"pageviews":{"type":"number"},"events":{"type":"number"},"pages_read":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"marks":{"type":"array","items":{"type":"string"}}},"required":["path","marks"],"additionalProperties":false}},"at":{"type":"string"},"ended_at":{"type":["string","null"]},"set_by_name":{"type":"string"}},"required":["site_id","channel","referrer_host","utm_source","utm_medium","utm_campaign","utm_content","utm_term","partner_token","landing_path","campaign_id","from_ref","pageviews","events","pages_read","at","ended_at"],"additionalProperties":false},{"type":"null"}]},"heard_about":{"type":["string","null"]},"manual":{"type":"boolean"}},"required":["lead_id","origin","heard_about","manual"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/landing-pages":{"get":{"operationId":"list_landing_pages","summary":"Einstiegsseiten auflisten","description":"Landing pages of one registered website for a period, busiest first, 50 per page: sessions, bounce_rate, inquiries that started there, conversion, quotes, won orders and revenue_cents. Visitors are counted per day: in cookieless mode one person on three days counts 3, in consent mode only visitors who allowed „Statistik“ are counted; in combined mode visitors who allowed „Statistik“ are recognised across days and all others are counted per day without cookies. revenue_cents is the net of issued invoices of the inquiries received in the period (gestellte Rechnungen, netto), so it keeps growing after the period. Inquiries without a matched visit count as „Unbekannt“ (unknown). Figures exclude bots.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"sessions":{"type":"number"},"bounce_rate":{"type":["number","null"]},"inquiries":{"type":"number"},"conversion":{"type":["number","null"]},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["path","sessions","bounce_rate","inquiries","conversion","quotes","won","revenue_cents"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"},"site":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"consent_mode":{"type":"string","enum":["cookieless","consent","combined"]},"consent_rate":{"type":["number","null"]},"consent_note":{"type":"string"},"revenue_note":{"type":"string"}},"required":["items","page","total","has_more","site","period","consent_mode","revenue_note"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/partner-stats":{"get":{"operationId":"get_partner_stats","summary":"Partner-Zahlen lesen","description":"One referral partner for a period: partner (code, name, status, rule: the version valid now with kind percent, fixed or both, rate_percent, duration_months, fixed_cents), link_sessions (visits through the partner's link; null without a named website or before raw data retention), inquiries (of the named website, or of all websites when none is named: then site is null and site_note says so), by_via (link, manual), new_customers (referrals starting in the period), revenue_cents, commission_cents and statements (month, state, commission_cents; all months). partner is the display code. state: draft (not released), released (released, not paid), paid, credit_note_cancelled (the credit note was cancelled). Revenue = net of the issued invoices of the referred Firmen (cancellations subtracted, items excluded from the commission still included). Commission = the lines of the commission statements for invoices dated in the period, drafts included. Link sessions only count visitors who allowed „Statistik“ on a website in consent mode. Statements cannot be created or released here. Payout and tax data of partners are not available to agents.","x-scope":"leads:read","parameters":[{"name":"partner","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"description":"The partner's display code."}},{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"compare","in":"query","required":false,"schema":{"description":"Also return the previous period of the same length. Default true.","type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"partner":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"rule":{"anyOf":[{"type":"object","properties":{"version":{"type":"number"},"kind":{"type":"string"},"rate_percent":{"type":["number","null"]},"duration_months":{"type":["number","null"]},"fixed_cents":{"type":["number","null"]}},"required":["version","kind","rate_percent","duration_months","fixed_cents"],"additionalProperties":false},{"type":"null"}]}},"required":["code","name","status","rule"],"additionalProperties":false},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"site":{"type":["string","null"]},"site_note":{"type":"string"},"consent_mode":{"type":"string","enum":["cookieless","consent","combined"]},"consent_rate":{"type":["number","null"]},"consent_note":{"type":"string"},"link_sessions":{"type":["number","null"]},"inquiries":{"type":"number"},"by_via":{"type":"object","properties":{"link":{"type":"number"},"manual":{"type":"number"}},"required":["link","manual"],"additionalProperties":false},"new_customers":{"type":"number"},"revenue_cents":{"type":"number"},"commission_cents":{"type":"number"},"statements":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"state":{"type":"string"},"commission_cents":{"type":"number"}},"required":["month","state","commission_cents"],"additionalProperties":false}}},"required":["partner","period","site","link_sessions","inquiries","by_via","new_customers","revenue_cents","commission_cents","statements"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/partners":{"get":{"operationId":"list_partners","summary":"Partner auflisten","description":"Referral partners with their all-time figures: code, name, status (active, paused, ended), since, inquiries (discarded ones excluded), customers (referred Firmen), revenue_cents, commission_open_cents (commission of all statements not yet paid, drafts included) and open_statement (the earliest unpaid statement: month, state, commission_cents; null when none). state: draft (not released), released (released, not paid), paid, credit_note_cancelled (the credit note was cancelled). Without status it lists active and paused partners; status all lists every one. Revenue = net of the issued invoices of the referred Firmen (cancellations subtracted, items excluded from the commission still included). Commission = the lines of the commission statements for invoices dated in the period, drafts included. Link sessions only count visitors who allowed „Statistik“ on a website in consent mode. Statements cannot be created or released here. Payout and tax data of partners are not available to agents.","x-scope":"leads:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Default active and paused.","type":"string","enum":["active","paused","ended","all"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"partners":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"since":{"type":"string"},"inquiries":{"type":"number"},"customers":{"type":"number"},"revenue_cents":{"type":"number"},"commission_open_cents":{"type":"number"},"open_statement":{"anyOf":[{"type":"object","properties":{"month":{"type":"string"},"state":{"type":"string"},"commission_cents":{"type":"number"}},"required":["month","state","commission_cents"],"additionalProperties":false},{"type":"null"}]}},"required":["code","name","status","since","inquiries","customers","revenue_cents","commission_open_cents","open_statement"],"additionalProperties":false}},"note":{"type":"string"}},"required":["partners","note"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/search-queries":{"get":{"operationId":"list_search_queries","summary":"Suchanfragen auflisten","description":"Google Search Console figures per search query of one registered website for a period, 50 per page: query, top_page (the page with most clicks for it), clicks, impressions, ctr, position and opportunity ({ kind, reason } or null). The result also names connected, error, data_until, range (the period clipped to the last day with data), median_ctr and totals over every matching query. Google lags 2 to 3 days, so the newest days are missing. position is the average weighted by impressions. Google leaves out anonymised queries, so the totals are below the Search Console UI. „Chance“ rules: rule 1 (kind position) = average position 4 to 15 with at least 100 impressions; rule 2 (kind ctr) = position 5 or better, at least 100 impressions and a CTR below half the website median CTR (the median over the queries at position 5 or better with at least 100 impressions; none with fewer than 3 such queries); rule 1 wins. Filter with page (a path) and opportunities_only; sort by clicks (default), impressions, ctr or position.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"page","in":"query","required":false,"schema":{"description":"Only the figures of this page, a path like /preise.","type":"string","maxLength":500}},{"name":"opportunities_only","in":"query","required":false,"schema":{"description":"Only queries marked as „Chance“.","type":"boolean"}},{"name":"sort","in":"query","required":false,"schema":{"description":"Default clicks.","type":"string","enum":["clicks","impressions","ctr","position"]}},{"name":"page_number","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"connected":{"type":"boolean"},"error":{"type":["string","null"]},"data_until":{"type":["string","null"]},"range":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]},"median_ctr":{"type":["number","null"]},"totals":{"type":"object","properties":{"queries":{"type":"number"},"clicks":{"type":"number"},"impressions":{"type":"number"},"ctr":{"type":["number","null"]},"position":{"type":["number","null"]}},"required":["queries","clicks","impressions","ctr","position"],"additionalProperties":false},"rows":{"type":"array","items":{"type":"object","properties":{"query":{"type":"string"},"top_page":{"type":"string"},"clicks":{"type":"number"},"impressions":{"type":"number"},"ctr":{"type":"number"},"position":{"type":"number"},"opportunity":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["position","ctr"]},"reason":{"type":"string"}},"required":["kind","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["query","top_page","clicks","impressions","ctr","position","opportunity"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"},"truncated":{"type":"boolean"}},"required":["site","connected","error","data_until","range","median_ctr","totals","rows","page","total","has_more","truncated"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/marketing/web-stats":{"get":{"operationId":"get_web_stats","summary":"Website-Zahlen lesen","description":"Website figures of one registered website for a period: totals (visitors, sessions, pageviews, bounce_rate, inquiries, revenue_cents), the same for the previous period of equal length (previous, with compare), and groups by group_by: channel (default; sessions, share, inquiries, conversion, revenue per channel, unknown last), landing_page (top 50), event (non-pageview events such as tool use or form submits, needs raw data) or day (the daily trend) or captured_by (inquiries, share, quotes, won, revenue_cents per capture source) or campaign (sessions, inquiries, quotes, won, revenue_cents per nxva.base campaign as campaign_id, name, slug; campaign_id null = no campaign). captured_by = how the inquiry was taken (Formular, Assistent …), next to the traffic channel; website inquiries only. Visitors are counted per day: in cookieless mode one person on three days counts 3, in consent mode only visitors who allowed „Statistik“ are counted; in combined mode visitors who allowed „Statistik“ are recognised across days and all others are counted per day without cookies. revenue_cents is the net of issued invoices of the inquiries received in the period (gestellte Rechnungen, netto), so it keeps growing after the period. Inquiries without a matched visit count as „Unbekannt“ (unknown). Figures exclude bots. The result names consent_mode and, in consent mode, consent_rate.","x-scope":"leads:read","parameters":[{"name":"site","in":"query","required":false,"schema":{"description":"Domain of the website, like example.com. Optional when exactly one website is registered.","type":"string","maxLength":200}},{"name":"period","in":"query","required":false,"schema":{"description":"Period ending today (Europe/Berlin days). Default 28d. Ignored when from and to are given.","type":"string","enum":["7d","28d","90d","this_month","last_month"]}},{"name":"from","in":"query","required":false,"schema":{"description":"First day of a free range, YYYY-MM-DD. Needs to as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day of a free range, YYYY-MM-DD. Needs from as well.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"compare","in":"query","required":false,"schema":{"description":"Also return the previous period of the same length. Default true.","type":"boolean"}},{"name":"group_by","in":"query","required":false,"schema":{"description":"How to break the figures down. Default channel.","type":"string","enum":["channel","landing_page","event","day","captured_by","campaign"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"previous":{"anyOf":[{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["from","to","previous"],"additionalProperties":false},"consent_mode":{"type":"string","enum":["cookieless","consent","combined"]},"consent_rate":{"type":["number","null"]},"consent_note":{"type":"string"},"totals":{"type":"object","properties":{"visitors":{"type":"number"},"sessions":{"type":"number"},"pageviews":{"type":"number"},"bounce_rate":{"type":["number","null"]},"inquiries":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["visitors","sessions","pageviews","bounce_rate","inquiries","revenue_cents"],"additionalProperties":false},"previous":{"type":"object","properties":{"visitors":{"type":"number"},"sessions":{"type":"number"},"pageviews":{"type":"number"},"bounce_rate":{"type":["number","null"]},"inquiries":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["visitors","sessions","pageviews","bounce_rate","inquiries","revenue_cents"],"additionalProperties":false},"revenue_note":{"type":"string"},"group_by":{"type":"string","enum":["channel","landing_page","event","day","captured_by","campaign"]},"groups":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string"},"sessions":{"type":"number"},"share":{"type":"number"},"inquiries":{"type":"number"},"conversion":{"type":["number","null"]},"revenue_cents":{"type":"number"}},"required":["channel","sessions","share","inquiries","conversion","revenue_cents"],"additionalProperties":false},{"type":"object","properties":{"day":{"type":"string"},"sessions":{"type":"number"},"previous_sessions":{"type":["number","null"]},"inquiries":{"type":"number"}},"required":["day","sessions","previous_sessions","inquiries"],"additionalProperties":false},{"type":"object","properties":{"captured_by":{"type":"string"},"label":{"type":"string"},"inquiries":{"type":"number"},"share":{"type":"number"},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["captured_by","label","inquiries","share","quotes","won","revenue_cents"],"additionalProperties":false},{"type":"object","properties":{"campaign_id":{"type":["string","null"]},"name":{"type":["string","null"]},"slug":{"type":["string","null"]},"sessions":{"type":"number"},"inquiries":{"type":"number"},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["campaign_id","name","slug","sessions","inquiries","quotes","won","revenue_cents"],"additionalProperties":false},{"type":"object","properties":{"path":{"type":"string"},"sessions":{"type":"number"},"bounce_rate":{"type":["number","null"]},"inquiries":{"type":"number"},"conversion":{"type":["number","null"]},"quotes":{"type":"number"},"won":{"type":"number"},"revenue_cents":{"type":"number"}},"required":["path","sessions","bounce_rate","inquiries","conversion","quotes","won","revenue_cents"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string"},"name":{"type":["string","null"]},"count":{"type":"number"},"sessions":{"type":"number"},"with_inquiry":{"type":"number"},"conversion":{"type":["number","null"]}},"required":["type","name","count","sessions","with_inquiry","conversion"],"additionalProperties":false}]}},"groups_total":{"type":"number"},"limited_from":{"type":["string","null"]}},"required":["site","period","consent_mode","totals","revenue_note","group_by","groups"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/me":{"get":{"operationId":"whoami","summary":"Wer bin ich","description":"Returns the nxva.base user this agent acts as, the roles they hold, the client or access token it came in through, the scopes an access token was given, and the modules this nxva.base instance has booked. Call it first to see what the agent may do.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":["string","null"]},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"clientId":{"type":"string"},"label":{"type":"string"},"scopes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"modules":{"type":"array","items":{"type":"string"}}},"required":["userId","name","roles","channel","clientId","label","scopes","modules"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/notes":{"get":{"operationId":"list_notes","summary":"Notizen lesen","description":"The notes kept on one record, newest first, with author and time, and whether the caller may change each one (only its author may).","x-scope":"notes","parameters":[{"name":"carrier","in":"query","required":true,"schema":{"type":"string","enum":["company","person","lead","quote","order","invoice","contract","incomingInvoice","campaign","partner"],"description":"What the note is kept on."}},{"name":"id","in":"query","required":true,"schema":{"type":"string","description":"The record's id. A quote, order or invoice may also be named by its number, e.g. \"AB-2026-0007\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"author":{"type":"string"},"created_at":{"type":"string"},"edited_at":{"type":["string","null"]},"body":{"type":"string"},"via_agent":{"type":["string","null"]},"agent":{"type":"string"},"yours":{"type":"boolean"}},"required":["id","author","created_at","edited_at","body","via_agent","yours"],"additionalProperties":false}},"url":{"type":"string"}},"required":["notes","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"add_note","summary":"Notiz anlegen","description":"Adds a note to a company, person, lead, quote, order, invoice, incoming invoice or contract, as the person this agent works for. Notes are internal: nobody outside reads them.","x-scope":"notes","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"carrier":{"type":"string","enum":["company","person","lead","quote","order","invoice","contract","incomingInvoice","campaign","partner"],"description":"What the note is kept on."},"id":{"type":"string","description":"The record's id. A quote, order or invoice may also be named by its number, e.g. \"AB-2026-0007\"."},"body":{"type":"string","minLength":1,"maxLength":4000}},"required":["carrier","id","body"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"}},"required":["id","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/notes/{id}":{"patch":{"operationId":"update_note","summary":"Notiz ändern","description":"Replaces the text of a note the caller wrote. A note somebody else wrote stays as it is.","x-scope":"notes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The note's id, from list_notes."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":4000}},"required":["body"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"}},"required":["id","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_note","summary":"Notiz löschen","description":"Deletes a note the caller wrote. A note somebody else wrote stays.","x-scope":"notes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The note's id, from list_notes."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders":{"post":{"operationId":"create_order","summary":"Auftrag manuell anlegen","description":"Enters an order that never went through a quote -- a running contract -- with its sales contract: a recurring line for the monthly amount, an undated line for the one-off amount, which somebody dates in the billing section. finance.manage only. No onboarding tasks, and nothing is sent.","x-scope":"orders:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","description":"The customer's company id, from search_companies: active and a customer."},"business_unit":{"description":"Name or id of a business unit (list_business_units). Default: the default unit.","type":"string","minLength":1,"maxLength":100},"billing_mode":{"type":"string","enum":["fixed","time_material"]},"start_date":{"type":"string","description":"YYYY-MM-DD"},"contract_term_months":{"type":"integer","minimum":1,"maximum":120},"one_off_net_cents":{"description":"Default: 0.","type":"integer","minimum":0,"maximum":100000000},"monthly_net_cents":{"description":"Default: 0.","type":"integer","minimum":0,"maximum":100000000},"comment":{"type":"string","maxLength":2000}},"required":["title","company","billing_mode","start_date","contract_term_months"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["id","number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"list_orders","summary":"Aufträge auflisten","description":"Lists orders, newest first, 50 per page, with their one-off and monthly net amounts in cents. Use get_order for one order's quote, period and tasks.","x-scope":"orders:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Statuses to include. Default: all.","type":"array","items":{"type":"string","enum":["active","completed","cancelled"]}},"style":"form","explode":true},{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in the order number, customer, the quote's number, title or contact, or a task title.","type":"string","maxLength":120}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":["string","null"]},"customer":{"type":"string"},"status":{"type":"string"},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"start_date":{"type":["string","null"]},"open_tasks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","number","title","customer","status","one_off_net_cents","monthly_net_cents","start_date","open_tasks","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}":{"patch":{"operationId":"update_order","summary":"Auftrag ändern","description":"Changes an order's status, the customer's reference or the default assignee; at least one. status (leads.manage): completing or cancelling also ends or cancels its contract, and cancelling cancels the quote it was accepted from -- it bills nothing more. customer_reference (tasks.manage): \"\" clears it; invoices already drafted keep theirs. default_assignee (tasks.manage): who gets new unassigned tasks on the order -- \"me\", \"none\", a user id or e-mail; tasks already there are not touched.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","completed","cancelled"]},"customer_reference":{"type":"string"},"default_assignee":{"type":"string"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"get_order","summary":"Auftrag lesen","description":"One order: amounts in cents, contract term, delivery period, the quote it came from and its company, its hourly rates per role and who works in which role, the default assignee, the repositories linked to it, its tasks, and the notes kept on the order and on its company.","x-scope":"orders:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":["string","null"]},"customer":{"type":"string"},"status":{"type":"string"},"business_unit":{"type":"string"},"project_type":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"start_date":{"type":["string","null"]},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"comment":{"type":["string","null"]},"quote":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"contact":{"type":"string"}},"required":["id","number","title","contact"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"notes":{"type":"array","items":{"type":"object","properties":{"author":{"type":"string"},"agent":{"type":"string"},"created_at":{"type":"string"},"body":{"type":"string"}},"required":["author","created_at","body"],"additionalProperties":false}},"company_notes":{"type":"array","items":{"type":"object","properties":{"author":{"type":"string"},"agent":{"type":"string"},"created_at":{"type":"string"},"body":{"type":"string"}},"required":["author","created_at","body"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"tasks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"assignee":{"type":["string","null"]}},"required":["id","number","title","status","assignee"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","title","customer","status","business_unit","project_type","customer_reference","one_off_net_cents","monthly_net_cents","contract_value_cents","contract_term_months","billing_mode","start_date","delivery_from","delivery_to","comment","quote","company","notes","company_notes","default_assignee","rates","people","tasks","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}/people":{"post":{"operationId":"set_order_person_role","summary":"Rolle einer Person am Auftrag","description":"Says which billing role a person works in on this order -- what the time form suggests when they book, not a restriction. role null removes it. tasks.manage only.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string","description":"\"me\", a user id or e-mail address."},"role":{"description":"The billing role's key, or null to remove the person's role.","type":["string","null"]}},"required":["user","role"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}/rates":{"post":{"operationId":"set_order_rate","summary":"Satz am Auftrag setzen","description":"Puts a billing role on an order, or changes what the order pays for it, by the hour. Without rate_cents the role is added at today's list rate, and one already on the order stays as it is. A rate is agreed per order: the customer's next project is negotiated again. tasks.manage only.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","description":"The billing role's key, from list_catalog_items or get_order."},"rate_cents":{"type":"integer","minimum":1,"maximum":100000000}},"required":["role"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}/rates/{role_id}":{"delete":{"operationId":"remove_order_rate","summary":"Satz vom Auftrag nehmen","description":"Takes a billing role off an order. Bookings in that role can then not be priced: the service report shows them as a gap. tasks.manage only.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}},{"name":"role_id","in":"path","required":true,"schema":{"type":"string","description":"The billing role's key, as get_order lists it."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}/repositories":{"post":{"operationId":"link_repository","summary":"Repository mit Auftrag verknüpfen","description":"Routes the issues of a repository already connected to nxva.base to this order -- all of them, or only those with issue_label. Connecting a new repository stays in the settings. tasks.manage only.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"repository":{"type":"string","description":"\"owner/name\" or the repository's id."},"issue_label":{"description":"Only issues with this label belong to the order.","type":"string","maxLength":100}},"required":["repository"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/orders/{id}/repositories/{repository_id}":{"delete":{"operationId":"unlink_repository","summary":"Repository vom Auftrag lösen","description":"Stops routing a repository's issues to this order. Its tasks stay, with their booked time. tasks.manage only.","x-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."}},{"name":"repository_id","in":"path","required":true,"schema":{"type":"string","description":"\"owner/name\" or the repository's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"customer_reference":{"type":["string","null"]},"default_assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"rates":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"name":{"type":"string"},"rate_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["role","name","rate_cents"],"additionalProperties":false}},"people":{"type":"array","items":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},"role":{"type":"string"}},"required":["user","role"],"additionalProperties":false}},"repositories":{"type":"array","items":{"type":"string"}},"issue_labels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":["string","null"]}},"url":{"type":"string"}},"required":["number","status","customer_reference","default_assignee","rates","people","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/payments/{id}/cancel":{"post":{"operationId":"cancel_payment","summary":"Zahlung aufheben","description":"Cancels a payment recorded by hand on an invoice, e.g. one typed wrong, with a reason: a counter-entry is booked, the payment stays listed as cancelled and no longer counts as paid. The payment ids are in get_invoice. A payment from a bank transaction, or one coupled to a bank transaction, is undone on the transaction instead and is refused here.","x-scope":"invoices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The payment's id, from get_invoice's payments."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"description":"Why it is cancelled; stays visible at the payment."}},"required":["reason"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"kind":{"type":"string"},"status":{"type":"string","enum":["draft","issuing","issued","cancelled"]},"payment":{"anyOf":[{"type":"string","enum":["unsent","open","partially_paid","paid","overdue","cancelled"]},{"type":"null"}]},"invoice_date":{"type":["string","null"]},"company":{"type":"string"},"order":{"type":["string","null"]},"business_unit":{"type":["string","null"]},"customer_reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"period_from":{"type":["string","null"]},"period_to":{"type":["string","null"]},"quantity":{"type":"string"},"unit":{"type":"string"},"unit_price_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","position","source","name","description","period_from","period_to","quantity","unit","unit_price_cents","net_cents"],"additionalProperties":false}},"totals":{"type":"object","properties":{"net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["net_cents","vat_cents","gross_cents"],"additionalProperties":false},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"paid_on":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":["string","null"]},"origin":{"type":"string","enum":["hand","bank","reversal","cancellation"]},"bank_transaction_id":{"type":["string","null"]},"cancelled":{"anyOf":[{"type":"object","properties":{"on":{"type":["string","null"]},"by":{"type":"string"},"reason":{"type":"string"}},"required":["on","by","reason"],"additionalProperties":false},{"type":"null"}]}},"required":["id","paid_on","amount_cents","note","origin","bank_transaction_id","cancelled"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","kind","status","payment","invoice_date","company","order","business_unit","customer_reference","lines","totals","payments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/people":{"get":{"operationId":"search_people","summary":"Personen suchen","description":"Finds people by name or email address, 50 per page, by last name. Optionally only the people of one company.","x-scope":"customers:read","parameters":[{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in first name, last name or email.","type":"string","maxLength":120}},{"name":"company","in":"query","required":false,"schema":{"description":"A company id, to list only its people.","type":"string"}},{"name":"include_inactive","in":"query","required":false,"schema":{"description":"Include deactivated rows. Default: only active ones, as the lists in nxva.base show.","type":"boolean"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"is_active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","name","email","phone","position","company","is_active","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_person","summary":"Person anlegen","description":"Creates a contact person, with or without a company. Refused when the email address already belongs to somebody, naming that person. Search first with search_people.","x-scope":"customers:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"last_name":{"type":"string","minLength":1,"maxLength":120},"first_name":{"description":"First name. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"salutation":{"description":"\"Herr\" or \"Frau\", used in letters and mails. An empty string leaves it open for a person to fill in.","type":"string","enum":["Herr","Frau",""]},"email":{"description":"Email address. Unique: two people cannot share one. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":200},"phone":{"description":"Phone number. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":30},"position":{"description":"Job title. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"company":{"description":"The id of the company they work for, from search_companies.","type":"string"}},"required":["last_name"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"is_active":{"type":"boolean"},"support_access":{"type":"string","enum":["not_invited","invited","linked","withdrawn"]},"salutation":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"url":{"type":"string"}},"required":["id","created","name","is_active","support_access","salutation","email","phone","position","company","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/people/{id}":{"get":{"operationId":"get_person","summary":"Person lesen","description":"One person: contact data, company, their access to the support site (not_invited, invited, linked, withdrawn), and the tickets they raised.","x-scope":"customers:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The person's id, from search_people or get_company."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"salutation":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"is_active":{"type":"boolean"},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"support_access":{"type":"string","enum":["not_invited","invited","linked","withdrawn"]},"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"}},"required":["id","number","title","status"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","salutation","first_name","last_name","name","email","phone","position","is_active","company","support_access","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_person","summary":"Person ändern","description":"Changes a person's name, salutation, contact details or company. Only the fields given change. company: \"none\" detaches them from their company.","x-scope":"customers:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The person's id, from search_people."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"last_name":{"type":"string","minLength":1,"maxLength":120},"first_name":{"description":"First name. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"salutation":{"description":"\"Herr\" or \"Frau\", used in letters and mails. An empty string leaves it open for a person to fill in.","type":"string","enum":["Herr","Frau",""]},"email":{"description":"Email address. Unique: two people cannot share one. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":200},"phone":{"description":"Phone number. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":30},"position":{"description":"Job title. An empty string clears it; omit it to leave it as it is.","type":"string","maxLength":120},"company":{"description":"A company id, or \"none\".","type":"string"},"active":{"description":"false deactivates the person: they stay, with their quotes and tickets, but are no longer offered. true activates them again.","type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"is_active":{"type":"boolean"},"support_access":{"type":"string","enum":["not_invited","invited","linked","withdrawn"]},"salutation":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"url":{"type":"string"}},"required":["id","created","name","is_active","support_access","salutation","email","phone","position","company","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/people/{id}/withdraw-support-access":{"post":{"operationId":"withdraw_support_access","summary":"Support-Zugang entziehen","description":"Takes a person's access to the support site away: a linked account is no longer recognised, and an outstanding invitation can no longer be redeemed. Takes effect on their next request. Nobody is mailed. Inviting is not a tool: it mails the customer.","x-scope":"customers:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The person's id, from search_people."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"is_active":{"type":"boolean"},"support_access":{"type":"string","enum":["not_invited","invited","linked","withdrawn"]},"salutation":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"position":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"url":{"type":"string"}},"required":["id","created","name","is_active","support_access","salutation","email","phone","position","company","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/project-types":{"get":{"operationId":"list_project_types","summary":"Projektarten lesen","description":"The project types a quote can carry. The type decides the layout of the quote's documents.","x-scope":"quotes:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]}},"required":["key","name","description"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_project_type","summary":"Projektart anlegen oder ändern","description":"Creates a project type (omit project_type; name is required, and the key is made from key or, without one, from the name) or edits one: only the fields given change. The key is set once, when the type is created. Project type ids and keys come from list_all_project_types. catalog.manage only.","x-scope":"catalog","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"project_type":{"description":"The type's id or key, from list_all_project_types. Omit to create one.","type":"string"},"name":{"type":"string","maxLength":200},"key":{"description":"Only for a new type; lower-cased, umlauts spelt out, anything else becomes _.","type":"string","maxLength":40},"description":{"description":"A note; null or an empty string clears it.","anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"sort_order":{"description":"Default for a new one: 0.","type":"integer","minimum":-1000000,"maximum":1000000},"active":{"description":"Default for a new one: true.","type":"boolean"}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"note":{"type":"string"},"project_type":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"quotes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"orders":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","key","name","description","sort_order","active","quotes","orders","url"],"additionalProperties":false}},"required":["created","project_type"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/project-types/{id}/active":{"post":{"operationId":"set_project_type_active","summary":"Projektart aktivieren oder deaktivieren","description":"Deactivates a project type -- new quotes can no longer pick it -- or activates it again. Nothing is deleted: quotes and orders that carry it keep it, and their documents stay as they were. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The type's id or key, from list_all_project_types."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_type":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"quotes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"orders":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","key","name","description","sort_order","active","quotes","orders","url"],"additionalProperties":false}},"required":["project_type"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/project-types/all":{"get":{"operationId":"list_all_project_types","summary":"Projektarten zum Pflegen lesen","description":"Every project type, inactive ones too, with its id and how many quotes and orders carry it. The type decides the layout of a quote's documents. To pick one for a quote use list_project_types, which shows only active ones. catalog.manage only.","x-scope":"catalog","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"quotes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"orders":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","key","name","description","sort_order","active","quotes","orders","url"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/prospects":{"get":{"operationId":"list_prospects","summary":"Zielfirmen auflisten","description":"Lists target companies (Zielfirmen) the Scout found and the Rechercheur researched, best score first. Not customers: a target company becomes a company only by adoption. Filter by status, vertical, a minimum score or a search term.","x-scope":"leads:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Statuses to include. Default: found, researched, failed, qualified.","type":"array","items":{"type":"string","enum":["found","researched","failed","qualified","rejected","adopted"]}},"style":"form","explode":true},{"name":"vertical","in":"query","required":false,"schema":{"description":"Verticals to include. Default: all.","type":"array","items":{"type":"string","enum":["it","agentur","beratung","ingenieur","sonstige"]}},"style":"form","explode":true},{"name":"min_score","in":"query","required":false,"schema":{"description":"Only firms with at least this score.","type":"integer","minimum":0,"maximum":100}},{"name":"q","in":"query","required":false,"schema":{"description":"Search in name, domain, city and summary.","type":"string","maxLength":100}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"domain":{"type":["string","null"]},"city":{"type":["string","null"]},"vertical":{"anyOf":[{"type":"string","enum":["it","agentur","beratung","ingenieur","sonstige"]},{"type":"null"}]},"vertical_label":{"type":["string","null"]},"status":{"type":"string","enum":["found","researched","failed","qualified","rejected","adopted"]},"score":{"type":["number","null"]},"headcount":{"type":["string","null"]},"summary":{"type":["string","null"]},"researched_at":{"type":["string","null"]},"company_id":{"type":["string","null"]}},"required":["id","name","domain","city","vertical","vertical_label","status","score","headcount","summary","researched_at","company_id"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_prospect","summary":"Zielfirma erfassen","description":"Adds a target company by hand, for the Rechercheur to read at its next run. Needs a name; a website makes it researchable.","x-scope":"leads:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"website":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"vertical":{"anyOf":[{"type":"string","enum":["it","agentur","beratung","ingenieur","sonstige"]},{"type":"null"}]}},"required":["name"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/prospects/{id}":{"get":{"operationId":"get_prospect","summary":"Zielfirma lesen","description":"One target company with its dossier: profile, decision makers, signals with evidence, the score and how it came about, the pages read.","x-scope":"leads:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The target company's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"website":{"type":["string","null"]},"domain":{"type":["string","null"]},"address":{"type":"object","properties":{"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"country":{"type":"string"}},"required":["street","zip","city","country"],"additionalProperties":false},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"source":{"type":"string"},"source_ref":{"type":["string","null"]},"region":{"type":["string","null"]},"vertical":{"anyOf":[{"type":"string","enum":["it","agentur","beratung","ingenieur","sonstige"]},{"type":"null"}]},"status":{"type":"string","enum":["found","researched","failed","qualified","rejected","adopted"]},"score":{"type":["number","null"]},"score_parts":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"},"max":{"type":"number"},"note":{"type":["string","null"]}},"required":["key","label","points","max","note"],"additionalProperties":false}},"summary":{"type":["string","null"]},"profile":{"anyOf":[{"type":"object","properties":{"industry":{"type":["string","null"]},"services":{"type":"array","items":{"type":"string"}},"headcount":{"type":"object","properties":{"min":{"type":["number","null"]},"max":{"type":["number","null"]},"evidence":{"type":["string","null"]}},"required":["min","max","evidence"],"additionalProperties":false},"decisionMakers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["name","role","url"],"additionalProperties":false}},"tools":{"type":"array","items":{"type":"string"}},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"evidence":{"type":"string"},"url":{"type":["string","null"]}},"required":["key","label","evidence","url"],"additionalProperties":false}},"negatives":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"evidence":{"type":"string"},"url":{"type":["string","null"]}},"required":["key","label","evidence","url"],"additionalProperties":false}},"pitchAngle":{"type":["string","null"]},"pagesRead":{"type":"array","items":{"type":"string"}},"perception":{"anyOf":[{"type":"object","properties":{"strengths":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"source":{"type":"string"}},"required":["text","source"],"additionalProperties":false}},"weaknesses":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"source":{"type":"string"}},"required":["text","source"],"additionalProperties":false}},"rating":{"anyOf":[{"type":"object","properties":{"value":{"type":"number"},"count":{"type":"number"},"source":{"type":"string"}},"required":["value","count","source"],"additionalProperties":false},{"type":"null"}]}},"required":["strengths","weaknesses","rating"],"additionalProperties":false},{"type":"null"}]}},"required":["industry","services","headcount","decisionMakers","tools","signals","negatives","pitchAngle","pagesRead","perception"],"additionalProperties":false},{"type":"null"}]},"researched_at":{"type":["string","null"]},"research_error":{"type":["string","null"]},"verdict":{"anyOf":[{"type":"object","properties":{"reason":{"type":["string","null"]},"at":{"type":"string"},"by":{"type":["string","null"]}},"required":["reason","at","by"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string"}},"required":["id","name","website","domain","address","phone","email","source","source_ref","region","vertical","status","score","score_parts","summary","profile","researched_at","research_error","verdict","company","created_at"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_prospect","summary":"Zielfirma entscheiden","description":"Decides a target company: `verdict` qualified or rejected with an optional reason; `research: true` sends it back to the Rechercheur; `adopt: true` creates a company in the master data from it (once). One of the three per call.","x-scope":"leads:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The target company's id."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["qualified","rejected"]},"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"research":{"type":"boolean"},"adopt":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["qualified","rejected"]}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"found"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"adopted"},"company_id":{"type":"string"},"url":{"type":"string"}},"required":["status","company_id","url"],"additionalProperties":false}]}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/purchase-contracts":{"post":{"operationId":"save_purchase_contract","summary":"Einkaufsvertrag anlegen oder ändern","description":"Creates a purchase contract with a supplier, or -- with contract -- edits one: only the fields given change, the rest stays. A new contract needs company (an active company with the supplier role) and title; business unit, cost center and payment term start as the page proposes them: the default unit, its cost center, the billing settings' payment term, and its status is active. The company of an existing contract stays. Lines are added afterwards with add_purchase_contract_line. Sales contracts are edited through their order (save_contract). finance.manage only.","x-scope":"finance:write","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"contract":{"description":"Omit to create a new purchase contract.","type":"string"},"company":{"description":"Only for a new contract: the supplier's company id.","type":"string"},"title":{"type":"string","maxLength":200},"business_unit":{"description":"Name or id of a business unit (list_business_units). New contract default: the default unit.","type":"string","minLength":1,"maxLength":100},"cost_center":{"description":"DATEV KOST1: up to 8 letters or digits; null for none. New contract default: the unit's cost center.","anyOf":[{"type":"string","maxLength":8},{"type":"null"}]},"payment_term_days":{"description":"New contract default: the billing settings' payment term.","type":"integer","minimum":0,"maximum":365},"status":{"description":"Only when editing: active, ended or cancelled.","type":"string","enum":["active","ended","cancelled"]}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","label","kind","category","vat_rate_pct","reverse_charge","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines","url"],"additionalProperties":false},{"type":"null"}]}},"required":["created","contract"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/purchase-contracts/{id}":{"get":{"operationId":"get_purchase_contract","summary":"Einkaufsvertrag lesen","description":"A purchase contract with a supplier: terms, and every line with amounts in cents, dates, term and notice, and month values.","x-scope":"finance:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The contract's id, from list_contracts."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","label","kind","category","vat_rate_pct","reverse_charge","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/purchase-contracts/{id}/lines":{"post":{"operationId":"add_purchase_contract_line","summary":"Einkaufsvertragsposition anlegen","description":"Adds a line to a purchase contract: what it costs and when. label, kind and category (a cost category) are required, and each kind needs its own fields (see the field descriptions). finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The purchase contract's id, from list_contracts."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"kind":{"description":"instalment (a part delivered once), recurring, time_material, forecast, or monthly_values (a year of month amounts).","type":"string","enum":["instalment","recurring","time_material","forecast","monthly_values"]},"category":{"description":"A cost category key, from list_finance_categories.","type":"string"},"vat_rate_pct":{"description":"Default for a new line: 19.","type":"number","minimum":0,"maximum":100},"amount_cents":{"description":"Every kind but time_material and monthly_values.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"instalment and forecast.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completed_on":{"description":"instalment: the day it was delivered.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"timing":{"description":"recurring: in advance or in arrears.","type":"string","enum":["advance","arrears"]},"start_date":{"description":"recurring and time_material.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":1,"maximum":52},{"type":"null"}]},"notice_unit":{"anyOf":[{"type":"string","enum":["weeks","months"]},{"type":"null"}]},"notice_effective":{"anyOf":[{"type":"string","enum":["month_end","term_end"]},{"type":"null"}]},"notice_given_on":{"description":"Recorded notice; without an end, the earliest end the term allows is set.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2026-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}},"reverse_charge":{"description":"Reverse charge (§ 13b UStG): the VAT is owed by us, the buyer, not paid to the supplier. Default for a new line: false.","type":"boolean"}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"line":{"type":"string"},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","label","kind","category","vat_rate_pct","reverse_charge","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines","url"],"additionalProperties":false},{"type":"null"}]}},"required":["line","contract"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/purchase-contracts/{id}/lines/{line_id}":{"patch":{"operationId":"update_purchase_contract_line","summary":"Einkaufsvertragsposition ändern","description":"Changes a line of a purchase contract: only the fields given, the rest stays as the line holds it. For monthly_values, values_year with values replaces that year's months. finance.manage only.","x-scope":"finance:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The purchase contract's id, from list_contracts."}},{"name":"line_id","in":"path","required":true,"schema":{"type":"string","description":"The line's id, from get_purchase_contract."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"kind":{"description":"instalment (a part delivered once), recurring, time_material, forecast, or monthly_values (a year of month amounts).","type":"string","enum":["instalment","recurring","time_material","forecast","monthly_values"]},"category":{"description":"A cost category key, from list_finance_categories.","type":"string"},"vat_rate_pct":{"description":"Default for a new line: 19.","type":"number","minimum":0,"maximum":100},"amount_cents":{"description":"Every kind but time_material and monthly_values.","type":"integer","minimum":1,"maximum":9007199254740991},"planned_date":{"description":"instalment and forecast.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completed_on":{"description":"instalment: the day it was delivered.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"interval":{"description":"recurring.","type":"string","enum":["monthly","yearly"]},"timing":{"description":"recurring: in advance or in arrears.","type":"string","enum":["advance","arrears"]},"start_date":{"description":"recurring and time_material.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"end_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":1,"maximum":120},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":1,"maximum":52},{"type":"null"}]},"notice_unit":{"anyOf":[{"type":"string","enum":["weeks","months"]},{"type":"null"}]},"notice_effective":{"anyOf":[{"type":"string","enum":["month_end","term_end"]},{"type":"null"}]},"notice_given_on":{"description":"Recorded notice; without an end, the earliest end the term allows is set.","anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"values_year":{"description":"monthly_values: the year the values belong to.","type":"integer","minimum":2000,"maximum":2100},"values":{"description":"monthly_values: cents per month of values_year, e.g. {\"2026-03\": 120000}. A month left out is empty.","type":"object","propertyNames":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}},"reverse_charge":{"description":"Reverse charge (§ 13b UStG): the VAT is owed by us, the buyer, not paid to the supplier. Default for a new line: false.","type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"line":{"type":"string"},"contract":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"business_unit":{"type":["string","null"]},"cost_center":{"type":["string","null"]},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"signed_on":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"},"vat_rate_pct":{"type":"number"},"reverse_charge":{"type":"boolean"},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_date":{"type":["string","null"]},"completed_on":{"type":["string","null"]},"interval":{"type":["string","null"]},"timing":{"type":["string","null"]},"start_date":{"type":["string","null"]},"end_date":{"type":["string","null"]},"minimum_term_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"renewal_months":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_period":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notice_unit":{"type":["string","null"]},"notice_effective":{"type":["string","null"]},"notice_given_on":{"type":["string","null"]},"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","label","kind","category","vat_rate_pct","reverse_charge","amount_cents","planned_date","completed_on","interval","timing","start_date","end_date","minimum_term_months","renewal_months","notice_period","notice_unit","notice_effective","notice_given_on","values"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","title","status","company","business_unit","cost_center","payment_term_days","signed_on","lines","url"],"additionalProperties":false},{"type":"null"}]}},"required":["line","contract"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes":{"get":{"operationId":"list_quotes","summary":"Angebote auflisten","description":"Lists quotes, newest first, 50 per page, with their net amounts in cents. Use get_quote for one quote's positions.","x-scope":"quotes:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Statuses to include. Default: all.","type":"array","items":{"type":"string","enum":["draft","sent","accepted","rejected","expired","cancelled"]}},"style":"form","explode":true},{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in the number, customer, contact, title, city or a position's name.","type":"string","maxLength":120}},{"name":"company","in":"query","required":false,"schema":{"description":"Only this company's quotes, by id.","type":"string"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"customer":{"type":"string"},"status":{"type":"string"},"valid_until":{"type":["string","null"]},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"awaiting_approval":{"type":"boolean"},"url":{"type":"string"}},"required":["id","number","title","customer","status","valid_until","one_off_net_cents","monthly_net_cents","awaiting_approval","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_quote","summary":"Angebotsentwurf anlegen","description":"Creates a quote as a draft, priced the way the editor prices it. A position is a catalogue item (item_key), an individual position with its own price (custom: true), or an effort line priced by a billing role (effort_role, hours). Read list_catalog_items first. Discounts go in percent or in cents, per line or on the totals; one above the thresholds marks the draft for approval. payment_plan splits the one-off total. The quote is never sent: a person reviews and sends it in nxva.base.","x-scope":"quotes:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string","description":"The customer's company id, from search_companies."},"person":{"type":"string","description":"The contact person's id, from search_people: at that company, or at none."},"title":{"type":"string","minLength":1,"maxLength":160},"items":{"minItems":1,"maxItems":60,"type":"array","items":{"anyOf":[{"type":"object","properties":{"item_key":{"type":"string","description":"A key from list_catalog_items."},"quantity":{"description":"Default: 1.","type":"integer","minimum":1,"maximum":10000},"discount_pct":{"description":"A discount on this line, in percent.","type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"description":"A discount on this line's one-off amount, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_cents":{"description":"A discount on this line's monthly amount, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"process_name":{"description":"Required for a process item: what the process is called at the customer.","type":"string","maxLength":160},"process_note":{"type":"string","maxLength":1000},"note":{"description":"A note printed with the position.","type":"string","maxLength":500},"instance":{"description":"Only for an item with a provisioning_flow (list_catalog_items): the instance it provisions on acceptance, printed on the quote as „Ihre Instanz“. Optional; ignored on any other item. In update_quote, an item left without instance keeps what the quote's item with the same item_key holds; null (or empty fields) clears it.","anyOf":[{"type":"object","properties":{"subdomain":{"description":"Lower-case letters, digits and hyphens, 3 to 16 characters, no double hyphen.","type":"string","maxLength":60},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"email":{"description":"Receives the invitation to set a password once the instance is provisioned.","type":"string","maxLength":200}}},{"type":"null"}]}},"required":["item_key"]},{"type":"object","properties":{"custom":{"type":"boolean","const":true,"description":"An individual position: nothing comes from the catalogue, the price is the one given."},"name":{"type":"string","minLength":1,"maxLength":200,"description":"What the position is, as printed on the quote."},"category":{"type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"],"description":"Where the position is listed. credit is a credit note line with negative prices."},"price_one_time_cents":{"description":"One-off price per unit, net, in cents. Negative only for credit. Default: 0.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"description":"Monthly price per unit, net, in cents. Negative only for credit. Default: 0.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quantity":{"description":"Default: 1.","type":"integer","minimum":1,"maximum":10000},"discount_pct":{"type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":0,"maximum":9007199254740991},"offer_text":{"description":"A longer description printed under the name.","type":"string","maxLength":4000},"process_name":{"description":"Required for category process.","type":"string","maxLength":160},"process_class":{"type":"string","enum":["S","M","L"]},"process_note":{"type":"string","maxLength":1000},"note":{"type":"string","maxLength":500}},"required":["custom","name","category"]},{"type":"object","properties":{"effort_role":{"type":"string","description":"A billing role's key from list_catalog_items: the line is priced by the hour at that role's rate."},"hours":{"type":"integer","minimum":1,"maximum":10000},"name":{"type":"string","minLength":1,"maxLength":200,"description":"What the effort is for, as printed on the quote."},"rate_cents":{"description":"An hourly rate agreed for this quote, in cents. Default: the rate agreed with the company, else the role's list rate. All effort lines of one role carry one rate.","type":"integer","minimum":1,"maximum":9007199254740991},"offer_text":{"description":"A longer description printed under the name.","type":"string","maxLength":4000},"note":{"type":"string","maxLength":500}},"required":["effort_role","hours","name"]}]}},"intro_text":{"description":"The opening paragraph.","type":"string","maxLength":2000},"quote_date":{"description":"YYYY-MM-DD, the date printed on the quote. Default for a new quote: today.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"valid_until":{"description":"YYYY-MM-DD. Default for a new quote: 30 days from today.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"project_type":{"description":"A key from list_project_types.","type":"string"},"contract_term_months":{"description":"Default for a new quote: 12.","type":"integer","minimum":1,"maximum":120},"billing_mode":{"description":"Default for a new quote: fixed.","type":"string","enum":["fixed","time_material"]},"recurring_interval":{"description":"Default for a new quote: monthly.","type":"string","enum":["monthly","yearly"]},"recurring_timing":{"description":"Default for a new quote: advance.","type":"string","enum":["advance","arrears"]},"payment_term_days":{"description":"Days an invoice is due in. Default for a new quote: the company's payment term, else the billing settings. Anything but 14 is printed on the quote as a deviation from § 5 (8) of the terms.","type":"integer","minimum":0,"maximum":120},"delivery_from":{"description":"Start of the planned delivery period, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"delivery_to":{"description":"End of the planned delivery period, YYYY-MM-DD; needs delivery_from.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"discount_one_time_pct":{"description":"A discount on the one-off total, in percent.","type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"description":"A discount on the one-off total, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_pct":{"description":"A discount on the monthly total, in percent.","type":"number","minimum":0,"maximum":100},"discount_monthly_cents":{"description":"A discount on the monthly total, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_reason":{"description":"Required as soon as there is any discount.","type":"string","enum":["pilot","reference","multi_year","negotiation","other"]},"discount_note":{"type":"string","maxLength":1000},"payment_plan":{"description":"The instalments of the one-off total, all as amount_cents or all as share_pct. Shares must add up to 100 and are turned into amounts that add up to the cent. Amounts must add up to the one-off net total. [] means no plan: § 5 (6) of the terms applies. Left out, update_quote keeps the plan.","maxItems":24,"type":"array","items":{"anyOf":[{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":160},"amount_cents":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["label","amount_cents"]},{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":160},"share_pct":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["label","share_pct"]}]}},"lead":{"description":"The inquiry (lead) this quote answers, by id; it must be adopted first.","type":"string"}},"required":["company","person","title","items"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"},"created":{"type":"boolean"},"next":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url","created","next"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes/{id}":{"get":{"operationId":"get_quote","summary":"Angebot lesen","description":"One quote: recipient, terms, every position (kind catalog, custom or effort) with its list and net prices in cents, discounts, payment plan, totals, forecast, and whether its discount needs approval. editable_by_agent says whether update_quote can still change it.","x-scope":"quotes:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_quote","summary":"Angebotsentwurf ändern","description":"Changes a draft quote. Only the fields given change; items, when given, replace all positions, and payment_plan, when given, the plan. company moves the draft to another customer, with a person at that company. Refused once the quote is no longer a draft -- relink_quote corrects the link on any quote, duplicate_quote starts a new version. A change withdraws an approval already given.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"description":"Another customer company, by id; needs a person at that company.","type":"string"},"person":{"description":"Another contact person, by id: at the quote's company, or at the one given.","type":"string"},"title":{"type":"string","minLength":1,"maxLength":160},"items":{"description":"All positions, replacing the current ones.","minItems":1,"maxItems":60,"type":"array","items":{"anyOf":[{"type":"object","properties":{"item_key":{"type":"string","description":"A key from list_catalog_items."},"quantity":{"description":"Default: 1.","type":"integer","minimum":1,"maximum":10000},"discount_pct":{"description":"A discount on this line, in percent.","type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"description":"A discount on this line's one-off amount, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_cents":{"description":"A discount on this line's monthly amount, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"process_name":{"description":"Required for a process item: what the process is called at the customer.","type":"string","maxLength":160},"process_note":{"type":"string","maxLength":1000},"note":{"description":"A note printed with the position.","type":"string","maxLength":500},"instance":{"description":"Only for an item with a provisioning_flow (list_catalog_items): the instance it provisions on acceptance, printed on the quote as „Ihre Instanz“. Optional; ignored on any other item. In update_quote, an item left without instance keeps what the quote's item with the same item_key holds; null (or empty fields) clears it.","anyOf":[{"type":"object","properties":{"subdomain":{"description":"Lower-case letters, digits and hyphens, 3 to 16 characters, no double hyphen.","type":"string","maxLength":60},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"email":{"description":"Receives the invitation to set a password once the instance is provisioned.","type":"string","maxLength":200}}},{"type":"null"}]}},"required":["item_key"]},{"type":"object","properties":{"custom":{"type":"boolean","const":true,"description":"An individual position: nothing comes from the catalogue, the price is the one given."},"name":{"type":"string","minLength":1,"maxLength":200,"description":"What the position is, as printed on the quote."},"category":{"type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"],"description":"Where the position is listed. credit is a credit note line with negative prices."},"price_one_time_cents":{"description":"One-off price per unit, net, in cents. Negative only for credit. Default: 0.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_cents":{"description":"Monthly price per unit, net, in cents. Negative only for credit. Default: 0.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quantity":{"description":"Default: 1.","type":"integer","minimum":1,"maximum":10000},"discount_pct":{"type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":0,"maximum":9007199254740991},"offer_text":{"description":"A longer description printed under the name.","type":"string","maxLength":4000},"process_name":{"description":"Required for category process.","type":"string","maxLength":160},"process_class":{"type":"string","enum":["S","M","L"]},"process_note":{"type":"string","maxLength":1000},"note":{"type":"string","maxLength":500}},"required":["custom","name","category"]},{"type":"object","properties":{"effort_role":{"type":"string","description":"A billing role's key from list_catalog_items: the line is priced by the hour at that role's rate."},"hours":{"type":"integer","minimum":1,"maximum":10000},"name":{"type":"string","minLength":1,"maxLength":200,"description":"What the effort is for, as printed on the quote."},"rate_cents":{"description":"An hourly rate agreed for this quote, in cents. Default: the rate agreed with the company, else the role's list rate. All effort lines of one role carry one rate.","type":"integer","minimum":1,"maximum":9007199254740991},"offer_text":{"description":"A longer description printed under the name.","type":"string","maxLength":4000},"note":{"type":"string","maxLength":500}},"required":["effort_role","hours","name"]}]}},"intro_text":{"description":"The opening paragraph.","type":"string","maxLength":2000},"quote_date":{"description":"YYYY-MM-DD, the date printed on the quote. Default for a new quote: today.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"valid_until":{"description":"YYYY-MM-DD. Default for a new quote: 30 days from today.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"project_type":{"description":"A key from list_project_types.","type":"string"},"contract_term_months":{"description":"Default for a new quote: 12.","type":"integer","minimum":1,"maximum":120},"billing_mode":{"description":"Default for a new quote: fixed.","type":"string","enum":["fixed","time_material"]},"recurring_interval":{"description":"Default for a new quote: monthly.","type":"string","enum":["monthly","yearly"]},"recurring_timing":{"description":"Default for a new quote: advance.","type":"string","enum":["advance","arrears"]},"payment_term_days":{"description":"Days an invoice is due in. Default for a new quote: the company's payment term, else the billing settings. Anything but 14 is printed on the quote as a deviation from § 5 (8) of the terms.","type":"integer","minimum":0,"maximum":120},"delivery_from":{"description":"Start of the planned delivery period, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"delivery_to":{"description":"End of the planned delivery period, YYYY-MM-DD; needs delivery_from.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"discount_one_time_pct":{"description":"A discount on the one-off total, in percent.","type":"number","minimum":0,"maximum":100},"discount_one_time_cents":{"description":"A discount on the one-off total, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_monthly_pct":{"description":"A discount on the monthly total, in percent.","type":"number","minimum":0,"maximum":100},"discount_monthly_cents":{"description":"A discount on the monthly total, in cents.","type":"integer","minimum":0,"maximum":9007199254740991},"discount_reason":{"description":"Required as soon as there is any discount.","type":"string","enum":["pilot","reference","multi_year","negotiation","other"]},"discount_note":{"type":"string","maxLength":1000},"payment_plan":{"description":"The instalments of the one-off total, all as amount_cents or all as share_pct. Shares must add up to 100 and are turned into amounts that add up to the cent. Amounts must add up to the one-off net total. [] means no plan: § 5 (6) of the terms applies. Left out, update_quote keeps the plan.","maxItems":24,"type":"array","items":{"anyOf":[{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":160},"amount_cents":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["label","amount_cents"]},{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":160},"share_pct":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["label","share_pct"]}]}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"},"created":{"type":"boolean"},"next":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url","created","next"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_quote","summary":"Angebotsentwurf löschen","description":"Deletes a draft quote with its positions and payment plan. A quote that was sent is never deleted.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes/{id}/duplicate":{"post":{"operationId":"duplicate_quote","summary":"Angebot kopieren","description":"Copies a quote, in any status, as a new draft with the next version number -- the way to change a quote that was already sent. The copy follows the company and person in the master data again.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"},"created":{"type":"boolean"},"next":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url","created","next"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes/{id}/extend-validity":{"post":{"operationId":"extend_quote_validity","summary":"Gültigkeit verlängern","description":"Moves the last day of a sent or expired quote to a later date; an expired quote is open again. Nothing else about the quote changes, and a note on it records the old and new date. The customer learns of it only when a person sends the quote again.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"valid_until":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"The new last day, YYYY-MM-DD: not before today and after the current one."}},"required":["valid_until"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes/{id}/forecast":{"patch":{"operationId":"set_quote_forecast","summary":"Prognose am Angebot setzen","description":"Sets what the finance planning reads from an open quote (draft or sent): the business unit, the probability of winning it, and the month the order is expected. Not a commercial term, so it changes nothing on paper and withdraws no approval.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"description":"Name or id of a business unit (list_business_units). Default: the quote's own unit, else the default unit.","type":"string","minLength":1,"maxLength":100},"probability_pct":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}],"description":"Chance of winning in percent, stored in steps of 5. null: no estimate, the pipeline counts it unweighted."},"planned_order_month":{"anyOf":[{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},{"type":"null"}],"description":"YYYY-MM, or null."}},"required":["probability_pct","planned_order_month"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/quotes/{id}/relink":{"post":{"operationId":"relink_quote","summary":"Angebot neu verknüpfen","description":"Corrects which company and person a quote is linked to in the master data, on any quote. A draft takes over their names and address; on a quote that was sent, what the customer holds stays as it was and only the link moves.","x-scope":"quotes:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The quote's id or number, e.g. \"A-2026-0042\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string","description":"The company id, from search_companies."},"person":{"type":"string","description":"The person id, from search_people: at that company, or at none."}},"required":["company","person"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string"},"editable_by_agent":{"type":"boolean"},"title":{"type":"string"},"intro_text":{"type":["string","null"]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"addressed":{"type":"boolean"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","name","email"],"additionalProperties":false},{"type":"null"}]},"quote_date":{"type":["string","null"]},"valid_until":{"type":["string","null"]},"project_type":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"contract_term_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billing_mode":{"type":"string"},"recurring_interval":{"type":"string"},"recurring_timing":{"type":"string"},"payment_term_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"delivery_from":{"type":["string","null"]},"delivery_to":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["effort","catalog","custom"]},"item_key":{"type":["string","null"]},"category":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"process_name":{"type":["string","null"]},"note":{"type":["string","null"]},"discount_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"offer_text":{"type":["string","null"]},"price_one_time_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_list_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_one_time_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"price_monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort":{"anyOf":[{"type":"object","properties":{"role":{"type":"string"},"role_name":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["role","role_name","rate_cents"],"additionalProperties":false},{"type":"null"}]},"instance":{"anyOf":[{"type":"object","properties":{"flow":{"type":"string"},"subdomain":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["flow","subdomain","first_name","last_name","email"],"additionalProperties":false},{"type":"null"}]}},"required":["position","kind","item_key","category","name","quantity","process_name","note","discount_pct","discount_one_time_cents","discount_monthly_cents","offer_text","price_one_time_list_cents","price_monthly_list_cents","price_one_time_net_cents","price_monthly_net_cents","effort","instance"],"additionalProperties":false}},"discount_one_time_pct":{"type":"number"},"discount_one_time_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_monthly_pct":{"type":"number"},"discount_monthly_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount_reason":{"type":["string","null"]},"discount_note":{"type":["string","null"]},"payment_plan":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"share_pct":{"type":["number","null"]}},"required":["label","amount_cents","share_pct"],"additionalProperties":false}},"one_off_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthly_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract_value_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"effort_estimate_net_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approval":{"type":"string","enum":["approved","required","not_needed"]},"forecast":{"type":"object","properties":{"business_unit":{"type":"string"},"probability_pct":{"type":["number","null"]},"planned_order_month":{"type":["string","null"]}},"required":["business_unit","probability_pct","planned_order_month"],"additionalProperties":false},"url":{"type":"string"}},"required":["id","number","version","status","editable_by_agent","title","intro_text","company","addressed","person","quote_date","valid_until","project_type","contract_term_months","billing_mode","recurring_interval","recurring_timing","payment_term_days","delivery_from","delivery_to","items","discount_one_time_pct","discount_one_time_cents","discount_monthly_pct","discount_monthly_cents","discount_reason","discount_note","payment_plan","one_off_net_cents","monthly_net_cents","contract_value_cents","effort_estimate_net_cents","approval","forecast","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/service-reports":{"get":{"operationId":"list_service_reports","summary":"Leistungsnachweise auflisten","description":"Service reports, newest first, 50 per page: number, order, period, status, minutes. tasks.admin only.","x-scope":"service-reports","parameters":[{"name":"order","in":"query","required":false,"schema":{"description":"Only this order's reports, by id or number, e.g. \"AB-2026-0007\".","type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["issued","cancelled"]}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order":{"type":"string"},"customer":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"total_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"}},"required":["id","number","status","order","customer","period_from","period_to","total_minutes","billable_minutes","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"issue_service_report","summary":"Leistungsnachweis ausstellen","description":"Issues a service report for an order and a period: draws the LN number, freezes every open booking of the period with the order's rates, and settles those bookings. Nothing is sent; a report reaches the customer only with an invoice a person sends. tasks.admin only.","x-scope":"service-reports","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"string","description":"The order's id or number, e.g. \"AB-2026-0007\"."},"from":{"type":"string","description":"First day, YYYY-MM-DD."},"to":{"type":"string","description":"Last day, YYYY-MM-DD."},"include_non_billable":{"description":"Also list bookings that are not billable. Default: false.","type":"boolean"}},"required":["order","from","to"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order":{"type":"string"},"customer":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"issued_by":{"type":"string"},"issued_at":{"type":"string"},"cancelled_at":{"type":["string","null"]},"includes_non_billable":{"type":"boolean"},"total_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoice":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"work_date":{"type":"string"},"task":{"type":["string","null"]},"task_title":{"type":"string"},"description":{"type":["string","null"]},"person":{"type":"string"},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable":{"type":"boolean"},"kind":{"type":"string"},"role":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["work_date","task","task_title","description","person","minutes","billable","kind","role"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","status","order","customer","period_from","period_to","issued_by","issued_at","cancelled_at","includes_non_billable","total_minutes","billable_minutes","invoice","lines","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/service-reports/{id}":{"get":{"operationId":"get_service_report","summary":"Leistungsnachweis lesen","description":"One service report with its frozen lines, and the invoice that holds it, if any. tasks.admin only.","x-scope":"service-reports","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The report's id or number, e.g. \"LN-2026-0012\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order":{"type":"string"},"customer":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"issued_by":{"type":"string"},"issued_at":{"type":"string"},"cancelled_at":{"type":["string","null"]},"includes_non_billable":{"type":"boolean"},"total_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoice":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"work_date":{"type":"string"},"task":{"type":["string","null"]},"task_title":{"type":"string"},"description":{"type":["string","null"]},"person":{"type":"string"},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable":{"type":"boolean"},"kind":{"type":"string"},"role":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["work_date","task","task_title","description","person","minutes","billable","kind","role"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","status","order","customer","period_from","period_to","issued_by","issued_at","cancelled_at","includes_non_billable","total_minutes","billable_minutes","invoice","lines","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/service-reports/{id}/cancel":{"post":{"operationId":"cancel_service_report","summary":"Leistungsnachweis stornieren","description":"Cancels an issued service report: the document stays, marked cancelled, and its bookings are open again for a later report. Refused while an invoice holds the report. tasks.admin only.","x-scope":"service-reports","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The report's id or number, e.g. \"LN-2026-0012\"."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order":{"type":"string"},"customer":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"issued_by":{"type":"string"},"issued_at":{"type":"string"},"cancelled_at":{"type":["string","null"]},"includes_non_billable":{"type":"boolean"},"total_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_cents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoice":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"work_date":{"type":"string"},"task":{"type":["string","null"]},"task_title":{"type":"string"},"description":{"type":["string","null"]},"person":{"type":"string"},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable":{"type":"boolean"},"kind":{"type":"string"},"role":{"type":["string","null"]},"rate_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"amount_cents":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["work_date","task","task_title","description","person","minutes","billable","kind","role"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","status","order","customer","period_from","period_to","issued_by","issued_at","cancelled_at","includes_non_billable","total_minutes","billable_minutes","invoice","lines","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/task-activity":{"get":{"operationId":"list_task_activity","summary":"Neues an Aufgaben","description":"New tasks and new comments since a moment, on the given orders, a company, or the caller's own tasks (assigned to them, or on an order they are the default assignee of). Most recent activity first, 50 per page. awaiting_reply marks tasks whose latest comment came from a customer, a public sender or GitHub and has not been answered. Use get_task for the full thread.","x-scope":"tasks:read","parameters":[{"name":"since","in":"query","required":true,"schema":{"type":"string","description":"ISO date or date-time, e.g. \"2026-09-28\" or \"2026-09-28T14:00:00Z\". A bare date is midnight UTC."}},{"name":"orders","in":"query","required":false,"schema":{"description":"Order ids or numbers, e.g. [\"AB-2026-0007\"].","maxItems":20,"type":"array","items":{"type":"string"}},"style":"form","explode":true},{"name":"company","in":"query","required":false,"schema":{"description":"A company id.","type":"string"}},{"name":"assignedToMe","in":"query","required":false,"schema":{"description":"Tasks assigned to the caller, or on an order whose default assignee is the caller.","type":"boolean"}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"order":{"type":["string","null"]},"assignee":{"type":["string","null"]},"origin":{"type":"string"},"github":{"type":"boolean"},"is_new":{"type":"boolean"},"awaiting_reply":{"type":"boolean"},"last_activity_at":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"author":{"type":"string"},"origin":{"type":"string"},"audience":{"type":"string"},"agent_label":{"type":["string","null"]},"agent":{"type":"string"},"created_at":{"type":"string"},"excerpt":{"type":["string","null"]}},"required":["author","origin","audience","agent_label","created_at","excerpt"],"additionalProperties":false}},"url":{"type":"string"}},"required":["number","title","status","priority","assignee","origin","is_new","awaiting_reply","last_activity_at","comments","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/task-templates":{"get":{"operationId":"list_task_templates","summary":"Aufgabenvorlagen lesen","description":"Every task template, inactive ones too: the tasks an accepted quote produces. trigger once_per_order makes one task per order; per_item one per quote line of the template's category; per_flow_item one per quote line with a provisioning flow (with kind provisioning, the task is linked to the instance that line orders). Planned effort is in minutes; a per-class figure (S, M, L) wins over the flat one for a line with that process class. Title and description may carry placeholders such as {kunde}, {auftrag}, {position}, {prozess}. catalog.manage only.","x-scope":"catalog","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"trigger":{"type":"string"},"category":{"type":["string","null"]},"kind":{"type":"string"},"planned_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_minutes_by_class":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","title","description","trigger","category","kind","planned_minutes","planned_minutes_by_class","position","active","url"],"additionalProperties":false}}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"save_task_template","summary":"Aufgabenvorlage anlegen oder ändern","description":"Creates a task template (omit template; key, title and trigger are required, and a per_item template needs a category) or edits one: only the fields given change. Only orders made from now on are affected; tasks already created stay as they are. Planned effort is in minutes. Like on the page, the per-class figures cannot all be cleared at once: clearing the last one leaves them as they were. Template ids and keys come from list_task_templates. catalog.manage only.","x-scope":"catalog","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"description":"The template's id or key, from list_task_templates. Omit to create one.","type":"string"},"key":{"description":"Lower-case letters, digits and underscores.","type":"string","maxLength":60},"title":{"description":"May carry placeholders, e.g. „Prozess-Onboarding: {prozess}“.","type":"string","maxLength":200},"description":{"description":"null or an empty string clears it.","anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]},"trigger":{"type":"string","enum":["once_per_order","per_item","per_flow_item"]},"category":{"description":"For per_item: the catalogue category whose lines each get a task.","anyOf":[{"type":"string","enum":["platform","edition","connectivity","process","service","ai_package","one_time","credit"]},{"type":"null"}]},"kind":{"description":"Default for a new one: manual.","type":"string","enum":["manual","platform_setup","process_onboarding","provisioning","decommission","deletion","release_rollout"]},"planned_minutes":{"description":"Flat planned effort in minutes; null clears it.","anyOf":[{"type":"integer","minimum":1,"maximum":120000},{"type":"null"}]},"planned_minutes_by_class":{"description":"Planned effort in minutes per process class; a class given null is cleared, one left out is kept.","type":"object","properties":{"S":{"anyOf":[{"type":"integer","minimum":1,"maximum":120000},{"type":"null"}]},"M":{"anyOf":[{"type":"integer","minimum":1,"maximum":120000},{"type":"null"}]},"L":{"anyOf":[{"type":"integer","minimum":1,"maximum":120000},{"type":"null"}]}}},"position":{"description":"Order among the templates. Default for a new one: 0.","type":"integer","minimum":0,"maximum":9999},"active":{"description":"Default for a new one: true.","type":"boolean"}},"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"note":{"type":"string"},"template":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"trigger":{"type":"string"},"category":{"type":["string","null"]},"kind":{"type":"string"},"planned_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_minutes_by_class":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","title","description","trigger","category","kind","planned_minutes","planned_minutes_by_class","position","active","url"],"additionalProperties":false}},"required":["created","template"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/task-templates/{id}":{"delete":{"operationId":"delete_task_template","summary":"Aufgabenvorlage löschen","description":"Deletes a task template for good. The tasks it already produced stay with their orders. To stop it without losing it, use set_task_template_active. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The template's id or key, from list_task_templates."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"key":{"type":"string"}},"required":["deleted","key"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/task-templates/{id}/active":{"post":{"operationId":"set_task_template_active","summary":"Aufgabenvorlage aktivieren oder deaktivieren","description":"Deactivates a task template -- orders made from now on no longer get its task -- or activates it again. catalog.manage only.","x-scope":"catalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The template's id or key, from list_task_templates."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"trigger":{"type":"string"},"category":{"type":["string","null"]},"kind":{"type":"string"},"planned_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"planned_minutes_by_class":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"url":{"type":"string"}},"required":["id","key","title","description","trigger","category","kind","planned_minutes","planned_minutes_by_class","position","active","url"],"additionalProperties":false}},"required":["template"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/tasks":{"get":{"operationId":"list_tasks","summary":"Aufgaben auflisten","description":"Lists tasks the way the task list in nxva.base does, 50 per page, soonest due first. Without a status it shows what is still to be done (open, in_progress). Use get_task for one task's description and comments.","x-scope":"tasks:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Statuses to include. Default: open and in_progress.","type":"array","items":{"type":"string","enum":["open","in_progress","done","cancelled"]}},"style":"form","explode":true},{"name":"assignee","in":"query","required":false,"schema":{"description":"\"me\", \"unassigned\", or a user id.","type":"string"}},{"name":"order","in":"query","required":false,"schema":{"description":"An order id or number (e.g. \"AB-2026-0007\"), or \"none\" for tasks without an order.","type":"string"}},{"name":"due","in":"query","required":false,"schema":{"type":"string","enum":["overdue","today","this_week","this_month","none"]}},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["github","wingman","customer","public"]}},{"name":"query","in":"query","required":false,"schema":{"description":"Words to find in number, title, description, comments, order, assignee or issue.","type":"string","maxLength":120}},{"name":"page","in":"query","required":false,"schema":{"description":"1-based page of 50 rows. Omit for the first page.","type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"due_date":{"type":["string","null"]},"assignee":{"type":["string","null"]},"order":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"customer":{"type":"string"}},"required":["number","customer"],"additionalProperties":false},{"type":"null"}]},"source":{"type":"string","enum":["github","wingman","customer","public"]},"issue_url":{"type":["string","null"]},"url":{"type":"string"}},"required":["id","number","title","status","priority","due_date","assignee","source","url"],"additionalProperties":false}},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"has_more":{"type":"boolean"}},"required":["items","page","total","has_more"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"create_task","summary":"Aufgabe anlegen","description":"Creates a task, as the signed-in person -- tasks.manage only, as on the page. Optionally on an order, assigned to somebody, with dates, an estimate, a status and a priority. With a reporter it is a customer request raised for that person: it belongs to their company and they see it in support. visible_to_customer shows an internal task in support too, on an order. Creating either mails nobody -- the same as the form.","x-scope":"tasks:create","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"description":{"description":"Markdown.","type":"string","maxLength":4000},"order":{"description":"The order's id or number, e.g. \"AB-2026-0007\".","type":"string"},"assignee":{"description":"\"me\", or a user id. Default: nobody.","type":"string"},"status":{"description":"Default: open.","type":"string","enum":["open","in_progress","done","cancelled"]},"priority":{"description":"Default: medium.","type":"string","enum":["low","medium","high"]},"start_date":{"description":"YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"due_date":{"description":"YYYY-MM-DD, not before start_date.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"planned_minutes":{"description":"The estimate, in minutes.","type":"integer","minimum":1,"maximum":9007199254740991},"reporter":{"description":"A person's id or email address. Makes the task a customer request from them: always visible to the customer. On an order, the person must belong to its company.","type":"string"},"visible_to_customer":{"description":"Show an internal task to the customer in support. Only takes effect on a task with an order. Default: false.","type":"boolean"}},"required":["title"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"assignee":{"type":["string","null"]},"order":{"type":["string","null"]},"due_date":{"type":["string","null"]},"origin":{"type":"string"},"reported_by":{"type":["string","null"]},"visible_to_customer":{"type":"boolean"},"url":{"type":"string"}},"required":["id","number","status","priority","assignee","due_date","origin","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/tasks/{id}":{"get":{"operationId":"get_task","summary":"Aufgabe lesen","description":"One task with its description, dates, planned and booked time, the GitHub issue it mirrors if any, and every comment. Comments carry an audience: internal notes, or answers the customer can read. The task and each comment list their attachments; get_attachment reads one whose scan_state is clean. A public request (source public) has a requester instead of reported_by; an answer with audience customer is mailed to them.","x-scope":"tasks:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string"},"priority":{"type":"string"},"kind":{"type":"string"},"source":{"type":"string","enum":["github","wingman","customer","public"]},"start_date":{"type":["string","null"]},"due_date":{"type":["string","null"]},"completed_at":{"type":["string","null"]},"planned_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"booked_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"created_by":{"type":["string","null"]},"created_by_agent":{"type":"string"},"intake_item_id":{"type":["string","null"]},"order":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customer":{"type":"string"}},"required":["id","number","customer"],"additionalProperties":false},{"type":"null"}]},"company":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"reported_by":{"type":["string","null"]},"requester":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["email","name"],"additionalProperties":false},{"type":"null"}]},"public_address":{"type":["string","null"]},"anonymised_at":{"type":["string","null"]},"visible_to_customer":{"type":"boolean"},"rejection_reason":{"type":["string","null"]},"issue":{"anyOf":[{"type":"object","properties":{"repository":{"type":"string"},"number":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"url":{"type":["string","null"]},"state":{"type":["string","null"]},"labels":{"type":"array","items":{"type":"string"}},"pending_pushes":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"boolean"},"last_error":{"type":["string","null"]}},"required":["kind","attempts","failed","last_error"],"additionalProperties":false}}},"required":["repository","number","url","state","labels","pending_pushes"],"additionalProperties":false},{"type":"null"}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"file_name":{"type":"string"},"content_type":{"type":"string"},"bytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scan_state":{"type":"string"}},"required":["id","file_name","content_type","bytes","scan_state"],"additionalProperties":false}},"comments":{"type":"array","items":{"type":"object","properties":{"author":{"type":"string"},"origin":{"type":"string"},"audience":{"type":"string"},"body":{"type":["string","null"]},"deleted":{"type":"boolean"},"agent_label":{"type":["string","null"]},"agent":{"type":"string"},"created_at":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"file_name":{"type":"string"},"content_type":{"type":"string"},"bytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scan_state":{"type":"string"}},"required":["id","file_name","content_type","bytes","scan_state"],"additionalProperties":false}}},"required":["author","origin","audience","body","deleted","agent_label","created_at","attachments"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","number","title","description","status","priority","kind","source","start_date","due_date","completed_at","planned_minutes","booked_minutes","assignee","created_by","company","attachments","comments","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"operationId":"update_task","summary":"Aufgabe ändern","description":"Changes a task's status, priority, assignee, order or -- on a customer ticket -- reporter; at least one. order (tasks.manage): moves the task to another order, or off any with \"none\"; refused once settled time is booked on it, and an unassigned task gets the new order's default assignee. Status and priority: the assignee, or anybody with tasks.manage. Assignee: tasks.manage only. A status change on a task mirrored from GitHub is pushed to the issue. On a customer ticket, accepting (in_progress), declining (cancelled) or finishing (done) it mails the person who raised it, exactly as from the page; moving it back to open and changing its priority mail nobody. reporter: tasks.manage only, a person of the ticket's company; nobody is mailed about it, and the change is noted internally on the task. convert_to_customer_ticket (tasks.manage, with reporter): turns an internal task on an order into that person's customer ticket -- the reporter must belong to the order's company; title, description and attachments become visible to them in support, earlier comments stay internal, the status is kept, and it cannot be undone. The reporter is mailed only with notify_reporter.","x-scope":"tasks:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","done","cancelled"]},"priority":{"type":"string","enum":["low","medium","high"]},"assignee":{"description":"\"me\", \"unassigned\", or a user id.","type":"string"},"reporter":{"description":"A customer ticket's new reporter: a person's id or email address, of the ticket's company. tasks.manage only.","type":"string"},"order":{"description":"The order to move the task to, by id or number (e.g. \"AB-2026-0007\"), or \"none\". tasks.manage only.","type":"string"},"convert_to_customer_ticket":{"description":"true: turns an internal task into a customer ticket raised by `reporter`. Irreversible. tasks.manage only.","type":"boolean"},"notify_reporter":{"description":"With convert_to_customer_ticket: mails the reporter that the ticket was opened. Default false.","type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"assignee":{"type":["string","null"]},"order":{"type":["string","null"]},"reported_by":{"type":["string","null"]},"url":{"type":"string"}},"required":["number","status","priority","assignee","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_task","summary":"Aufgabe löschen","description":"Deletes a task entered by hand, with its comments. tasks.manage only. An onboarding step or a task from a GitHub issue is never deleted -- set its status to cancelled -- and neither is a task with booked time.","x-scope":"tasks:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/tasks/{id}/comments":{"post":{"operationId":"add_task_comment","summary":"Aufgabe kommentieren","description":"Writes a comment on a task, as the signed-in person, marked as written through an agent. Markdown is fine. audience defaults to internal. audience customer makes it an answer the customer reads in support, and mails the person who raised the ticket -- it cannot be taken back or made internal later, so write it as the final text. attachments takes ids from upload_attachment. On a task mirrored from GitHub the comment is also posted to the issue. Allowed to the assignee, or anybody with tasks.manage.","x-scope":"tasks:comment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":4000,"description":"The comment, Markdown."},"audience":{"description":"internal (default): the team only. customer: visible in support, and the reporter is mailed.","type":"string","enum":["internal","customer"]},"attachments":{"description":"Ids from upload_attachment, at most 5. With audience customer the customer sees them once scanned clean.","maxItems":5,"type":"array","items":{"type":"string"}}},"required":["body"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string"},"comment_id":{"type":"string"},"audience":{"type":"string","enum":["internal","customer"]},"url":{"type":"string"}},"required":["number","comment_id","audience","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/tasks/{id}/push/discard":{"post":{"operationId":"discard_task_push","summary":"GitHub-Übertragung verwerfen","description":"Gives up on pushes to GitHub that failed for good (issue deleted or locked, repository removed): the failed entries are dropped, the task stays as it is in nxva.base, and the next sync brings the issue's state back. A comment whose push is dropped stays in nxva.base only. The assignee, or anybody with tasks.manage.","x-scope":"tasks:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"discarded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["discarded"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/tasks/{id}/push/retry":{"post":{"operationId":"retry_task_push","summary":"GitHub-Übertragung wiederholen","description":"Tries again to push a task's pending status changes and comments to its GitHub issue, once the cause of a failure is fixed. The assignee, or anybody with tasks.manage. get_task shows whether a push failed.","x-scope":"tasks:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."}}],"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"retried":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"still_pending":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["retried","still_pending"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/ticket-sources":{"post":{"operationId":"save_ticket_source","summary":"Ticketsystem einer Firma","description":"Registers a customer's ticket system (Jira or another) on its company, or changes one: the address its mails come from, how an issue key is found in a subject, the order new tickets go to, the person they are raised for when the mail names nobody known, and whether the team's answers and status changes are mailed into the system. Mails from that address then become tickets. Every field is set as given: one left out is cleared. Nothing is sent by this.","x-scope":"customers:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string","description":"The company's id."},"source":{"description":"A ticket system's id from get_company, to change it. Left out: a new one.","type":"string"},"label":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["jira","other"]},"address":{"type":"string","maxLength":320,"description":"The exact sender address of the system's mails."},"key_pattern":{"description":"For kind other: a pattern that finds the issue key in a subject.","type":"string","maxLength":200},"default_order":{"description":"An active order of the company, by id, that new tickets go to.","type":"string"},"fallback_person":{"description":"An active person of the company, by id, a ticket is raised for when the mail names nobody known.","type":"string"},"answer_mode":{"description":"Where answers and status changes of its tickets are mailed: off (the reporter, as before; the default), system (the ticket system instead of the reporter), system_and_reporter (the system, the reporter in copy). The subject then ends with the issue key in brackets.","type":"string","enum":["off","system","system_and_reporter"]},"answer_address":{"description":"Where the system takes mail; needed unless answer_mode is off. Often the sender address, but not for Jira Cloud.","type":"string","maxLength":320}},"required":["company","label","kind","address"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"vat_id":{"type":["string","null"]},"country_code":{"type":"string"},"document_language":{"type":"string"},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"active":{"type":"boolean"}},"required":["id","label","kind","address","active"],"additionalProperties":false}},"url":{"type":"string"},"source":{"type":"string"}},"required":["id","created","name","street","zip","city","vat_id","country_code","document_language","payment_term_days","avv_signed_on","is_customer","is_supplier","is_active","url","source"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/ticket-sources/{id}/active":{"post":{"operationId":"set_ticket_source_active","summary":"Ticketsystem an- oder abschalten","description":"Switches a registered ticket system off -- its mails no longer become tickets -- or on again.","x-scope":"customers:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"active":{"type":"boolean"}},"required":["company","active"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"boolean"},"name":{"type":"string"},"street":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"vat_id":{"type":["string","null"]},"country_code":{"type":"string"},"document_language":{"type":"string"},"payment_term_days":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"avv_signed_on":{"type":["string","null"]},"is_customer":{"type":"boolean"},"is_supplier":{"type":"boolean"},"is_active":{"type":"boolean"},"mail_recipients":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"role":{"type":"string"},"person":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"email":{"type":["string","null"]}},"required":["kind","role","person","email"],"additionalProperties":false}},"ticket_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"address":{"type":"string"},"active":{"type":"boolean"}},"required":["id","label","kind","address","active"],"additionalProperties":false}},"url":{"type":"string"}},"required":["id","created","name","street","zip","city","vat_id","country_code","document_language","payment_term_days","avv_signed_on","is_customer","is_supplier","is_active","url"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/time-entries":{"get":{"operationId":"list_time_entries","summary":"Zeiten auflisten","description":"Lists bookings, oldest first, at most 200: by default the signed-in person's own of the last 14 days. With tasks.admin, anybody's (user) or everybody's (user: \"all\").","x-scope":"time","parameters":[{"name":"from","in":"query","required":false,"schema":{"description":"First day, YYYY-MM-DD. Default: 13 days ago.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"description":"Last day, YYYY-MM-DD. Default: today.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"task","in":"query","required":false,"schema":{"description":"Only bookings on this task (id or number).","type":"string"}},{"name":"user","in":"query","required":false,"schema":{"description":"A user id, or \"all\". tasks.admin only.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":["string","null"]},"start":{"type":["string","null"]},"end":{"type":["string","null"]},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"task":{"type":"object","properties":{"number":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["number","title","url"],"additionalProperties":false},"person":{"type":"string"},"description":{"type":["string","null"]},"kind":{"type":"string"},"role":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"billable":{"type":"boolean"},"settled":{"type":"boolean"},"via_agent":{"type":"boolean"}},"required":["id","date","start","end","minutes","task","person","description","kind","via_agent"],"additionalProperties":false}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total_minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["from","to","entries","count","total_minutes"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"book_time","summary":"Zeit buchen","description":"Books time on a task as the signed-in person's. Give a duration, or a start and an end (quarter-hour grid; the duration follows), or a start and a duration. A bare duration is rounded up to the next quarter hour. Answers with the booking as stored.","x-scope":"time","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"task":{"type":"string","description":"The task's id or number, e.g. \"AU-2026-0042\"."},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"The day the work happened, YYYY-MM-DD."},"duration":{"description":"e.g. \"1:30\", \"1,5h\", \"90m\".","type":"string"},"start":{"type":"string","pattern":"^\\d{1,2}:\\d{2}$"},"end":{"type":"string","pattern":"^\\d{1,2}:\\d{2}$"},"description":{"type":"string","maxLength":2000},"billable":{"description":"Default: true.","type":"boolean"},"kind":{"description":"Default: work. Travel is billed at half the rate.","type":"string","enum":["work","travel"]},"role":{"description":"A billing role's id or key. Default: the role the order gives the person, if any.","type":"string"},"user":{"description":"Book for somebody else (user id). tasks.admin only.","type":"string"}},"required":["task","date"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":["string","null"]},"start":{"type":["string","null"]},"end":{"type":["string","null"]},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"task":{"type":"object","properties":{"number":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["number","title","url"],"additionalProperties":false},"person":{"type":"string"},"description":{"type":["string","null"]},"kind":{"type":"string"},"role":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"billable":{"type":"boolean"},"settled":{"type":"boolean"},"via_agent":{"type":"boolean"}},"required":["id","date","start","end","minutes","task","person","description","kind","via_agent"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/time-entries/{id}":{"patch":{"operationId":"update_time_entry","summary":"Buchung ändern","description":"Changes a booking: only the fields given, the rest stays. Your own, or anybody's with tasks.admin, and never a settled one. A new duration without a start drops the stored start and end.","x-scope":"time","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The booking's id, from list_time_entries or book_time."}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"task":{"description":"Move it to another task (id or number).","type":"string"},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"duration":{"type":"string"},"start":{"type":"string","pattern":"^\\d{1,2}:\\d{2}$"},"end":{"type":"string","pattern":"^\\d{1,2}:\\d{2}$"},"description":{"type":"string","maxLength":2000},"billable":{"description":"Default: true.","type":"boolean"},"kind":{"description":"Default: work. Travel is billed at half the rate.","type":"string","enum":["work","travel"]},"role":{"description":"A billing role's id or key. Default: the role the order gives the person, if any.","type":"string"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":["string","null"]},"start":{"type":["string","null"]},"end":{"type":["string","null"]},"minutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"task":{"type":"object","properties":{"number":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["number","title","url"],"additionalProperties":false},"person":{"type":"string"},"description":{"type":["string","null"]},"kind":{"type":"string"},"role":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}},"required":["key","name"],"additionalProperties":false},{"type":"null"}]},"billable":{"type":"boolean"},"settled":{"type":"boolean"},"via_agent":{"type":"boolean"}},"required":["id","date","start","end","minutes","task","person","description","kind","via_agent"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"operationId":"delete_time_entry","summary":"Buchung löschen","description":"Deletes a booking. Your own, or anybody's with tasks.admin, and never a settled one.","x-scope":"time","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The booking's id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/time-entries/settle":{"post":{"operationId":"settle_time_entries","summary":"Buchungen als abgerechnet markieren","description":"Marks bookings as settled -- for time invoiced outside nxva.base -- or, with settled false, takes the mark off again -- never on a booking an issued service report holds. tasks.admin only. A settled booking can no longer be changed or deleted, and its task no longer moves to another order. Issuing a service report settles a whole period by itself.","x-scope":"time","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string"},"description":"The bookings' ids, from list_time_entries."},"settled":{"description":"Default: true.","type":"boolean"}},"required":["entries"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"settled":{"type":"boolean"},"entries":{"type":"array","items":{"type":"string"}}},"required":["settled","entries"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/api/v1/vat-checks":{"post":{"operationId":"record_vat_check","summary":"USt-IdNr.-Bestätigung erfassen","description":"Records that a customer's VAT ID was checked with the Federal Central Tax Office (bzst.de): the day, whether it was confirmed, and the office's answer or reference. Only for a company in another EU state. Record only a check that was actually made -- reverse charge on its invoices relies on it. Cannot be changed afterwards.","x-scope":"invoices","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string","description":"The company's id."},"checked_on":{"type":"string","description":"YYYY-MM-DD, not in the future."},"confirmed":{"type":"boolean"},"reference":{"type":"string","minLength":1,"maxLength":500,"description":"The BZSt's answer or reference."}},"required":["company","checked_on","confirmed","reference"],"additionalProperties":false}}}},"x-idempotent-with-key":true,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"vat_id":{"type":"string"},"checked_on":{"type":"string"},"confirmed":{"type":"boolean"},"reference":{"type":"string"}},"required":["company","vat_id","checked_on","confirmed","reference"],"additionalProperties":false}}}},"default":{"description":"A refusal","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}}}