v0.36.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: Apache-2.0



PkgGoDev CI

A Go HTTP client for the MongoDB Atlas API.

Note that go-client-mongodb-atlas only supports the two most recent major versions of Go.


go-client-mongodb-atlas is targeting Atlas API V1 and v1.5. For new projects, please consider the official Atlas Go SDK To learn how to migrate from go-client-mongodb-atlas to the Atlas Go SDK, see the migration guide.


import ""

Construct a new Atlas client, then use the various services on the client to access different parts of the Atlas API. For example:

client := mongodbatlas.NewClient(nil)

The services of a client divide the API into logical chunks and correspond to the structure of the Atlas API documentation at

NOTE: Using the context package, one can easily pass cancellation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.


The go-client-mongodb-atlas library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle Digest Access authentication for you. The easiest way to do this is using the digest library, but you can always use any other library that provides an http.Client. If you have a private and public API token pair (, you can use it with the digest library like:

import (


func main() {
    t := digest.NewTransport("your public key", "your private key")
    tc, err := t.Client()
    if err != nil {

    client := mongodbatlas.NewClient(tc)
    projects, _, err := client.Projects.GetAllProjects(context.Background(), nil)

Note that when using an authenticated Client, all calls made by the client will include the specified tokens. Therefore, authenticated clients should almost never be shared between different users.


Each version of the client is tagged and the version is updated accordingly.

To see the list of past versions, run git tag.

To release a new version, first ensure that Version is updated (i.e., before running git push origin vx.y.z, verify that Version=x.y.z should match the tag being pushed to GitHub)


This library is being initially developed for mongocli, Atlas Terraform Provider, Atlas Vault Plugin, and Atlas Cloudformation Provider so API methods will likely be implemented in the order that they are needed by those projects.


See our Guide.


go-client-mongodb-atlas is released under the Apache 2.0 license. See LICENSE


Path Synopsis
Package auth provides a way to follow a Device Authorization Grant
Package auth provides a way to follow a Device Authorization Grant
Package mongodbatlas provides a client for using the MongoDB Atlas API.
Package mongodbatlas provides a client for using the MongoDB Atlas API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL