Quickstart
Get Bulwark running in under 5 minutes.
1. Install the SDK
npm install @bulwark/core
# or
pnpm add @bulwark/core
2. Configure the client
import { BulwarkClient } from "@bulwark/core";
const bulwark = new BulwarkClient({
tenantId: process.env.BULWARK_TENANT_ID!,
apiKey: process.env.BULWARK_API_KEY!,
baseUrl: "https://api.bulwarkauth.io",
});
3. Register a user
const { user, token } = await bulwark.auth.register({
email: "user@example.com",
password: "supersecret",
name: "Jane Doe",
});
4. Login
const { accessToken, refreshToken } = await bulwark.auth.login({
email: "user@example.com",
password: "supersecret",
});
5. Register an AI agent
const agent = await bulwark.agents.register({
name: "my-assistant",
description: "Customer support AI agent",
scopes: ["read:customers", "write:tickets"],
trustLevel: "medium",
});
console.log(agent.agentId); // agent_01j...
console.log(agent.apiKey); // bwk_agent_...
6. Create an agent session
const session = await bulwark.sessions.create({
agentId: agent.agentId,
userId: user.id,
requestedScopes: ["read:customers"],
});
// Use session.credentialToken to make proxied API calls