# Una API

Version: 0.6.5

Auto-generated OpenAPI definition for all enabled modules.

## Servers
- https://151.115.63.33.sslip.io/api – Default environment

## DELETE `/attachments`

Delete attachment

Removes an uploaded attachment and deletes the stored asset.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Required |

### Responses

**200** – Attachment deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing attachment identifier

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachment not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/attachments?id=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/attachments`

List attachments for a record

Returns uploaded attachments for the given entity record, ordered by newest first.

Requires features: attachments.view

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Required. Entity identifier that owns the attachments |
| recordId | query | any | Required. Record identifier within the entity |
| page | query | any | Optional |
| pageSize | query | any | Optional |

### Responses

**200** – Attachments found for the record

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "string",
      "url": "string",
      "fileName": "string",
      "fileSize": 1,
      "createdAt": "string",
      "mimeType": null,
      "content": null
    }
  ]
}
```

**400** – Missing entity or record identifiers

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments?entityId=string&recordId=string" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/attachments`

Upload attachment

Uploads a new attachment using multipart form-data and stores metadata for later retrieval.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Request Body

Content-Type: `multipart/form-data`

```text
entityId=string
recordId=string
file=string
```

### Responses

**200** – Attachment stored successfully

Content-Type: `application/json`

```json
{
  "ok": true,
  "item": {
    "id": "string",
    "url": "string",
    "fileName": "string",
    "fileSize": 1,
    "content": null
  }
}
```

**400** – Payload validation error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/attachments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: multipart/form-data" \
  -d "{
  \"entityId\": \"string\",
  \"recordId\": \"string\",
  \"file\": \"string\"
}"
```

## GET `/attachments/file/{id}`

Download or serve attachment file

Returns the raw file content for an attachment. Path parameter: {id} - Attachment UUID. Query parameter: ?download=1 - Force file download with Content-Disposition header. Access control is enforced based on partition settings.

**Tags:** Attachments

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – File content with appropriate MIME type

Content-Type: `application/json`

**400** – Missing attachment ID

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**401** – Unauthorized - authentication required for private partitions

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**403** – Forbidden - insufficient permissions

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachment or file not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Partition misconfigured

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments/file/:id" \
  -H "Accept: application/json"
```

## GET `/attachments/image/{id}/{slug}`

Serve image with optional resizing

Returns an image attachment with optional on-the-fly resizing and cropping. Resized images are cached for performance. Only works with image MIME types. Path parameter: {id} - Attachment UUID. Query parameters: ?width=N (1-4000 pixels), ?height=N (1-4000 pixels), ?cropType=cover|contain (resize behavior).

**Tags:** Attachments

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |
| slug | path | any | Optional |

### Responses

**200** – Binary image content (Content-Type: image/jpeg, image/png, etc.)

Content-Type: `application/json`

**400** – Invalid parameters, missing ID, or non-image attachment

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**401** – Unauthorized - authentication required for private partitions

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**403** – Forbidden - insufficient permissions

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Image not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Partition misconfigured or image rendering failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments/image/:id/:slug" \
  -H "Accept: application/json"
```

## GET `/attachments/library`

List attachments

Returns paginated list of attachments with optional filtering by search term, partition, and tags. Includes available tags and partitions.

Requires features: attachments.view

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional. Page number for pagination |
| pageSize | query | any | Optional. Number of items per page (max 100) |
| search | query | any | Optional. Search by file name (case-insensitive) |
| partition | query | any | Optional. Filter by partition code |
| tags | query | any | Optional. Filter by tags (comma-separated) |
| sortField | query | any | Optional. Field to sort by |
| sortDir | query | any | Optional. Sort direction |

### Responses

**200** – Attachments list with pagination and metadata

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "fileName": "string",
      "fileSize": 1,
      "mimeType": "string",
      "partitionCode": "string",
      "partitionTitle": null,
      "url": null,
      "createdAt": "string",
      "tags": [
        "string"
      ],
      "assignments": [],
      "content": null
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 1,
  "totalPages": 1,
  "availableTags": [
    "string"
  ],
  "partitions": [
    {
      "code": "string",
      "title": "string",
      "description": null,
      "isPublic": true
    }
  ]
}
```

**400** – Invalid query parameters

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments/library?page=1&pageSize=25" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/attachments/library/{id}`

Delete attachment

Permanently deletes an attachment file from storage and database. Emits CRUD side effects.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Attachment deleted successfully

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid attachment ID

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachment not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/attachments/library/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/attachments/library/{id}`

Get attachment details

Returns complete details of an attachment including metadata, tags, assignments, and custom fields.

Requires features: attachments.view

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Attachment details

Content-Type: `application/json`

```json
{
  "item": {
    "id": "00000000-0000-4000-8000-000000000000",
    "fileName": "string",
    "fileSize": 1,
    "mimeType": "string",
    "partitionCode": "string",
    "partitionTitle": null,
    "tags": [
      "string"
    ],
    "assignments": [],
    "content": null,
    "customFields": null
  }
}
```

**400** – Invalid attachment ID

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachment not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments/library/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PATCH `/attachments/library/{id}`

Update attachment metadata

Updates attachment tags, assignments, and custom fields. Emits CRUD side effects for indexing and events.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Attachment updated successfully

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid payload or attachment ID

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachment not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Failed to save attributes

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PATCH "https://151.115.63.33.sslip.io/api/attachments/library/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## DELETE `/attachments/partitions`

Delete partition

Deletes a partition. Default partitions cannot be deleted. Partitions with existing attachments cannot be deleted.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Responses

**200** – Partition deleted successfully

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid ID or default partition deletion attempt

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Partition not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – Partition in use

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/attachments/partitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/attachments/partitions`

List all attachment partitions

Returns all configured attachment partitions with storage settings, OCR configuration, and access control settings.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Responses

**200** – List of partitions

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "title": "string",
      "description": null,
      "isPublic": true,
      "requiresOcr": true,
      "ocrModel": null,
      "configJson": null,
      "createdAt": null,
      "updatedAt": null,
      "envKey": "string"
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/attachments/partitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/attachments/partitions`

Create new partition

Creates a new attachment partition with specified storage and OCR settings. Requires unique partition code.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "title": "string",
  "description": null,
  "ocrModel": null,
  "storageDriver": "local",
  "configJson": null
}
```

### Responses

**201** – Partition created successfully

Content-Type: `application/json`

```json
{
  "item": {
    "id": "00000000-0000-4000-8000-000000000000",
    "code": "string",
    "title": "string",
    "description": null,
    "isPublic": true,
    "requiresOcr": true,
    "ocrModel": null,
    "configJson": null,
    "createdAt": null,
    "updatedAt": null,
    "envKey": "string"
  }
}
```

**400** – Invalid payload or partition code

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – Partition code already exists

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/attachments/partitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"title\": \"string\",
  \"description\": null,
  \"ocrModel\": null,
  \"storageDriver\": \"local\",
  \"configJson\": null
}"
```

## PUT `/attachments/partitions`

Update partition

Updates an existing partition. Partition code cannot be changed. Title, description, OCR settings, and access control can be modified.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "title": "string",
  "description": null,
  "ocrModel": null,
  "storageDriver": "local",
  "configJson": null,
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Partition updated successfully

Content-Type: `application/json`

```json
{
  "item": {
    "id": "00000000-0000-4000-8000-000000000000",
    "code": "string",
    "title": "string",
    "description": null,
    "isPublic": true,
    "requiresOcr": true,
    "ocrModel": null,
    "configJson": null,
    "createdAt": null,
    "updatedAt": null,
    "envKey": "string"
  }
}
```

**400** – Invalid payload or code change attempt

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Partition not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/attachments/partitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"title\": \"string\",
  \"description\": null,
  \"ocrModel\": null,
  \"storageDriver\": \"local\",
  \"configJson\": null,
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## POST `/attachments/transfer`

Transfer attachments to different record

Transfers one or more attachments from one record to another within the same entity type. Updates attachment assignments and metadata to reflect the new record.

Requires features: attachments.manage

**Tags:** Attachments

**Requires authentication.**

**Features:** attachments.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "attachmentIds": [
    "00000000-0000-4000-8000-000000000000"
  ],
  "toRecordId": "string"
}
```

### Responses

**200** – Attachments transferred successfully

Content-Type: `application/json`

```json
{
  "ok": true,
  "updated": 1
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Attachments not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Attachment model missing

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/attachments/transfer" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"attachmentIds\": [
    \"00000000-0000-4000-8000-000000000000\"
  ],
  \"toRecordId\": \"string\"
}"
```

## GET `/audit_logs/audit-logs/access`

Retrieve access logs

Fetches paginated access audit logs scoped to the authenticated user. Tenant administrators can optionally expand the search to other actors or organizations.

Requires features: audit_logs.view_self

**Tags:** Audit & Action Logs

**Requires authentication.**

**Features:** audit_logs.view_self

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| organizationId | query | any | Optional. Limit results to a specific organization |
| actorUserId | query | any | Optional. Filter by actor user id (tenant administrators only) |
| resourceKind | query | any | Optional. Restrict to a resource kind such as `order` or `product` |
| accessType | query | any | Optional. Access type filter, e.g. `read` or `export` |
| page | query | any | Optional. Page number (default 1) |
| pageSize | query | any | Optional. Page size (default 50) |
| limit | query | any | Optional. Explicit maximum number of records when paginating manually |
| before | query | any | Optional. Return logs created before this ISO-8601 timestamp |
| after | query | any | Optional. Return logs created after this ISO-8601 timestamp |

### Responses

**200** – Access logs returned successfully

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "string",
      "resourceKind": "string",
      "resourceId": "string",
      "accessType": "string",
      "actorUserId": null,
      "actorUserName": null,
      "tenantId": null,
      "tenantName": null,
      "organizationId": null,
      "organizationName": null,
      "fields": [
        "string"
      ],
      "context": null,
      "createdAt": "string"
    }
  ],
  "canViewTenant": true,
  "page": 1,
  "pageSize": 1,
  "total": 1,
  "totalPages": 1
}
```

**400** – Invalid filters supplied

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/audit_logs/audit-logs/access" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/audit_logs/audit-logs/actions`

Fetch action logs

Returns recent action audit log entries. Tenant administrators can widen the scope to other actors or organizations, and callers can optionally restrict results to undoable actions.

Requires features: audit_logs.view_self

**Tags:** Audit & Action Logs

**Requires authentication.**

**Features:** audit_logs.view_self

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| organizationId | query | any | Optional. Limit results to a specific organization |
| actorUserId | query | any | Optional. Filter logs created by specific actor IDs (tenant administrators only). Accepts a single UUID or a comma-separated UUID list. |
| resourceKind | query | any | Optional. Filter by resource kind (e.g., "order", "product") |
| resourceId | query | any | Optional. Filter by resource ID (UUID of the specific record) |
| actionType | query | any | Optional. Filter by action type (`create`, `edit`, `delete`, `assign`). Accepts a single value or a comma-separated list. |
| fieldName | query | any | Optional. Filter to entries where the given field changed. Accepts a single field name or a comma-separated list. |
| includeRelated | query | any | Optional. When `true`, also returns changes to child entities linked via parentResourceKind/parentResourceId |
| includeTotal | query | any | Optional. When `true`, the response includes the filtered total count. |
| undoableOnly | query | any | Optional. When `true`, only undoable actions are returned |
| limit | query | any | Optional. Maximum number of records to return (default 50, max 1000) |
| offset | query | any | Optional. Zero-based record offset for pagination (legacy — prefer page/pageSize) |
| page | query | any | Optional. Page number (default 1) |
| pageSize | query | any | Optional. Page size (default 50, max 200) |
| sortField | query | any | Optional. Sort field: `createdAt`, `user`, `action`, `field`, or `source`. |
| sortDir | query | any | Optional. Sort direction: `asc` or `desc`. |
| before | query | any | Optional. Return actions created before this ISO-8601 timestamp |
| after | query | any | Optional. Return actions created after this ISO-8601 timestamp |

### Responses

**200** – Action logs retrieved successfully

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "string",
      "commandId": "string",
      "actionLabel": null,
      "executionState": "done",
      "actorUserId": null,
      "actorUserName": null,
      "tenantId": null,
      "tenantName": null,
      "organizationId": null,
      "organizationName": null,
      "resourceKind": null,
      "resourceId": null,
      "parentResourceKind": null,
      "parentResourceId": null,
      "undoToken": null,
      "createdAt": "string",
      "updatedAt": "string",
      "snapshotBefore": null,
      "snapshotAfter": null,
      "changes": null,
      "context": null
    }
  ],
  "canViewTenant": true,
  "page": 1,
  "pageSize": 1,
  "total": 1,
  "totalPages": 1
}
```

**400** – Invalid filter values

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/audit_logs/audit-logs/actions?includeRelated=false&includeTotal=false&undoableOnly=false" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/audit_logs/audit-logs/actions/export`

Export action logs as CSV

Returns a CSV attachment containing filtered action audit log entries. Tenant administrators can widen the scope to other actors or organizations.

Requires features: audit_logs.view_self

**Tags:** Audit & Action Logs

**Requires authentication.**

**Features:** audit_logs.view_self

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| organizationId | query | any | Optional. Limit results to a specific organization |
| actorUserId | query | any | Optional. Filter logs created by specific actor IDs (tenant administrators only). Accepts a single UUID or a comma-separated UUID list. |
| resourceKind | query | any | Optional. Filter by resource kind (e.g., "order", "product") |
| resourceId | query | any | Optional. Filter by resource ID (UUID of the specific record) |
| actionType | query | any | Optional. Filter by action type (`create`, `edit`, `delete`, `assign`). Accepts a single value or a comma-separated list. |
| fieldName | query | any | Optional. Filter to entries where the given field changed. Accepts a single field name or a comma-separated list. |
| includeRelated | query | any | Optional. When `true`, also returns changes to child entities linked via parentResourceKind/parentResourceId |
| undoableOnly | query | any | Optional. When `true`, only undoable actions are returned |
| limit | query | any | Optional. Maximum number of records to export (default 1000, capped at 1000) |
| sortField | query | any | Optional. Sort field: `createdAt`, `user`, `action`, `field`, or `source`. |
| sortDir | query | any | Optional. Sort direction: `asc` or `desc`. |
| before | query | any | Optional. Return actions created before this ISO-8601 timestamp |
| after | query | any | Optional. Return actions created after this ISO-8601 timestamp |

### Responses

**200** – CSV export generated successfully

Content-Type: `application/json`

```json
{
  "file": "csv"
}
```

**400** – Invalid filter values

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/audit_logs/audit-logs/actions/export?includeRelated=false&undoableOnly=false" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/audit_logs/audit-logs/actions/redo`

Redo by action log id

Redoes the latest undone command owned by the caller. Requires the action to still be eligible for redo within tenant and organization scope.

Requires features: audit_logs.redo_self

**Tags:** Audit & Action Logs

**Requires authentication.**

**Features:** audit_logs.redo_self

### Request Body

Content-Type: `application/json`

```json
{
  "logId": "string"
}
```

### Responses

**200** – Redo executed successfully

Content-Type: `application/json`

```json
{
  "ok": true,
  "logId": null,
  "undoToken": null
}
```

**400** – Log not eligible for redo

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/audit_logs/audit-logs/actions/redo" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"logId\": \"string\"
}"
```

## POST `/audit_logs/audit-logs/actions/undo`

Undo action by token

Replays the undo handler registered for a command. The provided undo token must match the latest undoable log entry accessible to the caller.

Requires features: audit_logs.undo_self

**Tags:** Audit & Action Logs

**Requires authentication.**

**Features:** audit_logs.undo_self

### Request Body

Content-Type: `application/json`

```json
{
  "undoToken": "string"
}
```

### Responses

**200** – Undo applied successfully

Content-Type: `application/json`

```json
{
  "ok": true,
  "logId": "string"
}
```

**400** – Invalid or unavailable undo token

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/audit_logs/audit-logs/actions/undo" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"undoToken\": \"string\"
}"
```

## GET `/auth/admin/nav`

Resolve backend chrome bootstrap payload

Returns the backend chrome payload available to the authenticated administrator after applying scope, RBAC, role defaults, and personal sidebar preferences.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Responses

**200** – Backend chrome payload

Content-Type: `application/json`

```json
{
  "brand": null,
  "groups": [
    {
      "name": "string",
      "items": [
        {
          "href": "string",
          "title": "string"
        }
      ]
    }
  ],
  "settingsSections": [
    {
      "id": "string",
      "label": "string",
      "items": [
        {
          "id": "string",
          "label": "string",
          "href": "string"
        }
      ]
    }
  ],
  "settingsPathPrefixes": [
    "string"
  ],
  "profileSections": [
    {
      "id": "string",
      "label": "string",
      "items": [
        {
          "id": "string",
          "label": "string",
          "href": "string"
        }
      ]
    }
  ],
  "profilePathPrefixes": [
    "string"
  ],
  "grantedFeatures": [
    "string"
  ],
  "roles": [
    "string"
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/admin/nav" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/auth/feature-check`

Check feature grants for the current user

Evaluates which of the requested features are available to the signed-in user within the active tenant / organization context.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Request Body

Content-Type: `application/json`

```json
{
  "features": [
    "string"
  ]
}
```

### Responses

**200** – Evaluation result

Content-Type: `application/json`

```json
{
  "ok": true,
  "granted": [
    "string"
  ],
  "userId": "string"
}
```

**400** – Invalid request — features array missing, too large, or contains invalid entries

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/feature-check" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"features\": [
    \"string\"
  ]
}"
```

## GET `/auth/features`

List declared feature flags

Returns all static features contributed by the enabled modules along with their module source.

Requires features: auth.acl.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.acl.manage

### Responses

**200** – Aggregated feature catalog

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "string",
      "title": "string",
      "module": "string"
    }
  ],
  "modules": [
    {
      "id": "string",
      "title": "string"
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/features" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/locale`

Set locale and redirect

Stores the selected locale in a cookie and redirects to a safe local path.

**Tags:** Authentication & Accounts

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| locale | query | any | Required |
| redirect | query | any | Optional |

### Responses

**200** – Success response

Content-Type: `application/json`

**302** – Locale cookie set and request redirected

Content-Type: `application/json`

**400** – Invalid locale

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/locale?locale=en" \
  -H "Accept: application/json"
```

## POST `/auth/locale`

Set locale

Stores the selected locale in a cookie and returns a JSON success response.

**Tags:** Authentication & Accounts

### Request Body

Content-Type: `application/json`

```json
{
  "locale": "en"
}
```

### Responses

**200** – Locale cookie set

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid locale or malformed request body

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/locale" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d "{
  \"locale\": \"en\"
}"
```

## POST `/auth/login`

Authenticate user credentials

Validates the submitted credentials and issues a bearer token cookie for subsequent API calls.

**Tags:** Authentication & Accounts

### Request Body

Content-Type: `application/x-www-form-urlencoded`

```text
email=user%40example.com&password=string
```

### Responses

**200** – Authentication succeeded

Content-Type: `application/json`

```json
{
  "ok": true,
  "token": "string",
  "redirect": null
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**401** – Invalid credentials

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**403** – User lacks required role

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**429** – Too many login attempts

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/login" \
  -H "Accept: application/json" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "email=user%40example.com&password=string"
```

## POST `/auth/logout`

Invalidate session and redirect

Clears authentication cookies and redirects the browser to the login page.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Responses

**201** – Success response

Content-Type: `application/json`

**302** – Redirect to login after successful logout

Content-Type: `text/html`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/logout" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/profile`

Get current profile

Returns the email address for the signed-in user.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Responses

**200** – Profile payload

Content-Type: `application/json`

```json
{
  "email": "user@example.com",
  "roles": [
    "string"
  ]
}
```

**404** – User not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/profile" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/auth/profile`

Update current profile

Updates the email address or password for the signed-in user.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Profile updated

Content-Type: `application/json`

```json
{
  "ok": true,
  "email": "user@example.com"
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/profile" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## POST `/auth/reset`

Send reset email

Requests a password reset email for the given account. The endpoint always returns `ok: true` to avoid leaking account existence.

**Tags:** Authentication & Accounts

### Request Body

Content-Type: `application/x-www-form-urlencoded`

```text
email=user%40example.com
```

### Responses

**200** – Reset email dispatched (or ignored for unknown accounts)

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid request origin

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**429** – Too many password reset requests

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Password reset email origin is not configured

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/reset" \
  -H "Accept: application/json" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "email=user%40example.com"
```

## POST `/auth/reset/confirm`

Complete password reset

Validates the reset token and updates the user password.

**Tags:** Authentication & Accounts

### Request Body

Content-Type: `application/x-www-form-urlencoded`

```text
token=string&password=string
```

### Responses

**200** – Password reset succeeded

Content-Type: `application/json`

```json
{
  "ok": true,
  "redirect": "string"
}
```

**400** – Invalid token or payload

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**429** – Too many reset confirmation attempts

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/reset/confirm" \
  -H "Accept: application/json" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "token=string&password=string"
```

## DELETE `/auth/roles`

Delete role

Deletes a role by identifier. Fails when users remain assigned.

Requires features: auth.roles.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.roles.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Required. Role identifier |

### Responses

**200** – Role deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Role cannot be deleted

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/auth/roles?id=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/roles`

List roles

Returns available roles within the current tenant. Super administrators receive visibility across tenants.

Requires features: auth.roles.list

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.roles.list

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| tenantId | query | any | Optional |

### Responses

**200** – Role collection

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "usersCount": 1,
      "tenantId": null,
      "tenantName": null,
      "updatedAt": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/roles?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/auth/roles`

Create role

Creates a new role for the current tenant or globally when `tenantId` is omitted.

Requires features: auth.roles.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.roles.manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string"
}
```

### Responses

**201** – Role created

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/roles" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\"
}"
```

## PUT `/auth/roles`

Update role

Updates mutable fields on an existing role.

Requires features: auth.roles.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.roles.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Role updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/roles" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/auth/roles/acl`

Fetch role ACL

Returns the feature and organization assignments associated with a role within the current tenant.

Requires features: auth.acl.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.acl.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| roleId | query | any | Required |
| tenantId | query | any | Optional |

### Responses

**200** – Role ACL entry

Content-Type: `application/json`

```json
{
  "isSuperAdmin": true,
  "features": [
    "string"
  ],
  "organizations": null,
  "updatedAt": null
}
```

**400** – Invalid role id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/roles/acl?roleId=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/auth/roles/acl`

Update role ACL

Replaces the feature list, super admin flag, and optional organization assignments for a role.

Requires features: auth.acl.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.acl.manage

### Request Body

Content-Type: `application/json`

```json
{
  "roleId": "00000000-0000-4000-8000-000000000000",
  "organizations": null
}
```

### Responses

**200** – Role ACL updated

Content-Type: `application/json`

```json
{
  "ok": true,
  "sanitized": true
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/roles/acl" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"roleId\": \"00000000-0000-4000-8000-000000000000\",
  \"organizations\": null
}"
```

## GET `/auth/session/refresh`

Refresh auth cookie from session token (browser)

Exchanges an existing `session_token` cookie for a fresh JWT auth cookie and redirects the browser.

**Tags:** Authentication & Accounts

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| redirect | query | any | Optional. Absolute or relative URL to redirect after refresh |

### Responses

**200** – Success response

Content-Type: `application/json`

**302** – Redirect to target location when session is valid

Content-Type: `text/html`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/session/refresh" \
  -H "Accept: application/json"
```

## POST `/auth/session/refresh`

Refresh access token (API/mobile)

Exchanges a refresh token for a new JWT access token. Pass the refresh token obtained from login in the request body.

**Tags:** Authentication & Accounts

### Request Body

Content-Type: `application/json`

```json
{
  "refreshToken": "string"
}
```

### Responses

**200** – New access token issued

Content-Type: `application/json`

```json
{
  "ok": true,
  "accessToken": "string",
  "expiresIn": 1
}
```

**400** – Missing refresh token

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**401** – Invalid or expired token

Content-Type: `application/json`

```json
{
  "ok": false,
  "error": "string"
}
```

**429** – Too many refresh attempts

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/session/refresh" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d "{
  \"refreshToken\": \"string\"
}"
```

## DELETE `/auth/sidebar/preferences`

Delete a role sidebar variant

Removes the role variant for the current tenant + locale. Idempotent. Requires `auth.sidebar.manage`.

Requires features: auth.sidebar.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.sidebar.manage

### Responses

**200** – Variant deleted (or never existed)

Content-Type: `application/json`

```json
{
  "ok": true,
  "scope": {
    "type": "user"
  }
}
```

**400** – Missing roleId query parameter

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found in current tenant scope

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/auth/sidebar/preferences" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/sidebar/preferences`

Get sidebar preferences

Returns sidebar customization for the current user (default) or the specified role (`?roleId=…`, requires `auth.sidebar.manage`).

**Tags:** Authentication & Accounts

**Requires authentication.**

### Responses

**200** – Current sidebar configuration

Content-Type: `application/json`

```json
{
  "locale": "string",
  "settings": {
    "version": 1,
    "groupOrder": [
      "string"
    ],
    "groupLabels": {
      "key": "string"
    },
    "itemLabels": {
      "key": "string"
    },
    "hiddenItems": [
      "string"
    ],
    "itemOrder": {
      "key": [
        "string"
      ]
    }
  },
  "canApplyToRoles": true,
  "roles": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "hasPreference": true
    }
  ],
  "scope": {
    "type": "user"
  },
  "updatedAt": null
}
```

**403** – Missing features for role-scope read

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found in current tenant scope

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/sidebar/preferences" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/auth/sidebar/preferences`

Update sidebar preferences

Updates sidebar configuration. With `scope.type === "user"` (default) writes the calling user's personal preferences and may optionally apply the same settings to selected roles via `applyToRoles[]`. With `scope.type === "role"` writes the named role variant directly (requires `auth.sidebar.manage`); `applyToRoles[]` and `clearRoleIds[]` are rejected in this mode.

Requires features: auth.sidebar.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.sidebar.manage

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Preferences saved

Content-Type: `application/json`

```json
{
  "locale": "string",
  "settings": {
    "version": 1,
    "groupOrder": [
      "string"
    ],
    "groupLabels": {
      "key": "string"
    },
    "itemLabels": {
      "key": "string"
    },
    "hiddenItems": [
      "string"
    ],
    "itemOrder": {
      "key": [
        "string"
      ]
    }
  },
  "canApplyToRoles": true,
  "roles": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "hasPreference": true
    }
  ],
  "scope": {
    "type": "user"
  },
  "updatedAt": null,
  "appliedRoles": [
    "00000000-0000-4000-8000-000000000000"
  ],
  "clearedRoles": [
    "00000000-0000-4000-8000-000000000000"
  ]
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Role not found in current tenant scope

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/sidebar/preferences" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## GET `/auth/sidebar/variants`

List sidebar variants

Returns the named sidebar variants saved by the current user for the current tenant + locale.

**Tags:** Authentication & Accounts

**Requires authentication.**

### Responses

**200** – Variant list

Content-Type: `application/json`

```json
{
  "locale": "string",
  "variants": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "isActive": true,
      "settings": {
        "version": 1,
        "groupOrder": [
          "string"
        ],
        "groupLabels": {
          "key": "string"
        },
        "itemLabels": {
          "key": "string"
        },
        "hiddenItems": [
          "string"
        ],
        "itemOrder": {
          "key": [
            "string"
          ]
        }
      },
      "createdAt": "string",
      "updatedAt": null
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/sidebar/variants" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/auth/sidebar/variants`

Create a sidebar variant

Creates a new variant. If `name` is omitted or blank, an auto-name like "My preferences", "My preferences 2", … is assigned.

Requires features: auth.sidebar.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.sidebar.manage

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Variant created

Content-Type: `application/json`

```json
{
  "locale": "string",
  "variant": {
    "id": "00000000-0000-4000-8000-000000000000",
    "name": "string",
    "isActive": true,
    "settings": {
      "version": 1,
      "groupOrder": [
        "string"
      ],
      "groupLabels": {
        "key": "string"
      },
      "itemLabels": {
        "key": "string"
      },
      "hiddenItems": [
        "string"
      ],
      "itemOrder": {
        "key": [
          "string"
        ]
      }
    },
    "createdAt": "string",
    "updatedAt": null
  }
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/sidebar/variants" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## DELETE `/auth/sidebar/variants/{id}`

Delete a sidebar variant

Soft-deletes the variant (sets deleted_at).

Requires features: auth.sidebar.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.sidebar.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Variant deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**404** – Variant not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/auth/sidebar/variants/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/sidebar/variants/{id}`

Get a sidebar variant

**Tags:** Authentication & Accounts

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Variant

Content-Type: `application/json`

```json
{
  "locale": "string",
  "variant": {
    "id": "00000000-0000-4000-8000-000000000000",
    "name": "string",
    "isActive": true,
    "settings": {
      "version": 1,
      "groupOrder": [
        "string"
      ],
      "groupLabels": {
        "key": "string"
      },
      "itemLabels": {
        "key": "string"
      },
      "hiddenItems": [
        "string"
      ],
      "itemOrder": {
        "key": [
          "string"
        ]
      }
    },
    "createdAt": "string",
    "updatedAt": null
  }
}
```

**404** – Variant not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/sidebar/variants/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/auth/sidebar/variants/{id}`

Update a sidebar variant

Updates the variant's name, settings, and/or isActive flag. Setting `isActive: true` deactivates other variants in the same scope (only one active per user/tenant/locale).

Requires features: auth.sidebar.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.sidebar.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Variant updated

Content-Type: `application/json`

```json
{
  "locale": "string",
  "variant": {
    "id": "00000000-0000-4000-8000-000000000000",
    "name": "string",
    "isActive": true,
    "settings": {
      "version": 1,
      "groupOrder": [
        "string"
      ],
      "groupLabels": {
        "key": "string"
      },
      "itemLabels": {
        "key": "string"
      },
      "hiddenItems": [
        "string"
      ],
      "itemOrder": {
        "key": [
          "string"
        ]
      }
    },
    "createdAt": "string",
    "updatedAt": null
  }
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Variant not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/sidebar/variants/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## DELETE `/auth/users`

Delete user

Deletes a user by identifier. Undo support is provided via the command bus.

Requires features: auth.users.delete

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.users.delete

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Required. User identifier |

### Responses

**200** – User deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – User cannot be deleted

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – User not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/auth/users?id=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/auth/users`

List users

Returns users for the effective selected tenant and organization scope. Search matches email, organization name, and role name. Super administrators may scope the response via the topbar context, organization filters, or role filters.

Requires features: auth.users.list

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.users.list

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| name | query | any | Optional |
| organizationId | query | any | Optional |
| roleIds | query | any | Optional |

### Responses

**200** – User collection

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "email": "user@example.com",
      "name": null,
      "organizationId": null,
      "organizationName": null,
      "tenantId": null,
      "tenantName": null,
      "roles": [
        "string"
      ],
      "updatedAt": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/users?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/auth/users`

Create user

Creates a new confirmed user within the specified organization, optional display name, and optional roles.

Requires features: auth.users.create

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.users.create

### Request Body

Content-Type: `application/json`

```json
{
  "email": "user@example.com",
  "name": null,
  "organizationId": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**201** – User created

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

**400** – Invalid payload or duplicate email

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/users" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"email\": \"user@example.com\",
  \"name\": null,
  \"organizationId\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## PUT `/auth/users`

Update user

Updates profile fields including display name, organization assignment, credentials, or role memberships.

Requires features: auth.users.edit

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.users.edit

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "name": null
}
```

### Responses

**200** – User updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – User not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/users" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\",
  \"name\": null
}"
```

## GET `/auth/users/acl`

Fetch user ACL

Returns custom ACL overrides for a user within the current tenant, if any.

Requires features: auth.acl.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.acl.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| userId | query | any | Required |

### Responses

**200** – User ACL entry

Content-Type: `application/json`

```json
{
  "hasCustomAcl": true,
  "isSuperAdmin": true,
  "features": [
    "string"
  ],
  "organizations": null,
  "updatedAt": null
}
```

**400** – Invalid user id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/users/acl?userId=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/auth/users/acl`

Update user ACL

Configures per-user ACL overrides, including super admin access, feature list, and organization scope.

Requires features: auth.acl.manage

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.acl.manage

### Request Body

Content-Type: `application/json`

```json
{
  "userId": "00000000-0000-4000-8000-000000000000",
  "organizations": null
}
```

### Responses

**200** – User ACL updated

Content-Type: `application/json`

```json
{
  "ok": true,
  "sanitized": true
}
```

**400** – Invalid payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/auth/users/acl" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"userId\": \"00000000-0000-4000-8000-000000000000\",
  \"organizations\": null
}"
```

## GET `/auth/users/consents`

List user consents

Returns all consent records for a given user, with integrity verification status.

Requires features: auth.users.edit

**Tags:** Auth

**Requires authentication.**

**Features:** auth.users.edit

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| userId | query | any | Required |

### Responses

**200** – Consent list returned

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/auth/users/consents?userId=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/auth/users/resend-invite`

Resend invitation email

Resends the invitation email to a user who has not yet set up their password. Generates a new 48-hour setup token and invalidates prior tokens.

Requires features: auth.users.create

**Tags:** Authentication & Accounts

**Requires authentication.**

**Features:** auth.users.create

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Invite email sent

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid request origin

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – User not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – User already has a password

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**422** – Validation error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**429** – Rate limit exceeded

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Invitation email origin is not configured

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/auth/users/resend-invite" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/billing/accounts`

List billing accounts

Returns a paginated collection of billing accounts scoped to the authenticated organization.

Requires features: billing.view

**Tags:** Billing

**Requires authentication.**

**Features:** billing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| customerId | query | any | Optional |
| contractId | query | any | Optional |
| status | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated billing accounts

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "balance": "string",
      "currency": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/billing/accounts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/billing/invoices`

List invoices

Returns a paginated collection of invoices scoped to the authenticated organization.

Requires features: billing.view

**Tags:** Billing

**Requires authentication.**

**Features:** billing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| customerId | query | any | Optional |
| buyerId | query | any | Optional |
| contractId | query | any | Optional |
| ppgId | query | any | Optional |
| status | query | any | Optional |
| asOf | query | any | Optional |
| periodFrom | query | any | Optional |
| periodTo | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| sort | query | any | Optional |
| order | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated invoices

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "status": "string",
      "buyerId": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "totalGross": "string",
      "issueDate": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/billing/invoices" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/billing/invoices`

Create invoice

Issue a gas invoice.

Requires features: billing.manage

**Tags:** Billing

**Requires authentication.**

**Features:** billing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "buyerId": "00000000-0000-4000-8000-000000000000",
  "contractId": "00000000-0000-4000-8000-000000000000",
  "issueDate": "string",
  "periodFrom": "string",
  "periodTo": "string",
  "totalNet": "string",
  "totalVat": "string",
  "totalGross": "string",
  "amountDue": "string",
  "validFrom": "string",
  "lines": [
    {
      "invoiceId": "00000000-0000-4000-8000-000000000000",
      "service": "Gaz",
      "qty": "string",
      "unit": "string",
      "unitPrice": "string",
      "net": "string",
      "vatRate": "string",
      "vatAmount": "string",
      "gross": "string",
      "tariffScope": "SPRZEDAWCA"
    }
  ]
}
```

### Responses

**201** – Invoice created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/billing/invoices" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"buyerId\": \"00000000-0000-4000-8000-000000000000\",
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"issueDate\": \"string\",
  \"periodFrom\": \"string\",
  \"periodTo\": \"string\",
  \"totalNet\": \"string\",
  \"totalVat\": \"string\",
  \"totalGross\": \"string\",
  \"amountDue\": \"string\",
  \"validFrom\": \"string\",
  \"lines\": [
    {
      \"invoiceId\": \"00000000-0000-4000-8000-000000000000\",
      \"service\": \"Gaz\",
      \"qty\": \"string\",
      \"unit\": \"string\",
      \"unitPrice\": \"string\",
      \"net\": \"string\",
      \"vatRate\": \"string\",
      \"vatAmount\": \"string\",
      \"gross\": \"string\",
      \"tariffScope\": \"SPRZEDAWCA\"
    }
  ]
}"
```

## GET `/billing/invoices/{id}/pdf`

Generate invoice PDF

Requires features: billing.view

**Tags:** Billing (Fakturowanie gazowe)

**Requires authentication.**

**Features:** billing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/billing/invoices/:id/pdf" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/billing/invoices/correct`

POST /billing/invoices/correct

Requires features: billing.correct

**Tags:** Billing (Fakturowanie gazowe)

**Requires authentication.**

**Features:** billing.correct

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/billing/invoices/correct" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/billing/invoices/ksef-submit`

POST /billing/invoices/ksef-submit

Requires features: billing.ksef

**Tags:** Billing (Fakturowanie gazowe)

**Requires authentication.**

**Features:** billing.ksef

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/billing/invoices/ksef-submit" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/billing/receivables`

List receivables

Returns a paginated collection of receivables scoped to the authenticated organization.

Requires features: billing.view

**Tags:** Billing

**Requires authentication.**

**Features:** billing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| billingAccountId | query | any | Optional |
| customerId | query | any | Optional |
| contractId | query | any | Optional |
| status | query | any | Optional |
| overdueOnly | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated receivables

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "invoiceId": "00000000-0000-4000-8000-000000000000",
      "billingAccountId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "amount": "string",
      "paidAmount": "string",
      "currency": "string",
      "dueDate": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/billing/receivables" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/billing/runs`

List billing runs

Returns a paginated collection of billing runs scoped to the authenticated organization.

Requires features: billing.view

**Tags:** Billing

**Requires authentication.**

**Features:** billing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| status | query | any | Optional |
| period | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated billing runs

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "status": "string",
      "period": "string",
      "scope": null,
      "totalContracts": null,
      "processedContracts": null,
      "failedContracts": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/billing/runs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/billing/runs`

Create billingrun

Enqueue a BillingRun for the specified period. Idempotent: returns existing run if already ZAPLANOWANY/W_TOKU for the same period+scope.

Requires features: billing.run

**Tags:** Billing

**Requires authentication.**

**Features:** billing.run

### Request Body

Content-Type: `application/json`

```json
{
  "period": "string"
}
```

### Responses

**201** – BillingRun created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/billing/runs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"period\": \"string\"
}"
```

## GET `/configs/cache`

Get cache statistics

Returns detailed cache statistics including total entries and breakdown by cache segments. Requires cache service to be available.

Requires features: configs.cache.view

**Tags:** Configs

**Requires authentication.**

**Features:** configs.cache.view

### Responses

**200** – Cache statistics

Content-Type: `application/json`

```json
{
  "generatedAt": "string",
  "totalKeys": 1,
  "segments": [
    {
      "segment": "string",
      "resource": null,
      "method": null,
      "path": null,
      "keyCount": 1,
      "keys": [
        "string"
      ]
    }
  ]
}
```

**500** – Failed to resolve cache stats

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**503** – Cache service unavailable

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/configs/cache" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/configs/cache`

Purge cache

Purges cache entries. Supports two actions: purgeAll (clears entire cache) or purgeSegment (clears specific segment). Returns updated cache statistics after purge.

Requires features: configs.cache.manage

**Tags:** Configs

**Requires authentication.**

**Features:** configs.cache.manage

### Request Body

Content-Type: `application/json`

```json
{
  "action": "purgeAll"
}
```

### Responses

**200** – Cache segment cleared successfully

Content-Type: `application/json`

```json
{
  "action": "purgeSegment",
  "segment": "string",
  "deleted": 1,
  "stats": {
    "generatedAt": "string",
    "totalKeys": 1,
    "segments": [
      {
        "segment": "string",
        "resource": null,
        "method": null,
        "path": null,
        "keyCount": 1,
        "keys": [
          "string"
        ]
      }
    ]
  }
}
```

**400** – Invalid request - missing segment identifier for purgeSegment action

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Failed to purge cache

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**503** – Cache service unavailable

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/configs/cache" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"action\": \"purgeAll\"
}"
```

## GET `/configs/system-status`

Get system health status

Returns comprehensive system health information including environment details, version, resource usage, and service connectivity status.

Requires features: configs.system_status.view

**Tags:** Configs

**Requires authentication.**

**Features:** configs.system_status.view

### Responses

**200** – System status snapshot

Content-Type: `application/json`

```json
{
  "generatedAt": "string",
  "runtimeMode": "development",
  "categories": [
    {
      "key": "profiling",
      "labelKey": "string",
      "descriptionKey": null,
      "items": [
        {
          "key": "string",
          "category": "profiling",
          "kind": "boolean",
          "labelKey": "string",
          "descriptionKey": "string",
          "docUrl": null,
          "defaultValue": null,
          "state": "enabled",
          "value": null,
          "normalizedValue": null
        }
      ]
    }
  ]
}
```

**500** – Failed to load system status

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/configs/system-status" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/configs/system-status`

Clear system cache

Purges the entire cache for the current tenant. Useful for troubleshooting or forcing fresh data loading.

Requires features: configs.manage

**Tags:** Configs

**Requires authentication.**

**Features:** configs.manage

### Responses

**200** – Cache cleared successfully

Content-Type: `application/json`

```json
{
  "cleared": true
}
```

**500** – Failed to purge cache

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**503** – Cache service unavailable

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/configs/system-status" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/configs/upgrade-actions`

List pending upgrade actions

Returns a list of pending upgrade actions for the current version. These are one-time setup tasks that need to be executed after upgrading to a new version. Requires organization and tenant context.

Requires features: configs.manage

**Tags:** Configs

**Requires authentication.**

**Features:** configs.manage

### Responses

**200** – List of pending upgrade actions

Content-Type: `application/json`

```json
{
  "version": "string",
  "actions": [
    {
      "id": "string",
      "version": "string",
      "message": "string",
      "ctaLabel": "string",
      "successMessage": "string",
      "loadingLabel": "string"
    }
  ]
}
```

**400** – Missing organization or tenant context

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Failed to load upgrade actions

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/configs/upgrade-actions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/configs/upgrade-actions`

Execute upgrade action

Executes a specific upgrade action by ID. Typically used for one-time setup tasks like seeding example data after version upgrade. Returns execution status and localized success message.

Requires features: configs.manage

**Tags:** Configs

**Requires authentication.**

**Features:** configs.manage

### Request Body

Content-Type: `application/json`

```json
{
  "actionId": "string"
}
```

### Responses

**200** – Upgrade action executed successfully

Content-Type: `application/json`

```json
{
  "status": "string",
  "message": "string",
  "version": "string"
}
```

**400** – Invalid request body or missing context

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Failed to execute upgrade action

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/configs/upgrade-actions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"actionId\": \"string\"
}"
```

## DELETE `/connector_accounting/connections`

Delete accounting connection (mockup)

Deletes a accounting connection (mockup) identified by id.

Requires features: connector_accounting.connection.manage

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.connection.manage

### Responses

**200** – Accounting Connection (MOCKUP) deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/connector_accounting/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_accounting/connections`

List accounting connections

Returns a paginated collection of accounting connections scoped to the authenticated organization. NOTE: transport is MOCKUP — no real accounting system is connected.

Requires features: connector_accounting.connection.view

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.connection.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated accounting connections

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "systemType": "string",
      "baseUrl": null,
      "exportScheduleCron": null,
      "isActive": true,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_accounting/connections?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/connector_accounting/connections`

Create accounting connection (mockup)

Create an accounting system connection configuration (MOCKUP — transport not connected)

Requires features: connector_accounting.connection.manage

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "systemType": "CUSTOM",
  "isActive": true
}
```

### Responses

**201** – Accounting Connection (MOCKUP) created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_accounting/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"systemType\": \"CUSTOM\",
  \"isActive\": true
}"
```

## PUT `/connector_accounting/connections`

Update accounting connection (mockup)

Updates an existing accounting connection (mockup) by id.

Requires features: connector_accounting.connection.manage

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "systemType": "CUSTOM",
  "isActive": true
}
```

### Responses

**200** – Accounting Connection (MOCKUP) updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/connector_accounting/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"systemType\": \"CUSTOM\",
  \"isActive\": true
}"
```

## GET `/connector_accounting/connections/{id}`

Get an accounting connection by id

Returns a single accounting connection by id, scoped to the authenticated organization. NOTE: transport is MOCKUP — no real accounting system is connected. Create/update/delete are exposed on the collection route /api/connector_accounting/connections.

Requires features: connector_accounting.connection.view

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.connection.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – The accounting connection

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "code": "string",
  "name": "string",
  "systemType": "string",
  "baseUrl": null,
  "exportScheduleCron": null,
  "isActive": true,
  "version": 1,
  "createdAt": "string",
  "updatedAt": "string"
}
```

**404** – Accounting connection not found

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_accounting/connections/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_accounting/export-batches`

List accounting export batches

Returns a paginated collection of accounting export batches scoped to the authenticated organization. NOTE: transport is MOCKUP — no real accounting system is connected.

Requires features: connector_accounting.export_batch.view

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.export_batch.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated accounting export batches

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "businessKey": null,
      "status": "string",
      "exportStartedAt": null,
      "completedAt": null,
      "totalPostings": 1,
      "sentOk": 1,
      "sendErrors": 1,
      "skipped": 1,
      "errorDetail": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_accounting/export-batches?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_accounting/export-batches/{id}`

Get an accounting export batch by id

Returns a single accounting export batch by id, scoped to the authenticated organization. NOTE: transport is MOCKUP — no real accounting system is connected.

Requires features: connector_accounting.export_batch.view

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.export_batch.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – The accounting export batch

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "connectionId": "00000000-0000-4000-8000-000000000000",
  "businessKey": null,
  "status": "string",
  "exportStartedAt": null,
  "completedAt": null,
  "totalPostings": 1,
  "sentOk": 1,
  "sendErrors": 1,
  "skipped": 1,
  "errorDetail": null,
  "version": 1,
  "createdAt": "string",
  "updatedAt": "string"
}
```

**404** – Accounting export batch not found

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_accounting/export-batches/:id" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_accounting/posting-logs`

List accounting posting logs

Returns a paginated collection of accounting posting logs scoped to the authenticated organization. NOTE: transport is MOCKUP — no real accounting system is connected.

Requires features: connector_accounting.posting_log.view

**Tags:** Connector Accounting (MOCKUP)

**Requires authentication.**

**Features:** connector_accounting.posting_log.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| batchId | query | any | Optional |
| invoiceId | query | any | Optional |
| status | query | any | Optional |
| accountingPeriod | query | any | Optional |
| search | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated accounting posting logs

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "invoiceId": "00000000-0000-4000-8000-000000000000",
      "invoiceNumber": null,
      "accountingPeriod": "string",
      "status": "string",
      "batchId": null,
      "externalRef": null,
      "sentAt": null,
      "errorDetail": null,
      "retryCount": 1,
      "idempotencyKey": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_accounting/posting-logs?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_bank/batches`

List bank import batches

Returns a paginated collection of bank import batches scoped to the authenticated organization.

Requires features: connector_bank.batch.view

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.batch.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated bank import batches

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": null,
      "status": "string",
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "pullStartedAt": null,
      "completedAt": null,
      "totalFiles": 1,
      "parsedOk": 1,
      "parseErrors": 1,
      "statementsDispatched": 1,
      "errorDetail": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_bank/batches?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/connector_bank/connections`

Delete bank connection

Deletes a bank connection identified by id.

Requires features: connector_bank.connection.manage

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.connection.manage

### Responses

**200** – Bank Connection deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/connector_bank/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_bank/connections`

List bank connections

Returns a paginated collection of bank connections scoped to the authenticated organization.

Requires features: connector_bank.connection.view

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.connection.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated bank connections

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "host": "string",
      "port": 1,
      "dirIn": "string",
      "dirArchive": "string",
      "pullScheduleCron": null,
      "isActive": true,
      "status": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_bank/connections?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/connector_bank/connections`

Create bank connection

Create a bank SFTP/H2H connection configuration

Requires features: connector_bank.connection.manage

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "host": "string",
  "port": 22,
  "dirIn": "in/",
  "dirArchive": "archive/",
  "isActive": true
}
```

### Responses

**201** – Bank Connection created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_bank/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"host\": \"string\",
  \"port\": 22,
  \"dirIn\": \"in/\",
  \"dirArchive\": \"archive/\",
  \"isActive\": true
}"
```

## PUT `/connector_bank/connections`

Update bank connection

Updates an existing bank connection by id.

Requires features: connector_bank.connection.manage

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "port": 22,
  "dirIn": "in/",
  "dirArchive": "archive/",
  "isActive": true
}
```

### Responses

**200** – Bank Connection updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/connector_bank/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"port\": 22,
  \"dirIn\": \"in/\",
  \"dirArchive\": \"archive/\",
  \"isActive\": true
}"
```

## POST `/connector_bank/connections/{id}/pull`

Trigger a manual MT940 SFTP pull

Enqueues an immediate SFTP pull of MT940 files outside the scheduled cron window. The pull is idempotent (dedup via BankFileLog + payments UNIQUE constraint). Returns 202 immediately; the actual transfer runs in the background.

Requires features: connector_bank.pull.trigger

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.pull.trigger

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "dryRun": false
}
```

### Responses

**202** – Pull accepted and queued

Content-Type: `application/json`

```json
{
  "message": "string",
  "connectionId": "string",
  "dryRun": true
}
```

**400** – Invalid payload or missing connection id

Content-Type: `application/json`

**404** – Bank connection not found

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_bank/connections/:id/pull" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"dryRun\": false
}"
```

## GET `/connector_bank/files`

List bank file logs

Returns a paginated collection of bank file logs scoped to the authenticated organization.

Requires features: connector_bank.file.view

**Tags:** Connector Bank

**Requires authentication.**

**Features:** connector_bank.file.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| batchId | query | any | Optional |
| status | query | any | Optional |
| search | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated bank file logs

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "status": "string",
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "batchId": null,
      "filename": "string",
      "contentHash": "string",
      "statementRef": null,
      "linesCount": null,
      "archivePath": null,
      "sizeBytes": null,
      "errorDetail": null,
      "sourceSystem": null,
      "sourceTimestamp": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_bank/files?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_osd_gaz/batches`

List osd import batches

Returns a paginated collection of osd import batches scoped to the authenticated organization.

Requires features: connector_osd_gaz.batch.view

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.batch.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated osd import batches

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": null,
      "status": "PENDING",
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "pullStartedAt": null,
      "completedAt": null,
      "totalFiles": 1,
      "parsedOk": 1,
      "parseErrors": 1,
      "recordsDispatched": 1,
      "errorDetail": null,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_osd_gaz/batches?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/connector_osd_gaz/connections`

Delete osd connection

Deletes a osd connection identified by id.

Requires features: connector_osd_gaz.connection.manage

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.connection.manage

### Responses

**200** – OSD Connection deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/connector_osd_gaz/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/connector_osd_gaz/connections`

List osd connections

Returns a paginated collection of osd connections scoped to the authenticated organization.

Requires features: connector_osd_gaz.connection.view

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.connection.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| osdId | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated osd connections

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "osdId": null,
      "host": "string",
      "port": 1,
      "dirIn": "string",
      "dirOut": "string",
      "dirArchive": "string",
      "pullScheduleCron": null,
      "isActive": true,
      "status": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_osd_gaz/connections?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/connector_osd_gaz/connections`

Create osd connection

Create an OSD SFTP connection configuration

Requires features: connector_osd_gaz.connection.manage

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "host": "string",
  "port": 22,
  "dirIn": "in/",
  "dirOut": "out/",
  "dirArchive": "archive/",
  "isActive": true
}
```

### Responses

**201** – OSD Connection created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_osd_gaz/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"host\": \"string\",
  \"port\": 22,
  \"dirIn\": \"in/\",
  \"dirOut\": \"out/\",
  \"dirArchive\": \"archive/\",
  \"isActive\": true
}"
```

## PUT `/connector_osd_gaz/connections`

Update osd connection

Updates an existing osd connection by id.

Requires features: connector_osd_gaz.connection.manage

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.connection.manage

### Request Body

Content-Type: `application/json`

```json
{
  "port": 22,
  "dirIn": "in/",
  "dirOut": "out/",
  "dirArchive": "archive/",
  "isActive": true
}
```

### Responses

**200** – OSD Connection updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/connector_osd_gaz/connections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"port\": 22,
  \"dirIn\": \"in/\",
  \"dirOut\": \"out/\",
  \"dirArchive\": \"archive/\",
  \"isActive\": true
}"
```

## POST `/connector_osd_gaz/connections/{id}/pull`

Trigger a manual SFTP pull

Enqueues an immediate SFTP pull outside the scheduled cron window. The pull is idempotent (dedup via OsdFileLog). Returns 202 immediately; the actual transfer runs in the background.

Requires features: connector_osd_gaz.pull.trigger

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.pull.trigger

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "dryRun": false
}
```

### Responses

**202** – Pull accepted and queued

Content-Type: `application/json`

```json
{
  "message": "string",
  "connectionId": "string",
  "messageKind": null,
  "dryRun": true
}
```

**400** – Invalid payload or missing connection id

Content-Type: `application/json`

**404** – OSD connection not found

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_osd_gaz/connections/:id/pull" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"dryRun\": false
}"
```

## GET `/connector_osd_gaz/files`

List osd file logs

Returns a paginated collection of osd file logs scoped to the authenticated organization.

Requires features: connector_osd_gaz.file.view

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.file.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| connectionId | query | any | Optional |
| batchId | query | any | Optional |
| status | query | any | Optional |
| direction | query | any | Optional |
| messageKind | query | any | Optional |
| search | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated osd file logs

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "filename": "string",
      "contentHash": "string",
      "direction": "in",
      "status": "POBRANY",
      "messageKind": null,
      "connectionId": "00000000-0000-4000-8000-000000000000",
      "batchId": null,
      "archivePath": null,
      "sizeBytes": null,
      "errorDetail": null,
      "sourceSystem": null,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/connector_osd_gaz/files?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/connector_osd_gaz/switch-requests`

Send outbound switching request

Serialises the switching payload to OSD format (XML/CSV per ACL), uploads it to the configured SFTP `out/` directory and emits `connector_osd_gaz.switch_request.sent`. Called internally by the switching module.

Requires features: connector_osd_gaz.switch_request.send

**Tags:** Connector OSD Gaz

**Requires authentication.**

**Features:** connector_osd_gaz.switch_request.send

### Request Body

Content-Type: `application/json`

```json
{
  "connectionId": "00000000-0000-4000-8000-000000000000",
  "ppgId": "00000000-0000-4000-8000-000000000000",
  "switchingCaseId": "00000000-0000-4000-8000-000000000000",
  "requestedSwitchDate": "string",
  "payload": {}
}
```

### Responses

**202** – Switch request accepted and queued for dispatch

Content-Type: `application/json`

```json
{
  "message": "string",
  "connectionId": "00000000-0000-4000-8000-000000000000",
  "ppgId": "00000000-0000-4000-8000-000000000000",
  "switchingCaseId": "00000000-0000-4000-8000-000000000000"
}
```

**400** – Invalid payload

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/connector_osd_gaz/switch-requests" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"connectionId\": \"00000000-0000-4000-8000-000000000000\",
  \"ppgId\": \"00000000-0000-4000-8000-000000000000\",
  \"switchingCaseId\": \"00000000-0000-4000-8000-000000000000\",
  \"requestedSwitchDate\": \"string\",
  \"payload\": {}
}"
```

## DELETE `/contracts/attachments`

Contract Attachment management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/attachments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/attachments`

List contract attachments

Returns a paginated collection of contract attachments scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract attachments

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "storageKey": "string",
      "mimeType": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/attachments?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/attachments`

Create contract attachment

Upload metadata; filename encrypted at rest.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "contractId": "00000000-0000-4000-8000-000000000000",
  "filename": "string",
  "mimeType": null,
  "storageKey": "string",
  "sizeBytes": null
}
```

### Responses

**201** – Contract Attachment created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/attachments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"filename\": \"string\",
  \"mimeType\": null,
  \"storageKey\": \"string\",
  \"sizeBytes\": null
}"
```

## DELETE `/contracts/calendar`

Contract Calendar Event management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/calendar" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/calendar`

List contract calendar events

Returns a paginated collection of contract calendar events scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| kind | query | any | Optional |
| dueBefore | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract calendar events

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "calendarId": "00000000-0000-4000-8000-000000000000",
      "kind": "string",
      "dueAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/calendar?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/calendar`

Create contract calendar event

Creates a new contract calendar event.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "calendarId": "00000000-0000-4000-8000-000000000000",
  "kind": "START_DOSTAW",
  "dueAt": "string",
  "note": null
}
```

### Responses

**201** – Contract Calendar Event created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/calendar" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"calendarId\": \"00000000-0000-4000-8000-000000000000\",
  \"kind\": \"START_DOSTAW\",
  \"dueAt\": \"string\",
  \"note\": null
}"
```

## DELETE `/contracts/contracts`

Delete contract

Deletes a contract identified by id.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**200** – Contract deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/contracts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/contracts`

List contracts

Returns a paginated collection of contracts scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| customerId | query | any | Optional |
| status | query | any | Optional |
| type | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contracts

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "type": "string",
      "status": "string",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "sellerId": null,
      "validFrom": "string",
      "validTo": null,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/contracts?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts`

Create contract

Create a draft contract.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "type": "sprzedaz",
  "status": "UMOWA_ROBOCZA",
  "customerId": "00000000-0000-4000-8000-000000000000",
  "sellerId": null,
  "aggregatorId": null,
  "serviceModel": null,
  "productModel": null,
  "validFrom": "string",
  "validTo": null,
  "sourceSystem": null,
  "owner": null
}
```

### Responses

**201** – Contract created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"type\": \"sprzedaz\",
  \"status\": \"UMOWA_ROBOCZA\",
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"sellerId\": null,
  \"aggregatorId\": null,
  \"serviceModel\": null,
  \"productModel\": null,
  \"validFrom\": \"string\",
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null
}"
```

## PUT `/contracts/contracts`

Update contract

Updates an existing contract by id.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "status": "UMOWA_ROBOCZA",
  "sellerId": null,
  "aggregatorId": null,
  "serviceModel": null,
  "productModel": null,
  "validTo": null,
  "sourceSystem": null,
  "owner": null,
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Contract updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/contracts/contracts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"status\": \"UMOWA_ROBOCZA\",
  \"sellerId\": null,
  \"aggregatorId\": null,
  \"serviceModel\": null,
  \"productModel\": null,
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null,
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## POST `/contracts/contracts/{id}/activate`

Activate a contract (PODPISANA → AKTYWNA)

Transitions a signed contract to active. Consent gate fail-closed is deferred to customers.consents extension (post-Fala 3). Emits `contracts.contract.activated`.

Requires features: contracts.activate

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.activate

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/activate" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts/{id}/amend`

Amend a contract (Correction-safe)

Creates a new ContractVersion + ContractAmendment row without overwriting the previous version. If the source status was AKTYWNA, the contract transitions to ANEKSOWANA. Emits `contracts.contract.amended`.

Requires features: contracts.amend

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.amend

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/amend" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts/{id}/assign-ppg`

Assign a PPG to a contract (bitemporal)

Closes any open ContractPpgAssignment for the (contract, PPG) pair and opens a new one starting at `validFrom`. Emits `contracts.ppg.added` (switching saga trigger per audit F1 §P-04).

Requires features: contracts.assign_ppg

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.assign_ppg

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/assign-ppg" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts/{id}/remove-ppg`

Remove a PPG from a contract (bitemporal close)

Sets validTo on the open ContractPpgAssignment instead of deleting it. Emits `contracts.ppg.removed`.

Requires features: contracts.assign_ppg

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.assign_ppg

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/remove-ppg" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts/{id}/renew`

Renew a finished contract (ZAKONCZONA → AKTYWNA)

Lifts a contract that ended cleanly (ZAKONCZONA) back to AKTYWNA with a new validTo. Records a ContractRenewal row. ROZWIAZANA contracts cannot be renewed — create a new contract instead. Emits `contracts.contract.renewed`.

Requires features: contracts.manage

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/renew" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/contracts/{id}/terminate`

Terminate a contract

Records a ContractTermination and transitions the contract to ROZWIAZANA (unilateral) or ZAKONCZONA (mutual / expiry). Emits `contracts.contract.terminated`.

Requires features: contracts.terminate

**Tags:** Contracts (CLM)

**Requires authentication.**

**Features:** contracts.terminate

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/contracts/:id/terminate" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/contracts/poa`

Power of Attorney management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/poa" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/poa`

List powers of attorney

Returns a paginated collection of powers of attorney scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| principalCustomerId | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated powers of attorney

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "principalCustomerId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "validFrom": "string",
      "validTo": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/poa?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/poa`

Create power of attorney

Register a Power of Attorney (PII fields encrypted at rest).

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "contractId": null,
  "principalCustomerId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "string",
  "validTo": null,
  "scopes": [
    "assignment"
  ],
  "businessKey": null
}
```

### Responses

**201** – Power of Attorney created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/poa" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"contractId\": null,
  \"principalCustomerId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"string\",
  \"validTo\": null,
  \"scopes\": [
    \"assignment\"
  ],
  \"businessKey\": null
}"
```

## DELETE `/contracts/ppg-assignments`

Contract PPG Assignment management

Requires features: contracts.assign_ppg

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.assign_ppg

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/ppg-assignments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/ppg-assignments`

List contract ppg assignments

Returns a paginated collection of contract ppg assignments scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| ppgId | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract ppg assignments

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "ppgId": "00000000-0000-4000-8000-000000000000",
      "validFrom": "string",
      "validTo": null,
      "status": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/ppg-assignments?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/ppg-assignments`

Create contract ppg assignment

Create a bitemporal PPG ↔ contract assignment.

Requires features: contracts.assign_ppg

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.assign_ppg

### Request Body

Content-Type: `application/json`

```json
{
  "contractId": "00000000-0000-4000-8000-000000000000",
  "ppgId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "string",
  "status": "ACTIVE",
  "sourceSystem": null
}
```

### Responses

**201** – Contract PPG Assignment created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/ppg-assignments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"ppgId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"string\",
  \"status\": \"ACTIVE\",
  \"sourceSystem\": null
}"
```

## DELETE `/contracts/price-assignments`

Contract Price Assignment management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/price-assignments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/price-assignments`

List contract price assignments

Returns a paginated collection of contract price assignments scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| priceId | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract price assignments

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "priceId": "00000000-0000-4000-8000-000000000000",
      "validFrom": "string",
      "validTo": null,
      "status": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/price-assignments?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/price-assignments`

Create contract price assignment

Creates a new contract price assignment.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "contractId": "00000000-0000-4000-8000-000000000000",
  "priceId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "string",
  "validTo": null,
  "businessKey": null
}
```

### Responses

**201** – Contract Price Assignment created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/price-assignments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"priceId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"string\",
  \"validTo\": null,
  \"businessKey\": null
}"
```

## DELETE `/contracts/templates`

Contract Template management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/contracts/templates" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/templates`

List contract templates

Returns a paginated collection of contract templates scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract templates

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "isActive": true
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/templates?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/contracts/templates`

Create contract template

Creates a new contract template.

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "isActive": true
}
```

### Responses

**201** – Contract Template created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/contracts/templates" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"isActive\": true
}"
```

## PUT `/contracts/templates`

Contract Template management

Requires features: contracts.manage

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.manage

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/contracts/templates" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/contracts/versions`

List contract versions

Returns a paginated collection of contract versions scoped to the authenticated organization.

Requires features: contracts.view

**Tags:** Contracts

**Requires authentication.**

**Features:** contracts.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated contract versions

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "versionNumber": 1,
      "changeKind": "string",
      "status": "string",
      "createdAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/contracts/versions?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/customers/customers`

Customer (Klient) CRUD

Requires features: customers.customer.manage

**Tags:** Klienci

**Requires authentication.**

**Features:** customers.customer.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/customers/customers" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/customers/customers`

Customer (Klient) CRUD

Requires features: customers.customer.view

**Tags:** Klienci

**Requires authentication.**

**Features:** customers.customer.view

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/customers/customers" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/customers/customers`

Customer (Klient) CRUD

Requires features: customers.customer.manage

**Tags:** Klienci

**Requires authentication.**

**Features:** customers.customer.manage

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/customers/customers" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/customers/customers`

Customer (Klient) CRUD

Requires features: customers.customer.manage

**Tags:** Klienci

**Requires authentication.**

**Features:** customers.customer.manage

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/customers/customers" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/dashboards/layout`

Load the current dashboard layout

Returns the saved widget layout together with the widgets the current user is allowed to place.

Requires features: dashboards.view

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.view

### Responses

**200** – Current dashboard layout and available widgets.

Content-Type: `application/json`

```json
{
  "layout": {
    "items": [
      {
        "id": "00000000-0000-4000-8000-000000000000",
        "widgetId": "string",
        "order": 1
      }
    ]
  },
  "allowedWidgetIds": [
    "string"
  ],
  "canConfigure": true,
  "context": {
    "userId": "00000000-0000-4000-8000-000000000000",
    "tenantId": null,
    "organizationId": null,
    "userName": null,
    "userEmail": null,
    "userLabel": "string"
  },
  "widgets": [
    {
      "id": "string",
      "title": "string",
      "description": null,
      "defaultSize": "sm",
      "defaultEnabled": true,
      "defaultSettings": null,
      "features": [
        "string"
      ],
      "moduleId": "string",
      "icon": null,
      "loaderKey": "string",
      "supportsRefresh": true
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dashboards/layout" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/dashboards/layout`

Persist dashboard layout changes

Saves the provided widget ordering, sizes, and settings for the current user.

Requires features: dashboards.configure

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.configure

### Request Body

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "widgetId": "string",
      "order": 1
    }
  ]
}
```

### Responses

**200** – Layout updated successfully.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid layout payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dashboards/layout" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"items\": [
    {
      \"id\": \"00000000-0000-4000-8000-000000000000\",
      \"widgetId\": \"string\",
      \"order\": 1
    }
  ]
}"
```

## PATCH `/dashboards/layout/{itemId}`

Update a dashboard layout item

Adjusts the size or settings for a single widget within the dashboard layout.

Requires features: dashboards.configure

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.configure

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| itemId | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Layout item updated.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Invalid payload or missing item id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Item not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PATCH "https://151.115.63.33.sslip.io/api/dashboards/layout/00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## GET `/dashboards/roles/widgets`

Fetch widget assignments for a role

Returns the widgets explicitly assigned to the given role together with the evaluation scope.

Requires features: dashboards.admin.assign-widgets

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.admin.assign-widgets

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| roleId | query | any | Required |
| tenantId | query | any | Optional |
| organizationId | query | any | Optional |

### Responses

**200** – Current widget configuration for the role.

Content-Type: `application/json`

```json
{
  "widgetIds": [
    "string"
  ],
  "hasCustom": true,
  "scope": {
    "tenantId": null,
    "organizationId": null
  }
}
```

**400** – Missing role identifier

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dashboards/roles/widgets?roleId=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/dashboards/roles/widgets`

Update widgets assigned to a role

Persists the widget list for a role within the provided tenant and organization scope.

Requires features: dashboards.admin.assign-widgets

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.admin.assign-widgets

### Request Body

Content-Type: `application/json`

```json
{
  "roleId": "00000000-0000-4000-8000-000000000000",
  "widgetIds": [
    "string"
  ]
}
```

### Responses

**200** – Widgets updated successfully.

Content-Type: `application/json`

```json
{
  "ok": true,
  "widgetIds": [
    "string"
  ]
}
```

**400** – Invalid payload or unknown widgets

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dashboards/roles/widgets" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"roleId\": \"00000000-0000-4000-8000-000000000000\",
  \"widgetIds\": [
    \"string\"
  ]
}"
```

## GET `/dashboards/users/widgets`

Read widget overrides for a user

Returns the widgets inherited and explicitly configured for the requested user within the current scope.

Requires features: dashboards.admin.assign-widgets

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.admin.assign-widgets

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| userId | query | any | Required |
| tenantId | query | any | Optional |
| organizationId | query | any | Optional |

### Responses

**200** – Widget settings for the user.

Content-Type: `application/json`

```json
{
  "mode": "inherit",
  "widgetIds": [
    "string"
  ],
  "hasCustom": true,
  "effectiveWidgetIds": [
    "string"
  ],
  "scope": {
    "tenantId": null,
    "organizationId": null
  }
}
```

**400** – Missing user identifier

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dashboards/users/widgets?userId=00000000-0000-4000-8000-000000000000" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/dashboards/users/widgets`

Update user-specific dashboard widgets

Sets the widget override mode and allowed widgets for a user. Passing `mode: inherit` clears overrides.

Requires features: dashboards.admin.assign-widgets

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.admin.assign-widgets

### Request Body

Content-Type: `application/json`

```json
{
  "userId": "00000000-0000-4000-8000-000000000000",
  "mode": "inherit",
  "widgetIds": [
    "string"
  ]
}
```

### Responses

**200** – Overrides saved.

Content-Type: `application/json`

```json
{
  "ok": true,
  "mode": "inherit",
  "widgetIds": [
    "string"
  ]
}
```

**400** – Invalid payload or unknown widgets

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dashboards/users/widgets" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"userId\": \"00000000-0000-4000-8000-000000000000\",
  \"mode\": \"inherit\",
  \"widgetIds\": [
    \"string\"
  ]
}"
```

## GET `/dashboards/widgets/catalog`

List available dashboard widgets

Returns the catalog of widgets that modules expose, including defaults and feature requirements.

Requires features: dashboards.admin.assign-widgets

**Tags:** Dashboards

**Requires authentication.**

**Features:** dashboards.admin.assign-widgets

### Responses

**200** – Widgets available for assignment.

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "string",
      "title": "string",
      "description": null,
      "defaultSize": "sm",
      "defaultEnabled": true,
      "defaultSettings": null,
      "features": [
        "string"
      ],
      "moduleId": "string",
      "icon": null,
      "loaderKey": "string",
      "supportsRefresh": true
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dashboards/widgets/catalog" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/dashboards/widgets/data`

Fetch aggregated data for dashboard widgets

Executes an aggregation query against the specified entity type and returns the result. Supports date range filtering, grouping, and period-over-period comparison.

Requires features: analytics.view

**Tags:** Dashboards

**Requires authentication.**

**Features:** analytics.view

### Request Body

Content-Type: `application/json`

```json
{
  "entityType": "string",
  "metric": {
    "field": "string",
    "aggregate": "count"
  }
}
```

### Responses

**200** – Aggregated data for the widget.

Content-Type: `application/json`

```json
{
  "value": null,
  "data": [
    {
      "value": null
    }
  ],
  "metadata": {
    "fetchedAt": "string",
    "recordCount": 1
  }
}
```

**400** – Invalid request payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Internal server error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dashboards/widgets/data" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityType\": \"string\",
  \"metric\": {
    \"field\": \"string\",
    \"aggregate\": \"count\"
  }
}"
```

## POST `/dashboards/widgets/data/batch`

Fetch aggregated data for multiple dashboard widgets in one request

Resolves a batch of widget data requests with a single authentication, RBAC, organization-scope, and database-context setup. Each request is keyed by an opaque widget id and resolved independently, so a failure in one widget does not fail the batch.

Requires features: analytics.view

**Tags:** Dashboards

**Requires authentication.**

**Features:** analytics.view

### Request Body

Content-Type: `application/json`

```json
{
  "requests": [
    {
      "id": "string",
      "request": {
        "entityType": "string",
        "metric": {
          "field": "string",
          "aggregate": "count"
        }
      }
    }
  ]
}
```

### Responses

**200** – Per-widget aggregation results keyed by request id.

Content-Type: `application/json`

```json
{
  "results": [
    {
      "id": "string",
      "ok": true,
      "data": {
        "value": null,
        "data": [
          {
            "value": null
          }
        ],
        "metadata": {
          "fetchedAt": "string",
          "recordCount": 1
        }
      }
    }
  ]
}
```

**400** – Invalid request payload

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Internal server error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dashboards/widgets/data/batch" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"requests\": [
    {
      \"id\": \"string\",
      \"request\": {
        \"entityType\": \"string\",
        \"metric\": {
          \"field\": \"string\",
          \"aggregate\": \"count\"
        }
      }
    }
  ]
}"
```

## GET `/directory/organization-branding`

Read sidebar branding for the selected organization

Returns the logo URL used by the backend sidebar for the currently selected organization.

Requires features: directory.organizations.view

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.view

### Responses

**200** – Organization branding

Content-Type: `application/json`

```json
{
  "organizationId": "00000000-0000-4000-8000-000000000000",
  "organizationName": "string",
  "tenantId": "00000000-0000-4000-8000-000000000000",
  "logoUrl": null
}
```

**400** – A concrete organization scope is required

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Organization not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/organization-branding" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/directory/organization-branding`

Update sidebar branding for the selected organization

Stores an external image URL or an internal attachment image URL as the selected organization logo.

Requires features: directory.organizations.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.manage

### Request Body

Content-Type: `application/json`

```json
{
  "logoUrl": null
}
```

### Responses

**200** – Updated organization branding

Content-Type: `application/json`

```json
{
  "organizationId": "00000000-0000-4000-8000-000000000000",
  "organizationName": "string",
  "tenantId": "00000000-0000-4000-8000-000000000000",
  "logoUrl": null
}
```

**400** – Save failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**422** – Invalid logo URL

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/directory/organization-branding" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"logoUrl\": null
}"
```

## GET `/directory/organization-switcher`

Load organization switcher menu

Returns the hierarchical menu of organizations the current user may switch to within the active tenant.

**Tags:** Directory

**Requires authentication.**

### Responses

**200** – Organization switcher payload.

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "depth": 1,
      "selectable": true,
      "children": []
    }
  ],
  "selectedId": null,
  "canManage": true,
  "canViewAllOrganizations": true,
  "tenantId": null,
  "tenants": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "isActive": true
    }
  ],
  "isSuperAdmin": true
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/organization-switcher" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/directory/organizations`

Delete organization

Soft deletes an organization identified by id.

Requires features: directory.organizations.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Organization deleted.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/directory/organizations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/directory/organizations`

List organizations

Returns organizations using options, tree, or paginated manage view depending on the `view` parameter.

Requires features: directory.organizations.view

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| view | query | any | Optional |
| ids | query | any | Optional |
| tenantId | query | any | Optional |
| includeInactive | query | any | Optional |
| status | query | any | Optional |

### Responses

**200** – Organization data for the requested view.

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "parentId": null,
      "parentName": null,
      "tenantId": null,
      "tenantName": null,
      "rootId": null,
      "treePath": null
    }
  ]
}
```

**400** – Invalid query or tenant scope

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/organizations?page=1&pageSize=50&view=options" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/directory/organizations`

Create organization

Creates a new organization within a tenant and optionally assigns hierarchy relationships.

Requires features: directory.organizations.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string",
  "slug": null,
  "logoUrl": null,
  "parentId": null
}
```

### Responses

**201** – Organization created.

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/directory/organizations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\",
  \"slug\": null,
  \"logoUrl\": null,
  \"parentId\": null
}"
```

## PUT `/directory/organizations`

Update organization

Updates organization details and hierarchy assignments.

Requires features: directory.organizations.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.organizations.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "slug": null,
  "logoUrl": null,
  "parentId": null
}
```

### Responses

**200** – Organization updated.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/directory/organizations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\",
  \"slug\": null,
  \"logoUrl\": null,
  \"parentId\": null
}"
```

## GET `/directory/organizations/lookup`

Public organization lookup by slug

**Tags:** Directory (Tenants & Organizations)

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/organizations/lookup" \
  -H "Accept: application/json"
```

## DELETE `/directory/tenants`

Delete tenant

Soft deletes the tenant identified by id.

Requires features: directory.tenants.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.tenants.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Tenant removed.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/directory/tenants" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/directory/tenants`

List tenants

Returns tenants visible to the current user with optional search and pagination.

Requires features: directory.tenants.view

**Tags:** Directory

**Requires authentication.**

**Features:** directory.tenants.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| isActive | query | any | Optional |

### Responses

**200** – Paged list of tenants.

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "isActive": true,
      "createdAt": null,
      "updatedAt": null
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 1,
  "totalPages": 1
}
```

**400** – Invalid query parameters

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/tenants?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/directory/tenants`

Create tenant

Creates a new tenant and returns its identifier.

Requires features: directory.tenants.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.tenants.manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string"
}
```

### Responses

**201** – Tenant created.

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/directory/tenants" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\"
}"
```

## PUT `/directory/tenants`

Update tenant

Updates tenant properties such as name or activation state.

Requires features: directory.tenants.manage

**Tags:** Directory

**Requires authentication.**

**Features:** directory.tenants.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Tenant updated.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/directory/tenants" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/directory/tenants/lookup`

Public tenant lookup

**Tags:** Directory (Tenants & Organizations)

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/directory/tenants/lookup" \
  -H "Accept: application/json"
```

## DELETE `/dunning/cases`

Delete dunningcase

Deletes a dunningcase identified by id.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Responses

**200** – DunningCase deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/dunning/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/dunning/cases`

List dunning cases

Returns a paginated collection of dunning cases scoped to the authenticated organization.

Requires features: dunning.view

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| status | query | any | Optional |
| customerId | query | any | Optional |
| invoiceId | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| sort | query | any | Optional |
| order | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated dunning cases

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "receivableId": "00000000-0000-4000-8000-000000000000",
      "invoiceId": "00000000-0000-4000-8000-000000000000",
      "billingAccountId": "00000000-0000-4000-8000-000000000000",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "amount": "string",
      "paidAmount": "string",
      "currency": "string",
      "dueDate": "string",
      "detectedAt": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dunning/cases?page=1&pageSize=20&sort=createdAt&order=desc" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/dunning/cases`

Create dunningcase

Open a new dunning case for an overdue receivable.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Request Body

Content-Type: `application/json`

```json
{
  "receivableId": "00000000-0000-4000-8000-000000000000",
  "invoiceId": "00000000-0000-4000-8000-000000000000",
  "billingAccountId": "00000000-0000-4000-8000-000000000000",
  "customerId": "00000000-0000-4000-8000-000000000000",
  "amount": "string",
  "paidAmount": "0",
  "currency": "PLN",
  "dueDate": "string",
  "detectedAt": "string",
  "policyId": null,
  "notes": null
}
```

### Responses

**201** – DunningCase created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dunning/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"receivableId\": \"00000000-0000-4000-8000-000000000000\",
  \"invoiceId\": \"00000000-0000-4000-8000-000000000000\",
  \"billingAccountId\": \"00000000-0000-4000-8000-000000000000\",
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"amount\": \"string\",
  \"paidAmount\": \"0\",
  \"currency\": \"PLN\",
  \"dueDate\": \"string\",
  \"detectedAt\": \"string\",
  \"policyId\": null,
  \"notes\": null
}"
```

## PUT `/dunning/cases`

Update dunningcase

Updates an existing dunningcase by id.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Request Body

Content-Type: `application/json`

```json
{
  "policyId": null,
  "currentLevelId": null,
  "workflowTaskId": null,
  "notes": null,
  "closedReason": null
}
```

### Responses

**200** – DunningCase updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dunning/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"policyId\": null,
  \"currentLevelId\": null,
  \"workflowTaskId\": null,
  \"notes\": null,
  \"closedReason\": null
}"
```

## DELETE `/dunning/letters`

Delete dunningletter

Deletes a dunningletter identified by id.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Responses

**200** – DunningLetter deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/dunning/letters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/dunning/letters`

List dunning letters

Returns a paginated collection of dunning letters scoped to the authenticated organization.

Requires features: dunning.view

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| caseId | query | any | Optional |
| status | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated dunning letters

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "caseId": "00000000-0000-4000-8000-000000000000",
      "stepId": null,
      "status": "string",
      "channel": null,
      "amount": "string",
      "currency": "string",
      "sentAt": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dunning/letters?page=1&pageSize=20" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/dunning/letters`

Create dunningletter

Generate a dunning letter for a case. PII fields encrypted at rest.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Request Body

Content-Type: `application/json`

```json
{
  "caseId": "00000000-0000-4000-8000-000000000000",
  "stepId": null,
  "templateId": null,
  "channel": null,
  "recipientName": null,
  "recipientAddress": null,
  "contactEmail": null,
  "contactPhone": null,
  "amount": "string",
  "currency": "PLN"
}
```

### Responses

**201** – DunningLetter created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dunning/letters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"caseId\": \"00000000-0000-4000-8000-000000000000\",
  \"stepId\": null,
  \"templateId\": null,
  \"channel\": null,
  \"recipientName\": null,
  \"recipientAddress\": null,
  \"contactEmail\": null,
  \"contactPhone\": null,
  \"amount\": \"string\",
  \"currency\": \"PLN\"
}"
```

## PUT `/dunning/letters`

Update dunningletter

Updates an existing dunningletter by id.

Requires features: dunning.manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.manage

### Request Body

Content-Type: `application/json`

```json
{
  "pdfStorageKey": null,
  "sentAt": null,
  "confirmedAt": null,
  "errorDetail": null
}
```

### Responses

**200** – DunningLetter updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dunning/letters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"pdfStorageKey\": null,
  \"sentAt\": null,
  \"confirmedAt\": null,
  \"errorDetail\": null
}"
```

## DELETE `/dunning/levels`

Delete dunninglevel

Deletes a dunninglevel identified by id.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Responses

**200** – DunningLevel deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/dunning/levels" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/dunning/levels`

List dunning levels

Returns a paginated collection of dunning levels scoped to the authenticated organization.

Requires features: dunning.view

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| policyId | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated dunning levels

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "policyId": "00000000-0000-4000-8000-000000000000",
      "levelNumber": 1,
      "label": "string",
      "triggerDays": 1,
      "autoEscalate": true,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dunning/levels?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/dunning/levels`

Create dunninglevel

Add an escalation level to a dunning policy.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Request Body

Content-Type: `application/json`

```json
{
  "policyId": "00000000-0000-4000-8000-000000000000",
  "levelNumber": 1,
  "label": "string",
  "description": null,
  "triggerDays": 1,
  "autoEscalate": false
}
```

### Responses

**201** – DunningLevel created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dunning/levels" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"policyId\": \"00000000-0000-4000-8000-000000000000\",
  \"levelNumber\": 1,
  \"label\": \"string\",
  \"description\": null,
  \"triggerDays\": 1,
  \"autoEscalate\": false
}"
```

## PUT `/dunning/levels`

Update dunninglevel

Updates an existing dunninglevel by id.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Request Body

Content-Type: `application/json`

```json
{
  "description": null
}
```

### Responses

**200** – DunningLevel updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dunning/levels" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"description\": null
}"
```

## DELETE `/dunning/policies`

Delete dunningpolicy

Deletes a dunningpolicy identified by id.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Responses

**200** – DunningPolicy deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/dunning/policies" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/dunning/policies`

List dunning policies

Returns a paginated collection of dunning policies scoped to the authenticated organization.

Requires features: dunning.view

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated dunning policies

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "description": null,
      "segment": null,
      "isActive": true,
      "maxDaysOverdue": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/dunning/policies?page=1&pageSize=20" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/dunning/policies`

Create dunningpolicy

Create a dunning escalation policy.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string",
  "description": null,
  "segment": null,
  "isActive": true,
  "maxDaysOverdue": null
}
```

### Responses

**201** – DunningPolicy created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/dunning/policies" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\",
  \"description\": null,
  \"segment\": null,
  \"isActive\": true,
  \"maxDaysOverdue\": null
}"
```

## PUT `/dunning/policies`

Update dunningpolicy

Updates an existing dunningpolicy by id.

Requires features: dunning.policy_manage

**Tags:** Dunning

**Requires authentication.**

**Features:** dunning.policy_manage

### Request Body

Content-Type: `application/json`

```json
{
  "description": null,
  "segment": null,
  "maxDaysOverdue": null
}
```

### Responses

**200** – DunningPolicy updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/dunning/policies" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"description\": null,
  \"segment\": null,
  \"maxDaysOverdue\": null
}"
```

## DELETE `/energy_master_data/hubs`

Delete hub

Deletes a hub identified by id.

Requires features: energy_master_data.hub.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.hub.manage

### Responses

**200** – Hub deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/energy_master_data/hubs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/energy_master_data/hubs`

List hubs

Returns a paginated collection of hubs scoped to the authenticated organization.

Requires features: energy_master_data.hub.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.hub.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| customerId | query | any | Optional |
| status | query | any | Optional |
| terytCode | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated hubs

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "addressLine1": null,
      "addressLine2": null,
      "city": null,
      "postalCode": null,
      "country": null,
      "terytCode": null,
      "status": "string",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/hubs?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/energy_master_data/hubs`

Create hub

Create a hub

Requires features: energy_master_data.hub.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.hub.manage

### Request Body

Content-Type: `application/json`

```json
{
  "customerId": "00000000-0000-4000-8000-000000000000",
  "name": "string"
}
```

### Responses

**201** – Hub created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/hubs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"name\": \"string\"
}"
```

## PUT `/energy_master_data/hubs`

Update hub

Updates an existing hub by id.

Requires features: energy_master_data.hub.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.hub.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Hub updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/energy_master_data/hubs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## DELETE `/energy_master_data/meters`

Delete meter

Deletes a meter identified by id.

Requires features: energy_master_data.meter.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.meter.manage

### Responses

**200** – Meter deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/energy_master_data/meters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/energy_master_data/meters`

List meters

Returns a paginated collection of meters scoped to the authenticated organization.

Requires features: energy_master_data.meter.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.meter.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| serialNumber | query | any | Optional |
| deviceId | query | any | Optional |
| status | query | any | Optional |
| podId | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated meters

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "serialNumber": "string",
      "deviceId": null,
      "remoteRead": true,
      "legalizationDate": null,
      "status": "IN_STOCK",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/meters?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/energy_master_data/meters`

Create meter

Create a meter in the tenant pool

Requires features: energy_master_data.meter.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.meter.manage

### Request Body

Content-Type: `application/json`

```json
{
  "serialNumber": "string"
}
```

### Responses

**201** – Meter created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/meters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"serialNumber\": \"string\"
}"
```

## PUT `/energy_master_data/meters`

Update meter

Updates an existing meter by id.

Requires features: energy_master_data.meter.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.meter.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Meter updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/energy_master_data/meters" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## DELETE `/energy_master_data/osds`

Delete osd

Deletes a osd identified by id.

Requires features: energy_master_data.osd.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.osd.manage

### Responses

**200** – OSD deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/energy_master_data/osds" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/energy_master_data/osds`

List osds

Returns a paginated collection of osds scoped to the authenticated organization.

Requires features: energy_master_data.osd.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.osd.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| code | query | any | Optional |
| commodity | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated osds

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "taxId": null,
      "commodity": "GAS",
      "status": "ACTIVE",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/osds?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/energy_master_data/osds`

Create osd

Create an OSD (platform admin only)

Requires features: energy_master_data.osd.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.osd.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string"
}
```

### Responses

**201** – OSD created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/osds" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\"
}"
```

## PUT `/energy_master_data/osds`

Update osd

Updates an existing osd by id.

Requires features: energy_master_data.osd.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.osd.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – OSD updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/energy_master_data/osds" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## DELETE `/energy_master_data/pods`

Delete point of delivery (ppg)

Deletes a point of delivery (ppg) identified by id.

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Responses

**200** – Point of Delivery (PPG) deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/energy_master_data/pods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/energy_master_data/pods`

List points of delivery (ppgs)

Returns a paginated collection of points of delivery (ppgs) scoped to the authenticated organization.

Requires features: energy_master_data.pod.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |
| hubId | query | any | Optional |
| customerId | query | any | Optional |
| gsrn | query | any | Optional |
| osdId | query | any | Optional |
| osdArea | query | any | Optional |
| commodity | query | any | Optional |
| status | query | any | Optional |
| asOf | query | any | Optional |

### Responses

**200** – Paginated points of delivery (ppgs)

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "hubId": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "gsrn": "string",
      "commodity": "GAS",
      "osdArea": "string",
      "osdId": null,
      "status": "DRAFT",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/pods?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/energy_master_data/pods`

Create point of delivery (ppg)

Create a PPG (validates GSRN checksum)

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Request Body

Content-Type: `application/json`

```json
{
  "hubId": "00000000-0000-4000-8000-000000000000",
  "code": "string",
  "osdArea": "string"
}
```

### Responses

**201** – Point of Delivery (PPG) created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/pods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"hubId\": \"00000000-0000-4000-8000-000000000000\",
  \"code\": \"string\",
  \"osdArea\": \"string\"
}"
```

## PUT `/energy_master_data/pods`

Update point of delivery (ppg)

Updates an existing point of delivery (ppg) by id.

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Point of Delivery (PPG) updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/energy_master_data/pods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## POST `/energy_master_data/pods/{id}/assign`

Assign a party to a PPG (bitemporal)

Adds or replaces the OPEN PpgCustomerAssignment for the given partyRole on this PPG. Closes the previous open row (if any) at validFrom and inserts a new row. Backdated edits earlier than the open row reject with 409 BitemporalOverlapError.

Requires features: energy_master_data.assignment.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.assignment.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "partyRole": "customer",
  "partyId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "2025-01-01T00:00:00.000Z"
}
```

### Responses

**201** – Assignment created (and previous open row closed when applicable).

Content-Type: `application/json`

```json
{
  "ok": true,
  "assignment": {
    "id": "00000000-0000-4000-8000-000000000000",
    "podId": "00000000-0000-4000-8000-000000000000",
    "partyRole": "string",
    "partyId": "00000000-0000-4000-8000-000000000000",
    "validFrom": "string",
    "validTo": null
  },
  "closedAssignmentId": null
}
```

**404** – PPG not found in caller scope.

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – New window overlaps an existing OPEN row (backdated edit).

Content-Type: `application/json`

```json
{
  "error": "string",
  "code": "BITEMPORAL_OVERLAP"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/pods/:id/assign" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"partyRole\": \"customer\",
  \"partyId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"2025-01-01T00:00:00.000Z\"
}"
```

## POST `/energy_master_data/pods/{id}/meter-install`

Install a meter on a PPG (bitemporal)

Opens a new MeterAssignment row mounting the meter on this PPG and flips the meter status to INSTALLED in a single atomic flush.

Requires features: energy_master_data.assignment.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.assignment.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "meterId": "00000000-0000-4000-8000-000000000000",
  "podId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "2025-01-01T00:00:00.000Z"
}
```

### Responses

**201** – Meter installed.

Content-Type: `application/json`

```json
{
  "ok": true,
  "assignment": {
    "id": "00000000-0000-4000-8000-000000000000",
    "podId": "00000000-0000-4000-8000-000000000000",
    "meterId": "00000000-0000-4000-8000-000000000000",
    "validFrom": "string",
    "validTo": null,
    "installReading": null
  }
}
```

**404** – PPG or meter not found.

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – PPG already has an active meter, meter already mounted elsewhere, or status invalid.

Content-Type: `application/json`

```json
{
  "error": "string",
  "code": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/pods/:id/meter-install" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"meterId\": \"00000000-0000-4000-8000-000000000000\",
  \"podId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"2025-01-01T00:00:00.000Z\"
}"
```

## POST `/energy_master_data/pods/{id}/meter-replace`

Replace the active meter on a PPG (bitemporal)

Closes the current open MeterAssignment at validFrom (stamping removal_reading + removal_reason if supplied), opens a new assignment for newMeterId, and flips both meter statuses inside a single atomic flush.

Requires features: energy_master_data.assignment.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.assignment.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "podId": "00000000-0000-4000-8000-000000000000",
  "newMeterId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "2025-01-01T00:00:00.000Z"
}
```

### Responses

**201** – Meter replaced.

Content-Type: `application/json`

```json
{
  "ok": true,
  "assignment": {
    "id": "00000000-0000-4000-8000-000000000000",
    "podId": "00000000-0000-4000-8000-000000000000",
    "meterId": "00000000-0000-4000-8000-000000000000",
    "validFrom": "string",
    "validTo": null,
    "installReading": null
  },
  "closedAssignmentId": "00000000-0000-4000-8000-000000000000"
}
```

**404** – PPG, replacement meter, or open assignment missing.

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – Replacement no-op, meter not installable, or backdated overlap.

Content-Type: `application/json`

```json
{
  "error": "string",
  "code": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/pods/:id/meter-replace" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"podId\": \"00000000-0000-4000-8000-000000000000\",
  \"newMeterId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"2025-01-01T00:00:00.000Z\"
}"
```

## POST `/energy_master_data/pods/{id}/transfer`

Transfer a PPG to another party (bitemporal)

Closes the current OPEN PpgCustomerAssignment for the partyRole at validFrom and opens a new one for the new party. Returns 404 if no open assignment exists (use assign instead) and 409 BitemporalOverlapError on backdated edits.

Requires features: energy_master_data.assignment.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.assignment.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Request Body

Content-Type: `application/json`

```json
{
  "partyRole": "customer",
  "partyId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "2025-01-01T00:00:00.000Z"
}
```

### Responses

**200** – No-op (transfer target equals current party).

Content-Type: `application/json`

```json
{
  "ok": true,
  "noop": true,
  "assignment": {
    "id": "00000000-0000-4000-8000-000000000000",
    "podId": "00000000-0000-4000-8000-000000000000",
    "partyRole": "string",
    "partyId": "00000000-0000-4000-8000-000000000000",
    "validFrom": "string",
    "validTo": null
  }
}
```

**201** – Transfer complete: previous row closed, new row opened.

Content-Type: `application/json`

```json
{
  "ok": true,
  "assignment": {
    "id": "00000000-0000-4000-8000-000000000000",
    "podId": "00000000-0000-4000-8000-000000000000",
    "partyRole": "string",
    "partyId": "00000000-0000-4000-8000-000000000000",
    "validFrom": "string",
    "validTo": null
  },
  "closedAssignmentId": "00000000-0000-4000-8000-000000000000"
}
```

**404** – PPG not found, or no open assignment to transfer.

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**409** – Backdated transfer would overlap an existing open window.

Content-Type: `application/json`

```json
{
  "error": "string",
  "code": "BITEMPORAL_OVERLAP"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/pods/:id/transfer" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"partyRole\": \"customer\",
  \"partyId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"2025-01-01T00:00:00.000Z\"
}"
```

## GET `/energy_master_data/ppg-assignments`

List ppg customer assignments

Returns a paginated collection of ppg customer assignments scoped to the authenticated organization.

Requires features: energy_master_data.assignment.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.assignment.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| ppgId | query | any | Optional |
| customerId | query | any | Optional |
| partyRole | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated ppg customer assignments

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "podId": "00000000-0000-4000-8000-000000000000",
      "partyRole": "string",
      "partyId": "00000000-0000-4000-8000-000000000000",
      "validFrom": "string",
      "validTo": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/ppg-assignments?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/energy_master_data/ppgs`

Delete point of delivery (ppg)

Deletes a point of delivery (ppg) identified by id.

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Responses

**200** – Point of Delivery (PPG) deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/energy_master_data/ppgs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/energy_master_data/ppgs`

List points of delivery (ppgs)

Returns a paginated collection of points of delivery (ppgs) scoped to the authenticated organization.

Requires features: energy_master_data.pod.view

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| id | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |
| hubId | query | any | Optional |
| customerId | query | any | Optional |
| gsrn | query | any | Optional |
| osdId | query | any | Optional |
| osdArea | query | any | Optional |
| commodity | query | any | Optional |
| status | query | any | Optional |
| asOf | query | any | Optional |

### Responses

**200** – Paginated points of delivery (ppgs)

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "hubId": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "gsrn": "string",
      "commodity": "GAS",
      "osdArea": "string",
      "osdId": null,
      "status": "DRAFT",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/energy_master_data/ppgs?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/energy_master_data/ppgs`

Create point of delivery (ppg)

Create a PPG (validates GSRN checksum)

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Request Body

Content-Type: `application/json`

```json
{
  "hubId": "00000000-0000-4000-8000-000000000000",
  "code": "string",
  "osdArea": "string"
}
```

### Responses

**201** – Point of Delivery (PPG) created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/energy_master_data/ppgs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"hubId\": \"00000000-0000-4000-8000-000000000000\",
  \"code\": \"string\",
  \"osdArea\": \"string\"
}"
```

## PUT `/energy_master_data/ppgs`

Update point of delivery (ppg)

Updates an existing point of delivery (ppg) by id.

Requires features: energy_master_data.pod.manage

**Tags:** Energy Master Data

**Requires authentication.**

**Features:** energy_master_data.pod.manage

### Request Body

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Point of Delivery (PPG) updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/energy_master_data/ppgs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## DELETE `/entities/definitions`

Soft delete custom field definition

Marks the specified definition inactive and tombstones it for the current scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "key": "string"
}
```

### Responses

**200** – Definition deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity id or key

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Definition not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/entities/definitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"key\": \"string\"
}"
```

## GET `/entities/definitions`

List active custom field definitions

Returns active custom field definitions for the supplied entity ids, respecting tenant scope and tombstones.

**Tags:** Entities

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Optional |
| entityIds | query | any | Optional |
| fieldset | query | any | Optional |

### Responses

**200** – Definition list

Content-Type: `application/json`

```json
{
  "items": [
    {
      "key": "string",
      "kind": "string",
      "label": "string",
      "entityId": "string"
    }
  ]
}
```

**400** – Missing entity id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/definitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/entities/definitions`

Upsert custom field definition

Creates or updates a custom field definition for the current tenant/org scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "key": "string",
  "kind": "text"
}
```

### Responses

**200** – Definition saved

Content-Type: `application/json`

```json
{
  "ok": true,
  "item": {
    "id": "00000000-0000-4000-8000-000000000000",
    "key": "string",
    "kind": "string",
    "configJson": {}
  }
}
```

**400** – Validation failed

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/definitions" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"key\": \"string\",
  \"kind\": \"text\"
}"
```

## POST `/entities/definitions.batch`

Save multiple custom field definitions

Creates or updates multiple definitions for a single entity in one transaction.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "definitions": [
    {
      "key": "string",
      "kind": "text"
    }
  ]
}
```

### Responses

**200** – Definitions saved

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Unexpected failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/definitions.batch" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"definitions\": [
    {
      \"key\": \"string\",
      \"kind\": \"text\"
    }
  ]
}"
```

## GET `/entities/definitions.manage`

Get management snapshot

Returns scoped custom field definitions (including inactive tombstones) for administration interfaces.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Required |

### Responses

**200** – Scoped definitions and deleted keys

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "key": "string",
      "kind": "string",
      "configJson": null,
      "organizationId": null,
      "tenantId": null
    }
  ],
  "deletedKeys": [
    "string"
  ]
}
```

**400** – Missing entity id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/definitions.manage?entityId=string" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/entities/definitions.restore`

Restore definition

Reactivates a previously soft-deleted definition within the current tenant/org scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "key": "string"
}
```

### Responses

**200** – Definition restored

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity id or key

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Definition not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/definitions.restore" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"key\": \"string\"
}"
```

## GET `/entities/encryption`

Fetch encryption map

Returns the encrypted field map for the current tenant/organization scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Required |

### Responses

**200** – Map

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "fields": [
    {
      "field": "string",
      "hashField": null
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/encryption?entityId=string" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/entities/encryption`

Upsert encryption map

Creates or updates the encryption map for the current tenant/organization scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "tenantId": null,
  "organizationId": null,
  "fields": [
    {
      "field": "string",
      "hashField": null
    }
  ]
}
```

### Responses

**200** – Saved

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/encryption" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"tenantId\": null,
  \"organizationId\": null,
  \"fields\": [
    {
      \"field\": \"string\",
      \"hashField\": null
    }
  ]
}"
```

## DELETE `/entities/entities`

Soft delete custom entity

Marks the specified custom entity inactive within the current scope.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string"
}
```

### Responses

**200** – Entity deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Entity not found in scope

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/entities/entities" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\"
}"
```

## GET `/entities/entities`

List available entities

Returns generated and custom entities scoped to the caller with field counts per entity.

**Tags:** Entities

**Requires authentication.**

### Responses

**200** – List of entities

Content-Type: `application/json`

```json
{
  "items": [
    {
      "entityId": "string",
      "source": "code",
      "label": "string",
      "count": 1
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/entities" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/entities/entities`

Upsert custom entity

Creates or updates a tenant/org scoped custom entity definition.

Requires features: entities.definitions.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "label": "string",
  "description": null,
  "showInSidebar": false
}
```

### Responses

**200** – Entity saved

Content-Type: `application/json`

```json
{
  "ok": true,
  "item": {
    "id": "00000000-0000-4000-8000-000000000000",
    "entityId": "string",
    "label": "string"
  }
}
```

**400** – Validation error

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/entities" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"label\": \"string\",
  \"description\": null,
  \"showInSidebar\": false
}"
```

## DELETE `/entities/records`

Delete record

Soft deletes the specified record within the current tenant/org scope.

Requires features: entities.records.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.records.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "recordId": "string"
}
```

### Responses

**200** – Record deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity id or record id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**404** – Record not found

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Unexpected failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/entities/records" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"recordId\": \"string\"
}"
```

## GET `/entities/records`

List records

Returns paginated records for the supplied entity. Supports custom field filters, exports, and soft-delete toggles.

Requires features: entities.records.view

**Tags:** Entities

**Requires authentication.**

**Features:** entities.records.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Required |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| withDeleted | query | any | Optional |
| format | query | any | Optional |
| exportScope | query | any | Optional |
| export_scope | query | any | Optional |
| all | query | any | Optional |
| full | query | any | Optional |

### Responses

**200** – Paginated records

Content-Type: `application/json`

```json
{
  "items": [
    {}
  ],
  "total": 1,
  "page": 1,
  "pageSize": 1,
  "totalPages": 1
}
```

**400** – Missing entity id

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Unexpected failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/records?entityId=string" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/entities/records`

Create record

Creates a record for the given entity. When `recordId` is omitted or not a UUID the data engine will generate one automatically.

Requires features: entities.records.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.records.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "values": {}
}
```

### Responses

**200** – Record created

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Unexpected failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/entities/records" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"values\": {}
}"
```

## PUT `/entities/records`

Update record

Updates an existing record. If the provided recordId is not a UUID the record will be created instead to support optimistic flows.

Requires features: entities.records.manage

**Tags:** Entities

**Requires authentication.**

**Features:** entities.records.manage

### Request Body

Content-Type: `application/json`

```json
{
  "entityId": "string",
  "recordId": "string",
  "values": {}
}
```

### Responses

**200** – Record updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Validation failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

**500** – Unexpected failure

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/entities/records" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityId\": \"string\",
  \"recordId\": \"string\",
  \"values\": {}
}"
```

## GET `/entities/relations/options`

List relation options

Returns up to 200 option entries for populating relation dropdowns, automatically resolving label fields when omitted.

Requires features: entities.definitions.view

**Tags:** Entities

**Requires authentication.**

**Features:** entities.definitions.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| entityId | query | any | Required |
| labelField | query | any | Optional |
| q | query | any | Optional |
| ids | query | any | Optional |
| routeContextFields | query | any | Optional |

### Responses

**200** – Option list

Content-Type: `application/json`

```json
{
  "items": [
    {
      "value": "string",
      "label": "string"
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/relations/options?entityId=string" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/entities/sidebar-entities`

Get sidebar entities

Returns custom entities flagged with `showInSidebar` for the current tenant/org scope.

**Tags:** Entities

**Requires authentication.**

### Responses

**200** – Sidebar entities for navigation

Content-Type: `application/json`

```json
{
  "items": [
    {
      "entityId": "string",
      "label": "string",
      "href": "string"
    }
  ]
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/entities/sidebar-entities" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/events`

List declared events

Returns every declared event. Filters: category, module, excludeTriggerExcluded (default true).

**Tags:** Events

**Requires authentication.**

### Responses

**200** – Declared events

Content-Type: `application/json`

```json
{
  "data": [
    {
      "id": "string",
      "label": "string"
    }
  ],
  "total": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/events" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/events/stream`

GET /events/stream

**Tags:** Events

**Requires authentication.**

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/events/stream" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/market_data/fixings`

Delete price fixing

Soft-deletes a price fixing.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Responses

**200** – Price Fixing deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/market_data/fixings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/market_data/fixings`

List price fixings

Returns a paginated collection of price fixings scoped to the authenticated organization.

Requires features: market_data.view

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| indexRefId | query | any | Optional |
| status | query | any | Optional |
| fixingDateFrom | query | any | Optional |
| fixingDateTo | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated price fixings

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "indexRefId": "00000000-0000-4000-8000-000000000000",
      "fixingDate": "string",
      "value": 1,
      "currency": "string",
      "status": "DRAFT",
      "publishedAt": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/market_data/fixings?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/market_data/fixings`

Create price fixing

Creates a new price fixing.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "indexRefId": "00000000-0000-4000-8000-000000000000",
  "fixingDate": "string",
  "value": 1,
  "currency": "PLN"
}
```

### Responses

**201** – Price Fixing created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/market_data/fixings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"indexRefId\": \"00000000-0000-4000-8000-000000000000\",
  \"fixingDate\": \"string\",
  \"value\": 1,
  \"currency\": \"PLN\"
}"
```

## PUT `/market_data/fixings`

Update price fixing

Updates an existing price fixing.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "currency": "PLN"
}
```

### Responses

**200** – Price Fixing updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/market_data/fixings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"currency\": \"PLN\"
}"
```

## DELETE `/market_data/indexes`

Delete index reference

Soft-deletes a index reference.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Responses

**200** – Index Reference deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/market_data/indexes" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/market_data/indexes`

List index references

Returns a paginated collection of index references scoped to the authenticated organization.

Requires features: market_data.view

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| commodity | query | any | Optional |
| sourceId | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated index references

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "commodity": "string",
      "currency": "string",
      "unit": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/market_data/indexes?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/market_data/indexes`

Create index reference

Creates a new index reference.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "commodity": "string",
  "currency": "PLN",
  "unit": "MWh"
}
```

### Responses

**201** – Index Reference created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/market_data/indexes" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"commodity\": \"string\",
  \"currency\": \"PLN\",
  \"unit\": \"MWh\"
}"
```

## PUT `/market_data/indexes`

Update index reference

Updates an existing index reference.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "currency": "PLN",
  "unit": "MWh"
}
```

### Responses

**200** – Index Reference updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/market_data/indexes" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"currency\": \"PLN\",
  \"unit\": \"MWh\"
}"
```

## DELETE `/market_data/sources`

Delete market data source

Soft-deletes a market data source.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Responses

**200** – Market Data Source deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/market_data/sources" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/market_data/sources`

List market data sources

Returns a paginated collection of market data sources scoped to the authenticated organization.

Requires features: market_data.view

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| isActive | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated market data sources

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "code": "string",
      "name": "string",
      "sourceType": "string",
      "isActive": true
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/market_data/sources?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/market_data/sources`

Create market data source

Creates a new market data source.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "code": "string",
  "name": "string",
  "sourceType": "TGE",
  "isActive": true
}
```

### Responses

**201** – Market Data Source created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/market_data/sources" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"code\": \"string\",
  \"name\": \"string\",
  \"sourceType\": \"TGE\",
  \"isActive\": true
}"
```

## PUT `/market_data/sources`

Update market data source

Updates an existing market data source.

Requires features: market_data.manage

**Tags:** Market Data

**Requires authentication.**

**Features:** market_data.manage

### Request Body

Content-Type: `application/json`

```json
{
  "isActive": true
}
```

### Responses

**200** – Market Data Source updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/market_data/sources" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"isActive\": true
}"
```

## POST `/metering/{orgSlug}/portal/self-reading`

Customer Self-Reading (eBOK)

Submit a customer meter self-reading via the eBOK portal (§9E). Authenticated through customer portal session; PPG ownership verified against PpgCustomerAssignment in energy_master_data. Creates a SelfReading with status=PENDING for back-office review.

**Tags:** Metering

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| orgSlug | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/:orgSlug/portal/self-reading" \
  -H "Accept: application/json"
```

## GET `/metering/corrections`

Metering Corrections (Correction Case)

GET: list correction cases. POST: create a Correction Case for a closed billing period. NEVER silently overwrites a snapshot — creates a new MeteringDataVersion and emits metering.correction.applied.

Requires features: metering.view

**Tags:** Metering

**Requires authentication.**

**Features:** metering.view

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/metering/corrections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/corrections`

Metering Corrections (Correction Case)

GET: list correction cases. POST: create a Correction Case for a closed billing period. NEVER silently overwrites a snapshot — creates a new MeteringDataVersion and emits metering.correction.applied.

Requires features: metering.correct

**Tags:** Metering

**Requires authentication.**

**Features:** metering.correct

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/corrections" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/metering/periods`

Billing Periods CRUD

List and create billing periods per PPG. Periods must be contiguous (no gaps/overlaps). Close a period via POST /periods/:id/close.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/metering/periods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/metering/periods`

Billing Periods CRUD

List and create billing periods per PPG. Periods must be contiguous (no gaps/overlaps). Close a period via POST /periods/:id/close.

Requires features: metering.view

**Tags:** Metering

**Requires authentication.**

**Features:** metering.view

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/metering/periods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/periods`

Billing Periods CRUD

List and create billing periods per PPG. Periods must be contiguous (no gaps/overlaps). Close a period via POST /periods/:id/close.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/periods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/metering/periods`

Billing Periods CRUD

List and create billing periods per PPG. Periods must be contiguous (no gaps/overlaps). Close a period via POST /periods/:id/close.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/metering/periods" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/periods/{id}/build`

Build Billing Period

Validate readings in the period, detect gaps, check completeness. Transitions status: DRAFT → BUILDING → COMPLETE.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/periods/:id/build" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/periods/{id}/close`

Close Billing Period

Closes a COMPLETE billing period. Creates an immutable MeteringDataSnapshot and emits metering.period.closed to trigger the meterToCash billing saga. Period must be in COMPLETE status.

Requires features: metering.close_period

**Tags:** Metering

**Requires authentication.**

**Features:** metering.close_period

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/periods/:id/close" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/metering/readings`

Meter Readings CRUD

Import, list, update and delete meter readings. POST triggers VEE pipeline. Filter by ppgId, meterId, billingPeriodId, source, quality, readAt range.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**204** – Success

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/metering/readings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/metering/readings`

Meter Readings CRUD

Import, list, update and delete meter readings. POST triggers VEE pipeline. Filter by ppgId, meterId, billingPeriodId, source, quality, readAt range.

Requires features: metering.view

**Tags:** Metering

**Requires authentication.**

**Features:** metering.view

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/metering/readings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/readings`

Meter Readings CRUD

Import, list, update and delete meter readings. POST triggers VEE pipeline. Filter by ppgId, meterId, billingPeriodId, source, quality, readAt range.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/readings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/metering/readings`

Meter Readings CRUD

Import, list, update and delete meter readings. POST triggers VEE pipeline. Filter by ppgId, meterId, billingPeriodId, source, quality, readAt range.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/metering/readings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/metering/readings/{id}/estimate`

Start Meter Reading Estimation

Creates an EstimatedReading (VEE §5G) for the given reading with status=PENDING. Requires USER_TASK acceptance in workflows before quality becomes szacunkowy.

Requires features: metering.manage

**Tags:** Metering

**Requires authentication.**

**Features:** metering.manage

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/metering/readings/:id/estimate" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/notifications`

List notifications

Returns a paginated collection of notifications.

**Tags:** Notifications

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| status | query | any | Optional |
| type | query | any | Optional |
| severity | query | any | Optional |
| sourceEntityType | query | any | Optional |
| sourceEntityId | query | any | Optional |
| since | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated notifications

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "type": "string",
      "title": "string",
      "body": null,
      "titleKey": null,
      "bodyKey": null,
      "titleVariables": null,
      "bodyVariables": null,
      "icon": null,
      "severity": "string",
      "status": "string",
      "actions": [
        {
          "id": "string",
          "label": "string"
        }
      ],
      "sourceModule": null,
      "sourceEntityType": null,
      "sourceEntityId": null,
      "linkHref": null,
      "createdAt": "string",
      "readAt": null,
      "actionTaken": null
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/notifications?page=1&pageSize=20" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/notifications`

Create notification

Creates a notification for a user.

Requires features: notifications.create

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.create

### Request Body

Content-Type: `application/json`

```json
{
  "type": "string",
  "severity": "info",
  "recipientUserId": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**201** – Notification created

Content-Type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"type\": \"string\",
  \"severity\": \"info\",
  \"recipientUserId\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## POST `/notifications/{id}/action`

POST /notifications/{id}/action

**Tags:** Notifications

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications/:id/action" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/notifications/{id}/dismiss`

PUT /notifications/{id}/dismiss

**Tags:** Notifications

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/notifications/:id/dismiss" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/notifications/{id}/read`

PUT /notifications/{id}/read

**Tags:** Notifications

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/notifications/:id/read" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/notifications/{id}/restore`

PUT /notifications/{id}/restore

**Tags:** Notifications

**Requires authentication.**

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/notifications/:id/restore" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/notifications/batch`

POST /notifications/batch

Requires features: notifications.create

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.create

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications/batch" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/notifications/feature`

POST /notifications/feature

Requires features: notifications.create

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.create

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications/feature" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/notifications/mark-all-read`

PUT /notifications/mark-all-read

**Tags:** Notifications

**Requires authentication.**

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/notifications/mark-all-read" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/notifications/role`

POST /notifications/role

Requires features: notifications.create

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.create

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications/role" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/notifications/settings`

GET /notifications/settings

Requires features: notifications.manage

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.manage

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/notifications/settings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/notifications/settings`

POST /notifications/settings

Requires features: notifications.manage

**Tags:** Notifications

**Requires authentication.**

**Features:** notifications.manage

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/notifications/settings" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/notifications/unread-count`

GET /notifications/unread-count

**Tags:** Notifications

**Requires authentication.**

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/notifications/unread-count" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/payments/allocations`

List paymentallocations

Returns a paginated collection of paymentallocations scoped to the authenticated organization.

Requires features: payments.view

**Tags:** Payments

**Requires authentication.**

**Features:** payments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| paymentId | query | any | Optional |
| invoiceId | query | any | Optional |
| receivableId | query | any | Optional |
| kind | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated paymentallocations

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "paymentId": "00000000-0000-4000-8000-000000000000",
      "invoiceId": "00000000-0000-4000-8000-000000000000",
      "receivableId": "00000000-0000-4000-8000-000000000000",
      "allocatedAmount": "string",
      "kind": "string",
      "allocatedAt": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/payments/allocations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/payments/payments`

List payments

Returns a paginated collection of payments scoped to the authenticated organization.

Requires features: payments.view

**Tags:** Payments

**Requires authentication.**

**Features:** payments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| customerId | query | any | Optional |
| contractId | query | any | Optional |
| ppgId | query | any | Optional |
| status | query | any | Optional |
| source | query | any | Optional |
| unmatched | query | any | Optional |
| paidAtFrom | query | any | Optional |
| paidAtTo | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| sort | query | any | Optional |
| order | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated payments

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "status": "string",
      "source": "string",
      "customerId": null,
      "contractId": null,
      "amount": "string",
      "currency": "string",
      "paidAt": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/payments/payments" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/payments/payments/{id}/match`

POST /payments/payments/{id}/match

Requires features: payments.match

**Tags:** Payments (Płatności gazowe)

**Requires authentication.**

**Features:** payments.match

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/payments/payments/:id/match" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/payments/payments/{id}/unmatch`

POST /payments/payments/{id}/unmatch

Requires features: payments.match

**Tags:** Payments (Płatności gazowe)

**Requires authentication.**

**Features:** payments.match

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/payments/payments/:id/unmatch" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/payments/statements`

List bankstatements

Returns a paginated collection of bankstatements scoped to the authenticated organization.

Requires features: payments.view

**Tags:** Payments

**Requires authentication.**

**Features:** payments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| status | query | any | Optional |
| periodFrom | query | any | Optional |
| periodTo | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated bankstatements

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "statementRef": "string",
      "status": "string",
      "importedAt": "string",
      "currency": "string",
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/payments/statements" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/payments/statements/import`

POST /payments/statements/import

Requires features: payments.manage

**Tags:** Payments (Płatności gazowe)

**Requires authentication.**

**Features:** payments.manage

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/payments/statements/import" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/payments/virtual-accounts`

List virtualbankaccounts

Returns a paginated collection of virtualbankaccounts scoped to the authenticated organization.

Requires features: payments.view

**Tags:** Payments

**Requires authentication.**

**Features:** payments.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| customerId | query | any | Optional |
| contractId | query | any | Optional |
| isActive | query | any | Optional |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated virtualbankaccounts

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "contractId": null,
      "label": null,
      "isActive": true,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/payments/virtual-accounts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/payments/virtual-accounts`

Create virtualbankaccount

Create a virtual bank account for a customer/contract.

Requires features: payments.manage

**Tags:** Payments

**Requires authentication.**

**Features:** payments.manage

### Request Body

Content-Type: `application/json`

```json
{
  "customerId": "00000000-0000-4000-8000-000000000000",
  "accountNumber": "string"
}
```

### Responses

**201** – VirtualBankAccount created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/payments/virtual-accounts" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"accountNumber\": \"string\"
}"
```

## DELETE `/pricing/calculations`

Delete rating calculation

Soft-deletes a rating calculation.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Responses

**200** – Rating Calculation deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/pricing/calculations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/pricing/calculations`

List rating calculations

Returns a paginated collection of rating calculations scoped to the authenticated organization.

Requires features: pricing.view

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ppgId | query | any | Optional |
| contractId | query | any | Optional |
| billingPeriodId | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated rating calculations

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "ppgId": "00000000-0000-4000-8000-000000000000",
      "ratingDate": "string",
      "totalNet": 1,
      "currency": "string",
      "status": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/pricing/calculations?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/pricing/calculations`

Rating Calculation management

Requires features: pricing.rate

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.rate

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/calculations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## PUT `/pricing/calculations`

Update rating calculation

Updates an existing rating calculation.

Requires features: pricing.rate

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.rate

### Request Body

Content-Type: `application/json`

```json
{}
```

### Responses

**200** – Rating Calculation updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/pricing/calculations" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{}"
```

## DELETE `/pricing/charge-components`

Delete charge component

Soft-deletes a charge component.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Responses

**200** – Charge Component deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/pricing/charge-components" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/pricing/charge-components`

List charge components

Returns a paginated collection of charge components scoped to the authenticated organization.

Requires features: pricing.view

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| tariffVersionId | query | any | Optional |
| kind | query | any | Optional |
| tariffScope | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated charge components

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "tariffVersionId": "00000000-0000-4000-8000-000000000000",
      "kind": "string",
      "tariffScope": "string",
      "unitPrice": 1,
      "currency": "string",
      "passThrough": true,
      "marginEligible": true
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/pricing/charge-components?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/pricing/charge-components`

Create charge component

Creates a new charge component.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "tariffVersionId": "00000000-0000-4000-8000-000000000000",
  "kind": "energia_czynna",
  "tariffScope": "SPRZEDAWCA",
  "unit": "string",
  "priceUnit": "string",
  "unitPrice": 1,
  "currency": "PLN",
  "passThrough": false,
  "marginEligible": true,
  "position": 0
}
```

### Responses

**201** – Charge Component created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/charge-components" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"tariffVersionId\": \"00000000-0000-4000-8000-000000000000\",
  \"kind\": \"energia_czynna\",
  \"tariffScope\": \"SPRZEDAWCA\",
  \"unit\": \"string\",
  \"priceUnit\": \"string\",
  \"unitPrice\": 1,
  \"currency\": \"PLN\",
  \"passThrough\": false,
  \"marginEligible\": true,
  \"position\": 0
}"
```

## PUT `/pricing/charge-components`

Update charge component

Updates an existing charge component.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "currency": "PLN",
  "passThrough": false,
  "marginEligible": true,
  "position": 0
}
```

### Responses

**200** – Charge Component updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/pricing/charge-components" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"currency\": \"PLN\",
  \"passThrough\": false,
  \"marginEligible\": true,
  \"position\": 0
}"
```

## DELETE `/pricing/formulas`

Delete pricing formula

Soft-deletes a pricing formula.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Responses

**200** – Pricing Formula deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/pricing/formulas" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/pricing/formulas`

List pricing formulas

Returns a paginated collection of pricing formulas scoped to the authenticated organization.

Requires features: pricing.view

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| kind | query | any | Optional |
| status | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated pricing formulas

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "kind": "fixed",
      "currency": "string",
      "status": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/pricing/formulas?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/pricing/formulas`

Create pricing formula

Creates a new pricing formula.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string",
  "kind": "fixed",
  "currency": "PLN",
  "status": "DRAFT"
}
```

### Responses

**201** – Pricing Formula created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/formulas" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\",
  \"kind\": \"fixed\",
  \"currency\": \"PLN\",
  \"status\": \"DRAFT\"
}"
```

## PUT `/pricing/formulas`

Update pricing formula

Updates an existing pricing formula.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "currency": "PLN",
  "status": "DRAFT"
}
```

### Responses

**200** – Pricing Formula updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/pricing/formulas" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"currency\": \"PLN\",
  \"status\": \"DRAFT\"
}"
```

## DELETE `/pricing/products`

Delete pricing product

Soft-deletes a pricing product.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Responses

**200** – Pricing Product deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/pricing/products" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/pricing/products`

List pricing products

Returns a paginated collection of pricing products scoped to the authenticated organization.

Requires features: pricing.view

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| status | query | any | Optional |
| commodity | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated pricing products

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "name": "string",
      "commodity": "string",
      "status": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/pricing/products?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/pricing/products`

Create pricing product

Creates a new pricing product.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "name": "string",
  "commodity": "GAS",
  "status": "DRAFT"
}
```

### Responses

**201** – Pricing Product created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/products" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"name\": \"string\",
  \"commodity\": \"GAS\",
  \"status\": \"DRAFT\"
}"
```

## PUT `/pricing/products`

Update pricing product

Updates an existing pricing product.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "commodity": "GAS",
  "status": "DRAFT"
}
```

### Responses

**200** – Pricing Product updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/pricing/products" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"commodity\": \"GAS\",
  \"status\": \"DRAFT\"
}"
```

## POST `/pricing/rate`

POST /pricing/rate

Requires features: pricing.rate

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.rate

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/rate" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/pricing/tariffs`

Delete tariff version

Soft-deletes a tariff version.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Responses

**200** – Tariff Version deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/pricing/tariffs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/pricing/tariffs`

List tariff versions

Returns a paginated collection of tariff versions scoped to the authenticated organization.

Requires features: pricing.view

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| search | query | any | Optional |
| status | query | any | Optional |
| tariffScope | query | any | Optional |
| productId | query | any | Optional |
| asOf | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated tariff versions

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "tariffCode": "string",
      "tariffScope": "SPRZEDAWCA",
      "status": "string",
      "validFrom": null,
      "validTo": null
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/pricing/tariffs?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/pricing/tariffs`

Create tariff version

Creates a new tariff version.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "tariffCode": "string",
  "tariffScope": "SPRZEDAWCA",
  "status": "DRAFT"
}
```

### Responses

**201** – Tariff Version created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/pricing/tariffs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"tariffCode\": \"string\",
  \"tariffScope\": \"SPRZEDAWCA\",
  \"status\": \"DRAFT\"
}"
```

## PUT `/pricing/tariffs`

Update tariff version

Updates an existing tariff version.

Requires features: pricing.manage

**Tags:** Pricing

**Requires authentication.**

**Features:** pricing.manage

### Request Body

Content-Type: `application/json`

```json
{
  "status": "DRAFT"
}
```

### Responses

**200** – Tariff Version updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/pricing/tariffs" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"status\": \"DRAFT\"
}"
```

## POST `/query_index/purge`

Purge query index records

Queues a purge job to remove indexed records for an entity type within the active scope.

Requires features: query_index.purge

**Tags:** Query Index

**Requires authentication.**

**Features:** query_index.purge

### Request Body

Content-Type: `application/json`

```json
{
  "entityType": "string"
}
```

### Responses

**200** – Purge job accepted.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity type

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/query_index/purge" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityType\": \"string\"
}"
```

## POST `/query_index/reindex`

Trigger query index rebuild

Queues a reindex job for the specified entity type within the current tenant scope.

Requires features: query_index.reindex

**Tags:** Query Index

**Requires authentication.**

**Features:** query_index.reindex

### Request Body

Content-Type: `application/json`

```json
{
  "entityType": "string"
}
```

### Responses

**200** – Reindex job accepted.

Content-Type: `application/json`

```json
{
  "ok": true
}
```

**400** – Missing entity type

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/query_index/reindex" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"entityType\": \"string\"
}"
```

## GET `/query_index/status`

Inspect query index coverage

Returns entity counts comparing base tables with the query index along with the latest job status.

Requires features: query_index.status.view

**Tags:** Query Index

**Requires authentication.**

**Features:** query_index.status.view

### Responses

**200** – Current query index status.

Content-Type: `application/json`

```json
{
  "items": [
    {
      "entityId": "string",
      "label": "string",
      "baseCount": null,
      "indexCount": null,
      "vectorCount": null,
      "ok": true,
      "job": {
        "status": "idle",
        "startedAt": null,
        "finishedAt": null,
        "heartbeatAt": null,
        "processedCount": null,
        "totalCount": null,
        "scope": null
      }
    }
  ],
  "errors": [
    {
      "id": "string",
      "source": "string",
      "handler": "string",
      "entityType": null,
      "recordId": null,
      "tenantId": null,
      "organizationId": null,
      "message": "string",
      "stack": null,
      "payload": null,
      "occurredAt": "string"
    }
  ],
  "logs": [
    {
      "id": "string",
      "source": "string",
      "handler": "string",
      "level": "info",
      "entityType": null,
      "recordId": null,
      "tenantId": null,
      "organizationId": null,
      "message": "string",
      "details": null,
      "occurredAt": "string"
    }
  ]
}
```

**400** – Tenant or organization context required

Content-Type: `application/json`

```json
{
  "error": "string"
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/query_index/status" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/switching/cases`

Delete switching case

Deletes a switching case identified by id.

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Responses

**200** – Switching Case deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/switching/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/switching/cases`

List switching cases

Returns a paginated collection of switching cases scoped to the authenticated organization.

Requires features: switching.view

**Tags:** Switching

**Requires authentication.**

**Features:** switching.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| ppgId | query | any | Optional |
| contractId | query | any | Optional |
| customerId | query | any | Optional |
| status | query | any | Optional |
| packageId | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated switching cases

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "ppgId": "00000000-0000-4000-8000-000000000000",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "customerId": "00000000-0000-4000-8000-000000000000",
      "packageId": null,
      "status": "string",
      "plannedChangeDate": "string",
      "effectiveChangeDate": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/switching/cases?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/switching/cases`

Create switching case

Create a draft switching case (SWITCHING_ROBOCZY).

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Request Body

Content-Type: `application/json`

```json
{
  "ppgId": "00000000-0000-4000-8000-000000000000",
  "contractId": "00000000-0000-4000-8000-000000000000",
  "customerId": "00000000-0000-4000-8000-000000000000",
  "packageId": null,
  "poaId": "00000000-0000-4000-8000-000000000000",
  "previousSupplierId": "00000000-0000-4000-8000-000000000000",
  "osdId": "00000000-0000-4000-8000-000000000000",
  "plannedChangeDate": "string",
  "validFrom": "string",
  "validTo": null,
  "sourceSystem": null,
  "owner": null,
  "status": "SWITCHING_ROBOCZY"
}
```

### Responses

**201** – Switching Case created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/switching/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"ppgId\": \"00000000-0000-4000-8000-000000000000\",
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"packageId\": null,
  \"poaId\": \"00000000-0000-4000-8000-000000000000\",
  \"previousSupplierId\": \"00000000-0000-4000-8000-000000000000\",
  \"osdId\": \"00000000-0000-4000-8000-000000000000\",
  \"plannedChangeDate\": \"string\",
  \"validFrom\": \"string\",
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null,
  \"status\": \"SWITCHING_ROBOCZY\"
}"
```

## PUT `/switching/cases`

Update switching case

Updates an existing switching case by id.

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Request Body

Content-Type: `application/json`

```json
{
  "packageId": null,
  "validTo": null,
  "sourceSystem": null,
  "owner": null,
  "status": "SWITCHING_ROBOCZY",
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Switching Case updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/switching/cases" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"packageId\": null,
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null,
  \"status\": \"SWITCHING_ROBOCZY\",
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## POST `/switching/cases/{id}/cancel`

Cancel switching case (4M rezygnacja / saga compensation)

Initiates saga compensation by transitioning to REZYGNACJA (if already sent to OSD) or ANULOWANY. Emits switching.case.cancelled; the saga handles OSD cancellation notification.

Requires features: switching.cancel

**Tags:** Switching (zmiana sprzedawcy gazu)

**Requires authentication.**

**Features:** switching.cancel

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/switching/cases/:id/cancel" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/switching/cases/{id}/resume`

Resume / re-activate switching case (4N ponowienie)

Resets a rejected or cancelled case to SWITCHING_ROBOCZY with a new planned change date. The caller must then re-submit with a new PoA check.

Requires features: switching.resume

**Tags:** Switching (zmiana sprzedawcy gazu)

**Requires authentication.**

**Features:** switching.resume

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/switching/cases/:id/resume" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/switching/cases/{id}/submit`

Submit switching case to OSD (fail-closed PoA check)

Validates an active Power-of-Attorney (scope=switching) before sending. If no valid PoA → 422, no request sent (REQ-007, AC-002). Creates SwitchingRequest, advances to ZGŁOSZENIE_PRZYGOTOWANE, emits switching.case.submitted. The switchingWorkflow saga (om-temporal-saga) picks up from the event.

Requires features: switching.submit

**Tags:** Switching (zmiana sprzedawcy gazu)

**Requires authentication.**

**Features:** switching.submit

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| id | path | any | Required |

### Responses

**201** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/switching/cases/:id/submit" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## DELETE `/switching/packages`

Delete switching package

Deletes a switching package identified by id.

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Responses

**200** – Switching Package deleted

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X DELETE "https://151.115.63.33.sslip.io/api/switching/packages" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/switching/packages`

List switching packages

Returns a paginated collection of switching packages scoped to the authenticated organization.

Requires features: switching.view

**Tags:** Switching

**Requires authentication.**

**Features:** switching.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| contractId | query | any | Optional |
| status | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated switching packages

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "businessKey": "string",
      "contractId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "totalPpgCount": 1,
      "acceptedPpgCount": 1,
      "rejectedPpgCount": 1,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/switching/packages?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## POST `/switching/packages`

Create switching package

Create a switching package (4J multi-PPG batch).

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Request Body

Content-Type: `application/json`

```json
{
  "contractId": "00000000-0000-4000-8000-000000000000",
  "customerId": "00000000-0000-4000-8000-000000000000",
  "osdId": "00000000-0000-4000-8000-000000000000",
  "poaId": "00000000-0000-4000-8000-000000000000",
  "validFrom": "string",
  "validTo": null,
  "sourceSystem": null,
  "owner": null,
  "status": "PAKIET_ROBOCZY"
}
```

### Responses

**201** – Switching Package created

Content-Type: `application/json`

```json
{
  "id": null
}
```

### Example

```bash
curl -X POST "https://151.115.63.33.sslip.io/api/switching/packages" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"contractId\": \"00000000-0000-4000-8000-000000000000\",
  \"customerId\": \"00000000-0000-4000-8000-000000000000\",
  \"osdId\": \"00000000-0000-4000-8000-000000000000\",
  \"poaId\": \"00000000-0000-4000-8000-000000000000\",
  \"validFrom\": \"string\",
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null,
  \"status\": \"PAKIET_ROBOCZY\"
}"
```

## PUT `/switching/packages`

Update switching package

Updates an existing switching package by id.

Requires features: switching.manage

**Tags:** Switching

**Requires authentication.**

**Features:** switching.manage

### Request Body

Content-Type: `application/json`

```json
{
  "validTo": null,
  "sourceSystem": null,
  "owner": null,
  "status": "PAKIET_ROBOCZY",
  "id": "00000000-0000-4000-8000-000000000000"
}
```

### Responses

**200** – Switching Package updated

Content-Type: `application/json`

```json
{
  "ok": true
}
```

### Example

```bash
curl -X PUT "https://151.115.63.33.sslip.io/api/switching/packages" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d "{
  \"validTo\": null,
  \"sourceSystem\": null,
  \"owner\": null,
  \"status\": \"PAKIET_ROBOCZY\",
  \"id\": \"00000000-0000-4000-8000-000000000000\"
}"
```

## GET `/switching/requests`

List switching requests

Returns a paginated collection of switching requests scoped to the authenticated organization.

Requires features: switching.view

**Tags:** Switching

**Requires authentication.**

**Features:** switching.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| switchingCaseId | query | any | Optional |
| packageId | query | any | Optional |
| status | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated switching requests

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "switchingCaseId": "00000000-0000-4000-8000-000000000000",
      "packageId": null,
      "ppgId": "00000000-0000-4000-8000-000000000000",
      "osdId": "00000000-0000-4000-8000-000000000000",
      "status": "string",
      "osdReferenceNumber": null,
      "sentAt": null,
      "confirmedAt": null,
      "version": 1,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/switching/requests?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/switching/sla-trackers`

List sla trackers

Returns a paginated collection of sla trackers scoped to the authenticated organization.

Requires features: switching.view

**Tags:** Switching

**Requires authentication.**

**Features:** switching.view

### Parameters
| Name | Location | Type | Description |
| --- | --- | --- | --- |
| page | query | any | Optional |
| pageSize | query | any | Optional |
| switchingCaseId | query | any | Optional |
| threatLevel | query | any | Optional |
| sortField | query | any | Optional |
| sortDir | query | any | Optional |
| ids | query | any | Optional. Comma-separated list of record UUIDs to filter by (max 200). |

### Responses

**200** – Paginated sla trackers

Content-Type: `application/json`

```json
{
  "items": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "switchingCaseId": "00000000-0000-4000-8000-000000000000",
      "stage": "string",
      "deadlineAt": "string",
      "warningAt": "string",
      "threatLevel": "string",
      "breachedAt": null,
      "escalatedAt": null,
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "total": 1,
  "totalPages": 1
}
```

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/switching/sla-trackers?page=1&pageSize=50" \
  -H "Accept: application/json" \
  -H "authorization: Bearer <token>"
```

## GET `/version`

Deployed Open Mercato version

**Tags:** API Documentation

### Responses

**200** – Success response

Content-Type: `application/json`

### Example

```bash
curl -X GET "https://151.115.63.33.sslip.io/api/version" \
  -H "Accept: application/json"
```