Skip to content
Docs
Policy Bundle

Fetch the effective Policy Bundle for the user

Fetch the effective Policy Bundle for the user

policy_bundle.retrieve(PolicyBundleRetrieveParams**kwargs) -> BinaryResponseContent
GET/policy/bundle

Returns the effective Policy Bundle for the user identified by the zone-issued resource-scoped token. When no user-scope binding exists, one will be generated from the default set.

The response body is a binary archive in the codec selected via the Accept header. The only codec supported today is application/vnd.keycard.policy-bundle.v1+tar+gzip. Clients SHOULD send an explicit Accept header; absent one, the server defaults to the tar+gzip codec.

Supports conditional fetch via If-None-Match: when the supplied ETag matches the current bundle, the server responds 304 Not Modified with no body.

ParametersExpand Collapse
if_none_match: Optional[str]
x_client_request_id: Optional[str]
formatuuid
ReturnsExpand Collapse
BinaryResponseContent

Fetch the effective Policy Bundle for the user

import os
from keycardai_api import KeycardAPI

client = KeycardAPI(
    api_key=os.environ.get("KEYCARD_API_API_KEY"),  # This is the default and can be omitted
)
policy_bundle = client.policy_bundle.retrieve()
print(policy_bundle)
content = policy_bundle.read()
print(content)
Returns Examples