Docs Menu

Create a Realm App with Realm API

On this page

  • Prerequisites
  • Procedure
  • Authenticate a MongoDB Atlas User
  • Get the Group ID
  • Create a new Realm App

You can use the Realm Admin API to create a new server-side Realm app.

1

Use your MongoDB Cloud API key pair to call the authentication endpoint:

curl --request POST \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{"username": "<Public API Key>", "apiKey": "<Private API Key>"}' \
https://realm.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login

If authentication succeeds, MongoDB Realm returns an access token as part of the JSON response document:

{
"access_token": "<access_token>",
"refresh_token": "<refresh_token>",
"user_id": "<user_id>",
"device_id": "<device_id>"
}

Save the access_token, which you'll use as the Bearer token to authenticate in the upcoming steps.

Tip
See also:
2

To delete a Realm app you will need to find the Group ID in Atlas.

Follow these steps and save the Group ID for the last step.

3

You can create a new Realm app through the create endpoint.

Your request should include:

  • The access_token from step 1 in a Bearer token Authorization header.
  • The Group ID from step 2.
  • A name for your new app.

If creation succeeds, the MongoDB Realm returns a 201 response and a JSON document.

Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.