ApiKeys Collection
Iterate over ApiKey resources in Zscaler Cloud & Branch Connector.
Returned items are ApiKey resources — access their fields via dot notation.
Iterate all items
import zssdk
session = zssdk.Session(profile_name="beta")
# Yield each item; pagination (if any) is handled automatically
for item in session.ztw.api_keys.all():
print(item.id)
# Materialize the full list
all_items = list(session.ztw.api_keys.all())
print(f"Total items: {len(all_items)}")
Iterate by page
# Paginated collections yield each server page; simple collections yield one page
for page in session.ztw.api_keys().pages():
print(f"Got a page with {len(page)} items")
for item in page:
print(item.id)
Simple collection
This endpoint returns all items in a single response — no server-side pagination. .all() and .pages() still work; .pages() yields exactly one page. .page_size(n) is ignored; .limit(n) just slices the single response.
See the Pagination guide for the full pagination model.
Filter and search
# Server-side filtering (query params sent to the API)
for item in session.ztw.api_keys.filter(include_partner_key="value"):
print(item.id)
# Client-side JMESPath on each page
for item in session.ztw.api_keys.search("[?contains(name, 'prod')]"):
print(item.id)
Resource Type
Each item is a ApiKey instance with standard CRUDL and any custom actions defined on that resource.
Related
- ApiKey resource — individual resource operations
- Pagination guide