To learn more about service account tokens, see Service Accounts Overview.
Note
IP access lists apply to using service account access tokens, not creating or revoking them. You can generate a token from any IP address, but you can only use it to call the API if your IP address is on the access list.
Resource
POST https://cloud.mongodb.com/api/oauth/revokeRequest Path Parameters
This endpoint doesn't use HTTP request path parameters.
Request Query Parameters
The following query parameters are optional:
Name | Type | Necessity | Description | Default |
|---|---|---|---|---|
pretty | boolean | Optional | Flag that indicates whether the response body should be in a prettyprint format. |
|
envelope | boolean | Optional | Flag that 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 For endpoints that return a list of results, the |
|
Request Body Parameters
All body parameters are required.
Name | Type | Description |
|---|---|---|
| string | The access token that you want to revoke. To learn more, see Generate Service Account Token. |
Response
Example Request
Replace {BASE64-AUTH} in the following example with your base64-encoded service account client ID and secret. To learn more, see Make an API Request.
curl -X POST https://cloud.mongodb.com/api/oauth/revoke \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Authorization: Basic {BASE64-AUTH}" \ -d "token={TOKEN}&token_type_hint=access_token"Example Response
Response Header
HTTP/2 200 OKdate: {dateInUnixFormat}strict-transport-security: max-age=31536000; includeSubdomains;vary: Accept-Encodingcontent-type: application/vnd.atlas.{apiVersion}+json;charset=utf-8referrer-policy: strict-origin-when-cross-originx-permitted-cross-domain-policies: nonex-content-type-options: nosniffx-mongodb-service-version: gitHash={gitHash}; versionString={applicationVersion}x-frame-options: DENYcontent-length: {requestLengthInBytes}x-envoy-upstream-service-time: 44server: mdbwsHTTP/1.1 400 Bad RequestDate: {dateInUnixFormat}Content-Type: application/jsonContent-Length: {requestLengthInBytes}Server: mdbwsStrict-Transport-Security: max-age=31536000; includeSubdomains;X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}...HTTP/1.1 401 UnauthorizedContent-Type: application/json;charset=ISO-8859-1Date: {dateInUnixFormat}WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=falseContent-Length: {requestLengthInBytes}Connection: keep-aliveHTTP/1.1 403 ForbiddenVary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Connection: keep-aliveContent-Length: {requestLengthInBytes}X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}...HTTP/1.1 429 Too Many RequestsRetry-After: {retryAfterValue}Vary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Connection: keep-aliveContent-Length: {requestLengthInBytes}X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}...HTTP/1.1 500 Internal Server ErrorVary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Content-Length: {requestLengthInBytes}X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}...HTTP/1.1 503 Service UnavailableRetry-After: {retryAfterValue}Vary: Accept-EncodingContent-Type: application/jsonStrict-Transport-Security: max-age=300Date: {dateInUnixFormat}Content-Length: {requestLengthInBytes}X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}...Response Body
This endpoint doesn't return a response body.
{ "error_description": "The provided credentials are not valid.", "error": "invalid_request"}{ "error_description": "Invalid grant type.", "error": "unsupported_grant_type"}{ "error_description": "Invalid grant.", "error": "invalid_grant"}{ "error_description": "Invalid credentials provided.", "error": "invalid_client"}{ "error_description": "IP access list validation failed for the service account.", "error": "access_denied"}{ "error_description": "Resource {URL} is limited to 10 requests every 1 minutes.", "error": "rate_limited"}{ "error_description": "Unexpected error.", "error": "server_error"}