@uipath/access-policy-sdk
TypeScript SDK for the UiPath Access Policy platform. Wraps two services:
| PAP — Policy Administration Point | Manage policy definitions (CRUD) | {baseUrl}/{orgId}/pap_ |
| PDP — Policy Decision Point | Evaluate a request against active policies | {baseUrl}/{orgId}/pdp_ |
The API surface is generated from swagger/swagger_policy_engine.json via openapi-generator (typescript-fetch). Generated code lives in generated/ and must not be edited by hand — regenerate after updating the swagger.
Install
bun add @uipath/access-policy-sdk
Usage
Two factory functions authenticate with @uipath/auth and return a configured API instance:
import {
createPapApiClient,
createPdpApiClient,
PolicyManagementApi,
PolicyEvaluationApi,
} from "@uipath/access-policy-sdk";
const pap = await createPapApiClient(PolicyManagementApi);
const { items } = await pap.apiPoliciesGet({ top: 20, skip: 0 });
const pdp = await createPdpApiClient(PolicyEvaluationApi);
const result = await pdp.apiPolicyEvaluateTenantTenantIdPost({
tenantId: "<tenant-uuid>",
policyEvaluationApiRequestDto: {
organizationId: "<org-uuid>",
resourceType: "Agent",
resourceIdentifier: "<uuid>",
},
});
Both factories call getLoginStatusAsync() under the hood — the caller must be logged in (uip login) with an organization context. Throw on missing credentials.
Options
interface CreateApiClientOptions {
tenant?: string;
loginValidity?: number;
}
Scripts
bun run generate
bun run build
bun run lint
Regeneration
bun run generate shells out to @openapitools/openapi-generator-cli, which requires Java 17+. If your system default is older:
JAVA_HOME=/opt/homebrew/opt/openjdk@17 PATH=$JAVA_HOME/bin:$PATH bun run generate
After regeneration:
- Inspect any new enums in
generated/src/models/ — add overrides in src/types.ts only if they render as NUMBER_0 style.
- Bump the package version.
- Update
swagger/swagger_policy_engine.json via git diff to confirm the source change is intentional.
Structure
src/
index.ts Re-exports generated APIs + factories
client-factory.ts createPapApiClient, createPdpApiClient
scripts/
generate-sdk.ts Regen script (wraps openapi-generator-cli)
generated/ 100% generated — do not edit
src/apis/ PolicyManagementApi, PolicyEvaluationApi, VersionApi
src/models/ DTOs + enums
src/runtime.ts Configuration, BaseAPI
swagger/
swagger_policy_engine.json Source of truth for generation