Build and test with MongoDB using an Atlas Ephemeral cluster, a temporary Free cluster (M0) that you can create and connect to without an Atlas account or API keys. An Ephemeral cluster is a good fit when an AI coding agent, or a developer working with one, needs a database on demand to start a new project, prototype an application, or test an idea.
To create an Ephemeral cluster and get a ready-to-use connection string in under a minute, send a POST request to the following endpoint:
https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters:create
For the complete workflow, required headers, and response details, see the Quick Start.
Unless you claim the Ephemeral cluster, Atlas pauses it 2 days after creation and deletes it 7 days after creation. To claim the cluster, open the claimUrl from the create response and sign in to Atlas. Claiming converts the Ephemeral cluster into a standard Free cluster with no expiration date. An agent can create and connect to the cluster autonomously, but only a human can claim it.
Ephemeral Cluster Specifications and Limits
An Ephemeral cluster is an Atlas Free cluster (M0) with a limited lifespan. To read and write its data, you can connect to the cluster with the connection string returned by the create response. Until you claim the cluster, you can't scale the cluster tier, add database users, restrict IP access, or perform other administrative operations.
An unclaimed Ephemeral cluster has the following fixed specifications:
Cluster tier: Free (
M0).Cloud provider and region:
AWSus-east-1.IP access: The cluster allows connections from any IP address (
0.0.0.0/0).Limited lifespan: Unless you claim the cluster, Atlas pauses it 2 days after creation and deletes it 7 days after creation. While paused, the cluster is inaccessible.
Because an Ephemeral cluster is a Free cluster, all Free cluster limits also apply, including:
Storage: Maximum of 512 MB, including indexes.
MongoDB server version: 8.0.
Throughput: Maximum of 100 total read and write operations per second.
Connections: Maximum of 500 concurrent connections.
For the complete list of Free cluster limitations, see Atlas Free Cluster Limits.
Quick Start: Create and Connect to an Ephemeral Cluster
Use the following workflow to create and connect to an Ephemeral cluster. An AI coding agent can complete every step of this workflow without human intervention.
Create the Ephemeral cluster.
Send a POST request to the following endpoint:
https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters:create
The request requires the following Accept header:
'Accept: application/vnd.atlas.preview+json'
The following example request creates an Ephemeral cluster named Cluster0:
curl -sS -X POST 'https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters:create' \ -H 'Accept: application/vnd.atlas.preview+json' \ -H 'Content-Type: application/json' \ -d '{"clusterName": "Cluster0"}'
The create endpoint returns a response in the following format:
{ "claimUrl": "https://account.mongodb.com/account/register?claimId={claimId}", "clusterId": "{clusterId}", "connectionString": "mongodb+srv://{username}:{password}@{host}/", "expiresAt": "{timestamp}", "status": "PROVISIONING", "termsOfService": "By using this API and any resources provisioned through it, you agree to be bound by MongoDB's Cloud Terms of Service at https://www.mongodb.com/legal/terms-and-conditions/cloud; and Privacy Policy at https://www.mongodb.com/legal/privacy/privacy-policy." }
The response includes the following fields:
claimUrl: Unique URL for claiming this Ephemeral cluster. A human must open this URL in a browser. Valid for 7 days after the cluster is created.clusterId: Unique identifier of the Ephemeral cluster. To retrieve the cluster'sstatus,claimUrl, and other details, send aGETrequest to the following endpoint, replacing{clusterId}with this value:https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters/{clusterId}To learn more, see Return One Ephemeral Atlas Cluster.
connectionString: Connection string that uses themongodb+srv://protocol to connect to the Ephemeral cluster. Includes the username and password for an autogenerated database user that can read and write data in the cluster. Any client that uses this connection string authenticates as this database user. The create response is the only time that Atlas returns the unredacted password.expiresAt: Date and time when Atlas pauses the cluster if it isn't claimed. A paused Ephemeral cluster is inaccessible until you claim it. The timestamp uses the ISO 8601 format in UTC.status: Status of the Ephemeral cluster. One ofPROVISIONING,ACTIVE, orPAUSED.termsOfService: Notice that by using this API, you agree to MongoDB's Cloud Terms of Service and Privacy Policy. Includes a link to the full terms.
To learn more about the create endpoint, see Create One Ephemeral Atlas Cluster.
Save the connection string and claim values.
From the create response, save the connectionString, claimUrl, and clusterId. You need them to connect to, claim, and retrieve the details of the cluster.
Warning
Treat the connectionString, claimUrl, and clusterId as secrets. Anyone with the connectionString can read and write cluster data. Anyone with the claimUrl can claim the cluster into their own Atlas account, and anyone with the clusterId can retrieve the claimUrl from the get
endpoint. MongoDB Support can't recover these values or transfer ownership of a claimed cluster.
Save all three values to a secure location where the person who claims the cluster can retrieve them. For example, use a shared secrets manager or a git-ignored local .env file. Don't overwrite existing secrets in that location.
Connect to the Ephemeral cluster.
Use the connectionString value from the create response to connect to the Ephemeral cluster from a compatible environment, such as:
Application code: Provide the connection string to the MongoDB driver for your programming language when you initialize the client object that connects to the cluster. This is the typical choice when connecting from an application. To learn more, see Connect to a Cluster via Client Libraries.
Command line: Provide the connection string as an argument to the MongoDB Shell (
mongosh) to connect and run commands interactively:Example command line connectionmongosh "<connectionString>"
To learn more about available connection methods, see Considerations.
Note
The Ephemeral cluster allows connections from any IP address (0.0.0.0/0). You can restrict IP access when you claim the cluster.
(Optional) Claim the Ephemeral cluster.
Claiming the Ephemeral cluster is optional. If you don't claim the cluster, Atlas pauses it 2 days after creation and deletes it 7 days after creation. When you claim the cluster, Atlas converts it into a standard Free cluster with no expiration date. The claimed cluster keeps all of its data, and the connection string you saved continues to work with the same credentials. To learn more about the effects of claiming, see Claim an Ephemeral Cluster.
To claim the cluster, a human must sign in to Atlas in a browser. Choose one of the following options:
Claim now: Share the
claimUrlonly with the person who will claim the cluster. They can follow the procedure in Claim an Ephemeral Cluster to claim the cluster.Claim later: Save the
claimUrlin a secure location that remains available to the person who will claim the cluster. That person can then claim the cluster any time within 7 days of creation.Claim never: Take no action. Atlas deletes the cluster 7 days after creation.
Claim an Ephemeral Cluster
Claiming an Ephemeral cluster is optional. If you don't claim the cluster, Atlas pauses it 2 days after creation and deletes it 7 days after creation.
When you claim an Ephemeral cluster, Atlas makes the following changes:
Extends the cluster's lifespan: Atlas converts the Ephemeral cluster into a standard Free cluster with no expiration date. The claimed cluster remains available until you delete it, or until Atlas pauses it due to 30 days of inactivity.
Preserves the cluster's data and connection string: The claimed cluster keeps all of its data, and the connection string from the create response continues to work with the same credentials.
Adds the cluster to a project and organization: In Atlas, every cluster belongs to a project, and every project belongs to an organization. Atlas places the claimed cluster into a new project within a new or existing organization owned by the account that claims the cluster.
Grants full cluster access: The account that claims the cluster is an
Organization Ownerof the cluster's organization, which also grants theProject Ownerrole on every project in that organization. As a Project Owner, you have database access to read and write the cluster's data, and administrative access to manage the cluster and its project using the Atlas UI, Atlas CLI, or Atlas Administration API.
An AI coding agent can't claim an Ephemeral cluster. To claim the cluster, a human must complete the following workflow in a web browser:
Sign in to Atlas from the claim URL.
In a web browser, open the
claimUrlthat you saved from the create response to reach the Atlas sign-in page. The claim URL has the following format, where{claimId}is a unique identifier for the Ephemeral cluster:https://account.mongodb.com/account/register?claimId={claimId}On the sign-in page, sign in to Atlas with an existing account, or create a new account. When you claim the cluster in the next step, this account gains both database and administrative access to the cluster.
If you create a new account, verify your email before you continue.
Note
The claim URL is the only way to claim the cluster. It expires 7 days after the cluster is created. If you lose the claim URL, retrieve it with one of the following methods:
Send a
GETrequest to the following endpoint, replacing{clusterId}with theclusterIdvalue from the create response:https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters/{clusterId}The response includes the
claimUrl. To learn more, see Return One Ephemeral Atlas Cluster.If an AI coding agent created the cluster, check for a secure location where it might have saved the
claimUrl, such as your project's local.envfile.
Configure and claim the Ephemeral cluster.
After you sign in, Atlas displays the claim page. On this page, do the following:
From the drop-down, select an existing organization, or select Create new org for this cluster to create one. When you claim the cluster, Atlas moves it into the selected organization and creates a project for it there.
Important
The drop-down lists only organizations where your Atlas account has the
Organization Ownerrole. When you claim the cluster, every Organization Owner in the selected organization can manage the cluster and its data.Configure IP access. To restrict access, remove
0.0.0.0/0and allow only your current IP address (recommended). To allow connections from any IP address, keep0.0.0.0/0. You can restrict IP access later in the project's Network Access settings.Click Claim Cluster. This is a one-time action that you can't undo.
(Optional) Reconfigure the claimed cluster.
You can reconfigure the claimed cluster and its project using the Atlas UI, Atlas CLI, or Atlas Administration API. At the cluster level, you can scale the cluster to a higher tier to increase storage. At the project level, you can manage database users and restrict IP access to increase security. To learn more, see Manage Clusters.
Ephemeral Cluster API Reference
Use the following Atlas Administration API endpoints to create an Ephemeral cluster and retrieve its status, connection, and claim details. To learn more, see Create One Ephemeral Atlas Cluster and Return One Ephemeral Atlas Cluster in the Atlas Administration API specification.
Note
You can create an Ephemeral cluster only through the Atlas Administration API, not through the Atlas CLI, HashiCorp Terraform MongoDB Atlas Provider, or any other interface.
Create One Ephemeral Atlas Cluster
Creates an Ephemeral cluster and returns its connection and claim details.
Method: POST
Endpoint: https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters:create
Path parameters: None.
Query parameters: None.
Request headers:
Header | Required | Value |
|---|---|---|
| Yes | 'Accept: application/vnd.atlas.preview+json' |
| Only with a request body |
|
Request body:
The request body is optional. If you send a body, include the following field:
Field | Type | Required | Description |
|---|---|---|---|
| string | No | Human-readable label that identifies the Ephemeral cluster. Defaults to |
Example request:
curl -sS -X POST 'https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters:create' \ -H 'Accept: application/vnd.atlas.preview+json' \ -H 'Content-Type: application/json' \ -d '{ "clusterName": "my-ephemeral-cluster" }'
Success status code: 201 Created
Success response fields:
Returns the new cluster's details in the following fields:
Field | Type | Description |
|---|---|---|
| string (URI) | Unique URL for claiming this Ephemeral cluster. Redirects to the Atlas sign-in or registration page, where a user signs in or creates an account to claim the cluster. Valid for 7 days after the cluster is created. |
| string | Unique identifier of the Ephemeral cluster. Use this ID to retrieve the cluster's status and details in a |
| string | Connection string that uses the |
| string (ISO 8601, UTC) | Date and time when the cluster will be paused and no longer accessible until it is claimed. This parameter expresses its value in the ISO 8601 timestamp format in UTC. |
| string (enum) | Status of the Ephemeral cluster. One of |
| string | Notice that by using this API, you agree to MongoDB's Cloud Terms of Service and Privacy Policy. Includes a link to the full terms. |
Response headers:
Header | Returned With | Description |
|---|---|---|
|
| The maximum number of requests that a user can make within a specific time window. |
|
| The number of requests remaining in the current rate limit window before the limit is reached. |
|
| The minimum time you should wait, in seconds, before retrying the API request. |
Error status codes:
Note
If you receive a 429 error, the shared limit for creating Ephemeral clusters has been reached. You can instead deploy a standard Free cluster, which provides the same cluster tier without an expiration date. To learn how to create and connect to a Free cluster through the Atlas CLI, see Get Started.
Status | Description |
|---|---|
| Bad Request. |
| Too Many Requests. |
| Internal Server Error. |
Return One Ephemeral Atlas Cluster
Returns the details for one Ephemeral cluster.
Method: GET
Endpoint: https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters/{clusterId}
Path parameters:
Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Unique ID of the Ephemeral cluster to look up. |
Query parameters: None.
Request headers:
Header | Required | Value |
|---|---|---|
| Yes |
|
Request body: None.
Example request:
curl -sS -X GET 'https://cloud.mongodb.com/api/atlas/v2/unauth/ephemeralClusters/{clusterId}' \ -H 'Accept: application/vnd.atlas.preview+json'
Success status code: 200 OK
Success response fields:
Returns the cluster's current status and details in the following fields:
Field | Type | Description |
|---|---|---|
| string (URI) | Unique URL for claiming this Ephemeral cluster. Redirects to the Atlas sign-in or registration page, where a user signs in or creates an account to claim the cluster. Valid for 7 days after the cluster is created. |
| string | Unique identifier of the Ephemeral cluster. Use this ID to retrieve the cluster's status and details in a |
| string | Connection string that uses the |
| string (ISO 8601, UTC) | Date and time when the cluster will be paused and no longer accessible until it is claimed. This parameter expresses its value in the ISO 8601 timestamp format in UTC. |
| string (enum) | Status of the Ephemeral cluster. One of |
| string | Notice that by using this API, you agree to MongoDB's Cloud Terms of Service and Privacy Policy. Includes a link to the full terms. |
Response headers:
Header | Returned With | Description |
|---|---|---|
|
| The maximum number of requests that a user can make within a specific time window. |
|
| The number of requests remaining in the current rate limit window before the limit is reached. |
|
| The minimum time you should wait, in seconds, before retrying the API request. |
Error status codes:
Status | Description |
|---|---|
| Bad Request. |
| Not Found. |
| Too Many Requests. |
| Internal Server Error. |