> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PoliciesClient

Defined in: [client/policies/policies.ts:25](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L25)

The namespace containing all Policy methods.

## Implements

* [`PoliciesClientInterface`](/sdks/cdp-sdks-v2/typescript/policies/Types/PoliciesClientInterface)

## Constructors

### Constructor

```ts theme={null}
new PoliciesClient(): PoliciesClient;
```

#### Returns

`PoliciesClient`

## Methods

### createPolicy()

```ts theme={null}
createPolicy(options: CreatePolicyOptions): Promise<Policy>;
```

Defined in: [client/policies/policies.ts:186](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L186)

Creates a new policy that can be used to govern the behavior of projects and accounts.

#### Parameters

##### options

[`CreatePolicyOptions`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#createpolicyoptions)

Options for creating the policy

#### Returns

`Promise`\<`Policy`>

The created policy

#### Throws

When the policy is invalid

#### Examples

```ts theme={null}
         const policy = await cdp.policies.createPolicy({
           policy: {
             scope: "account",
             description: "Limits the amount of ETH in transaction",
             rules: [
               {
                 action: "reject",
                 operation: "signEvmTransaction",
                 criteria: [
                   {
                     type: "ethValue",
                     ethValue: "1000000000000000000",
                     operator: ">",
                   },
                 ],
               },
             ],
           }
         });
```

```ts theme={null}
         const policy = await cdp.policies.createPolicy({
           policy: {
             scope: "account",
             description: "Limits SOL transfers and SPL token operations",
             rules: [
               {
                 action: "reject",
                 operation: "signSolTransaction",
                 criteria: [
                   {
                     type: "solValue",
                     solValue: "1000000000", // 1 SOL in lamports
                     operator: ">",
                   },
                   {
                     type: "solAddress",
                     addresses: ["9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"],
                     operator: "in",
                   },
                 ],
               },
               {
                 action: "accept",
                 operation: "sendSolTransaction",
                 criteria: [
                   {
                     type: "mintAddress",
                     addresses: ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], // USDC mint
                     operator: "in",
                   },
                 ],
               },
             ],
           }
         });
```

```ts theme={null}
         const idempotencyKey = uuidv4();

         // First call creates the policy
         const policy = await cdp.policies.createPolicy({
           policy: {
             scope: "account",
             description: "Limits the amount of ETH in transaction",
             rules: [
               {
                 action: "reject",
                 operation: "signEvmTransaction",
                 criteria: [
                   {
                     type: "ethValue",
                     ethValue: "1000000000000000000",
                     operator: ">",
                   },
                 ],
               },
             ],
           },
           idempotencyKey
         });

         // Second call with same key returns the same policy
         const samePolicy = await cdp.policies.createPolicy({
           policy: { ... },
           idempotencyKey
         });
```

#### Implementation of

```ts theme={null}
PoliciesClientInterface.createPolicy
```

***

### deletePolicy()

```ts theme={null}
deletePolicy(options: DeletePolicyOptions): Promise<void>;
```

Defined in: [client/policies/policies.ts:267](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L267)

Deletes a policy by its unique identifier.
If a policy is referenced by an active project or account, this operation will fail.

#### Parameters

##### options

[`DeletePolicyOptions`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#deletepolicyoptions)

Options containing the policy ID to delete

#### Returns

`Promise`\<`void`>

Void on successful deletion

#### Examples

```ts theme={null}
         await cdp.policies.deletePolicy({
           id: "__ID__"
         });
```

```ts theme={null}
         const idempotencyKey = uuidv4();

         // This operation is idempotent with the key
         await cdp.policies.deletePolicy({
           id: "__ID__",
           idempotencyKey
         });
```

#### Implementation of

```ts theme={null}
PoliciesClientInterface.deletePolicy
```

***

### getPolicyById()

```ts theme={null}
getPolicyById(options: GetPolicyByIdOptions): Promise<Policy>;
```

Defined in: [client/policies/policies.ts:226](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L226)

Retrieves a policy by its unique identifier.

#### Parameters

##### options

[`GetPolicyByIdOptions`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#getpolicybyidoptions)

Options containing the policy ID to retrieve

#### Returns

`Promise`\<`Policy`>

The requested policy

#### Example

```ts theme={null}
         const policy = await cdp.policies.getPolicyById({
           id: "__ID__"
         });

         console.log(policy.name);
         console.log(policy.rules);
```

#### Implementation of

```ts theme={null}
PoliciesClientInterface.getPolicyById
```

***

### listPolicies()

```ts theme={null}
listPolicies(options?: ListPoliciesOptions): Promise<ListPoliciesResult>;
```

Defined in: [client/policies/policies.ts:63](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L63)

Lists policies belonging to the developer's CDP Project.
Can be filtered by scope (project or account).

#### Parameters

##### options?

[`ListPoliciesOptions`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#listpoliciesoptions) = `{}`

Options for filtering and paginating the results

#### Returns

`Promise`\<[`ListPoliciesResult`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#listpoliciesresult)>

A paginated list of policies

#### Examples

```ts theme={null}
         const { policies } = await cdp.policies.listPolicies();
```

```ts theme={null}
         const &#123; policies &#125; = await cdp.policies.listPolicies({
           scope: 'project'
         });
```

```ts theme={null}
         // Get first page
         const firstPage = await cdp.policies.listPolicies({
           pageSize: 10
         });

         // Get next page using cursor
         const nextPage = await cdp.policies.listPolicies({
           pageSize: 10,
           pageToken: firstPage.pageToken
         });
```

#### Implementation of

```ts theme={null}
PoliciesClientInterface.listPolicies
```

***

### updatePolicy()

```ts theme={null}
updatePolicy(options: UpdatePolicyOptions): Promise<Policy>;
```

Defined in: [client/policies/policies.ts:360](https://github.com/coinbase/cdp-sdk/blob/59b6f4f714b6e359fb2390fa1df724c8c5419568/typescript/packages/cdp-sdk/src/client/policies/policies.ts#L360)

Updates an existing policy by its unique identifier.
This will apply the updated policy to any project or accounts that are currently using it.

#### Parameters

##### options

[`UpdatePolicyOptions`](/sdks/cdp-sdks-v2/typescript/policies/Types/index#updatepolicyoptions)

Options containing the policy ID and updated policy data

#### Returns

`Promise`\<`Policy`>

The updated policy

#### Throws

When the updated policy is invalid

#### Examples

```ts theme={null}
         const updatedPolicy = await cdp.policies.updatePolicy({
           id: "__ID__",
           policy: {
             description: "Now with lower transaction limits",
             rules: [
               {
                 action: "reject",
                 operation: "signEvmTransaction",
                 criteria: [
                   {
                     type: "ethValue",
                     ethValue: "1000000000",
                     operator: ">",
                   },
                 ],
               },
             ],
           },
         });
```

```ts theme={null}
         const updatedPolicy = await cdp.policies.updatePolicy({
           id: "__ID__",
           policy: {
             description: "Updated Solana transaction limits",
             rules: [
               {
                 action: "reject",
                 operation: "signSolTransaction",
                 criteria: [
                   {
                     type: "splValue",
                     splValue: "1000000", // SPL token amount
                     operator: ">=",
                   },
                   {
                     type: "mintAddress",
                     addresses: ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], // USDC mint
                     operator: "in",
                   },
                 ],
               },
             ],
           },
         });
```

```ts theme={null}
         const idempotencyKey = uuidv4();

         // This operation is idempotent with the key
         await cdp.policies.updatePolicy({
           id: "__ID__",
           policy: {
             description: "Modified Policy",
             rules: &#123; ... &#125;
           },
           idempotencyKey
         });
```

#### Implementation of

```ts theme={null}
PoliciesClientInterface.updatePolicy
```
