List Cases
Retrieves a paginated list of cases for your account with optional filtering by status and organization.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | int32 | No | Maximum number of cases to return (default: 50, max: 100) |
offset | int32 | No | Number of cases to skip (default: 0) |
status | string | No | Filter cases by status ("active", "archived") |
organization_id | string | No | Filter cases by organization ID. If omitted, returns all cases for the account. |
Response
Returns:
cases: Array of case objectstotal: Total number of cases (for pagination)
Examples
- Go
- TypeScript
import (
"context"
"github.com/silentwitness/go-sdk"
)
// List all cases
response, err := silentwitness.Cases.List(ctx, nil)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Total: %d cases\n", response.Total)
for _, c := range response.Cases {
fmt.Printf("- %s (ID: %s)\n", c.Name, c.Id)
}
// With pagination and filtering
response, err = silentwitness.Cases.List(ctx, &silentwitness.ListCasesParams{
Limit: silentwitness.Int32(20),
Offset: silentwitness.Int32(0),
Status: silentwitness.String("active"),
})
// Filter by organization
response, err = silentwitness.Cases.List(ctx, &silentwitness.ListCasesParams{
OrganizationId: silentwitness.String("org_123456"),
})
import { listCases } from "@silentwitness/typescript-sdk";
// List all cases
const response = await listCases();
console.log(`Total: ${response.total} cases`);
response.cases.forEach(c => {
console.log(`- ${c.name} (ID: ${c.id})`);
});
// With pagination and filtering
const filtered = await listCases({
limit: 20,
offset: 0,
status: "active"
});
// Filter by organization
const orgCases = await listCases({
organizationId: "org_123456"
});
Errors
| Code | Description |
|---|---|
INVALID_ARGUMENT | Invalid pagination parameters |
UNAUTHENTICATED | Invalid or missing API key |