Sardis

n8n Integration

Use the Sardis node in n8n workflows to execute policy-controlled payments from visual automation pipelines.

Coming Soon — The n8n Sardis node is not yet available for installation. This page describes the planned integration. In the meantime, you can use the REST API directly from n8n's HTTP Request node.

Installation

npm install n8n-nodes-sardis

After installing, restart n8n and the Sardis node will appear in the node palette under the "Transform" category. The node uses the Sardis API credential type for authentication.

Self-hosted n8n

# Install into your n8n custom nodes directory
cd ~/.n8n/custom
npm install n8n-nodes-sardis

# Or set the N8N_CUSTOM_EXTENSIONS env var to your custom nodes path
N8N_CUSTOM_EXTENSIONS="/path/to/custom-nodes" n8n start

Credentials Setup

The node uses a Sardis API credential with two fields:

API Key:  sk_live_...                   # Your Sardis API key
Base URL: https://api.sardis.sh         # Default, change for self-hosted deployments

In the n8n UI: go to Credentials, click "Add credential", search for "Sardis API", and enter your API key. The credential is shared across all Sardis nodes in your workflows.

Operations

The Sardis node supports three operations, selectable from the Operation dropdown.

Send Payment

Execute a policy-controlled payment. Maps to POST /api/v2/wallets/{walletId}/transfer.

# Node parameters
Wallet ID:  wallet_abc123             # Required
Amount:     50                        # Required — USD amount
Merchant:   api.openai.com            # Required — recipient identifier
Purpose:    GPT-4 API credits         # Optional — memo/reason
Token:      USDC | USDT | PYUSD | EURC  # Default: USDC
Chain:      base | ethereum | polygon | arbitrum | optimism  # Default: base

# Output data (passed to next node)
{
  "success": true,
  "tx_id": "pay_xyz789",
  "status": "completed",
  "amount": "50",
  "destination": "api.openai.com"
}

Check Balance

Retrieve wallet balance and limits. Maps to GET /api/v2/wallets/{walletId}/balance.

# Node parameters
Wallet ID:  wallet_abc123
Token:      USDC (default)
Chain:      base (default)

# Output data
{
  "success": true,
  "balance": "500.00",
  "token": "USDC",
  "chain": "base"
}

Check Policy

Pre-check whether a payment would pass spending policy before executing it.

# Node parameters
Wallet ID:  wallet_abc123
Amount:     50
Merchant:   api.openai.com

# Output data (allowed)
{
  "allowed": true,
  "amount": 50,
  "merchant": "api.openai.com",
  "limitPerTx": 100,
  "message": "$50 to api.openai.com would be allowed"
}

# Output data (blocked)
{
  "allowed": false,
  "amount": 200,
  "merchant": "api.openai.com",
  "limitPerTx": 100,
  "message": "$200 exceeds per-tx limit of $100"
}

Example: Conditional Payment Workflow

A workflow that checks policy first and only executes payment if allowed. Use n8n's IF node to branch on the allowed field.

Workflow: Conditional Payment

[Trigger]
  └── [Sardis: Check Policy]
         Wallet ID: {{ $env.SARDIS_WALLET_ID }}
         Amount:    {{ $json.amount }}
         Merchant:  {{ $json.merchant }}
  └── [IF: allowed == true]
         True  → [Sardis: Send Payment]
                   Wallet ID: {{ $env.SARDIS_WALLET_ID }}
                   Amount:    {{ $json.amount }}
                   Merchant:  {{ $json.merchant }}
                   Purpose:   {{ $json.purpose }}
                   Token:     USDC
                   Chain:     base
                 → [Slack: Notify "Payment approved: tx_id"]
         False → [Slack: Notify "Payment blocked: message"]

Example: Scheduled Balance Report

Use n8n's Schedule Trigger to send a daily balance report to Slack.

Workflow: Daily Balance Report

[Schedule Trigger: every day at 9am]
  └── [Sardis: Check Balance]
         Wallet ID: wallet_abc123
         Token:     USDC
         Chain:     base
  └── [Slack: Send Message]
         Channel: #finance
         Message: |
           Daily Sardis Balance Report
           Balance: {{ $json.balance }} {{ $json.token }}
           Chain: {{ $json.chain }}

Supported Tokens and Chains

TokenSupported Chains
USDCbase, ethereum, polygon, arbitrum, optimism
USDTethereum, polygon, arbitrum, optimism
PYUSDethereum
EURCbase, ethereum, polygon

Best Practices

  • Store the Sardis API key in n8n Credentials, never in node parameters directly
  • Use the IF node to branch on the allowed field from Check Policy before Send Payment
  • Use n8n expressions like {{ $json.amount }} to pass dynamic values between nodes
  • Enable workflow error handling to catch payment failures and send alerts
  • The node outputs are passed as JSON to subsequent nodes — use Set node to reshape if needed