Skip to main content

What is an API member?

API members are wallets that sign on behalf of automated systems. Setting one up requires registration and admin approval. Before requesting a registration payload, an admin must invite the API member through the GUI so the wallet is eligible to register.

1) Set up the client and signer

Create the SDK client and signer used to authorize the registration.
import { DenClient } from "@den/sdk";
import { privateKeyToAccount } from "viem/accounts";

const signer = privateKeyToAccount("0xYOUR_PRIVATE_KEY");

const client = new DenClient({
  apiKey: "ck_live_...",
  rpcProviders: {
    1: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY",
  },
});

2) Request a registration payload

Request the payload for the invited API member wallet address.
const payload = await client.getMemberRegistrationPayload("0xabc...");
The response includes a messageToSign and salt.

3) Sign the payload off-chain

Sign the payload to prove control of the wallet.
const signature = await signer.signMessage({
  message: payload.messageToSign,
});

4) Submit the registration

Submit the signature to register the API member wallet.
const registration = await client.registerMember({
  walletAddress: "0xabc...",
  signature,
});

5) Admins add the member

Submit and execute a member proposal to activate the API member. Registration only validates ownership of the wallet. An admin must still submit a member proposal to add the API member to the organization and execute it.
const proposal = await client.createNewMemberProposal({
  items: [{ name: "Treasury Bot", walletAddress: "0xabc..." }],
});

await client.signMemberProposal(proposal.id, {
  type: "approve",
  signature: "0x...",
});

await client.executeMemberProposal(proposal.id, { type: "approve" });

Notes

  • API members require an API key associated with that member.
  • User members are added through the admin UI, not via this flow.

Full example

import { DenClient } from "@den/sdk";
import { privateKeyToAccount } from "viem/accounts";

// 1) Set up the client and signer.
const signer = privateKeyToAccount("0xYOUR_PRIVATE_KEY");

const client = new DenClient({
  apiKey: "ck_live_...",
  rpcProviders: {
    1: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY",
  },
});

// 2) Request a registration payload.
const payload = await client.getMemberRegistrationPayload("0xabc...");

// 3) Sign the payload off-chain.
const signature = await signer.signMessage({
  message: payload.messageToSign,
});

// 4) Submit the registration.
const registration = await client.registerMember({
  walletAddress: "0xabc...",
  signature,
});

// 5) Admins add the member.
const proposal = await client.createNewMemberProposal({
  items: [{ name: "Treasury Bot", walletAddress: "0xabc..." }],
});

await client.signMemberProposal(proposal.id, {
  type: "approve",
  signature: "0x...",
});

await client.executeMemberProposal(proposal.id, { type: "approve" });