Administration
Manage users, webhooks, databases, and instance settings from the SDK.
#Administration
These sub-clients cover instance administration. They require the caller to
hold the relevant system/* grants (typically an admin or super-admin role, or
an API key scoped accordingly).
#Users
const { data, total } = await sdk.users.list({ search: 'ann', limit: 50 });
const user = await sdk.users.get('usr_123');
await sdk.users.create({ email: 'new@acme.co', name: 'New User', role: 'editor' });
await sdk.users.update('usr_123', { role: 'admin' });
await sdk.users.delete('usr_123'); // soft-deactivate (ban)
// Admin password-reset link
const { url } = await sdk.users.resetLink('usr_123');
Bulk legacy import — bring users across from another system with their existing password hashes (max 100 per call; per-row failures reported inline):
const result = await sdk.users.import({
source: 'legacy-app',
users: [{ email: 'a@acme.co', legacyHash: '$2b$...', algorithm: 'bcrypt' }]
});
console.log(`${result.created}/${result.total} imported`, result.results);
#Webhooks
const { data: hooks } = await sdk.webhooks.list(); // secret is masked here
const hook = await sdk.webhooks.create({
name: 'order-sync',
url: 'https://example.com/hooks/orders',
events: ['record.create', 'record.update'],
collections: ['orders'],
retryCount: 3,
timeoutMs: 5000
});
await sdk.webhooks.test(hook.id);
const { data: deliveries } = await sdk.webhooks.deliveries(hook.id, { limit: 20 });
await sdk.webhooks.update(hook.id, { enabled: false });
await sdk.webhooks.delete(hook.id);
Give a webhook a secret and every delivery carries an X-EmuView-Signature: sha256=<hex> header — the HMAC-SHA256 of the raw JSON body, keyed with that secret. Recompute it on the receiver over the bytes as received and compare before trusting the payload.
#Databases
const { data: dbs } = await sdk.databases.list();
const db = await sdk.databases.create({ name: 'analytics', mode: 'physical' });
await sdk.databases.delete(db.id);
#System
// Project context — collections, capabilities, API reference map.
// A natural single call to bootstrap tooling or an AI agent's world model.
const context = await sdk.system.context();
const { settings, categories } = await sdk.system.getSettings();
await sdk.system.updateSettings({ 'cache.public_enabled': true });
// Agent rules document (Markdown, returned as a string)
const rules = await sdk.system.agentRules();
#Collection policy & recycle bin
Access control and soft-delete purge live on the collection client:
const policy = await sdk.collection('posts').getPolicy();
await sdk.collection('posts').setPolicy({
roles: {
editor: { access: 'all', write: true },
public: { access: 'all', write: false } // public read
}
});
// Permanently delete every soft-deleted row (requires hard_delete). Irreversible.
const { purged } = await sdk.collection('posts').purgeDeleted();
#What you learned
sdk.users/webhooks/databases/systemcover instance adminusers.import()migrates accounts with pre-hashed credentialssdk.collection(x).getPolicy()/setPolicy()/purgeDeleted()manage access + the recycle bin