Кейсы / CasesRU / EN

REST API · OpenAPI

Спецификация описывает существующий поток импорта и отчётности, а не все маршруты платформы. Привязка к версии исходников сохранена в JSON. Страница не отправляет запросы в QA и не вызывает модели.

OpenAPI 3.1.1 JSON · Swagger compatible

Authentication / Авторизация

Cookie sid · X-CSRF-Token for writes · owner/admin/analyst/observer · organisation-scoped access · 451 when current terms are required.

GET summary · Пример полей ответа

{
  "revenue": 80,
  "soldCost": 30,
  "profit": 50,
  "margin": 62.5,
  "purchases": 150,
  "stockValue": 120,
  "exact": {
    "revenue": "80.00",
    "soldCost": "30.00",
    "profit": "50.00",
    "margin": "62.50",
    "purchases": "150.00",
    "stockValue": "120.00"
  },
  "stock": [
    {
      "sku": "DEMO-TEA",
      "stock": 8,
      "available": 8,
      "unitCost": 15,
      "value": 120
    }
  ],
  "finance": {
    "asOf": "2026-11-29",
    "receivables": null,
    "payables": null,
    "overdueReceivables": null,
    "overduePayables": null
  }
}
GET /api/workspace/projects

listProjects

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome.

Contract JSON / Контракт
{
  "operationId": "listProjects",
  "summary": "listProjects",
  "description": "",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "projects": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            },
            "required": [],
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": []
}
POST /api/workspace/projects

createProject

Owner/admin. A non-empty trimmed name is required.

201: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 400: Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying., 403: CSRF validation failed on a write request, or role cannot write this resource., 409: Quota, limit or conflict.

Contract JSON / Контракт
{
  "operationId": "createProject",
  "summary": "createProject",
  "description": "Owner/admin. A non-empty trimmed name is required.",
  "responses": {
    "201": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Project"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "CSRF validation failed on a write request, or role cannot write this resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Quota, limit or conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "X-CSRF-Token",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Must match the authenticated session CSRF value; the readable csrf cookie is issued at sign-in."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ProjectInput"
        }
      }
    }
  }
}
GET /api/workspace/projects/{projectId}/summary

getProjectSummary

All authenticated project roles can read their own project summary. No role-based 403 is added to this GET route. Financial values can be null when unavailable.

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "getProjectSummary",
  "summary": "getProjectSummary",
  "description": "All authenticated project roles can read their own project summary. No role-based 403 is added to this GET route. Financial values can be null when unavailable.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Summary"
          },
          "example": {
            "revenue": 80,
            "soldCost": 30,
            "profit": 50,
            "margin": 62.5,
            "purchases": 150,
            "stockValue": 120,
            "exact": {
              "revenue": "80.00",
              "soldCost": "30.00",
              "profit": "50.00",
              "margin": "62.50",
              "purchases": "150.00",
              "stockValue": "120.00"
            },
            "stock": [
              {
                "sku": "DEMO-TEA",
                "stock": 8,
                "available": 8,
                "unitCost": 15,
                "value": 120
              }
            ],
            "finance": {
              "asOf": "2026-11-29",
              "receivables": null,
              "payables": null,
              "overdueReceivables": null,
              "overduePayables": null
            }
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    }
  ]
}
GET /api/workspace/projects/{projectId}/documents

listDocuments

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "listDocuments",
  "summary": "listDocuments",
  "description": "",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "documents": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "required": [],
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    }
  ]
}
POST /api/workspace/projects/{projectId}/documents

uploadDocument

Owner/admin; JSON base64 upload. The original file is limited to 4 MiB, with additional quota/queue checks. Upload stores the document; it does not post movements.

201: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 400: Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying., 403: CSRF validation failed on a write request, or role cannot write this resource., 404: Project/resource unavailable in the current organisation, or operation unavailable., 409: Quota, limit or conflict.

Contract JSON / Контракт
{
  "operationId": "uploadDocument",
  "summary": "uploadDocument",
  "description": "Owner/admin; JSON base64 upload. The original file is limited to 4 MiB, with additional quota/queue checks. Upload stores the document; it does not post movements.",
  "responses": {
    "201": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Document"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "CSRF validation failed on a write request, or role cannot write this resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Quota, limit or conflict.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "X-CSRF-Token",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Must match the authenticated session CSRF value; the readable csrf cookie is issued at sign-in."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Upload"
        }
      }
    }
  }
}
POST /api/workspace/projects/{projectId}/documents/{documentId}/preview

previewDocument

Owner/admin. Auto-mapping supports the control CSV with {}. Token expires in 10 minutes. Invalid rows must not yield a usable token.

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 400: Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying., 403: CSRF validation failed on a write request, or role cannot write this resource., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "previewDocument",
  "summary": "previewDocument",
  "description": "Owner/admin. Auto-mapping supports the control CSV with {}. Token expires in 10 minutes. Invalid rows must not yield a usable token.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Preview"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "CSRF validation failed on a write request, or role cannot write this resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "documentId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "X-CSRF-Token",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Must match the authenticated session CSRF value; the readable csrf cookie is issued at sign-in."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PreviewInput"
        }
      }
    }
  }
}
POST /api/import

confirmImport

Confirms the session organisation preview token. Used/expired tokens return 400. A fresh preview of duplicate movements may succeed with added=0 and skipped>0.

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 400: Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying., 403: CSRF validation failed on a write request, or role cannot write this resource.

Contract JSON / Контракт
{
  "operationId": "confirmImport",
  "summary": "confirmImport",
  "description": "Confirms the session organisation preview token. Used/expired tokens return 400. A fresh preview of duplicate movements may succeed with added=0 and skipped>0.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ImportResult"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "CSRF validation failed on a write request, or role cannot write this resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "X-CSRF-Token",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Must match the authenticated session CSRF value; the readable csrf cookie is issued at sign-in."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ImportInput"
        }
      }
    }
  }
}
GET /api/workspace/projects/{projectId}/reports

listSavedReports

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "listSavedReports",
  "summary": "listSavedReports",
  "description": "",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "reports": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            },
            "required": [],
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    }
  ]
}
POST /api/workspace/projects/{projectId}/reports

saveReport

Owner/admin/analyst can save. Observer falls through to 404 for this operation; 403 is still possible from the common write CSRF guard. A non-empty trimmed title is required.

201: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 400: Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying., 403: CSRF validation failed on a write request, or role cannot write this resource., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "saveReport",
  "summary": "saveReport",
  "description": "Owner/admin/analyst can save. Observer falls through to 404 for this operation; 403 is still possible from the common write CSRF guard. A non-empty trimmed title is required.",
  "responses": {
    "201": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Report"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, mapping, rows or token. Inspect error/errors; correct the source before retrying.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "CSRF validation failed on a write request, or role cannot write this resource.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "X-CSRF-Token",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Must match the authenticated session CSRF value; the readable csrf cookie is issued at sign-in."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReportInput"
        }
      }
    }
  }
}
GET /api/workspace/projects/{projectId}/reports/{reportId}

getSavedReport

Returns the immutable saved snapshot, not a recalculation of current movements.

200: Success, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "getSavedReport",
  "summary": "getSavedReport",
  "description": "Returns the immutable saved snapshot, not a recalculation of current movements.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Report"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "reportId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    }
  ]
}
GET /api/workspace/projects/{projectId}/reports/{reportId}/pdf

downloadSavedReportPdf

200: Saved report bytes, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "downloadSavedReportPdf",
  "summary": "downloadSavedReportPdf",
  "description": "",
  "responses": {
    "200": {
      "description": "Saved report bytes",
      "content": {
        "application/pdf": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "reportId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "lang",
      "in": "query",
      "schema": {
        "type": "string",
        "enum": [
          "ru",
          "en"
        ],
        "default": "en"
      },
      "description": "Used by PDF rendering; omitted for Excel output."
    }
  ]
}
GET /api/workspace/projects/{projectId}/reports/{reportId}/excel

downloadSavedReportExcel

200: Saved report bytes, 401: Session missing or expired., 451: Current terms have not been accepted when legal enforcement is enabled., 503: Required PostgreSQL workspace or processing service unavailable., 500: Internal error. Do not blindly retry an import with an unknown outcome., 404: Project/resource unavailable in the current organisation, or operation unavailable.

Contract JSON / Контракт
{
  "operationId": "downloadSavedReportExcel",
  "summary": "downloadSavedReportExcel",
  "description": "",
  "responses": {
    "200": {
      "description": "Saved report bytes",
      "content": {
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "401": {
      "description": "Session missing or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "451": {
      "description": "Current terms have not been accepted when legal enforcement is enabled.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Required PostgreSQL workspace or processing service unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal error. Do not blindly retry an import with an unknown outcome.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Project/resource unavailable in the current organisation, or operation unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "tags": [
    "Import and reporting"
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "reportId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{32}$"
      }
    },
    {
      "name": "lang",
      "in": "query",
      "schema": {
        "type": "string",
        "enum": [
          "ru",
          "en"
        ],
        "default": "en"
      },
      "description": "Used by PDF rendering; omitted for Excel output."
    }
  ]
}