Skip to main content
Once you’ve created policies in the Developer Portal, you can fetch their details programmatically. This guide shows the current package choices for policy reads and how to retrieve policy information through the REST API and TypeScript clients.
This page covers the portal-facing clients @swig-wallet/api and @swig-wallet/developer. For the primary prepare-first Swig Developer SDK, see What the Developer SDK Does. Treat @swig-wallet/developer as the legacy SDK for new integrations. The current @swig-wallet/developer-sdk package is optimized for prepared wallet operations. It does expose swig.wallets.getPolicy(policyId), but it returns raw policy metadata rather than the richer helper surface from the legacy SDK.

Prerequisites

Before fetching policies, ensure you have:
  • An API key created in the Developer Portal
  • A policy created that you want to fetch
  • The policy ID (visible in the portal’s policy details)

Choose the Right Package

Fetching a Policy

Using the REST API

Make a GET request to the policies endpoint:
Replace {policyId} with your actual policy ID (e.g., clx1234567890abcdef). Example Response:

Using a Portal Client

If You’re Already Using the Current SDK

If your app already uses @swig-wallet/developer-sdk for prepared wallet operations, you can read the same raw policy metadata the SDK uses during wallet creation and recovery flows:
Use this when policy lookup is part of a prepared-wallet flow. For standalone policy inspection, prefer @swig-wallet/api. For richer helper methods around actions and authorities, use the legacy @swig-wallet/developer client.

Package Fit

If you are starting fresh and only need to fetch policies, prefer @swig-wallet/api. If you are starting fresh and need hosted wallet operations, use @swig-wallet/developer-sdk and treat policy reads as a supporting detail rather than the primary interface.

Response Types

Policy

Authority Configuration

The authority field can be one of several types:

Action Configuration

The actions array contains one or more action configurations:

Error Handling

Common Errors

Retry Configuration

Both SDKs support automatic retries for transient failures:
With these settings, retries occur at: 1s, 2s, 4s (exponential backoff).
Both SDKs only retry on 5xx server errors and network failures. Client errors (4xx) are not retried.

Complete Example

Next Steps

Now that you can fetch policies, learn how to create Swig wallets using those policies.