> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/case-repository-api.md).

# Case Repository - use in low-code

## Low-code integration with Case Repository

{% hint style="warning" %}
Functionality available from platform version: 4.760.0
{% endhint %}

{% hint style="info" %}
The functionality for adding new entries to Case Repository is available for scripts (scriptService) and script tasks (scriptTask).
{% endhint %}

## Low-Code API for Case Repository

`Eximee Case Repository` serves as the central repository of customer cases, aggregating information from many channels and systems into a unified data model.\
In the context of the low-code platform, the API enables standardized integration of processes, forms, and services with the case repository so that status and event data are consistent, up-to-date, and available across applications.

The integration is based on an event-driven model, which allows data to be published and updated in real time, regardless of where the process is initiated.\
This makes it possible to build a unified customer case view (omnichannel), support automation, and ensure service continuity across customer and internal channels.

This section describes how to use the low-code API to communicate with `Case Repository`, including data publication rules, object model requirements `Case`.

Detailed description of the role, architecture, and data model `Eximee Case Repository` is found in the document describing the assumptions [Case Repository](/documentation/documentation-en/wprowadzenie/architektura-platformy/rozszerzenia-platformy/eximee-case-repository.md).

### Creating a new case status

Method `create` creates a new case status entry in `Case Repository`.

Required fields:

* `caseType` - case type,
* `client` - customer identifier,
* `clientType` - customer identifier type,
* `status` - current case status.

Field `statusDescription` is optional and is used to extend the status description.

Field `caseId` is optional and is used to manually assign a case identifier. The value can be any string, however due to the uniqueness requirement it is recommended to use `Random.uuid()`. If we do not fill in the field `caseId`, the system will generate a unique identifier automatically.

Field `source` is filled by default with the value "eximee" for all entries created from the low-code platform. Field `caseType` is filled by default with the application name for all entries created from the low-code platform.

```javascript
api.caseRepository.v1.create({
    caseId: "caseId",
    caseType: "caseType",
    client: "client",
    clientType: "clientType",
    businessKey: "businessKey",
    source: "source",
    status: "status",
    statusDescription: "statusDescription"
});
```

Example:

```javascript
api.caseRepository.v1.create({
    caseId: "c3f9a7c2-6d61-4d35-9f8b-f3c9f1b8a111",
    caseType: "MORTGAGE_APPLICATION",
    client: "12345678901",
    clientType: "PERSON",
    businessKey: "MORTGAGE_APPLICATION-12345678901",
    source: "eximee",
    status: "APPLICATION_SUBMITTED",
    statusDescription: "The application has been successfully registered"
});
```

### Modifying an existing case status

Method `update` updates the status of an existing case. The request should include only the fields to be changed. The operation modifies all statuses assigned to the given case.

```javascript
api.caseRepository.v1.update({
    caseType: "caseType",
    client: "client",
    clientType: "clientType",
    source: "source",
    businessKey: "businessKey",
    status: "status",
    statusDescription: "statusDescription"
});
```

Example of updating the status and description:

```javascript
api.caseRepository.v1.update({
    status: "UNDER_VERIFICATION",
    statusDescription: "Income document verification in progress"
});
```

### Deleting a case status

Method `delete` removes all statuses assigned to the given case. The operation is irreversible.

```javascript
api.caseRepository.v1.delete();
```

### Retrieving the current case status

Method `get` retrieves the current case status.

```javascript
api.caseRepository.v1.get();
```

Sample response:

```json
{
  "caseId": "f6d7b6ba-5f7f-4f7a-b4d8-0f5be3fd8f16",
  "creationDate": "2026-05-06T10:15:22",
  "updateDate": "2026-05-07T08:42:03",
  "caseType": "MORTGAGE_APPLICATION",
  "clientId": "12345678901",
  "clientType": "PESEL",
  "status": "APPLICATION_SUBMITTED",
  "source": "eximee",
  "businessKey": "MORTGAGE_APPLICATION-12345678901",
  "statusDescription": "The application has been successfully registered"
}
```

### Searching for a case status

Method `search` allows searching for case statuses based on the provided filters. Filters can be combined freely, and the results are paginated. A logical product (`AND`) is used between different filter fields, which means that only records meeting all the specified conditions are returned.

```javascript
api.caseRepository.v1.search({
    caseTypes: ["caseType"],
    statuses: ["status"],
    clientId: "clientId",
    clientType: "clientType",
    createdDate: {
        from: "YYYY-MM-DDTHH:mm:ss",
        to: "YYYY-MM-DDTHH:mm:ss"
    },
    updatedDate: {
        from: "YYYY-MM-DDTHH:mm:ss",
        to: "YYYY-MM-DDTHH:mm:ss"
    },
    page: 0,
    pageSize: 10
});
```

Example usage:

```javascript
api.caseRepository.v1.search({
    caseTypes: ["MORTGAGE_APPLICATION"],
    statuses: ["APPLICATION_SUBMITTED", "UNDER_VERIFICATION"],
    clientId: "12345678901",
    clientType: "PESEL",
    createdDate: {
        from: "2026-05-01T00:00:00",
        to: "2026-05-12T23:59:59"
    },
    page: 0,
    pageSize: 20
});
```

Sample response:

```json
{
  "page": 0,
  "pageSize": 20,
  "count": 2,
  "statuses": [
    {
      "caseId": "f6d7b6ba-5f7f-4f7a-b4d8-0f5be3fd8f16",
      "creationDate": "2026-05-06T10:15:22",
      "updateDate": "2026-05-07T08:42:03",
      "caseType": "MORTGAGE_APPLICATION",
      "clientId": "12345678901",
      "clientType": "PESEL",
      "status": "APPLICATION_SUBMITTED",
      "source": "eximee",
      "businessKey": "MORTGAGE_APPLICATION-12345678901",
      "statusDescription": "The application has been successfully registered"
    },
    {
      "caseId": "f6d7b6ba-5f7f-4f7a-b4d8-0f5be3fd8f16",
      "creationDate": "2026-05-06T10:15:22",
      "updateDate": "2026-05-08T12:09:41",
      "caseType": "MORTGAGE_APPLICATION",
      "clientId": "12345678901",
      "clientType": "PESEL",
      "source": "eximee",
      "businessKey": "MORTGAGE_APPLICATION-12345678901",
      "status": "UNDER_VERIFICATION",
      "statusDescription": "Income document verification in progress"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/case-repository-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
