MongoDB Resource Policies API
Configure and manage Atlas Resource Policies within your organization.
Configure and manage Atlas Resource Policies within your organization.
openapi: 3.0.1
info:
description: "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API supports OAuth2 Service Accounts and HTTP Digest-based API keys. Service accounts are the recommended authentication method and API keys are considered a legacy option.\n\nTo authenticate with a Service Account, first exchange its client ID and secret for an access token using the OAuth 2.0 Client Credentials flow. Atlas provides a token endpoint at `POST https://cloud.mongodb.com/api/oauth/token`, which returns a Bearer token that is reusable and valid for 1 hour (3600 seconds).\n\nFor example, to [return a list of your organizations](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listorgs) with [cURL](https://en.wikipedia.org/wiki/CURL), first generate an access token and then use that token to call the same Atlas Administration API endpoint shown in the current example:\n\n```\nACCESS_TOKEN=$(curl -fsS --request POST https://cloud.mongodb.com/api/oauth/token \\\n --header \"Authorization: Basic $(printf '%s' \"${CLIENT_ID}:${CLIENT_SECRET}\" | base64 | tr -d '\\n')\" \\\n --header \"Content-Type: application/x-www-form-urlencoded\" \\\n --header \"Accept: application/json\" \\\n --data \"grant_type=client_credentials\" | jq -r '.access_token')\n\ncurl --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs?pretty=true\"\n```\n\nIf your organization requires an IP access list for the Atlas Administration API, the token can be created from any IP address, but the API call that uses the token must originate from an allowed IP.\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).\n\nYou can also explore the various endpoints available through the Atlas Administration API in MongoDB's [Postman workspace](https://www.postman.com/mongodb-devrel/workspace/mongodb-atlas-administration-apis/) (requires a Postman account)."
license:
name: CC BY-NC-SA 3.0 US
url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/
termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions
title: MongoDB Atlas Administration Access Tracking Resource Policies API
version: '2.0'
x-xgen-sha: 3d70e065843c008b9871ea7836c98c9de6f202f9
servers:
- url: https://cloud.mongodb.com
security:
- ServiceAccounts: []
- DigestAuth: []
tags:
- description: Configure and manage Atlas Resource Policies within your organization.
name: Resource Policies
paths:
/api/atlas/v2/orgs/{orgId}/nonCompliantResources:
get:
description: Return all non-compliant resources for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: getOrgNonCompliantResources
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
schema:
items:
$ref: '#/components/schemas/ApiAtlasNonCompliantResourceView'
type: array
x-xgen-version: '2024-08-05'
description: OK
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
$ref: '#/components/responses/badRequest'
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Return All Non-Compliant Resources
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies getNonCompliantResources --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.GetOrgNonCompliantResourcesApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tGetOrgNonCompliantResourcesWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/nonCompliantResources?pretty=true\""
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/nonCompliantResources?pretty=true\""
x-rolesRequirements:
- Organization Member
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/getOrgNonCompliantResources
x-xgen-operation-id-override: getNonCompliantResources
/api/atlas/v2/orgs/{orgId}/resourcePolicies:
get:
description: Return all Atlas Resource Policies for the organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: listOrgResourcePolicies
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
schema:
items:
$ref: '#/components/schemas/ApiAtlasResourcePolicyView'
type: array
x-xgen-version: '2024-08-05'
description: OK
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
$ref: '#/components/responses/badRequest'
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Return All Atlas Resource Policies
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies listOrgResourcePolicies --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.ListOrgResourcePoliciesApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tListOrgResourcePoliciesWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies?pretty=true\""
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies?pretty=true\""
x-rolesRequirements:
- Organization Member
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/listOrgResourcePolicies
post:
description: Create one Atlas Resource Policy for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: createOrgResourcePolicy
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
requestBody:
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyCreateView'
x-xgen-version: '2024-08-05'
description: Atlas Resource Policy to create.
required: true
responses:
'201':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyView'
x-xgen-version: '2024-08-05'
description: Created
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasInvalidResourcePolicyCreateErrorView'
x-xgen-version: '2024-08-05'
description: Bad request.
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Create One Atlas Resource Policy
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies createOrgResourcePolicy --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.CreateOrgResourcePolicyApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tCreateOrgResourcePolicyWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X POST \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies\" \\\n -d '{ <Payload> }'"
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X POST \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies\" \\\n -d '{ <Payload> }'"
x-rolesRequirements:
- Organization Owner
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/createOrgResourcePolicy
/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}:
delete:
description: Delete one Atlas Resource Policy for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: deleteOrgResourcePolicy
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
- description: Unique 24-hexadecimal digit string that identifies an atlas resource policy.
in: path
name: resourcePolicyId
required: true
schema:
description: Unique 24-hexadecimal character string that identifies the atlas resource policy.
example: 32b6e34b3d91647abb20e7b8
pattern: ^([a-f0-9]{24})$
readOnly: true
type: string
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
x-xgen-version: '2024-08-05'
description: This endpoint does not return a response body.
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
$ref: '#/components/responses/badRequest'
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Delete One Atlas Resource Policy
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies deleteOrgResourcePolicy --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.DeleteOrgResourcePolicyApiParams{}\n\thttpResp, err := client.ResourcePoliciesApi.\n\t\tDeleteOrgResourcePolicyWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X DELETE \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}\""
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X DELETE \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}\""
x-rolesRequirements:
- Organization Owner
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/deleteOrgResourcePolicy
get:
description: Return one Atlas Resource Policy for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: getOrgResourcePolicy
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
- description: Unique 24-hexadecimal digit string that identifies an atlas resource policy.
in: path
name: resourcePolicyId
required: true
schema:
description: Unique 24-hexadecimal character string that identifies the atlas resource policy.
example: 32b6e34b3d91647abb20e7b8
pattern: ^([a-f0-9]{24})$
readOnly: true
type: string
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyView'
x-xgen-version: '2024-08-05'
description: OK
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
$ref: '#/components/responses/badRequest'
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Return One Atlas Resource Policy
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies getOrgResourcePolicy --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.GetOrgResourcePolicyApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tGetOrgResourcePolicyWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}?pretty=true\""
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}?pretty=true\""
x-rolesRequirements:
- Organization Member
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/getOrgResourcePolicy
patch:
description: Update one Atlas Resource Policy for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: updateOrgResourcePolicy
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
- description: Unique 24-hexadecimal digit string that identifies an atlas resource policy.
in: path
name: resourcePolicyId
required: true
schema:
description: Unique 24-hexadecimal character string that identifies the atlas resource policy.
example: 32b6e34b3d91647abb20e7b8
pattern: ^([a-f0-9]{24})$
readOnly: true
type: string
requestBody:
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyEditView'
x-xgen-version: '2024-08-05'
description: Atlas Resource Policy to update.
required: true
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyView'
x-xgen-version: '2024-08-05'
description: Ok
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasInvalidResourcePolicyCreateErrorView'
x-xgen-version: '2024-08-05'
description: Bad request.
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Update One Atlas Resource Policy
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies updateOrgResourcePolicy --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.UpdateOrgResourcePolicyApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tUpdateOrgResourcePolicyWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}\" \\\n -d '{ <Payload> }'"
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies/{resourcePolicyId}\" \\\n -d '{ <Payload> }'"
x-rolesRequirements:
- Organization Owner
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/updateOrgResourcePolicy
/api/atlas/v2/orgs/{orgId}/resourcePolicies:validate:
post:
description: Validate one Atlas Resource Policy for an organization.
externalDocs:
description: Atlas Resource Policies
url: https://dochub.mongodb.org/core/atlas-resource-policies
operationId: validateOrgResourcePolicies
parameters:
- $ref: '#/components/parameters/envelope'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/orgId'
requestBody:
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyCreateView'
x-xgen-version: '2024-08-05'
description: Atlas Resource Policy to create.
required: true
responses:
'200':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasResourcePolicyView'
x-xgen-version: '2024-08-05'
description: Ok
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
'400':
content:
application/vnd.atlas.2024-08-05+json:
schema:
$ref: '#/components/schemas/ApiAtlasInvalidResourcePolicyCreateErrorView'
x-xgen-version: '2024-08-05'
description: Bad request.
'401':
$ref: '#/components/responses/unauthorized'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/notFound'
'429':
$ref: '#/components/responses/tooManyRequests'
'500':
$ref: '#/components/responses/internalServerError'
summary: Validate One Atlas Resource Policy
tags:
- Resource Policies
x-codeSamples:
- lang: cURL
label: Atlas CLI
source: atlas api resourcePolicies validateResourcePolicies --help
- lang: go
label: Go
source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.ValidateOrgResourcePoliciesApiParams{}\n\tsdkResp, httpResp, err := client.ResourcePoliciesApi.\n\t\tValidateOrgResourcePoliciesWithParams(ctx, params).\n\t\tExecute()\n}\n"
- lang: cURL
label: curl (Service Accounts)
source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X POST \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies:validate\" \\\n -d '{ <Payload> }'"
- lang: cURL
label: curl (Digest)
source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n --digest --include \\\n --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n --header \"Content-Type: application/json\" \\\n -X POST \"https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/resourcePolicies:validate\" \\\n -d '{ <Payload> }'"
x-rolesRequirements:
- Organization Owner
x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Resource-Policies/operation/validateOrgResourcePolicies
x-xgen-operation-id-override: validateResourcePolicies
components:
responses:
internalServerError:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint)
error: 500
errorCode: UNEXPECTED_ERROR
reason: Internal Server Error
schema:
$ref: '#/components/schemas/ApiError'
description: Internal Server Error.
forbidden:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint)
error: 403
errorCode: CANNOT_CHANGE_GROUP_NAME
reason: Forbidden
schema:
$ref: '#/components/schemas/ApiError'
description: Forbidden.
tooManyRequests:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint)
error: 429
errorCode: RATE_LIMITED
reason: Too Many Requests
schema:
$ref: '#/components/schemas/ApiError'
description: Too Many Requests.
headers:
RateLimit-Limit:
$ref: '#/components/headers/HeaderRateLimitLimit'
RateLimit-Remaining:
$ref: '#/components/headers/HeaderRateLimitRemaining'
Retry-After:
$ref: '#/components/headers/HeaderRetryAfter'
unauthorized:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint)
error: 401
errorCode: NOT_ORG_GROUP_CREATOR
reason: Unauthorized
schema:
$ref: '#/components/schemas/ApiError'
description: Unauthorized.
badRequest:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint) No provider AWS exists.
error: 400
errorCode: VALIDATION_ERROR
reason: Bad Request
schema:
$ref: '#/components/schemas/ApiError'
description: Bad Request.
notFound:
content:
application/json:
example:
detail: (This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS
error: 404
errorCode: RESOURCE_NOT_FOUND
reason: Not Found
schema:
$ref: '#/components/schemas/ApiError'
description: Not Found.
schemas:
ApiAtlasUserMetadataView:
description: The user that last updated the atlas resource policy.
properties:
id:
description: Unique 24-hexadecimal character string that identifies a user.
example: 32b6e34b3d91647abb20e7b8
pattern: ^([a-f0-9]{24})$
readOnly: true
type: string
name:
description: Human-readable label that describes a user.
readOnly: true
type: string
readOnly: true
type: object
ApiAtlasPolicyView:
properties:
body:
description: A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
example: " forbid (\n principal,\n action == cloud::Action::\"cluster.createEdit\",\n resource\n ) when {\n context.cluster.regions.contains(cloud::region::\"aws:us-east-1\")\n };\n"
readOnly: true
type: string
id:
description: Unique 24-hexadecimal character string that identifies the policy.
example: 32b6e34b3d91647abb20e7b8
pattern: ^([a-f0-9]{24})$
readOnly: true
type: string
type: object
ApiAtlasInvalidPolicyView:
properties:
body:
description: A string that defines the permissions for the policy. The syntax used is the Cedar Policy language.
example: " forbid (\n principal,\n action == cloud::Action::\"cluster.createEdit\",\n resource\n ) when {\n context.cluster.regions.contains(cloud::region::\"aws:us-east-1\")\n };\n"
readOnly: true
type: string
errors:
description: List of validation errors.
items:
$ref: '#/components/schemas/ApiAtlasInvalidPolicyErrorDetailView'
readOnly: true
type: array
type: object
ApiAtlasInvalidPolicyErrorDetailView:
properties:
detail:
description: A string that provides a detailed description of a validation error.
readOnly: true
type: string
type: object
ApiAtlasResourcePolicyView:
properties:
createdByUser:
$ref: '#/components/schemas/ApiAtlasUserMetadataView'
createdDate:
description: Date and time in UTC when the atlas resource policy was created.
fo
# --- truncated at 32 KB (42 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/mongodb/refs/heads/main/openapi/mongodb-resource-policies-api-openapi.yml