Docs/Getting Started

Getting Started

Go from zero to authorized in under 5 minutes. This guide walks you through installing the SDK, creating your first policy, and authorizing your first agent action.

1

Install the SDK

Install the PermitNetworks SDK for your language of choice. We support TypeScript, Python, and Rust.

TypeScript / Node.jsnpm install @permitnetworks/sdk
Pythonpip install permitnetworks
2

Create an API Key

Sign up at permitnetworks.com/signup and create an API key from the dashboard. Keys are scoped per environment.

# Your API key looks like this: pn_live_sk_7f3ae91c... # For development, use: pn_test_sk_...
3

Define a Policy

Create your first authorization policy. This policy sets a $1,000 daily spending limit for a purchase agent.

TypeScript// Initialize the client import { PermitNetworks } from '@permitnetworks/sdk'; const permit = new PermitNetworks({ apiKey: 'pn_live_sk_...' }); // Create a spending limit policy await permit.policies.create({ name: 'daily-spend-limit', rules: [{ action: 'spend', effect: 'allow', conditions: { maxAmount: 1000, period: 'daily' } }] });
Pythonfrom permitnetworks import PermitNetworks permit = PermitNetworks(api_key="pn_live_sk_...") await permit.policies.create( name="daily-spend-limit", rules=[{ "action": "spend", "effect": "allow", "conditions": {"maxAmount": 1000, "period": "daily"} }] )
4

Authorize Your First Action

Now authorize an agent action. The SDK sends the request to the nearest edge node and returns a decision in under 1ms.

const decision = await permit.authorize({ agent: 'purchase-bot', action: 'spend', resource: 'company-funds', context: { amount: 500, currency: 'USD' } }); if (decision.allowed) { // Proceed with purchase } else { console.log(`Denied: ${decision.reason}`); }

Verify It Works

You can also test authorization directly via curl:

curl -X POST https://api.permitnetworks.com/v1/authorize \ -H "Authorization: Bearer pn_live_sk_..." \ -H "Content-Type: application/json" \ -d '{ "agent": "purchase-bot", "action": "spend", "resource": "company-funds", "context": { "amount": 500 } }'