Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

MongoDB Ops Manager Go Client

Go Reference CI Go Report Card

A go client for Ops Manager and Cloud Manager API.

Note that ops-manager only supports the two most recent major versions of Go.


import ""

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

client := opsmngr.NewClient(nil)

The services of a client divide the API into logical chunks and correspond to the structure of the Ops Manager API documentation.

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 ops-manager 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 using:

import (


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

	// Note: If no Base URL is set the client is set to work with Cloud Manager by default
	clientops := opsmngr.SetBaseURL("https://opsmanagerurl/" + opsmngr.APIPublicV1Path)
	client, err := opsmngr.New(tc, clientops)
	if err != nil {

	orgs, _, err := client.Organizations.List(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.

To get your API Keys please refer to our docs for, Ops Manager, or Cloud Manager.


This library is being initially developed for mongocli, so API methods will likely be implemented in the order that they are needed by that application.


See our Guide.


MongoDB Ops Manager Go Client is released under the Apache 2.0 license. See LICENSE