List policies in a zone
List policies in a zone
client.zones.policies.list(stringzoneID, PolicyListParams { after, before, expand, 10 more } params?, RequestOptionsoptions?): PolicyListResponse { items, pagination }
GET/zones/{zone_id}/policies
Returns a paginated list of policies in the zone. Supports cursor-based pagination, sorting, full-text search, and composable filters.
The filter[id] parameter restricts results to a known set
of policy IDs (up to 100). It composes with other filters
(filter[owner_type], query[], etc.) but cannot be
combined with cursor pagination (after / before) — the
server returns 400 if both are present. When filter[id] is
used without an explicit limit, the limit defaults to the
number of requested IDs so all results fit in a single page.
IDs that don't exist or fall outside the zone are silently
omitted.
Parameters
zoneID: string
Returns
List policies in a zone
import KeycardAPI from '@keycardai/api';
const client = new KeycardAPI();
const policies = await client.zones.policies.list('zone_id');
console.log(policies.items);{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": "created_by",
"name": "name",
"owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"archived_at": "2019-12-27T18:11:19.117Z",
"description": "description",
"latest_schema_version": "latest_schema_version",
"latest_version": 0,
"latest_version_id": "latest_version_id",
"updated_by": "updated_by"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}Returns Examples
{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": "created_by",
"name": "name",
"owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"archived_at": "2019-12-27T18:11:19.117Z",
"description": "description",
"latest_schema_version": "latest_schema_version",
"latest_version": 0,
"latest_version_id": "latest_version_id",
"updated_by": "updated_by"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}