Listing state
This section provides information on how to list state entries.
API reference:
Required scopes:
Data/Buildby.Taskurai/state/read
Optional scopes:
Data/Buildby.Taskurai/sensitive/read: Can return sensitive data.
Prerequisites
- You have completed the Setup sample application tutorial.
Listing state
Use the following command to list state:
- C#
// Get state client
var stateClient = taskurai.GetStateClient();
Pageable<StateResponse> states = stateClient.ListState("DefaultStateStore");
// Iterate page by page
foreach (Page<StateResponse> page in states.AsPages())
{
foreach (StateResponse state in page.Values)
{
Console.WriteLine(JsonSerializer.Serialize(state, serializerOptions));
}
}
Next, run the console application to validate:
dotnet run
Sample output:
{
"id": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::model::timeseries::forecasting::v1",
"partitionKey": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::model::timeseries::forecasting::v1",
"created": "2026-03-27T17:23:25.4413203+00:00",
"createdBy": "d8e9cb3f-ffeb-4915-bb15-6681a3bcd175",
"modified": "2026-03-27T17:23:25.4413203+00:00",
"modifiedBy": "d8e9cb3f-ffeb-4915-bb15-6681a3bcd175",
"hasBlob": true,
"contentType": "application/octet-stream",
"tags": {
"trained_on": "sales_forecasting_dataset",
"accuracy": "0.95",
"description": "Time series forecasting model for sales predictions",
"model_type": "LSTM",
"framework": "Deep Learning"
},
"stateStoreName": "DefaultStateStore",
"isolationMode": true,
"isolationKey": "dd10b001-addd-45c2-94a6-932282b7515c",
"ttl": -1,
"eTagBlob": "\u00220x8DE8C258DCE6990\u0022",
"stateReference": {
"stateStoreName": "DefaultStateStore",
"id": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::model::timeseries::forecasting::v1"
}
}
{
"id": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::config::commonconfig",
"partitionKey": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::config::commonconfig",
"created": "2026-03-27T17:47:55.7175201+00:00",
"createdBy": "d8e9cb3f-ffeb-4915-bb15-6681a3bcd175",
"modified": "2026-03-27T17:47:55.7175201+00:00",
"modifiedBy": "d8e9cb3f-ffeb-4915-bb15-6681a3bcd175",
"hasBlob": true,
"tags": {},
"stateStoreName": "DefaultStateStore",
"isolationMode": true,
"isolationKey": "dd10b001-addd-45c2-94a6-932282b7515c",
"ttl": -1,
"eTagBlob": "\u00220x8DE8C28FA273160\u0022",
"stateReference": {
"stateStoreName": "DefaultStateStore",
"id": "isolation::dd10b001-addd-45c2-94a6-932282b7515c::state::ml::config::commonconfig"
}
}
Customize list options
- C#
You can customize the list options using the StateListInput like this:
// Get state client
var stateClient = taskurai.GetStateClient();
var listStateInput = new StateListInput()
{
IdPrefix = "webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a::",
IncludeBlobSasUri = false,
OrderBy = "created:DESC"
};
var stateResponseList = stateClient.ListState("DefaultStateStore", listStateInput);
Console.WriteLine(JsonSerializer.Serialize(stateResponseList, serializerOptions));
Sample output:
[
{
"Id": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::state::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a::cart",
"PartitionKey": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a",
"Created": "2025-01-10T13:04:49.439271+00:00",
"Tags": {},
"StateStoreName": "DefaultStateStore",
"IsolationMode": true,
"IsolationKey": "46e49c2c-cdd4-48e8-9106-f32c0a77a64e",
"Ttl": 3600,
"Etag": "\u002240001867-0000-0d00-0000-67811af60000\u0022",
"Value": {
"items": {
"Item A": 10,
"Item B": 5
}
},
"StateReference": {
"StateStoreName": "DefaultStateStore",
"Id": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::state::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a::cart"
}
},
{
"Id": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::state::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a::customer",
"PartitionKey": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a",
"Created": "2025-01-10T13:04:49.43865+00:00",
"Tags": {},
"StateStoreName": "DefaultStateStore",
"IsolationMode": true,
"IsolationKey": "46e49c2c-cdd4-48e8-9106-f32c0a77a64e",
"Ttl": 3600,
"Etag": "\u002240001767-0000-0d00-0000-67811af60000\u0022",
"Value": {
"name": "Jane Doe",
"email": "jane.doe@mail.net",
"address": {
"street": "",
"zipcode": "",
"city": "",
"state": "",
"country": "US"
}
},
"StateReference": {
"StateStoreName": "DefaultStateStore",
"Id": "isolation::46e49c2c-cdd4-48e8-9106-f32c0a77a64e::state::webshop::session::54e11dda-b68f-44f2-b508-59ac0f8d2e8a::customer"
}
}
]
Overview of the state list options:
| Property | Type | Default | Description |
|---|---|---|---|
continuationToken | string | Pageable continuation token | |
returnTotalCount | boolean | False | Return total count |
returnCondensed | boolean | True | Return condensed data |
orderBy | string | Order by field (format: fieldName:direction, direction: ASC, DESC) | |
partitionKey | string | State partition key | |
idPrefix | string | Filter on id prefix | |
externalAccountId | string | Filter tasks by external account ID | |
externalUserId | string | Filter tasks by external user ID | |
tags | Dictionary<string, string> | Filter tasks tags (case-insensitive) | |
isolationMode | boolean | Enable isolation mode (isolation key required) | |
isolationKey | string | Isolation key to filter isolated tasks | |
maxParallelism | int | 1 | Maximum number of blob state operations at once (max 10) |
concurrencyMode | StateConcurrencyMode | Concurrency mode | |
consistencyLevel | StateConsistencyLevel | Consistency level | |
includeValueBlob | boolean | true | Include value blob if any in the response |
includeBlobSasUri | boolean | true | Include value blob if any in the response |
blobSasExpiryHours | boolean | 2 | Blob SAS Uri expiry in hours |
blobSasAsAttachment | boolean | false | Set download attachment headers in SAS Uri |
Order by field names:
| Field name | Description |
|---|---|
created | State created |
Order by direction:
| Direction | Description |
|---|---|
ASC | Ascending |
DESC | Descending |