Enable/Disable a User API Key

Important With Circle IconCreated with Sketch.Important
Atlas deprecated Personal API keys
  • You can't create new Personal API Keys.
  • You can't access the API using your existing Personal API Keys starting March 1, 2021.
  • You must update any existing scripts or tools to use Programmatic API Keys instead.

The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

To learn how to configure API access for an Atlas project, see Configure Atlas API Access.

Use this endpoint to enable or disable a user's API key. You must be the database user specified in the digest authentication to successfully use this endpoint.

PATCH /users/{USER-ID}/keys/{KEY-ID}
Path ElementRequired/OptionalDescription
USER-IDRequired.The unique identifier for your database user. Specify the value of the id field in the response body to the /orgs/{ORG-ID}/users endpoint.
KEY-IDRequiredThe unique identifier for the user API key that you want to enable or disable.

The following query parameters are optional:

Query ParameterTypeDescriptionDefault
prettybooleanDisplays response in a prettyprint format.false
envelopebooleanSpecifies whether or not to wrap the response in an envelope.false
enabledbooleanIndicates whether the API key is enabled or disabled. Required.
createdAttimestampThe time the API key was created.
descriptionstringDescription of the API key.
enabledbooleanIndicates whether the API key is enabled.
idstringThe unique identifier of the API key.
obfuscatedKeystringThe last twelve digits of the API key that you enabled or disabled. The remainder of the key is obfuscated for security.
usedCountnumberThe number of times that the API key has been used by the associated user.
userIdstringThe user ID associated with the request for a new API key.

The following example disables a user API key:

curl -X PATCH --digest -u "{PUBLIC-KEY}:{PRIVATE-KEY}" --header "Content-Type: application/json" \
"" \
--data '{"enabled":"false"}'
"createdAt" : "2018-05-10T21:29:27Z",
"description" : "My API Key",
"enabled" : false,
"id" : "5af4b9b787d9d624af93c04c",
"obfuscatedKey" : "********-****-****-670587c49cc9",
"usedCount" : 1,
"userId" : "69g73c0980eef52994dbgdge"
Give Feedback