Home > @cerbos/core > Client > getPolicy
Fetch a policy by ID.
Signature:
getPolicy(id: string, options?: RequestOptions): Promise<Policy | undefined>;
Parameter |
Type |
Description |
---|---|---|
id |
string | |
options |
(Optional) |
Returns:
Promise<Policy | undefined>
Requires
-
the client to be configured with Options.adminCredentials, and
-
the Cerbos policy decision point server to be configured with the admin API enabled.
const policy = await cerbos.getPolicy("resource.document.v1");