Navigation

Enable/Disable a User API Key

Base URL: https://cloud.mongodb.com/api/public/v1.0

This endpoint creates an API key for a specific Cloud Manager user. You must be the Cloud Manager user specified in the digest authentication to successfully use this endpoint.

Note

You must have access to an a public API key generated from the GUI by your administrator before you can successfully user this endpoint. See Generate Public API Keys for instructions.

Resource

PATCH /users/{USER-ID}/keys/{KEY-ID}

Request Parameters

Request Path Parameters

Path Element Required/Optional Description
USER-ID Required. The unique identifier for your Cloud Manager user. Use the /users/byName/{USER-NAME} endpoint to retrieve your user ID. Specify the value of the id field in the response body to that endpoint.
KEY-ID Required The unique identifier for your user API key.

Request Query Parameters

This endpoint supports the following optional request query parameters:

This endpoint may use any of the HTTP request query parameters available to all Cloud Manager API resources. These are all optional.

Name Type Description Default
pretty boolean Indicates whether the response body should be in a prettyprint format. false
envelope boolean

Indicates whether or not to wrap the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

For endpoints that return one result, the response body includes:

status
HTTP response code
envelope
The expected response body
false

Request Body Parameters

Name Type Description
enabled boolean Specifies whether the user API key is enabled or disabled. Required.

Response

Name Type Description
createdAt timestamp The time the API key was created.
description string Description of the API key.
enabled boolean Indicates whether the API key is enabled.
id string The unique identifier of the API key.
obfuscatedKey string The last twelve digits of the API key that you enabled or disabled. The remainder of the key is obfuscated for security.
usedCount number The number of times that the API key has been used by the associated user.
userId string The user ID associated with the request for a new API key.

Example Request

curl -X POST --digest -u "{username}:{apiKey}" \
 "https://cloud.mongodb.com/api/public/v1.0/users/569g73c0980eef52994dbgdge/keys/5b27d00d-e454-4a21-863e-670587c49cc9" \
 --data '{"enabled":"false"}'

Example Response

{
  "createdAt" : "2018-05-10T21:29:27Z",
  "description" : "DOCSP-2368",
  "enabled" : false,
  "id" : "5af4b9b787d9d624af93c04c",
  "obfuscatedKey" : "********-****-****-670587c49cc9",
  "usedCount" : 0,
  "userId" : "569g73c0980eef52994dbgdge"
}