Registry / devops / mongodb-realm-api-client

mongodb-realm-api-client

JSON →
library1.31.0jsnpmunverified

A Node.js client for the MongoDB Realm (formerly Stitch) admin API. Version 1.31.0 (stable, last release 2022). Provides programmatic access to manage Realm applications, services, triggers, functions, rules, logs, security, and webhooks. Wraps the deprecated mongodb-stitch-api-client. Uses API keys for authentication and supports CRUD operations on Realm resources. Slower release cadence; not actively maintained by MongoDB Inc.

npm install mongodb-realm-api-client
INSTALL
IMPORT
SIG · MONGODB-REALM-API-
M
mongodb-realm-api-client
devopsjavascriptv1.31.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getClient
const getClient = require('mongodb-realm-api-client');
import getClient from 'mongodb-realm-api-client';
CommonJS only; no ESM exports available
getClient
const { trigger, application } = getClient({ publicKey, privateKey, baseUrl, projectId, appId });
const client = getClient({ publicKey, privateKey, baseUrl, projectId, appId }); client.trigger.getAll();
Destructure returned object; direct call to getClient returns an object with namespaced API methods
application.create
await application.create({ name: 'myApp', deployment_model: 'LOCAL', location: 'IE' });
await application.create({ name: 'myApp' });
Requires body with deployment_model and location; otherwise may fail

Initializes the Realm API client with API keys and project context, then fetches all triggers and creates a new application.

const getClient = require('mongodb-realm-api-client'); const { trigger, application } = getClient({ publicKey: process.env.REALM_PUBLIC_KEY ?? '', privateKey: process.env.REALM_PRIVATE_KEY ?? '', baseUrl: 'https://stitch.mongodb.com/api/admin/v3.0', projectId: process.env.REALM_PROJECT_ID ?? '', appId: process.env.REALM_APP_ID ?? '' }); async function main() { const triggers = await trigger.getAll(); console.log('Triggers:', triggers); const newApp = await application.create({ name: 'myNewApp', deployment_model: 'LOCAL', location: 'IE' }); console.log('Created app:', newApp); } main().catch(console.error);
Debug
Known issues
deprecatedPackage relies on mongodb-stitch-api-client which is deprecated. Underlying API may change.
fix
Migrate to MongoDB's official Atlas Admin API client or use direct REST calls.
affects: >=1.0.0
breakingThe getClient function expects baseUrl to include the admin API path '/api/admin/v3.0'.
fix
Ensure baseUrl ends with '/api/admin/v3.0' or adjust to match the actual Realm API version.
affects: >=1.0.0
gotchaThe 'application.create' method requires 'deployment_model' and 'location' fields in the body.
fix
Include both 'deployment_model' (e.g., 'LOCAL') and 'location' (e.g., 'IE') in the body.
affects: >=1.0.0
gotchaThe 'appId' is optional but if omitted, some operations (like service or trigger) may fail if the client needs a default app.
fix
Provide 'appId' in the config or pass it explicitly per operation if available.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mongodb-realm-api-client'
Package not installed or misspelled.
fix
npm install mongodb-realm-api-client
TypeError: getClient is not a function
Using ES6 import syntax instead of CommonJS require.
fix
Use require('mongodb-realm-api-client') instead of import.
Error: Unauthorized: could not authenticate with provided credentials
Invalid publicKey/privateKey or wrong baseUrl path.
fix
Verify API keys and ensure baseUrl ends with '/api/admin/v3.0'.
Upgrade
Version history
1.31.0latest on npm
Audit
Dependencies
mongodb-stitch-api-clientrequiredUnderlying library used for API calls; will be deprecated
Agent activity
4 hits · last 30 days
node
4
Resources
mongodb-realm-api-client — npm install mongodb-realm-api-client · libregistry