Quick Start

Get your first action tracked in under 5 minutes.

1. Get Your API Key

Sign up and get your API key from the onboarding wizard or Settings → API Keys.

Your key looks like: apk_abc123...

2. Install the SDK

Choose your language:

TypeScript/JavaScript
npm install apaai-ts-sdk
# or
yarn add apaai-ts-sdk
Python
pip install apaai

3. Track Your First Action

TypeScript/JavaScript
import { AccountabilityLayer } from 'apaai-ts-sdk';

const client = new AccountabilityLayer({
  endpoint: 'https://api.apaaiprotocol.org',
  apiKey: process.env.APAAI_API_KEY // Your API key
});

// Track an action
const action = await client.actions.create({
  type: 'send_email',
  actor: {
    kind: 'agent',
    name: 'marketing-bot',
    provider: 'openai'
  },
  target: 'user@example.com',
  params: {
    subject: 'Welcome!',
    body: 'Thanks for signing up'
  }
});

console.log('Action tracked:', action.actionId);
console.log('Status:', action.status); // 'approved' or 'requires_approval'
Python
from apaai import AccountabilityLayer
import os

client = AccountabilityLayer(
    endpoint='https://api.apaaiprotocol.org',
    api_key=os.environ['APAAI_API_KEY']
)

# Track an action
action = client.actions.create(
    type='send_email',
    actor={
        'kind': 'agent',
        'name': 'marketing-bot',
        'provider': 'openai'
    },
    target='user@example.com',
    params={
        'subject': 'Welcome!',
        'body': 'Thanks for signing up'
    }
)

print(f"Action tracked: {action['actionId']}")
print(f"Status: {action['status']}")  # 'approved' or 'requires_approval'
cURL
curl -X POST https://api.apaaiprotocol.org/actions \
  -H "Content-Type: application/json" \
  -H "x-apaaikey: YOUR_API_KEY" \
  -d '{
    "type": "send_email",
    "actor": {
      "kind": "agent",
      "name": "marketing-bot",
      "provider": "openai"
    },
    "target": "user@example.com",
    "params": {
      "subject": "Welcome!",
      "body": "Thanks for signing up"
    }
  }'

4. View in Dashboard

Go to your dashboard to see your action!

What Just Happened?

  • Your action was tracked and logged
  • If no policies matched, it was auto-approved
  • If a policy requires approval, it's pending review
  • All evidence is recorded automatically

Common Action Types

// Database operations
type: 'database.query'
type: 'database.write'
type: 'database.delete'

// External APIs
type: 'api.call'
type: 'send_email'
type: 'send_sms'

// File operations
type: 'file.read'
type: 'file.write'
type: 'file.delete'

// Custom
type: 'your-custom-action'

Need Help?


That's it! You're now tracking AI agent actions. 🎉