5-Minute Walkthrough
This guide takes you from zero to a signed on-chain transaction. By the end you will have:
- A vault with a secret stored inside it
- An agent with a signing key provisioned on Ethereum
- A policy granting the agent read access
- A signed transaction on a testnet
The whole thing takes about five minutes assuming you already have an account. If you do not, sign up at 1claw.co first.
Prerequisites
- A 1claw account (free tier works)
- A human API key (
1ck_...) or a session token from the dashboard curlandjqinstalled (or use the SDK)
Step 1: Create a vault
A vault is a container for secrets. Every secret lives inside exactly one vault.
- curl
- TypeScript
export TOKEN="your-jwt-or-1ck-key"
VAULT=$(curl -s -X POST https://api.1claw.co/v1/vaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Quickstart","description":"Five-minute walkthrough"}')
VAULT_ID=$(echo "$VAULT" | jq -r '.id')
echo "Vault ID: $VAULT_ID"
import { createClient } from "@1claw/sdk";
const client = createClient({
baseUrl: "https://api.1claw.co",
apiKey: process.env.ONECLAW_API_KEY!,
});
const { data: vault } = await client.vault.create({
name: "Quickstart",
description: "Five-minute walkthrough",
});
const vaultId = vault.id;
console.log("Vault ID:", vaultId);
Step 2: Store a secret
Put a secret into the vault. This could be an API key, a database URL, or any sensitive value. The value is encrypted at rest using AES-256-GCM with HSM-managed keys.
- curl
- TypeScript
curl -s -X PUT "https://api.1claw.co/v1/vaults/$VAULT_ID/secrets/demo/api-key" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"value": "sk-test-abc123def456",
"type": "api_key",
"metadata": { "description": "Demo API key for walkthrough" }
}'
await client.secrets.set(vaultId, "demo/api-key", "sk-test-abc123def456", {
type: "api_key",
metadata: { description: "Demo API key for walkthrough" },
});
Step 3: Register an agent
An agent is a non-human caller (AI assistant, backend service, automation) that accesses secrets through scoped policies. Save the api_key from the response. You will only see it once.
- curl
- TypeScript
AGENT=$(curl -s -X POST https://api.1claw.co/v1/agents \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Walkthrough Agent",
"intents_api_enabled": true
}')
AGENT_ID=$(echo "$AGENT" | jq -r '.agent.id')
AGENT_KEY=$(echo "$AGENT" | jq -r '.api_key')
echo "Agent ID: $AGENT_ID"
echo "Agent API Key: $AGENT_KEY" # save this, shown once
const agent = await client.agents.create({
name: "Walkthrough Agent",
intents_api_enabled: true,
});
const agentId = agent.data.agent.id;
const agentKey = agent.data.api_key; // save this, shown once
Step 4: Create a policy
Policies define what an agent can access. This one grants read access on everything under the demo/ path in the vault.
- curl
- TypeScript
curl -s -X POST "https://api.1claw.co/v1/vaults/$VAULT_ID/policies" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"principal_type\": \"agent\",
\"principal_id\": \"$AGENT_ID\",
\"secret_path_pattern\": \"demo/*\",
\"permissions\": [\"read\"]
}"
await client.access.grantAgent(vaultId, agentId, ["read"], {
secretPathPattern: "demo/*",
});