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 '{ }'" - 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 '{ }'" 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 '{ }'" - 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 '{ }'" 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 '{ }'" - 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 '{ }'" 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. format: date-time readOnly: true type: string description: description: Description of the atlas resource policy. readOnly: true type: string id: description: Unique 24-hexadecimal character string that identifies the atlas resource policy. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string lastUpdatedByUser: $ref: '#/components/schemas/ApiAtlasUserMetadataView' lastUpdatedDate: description: Date and time in UTC when the atlas resource policy was last updated. format: date-time readOnly: true type: string name: description: Human-readable label that describes the atlas resource policy. readOnly: true type: string orgId: description: Unique 24-hexadecimal character string that identifies the organization the atlas resource policy belongs to. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string policies: description: List of policies that make up the atlas resource policy. items: $ref: '#/components/schemas/ApiAtlasPolicyView' readOnly: true type: array version: description: A string that identifies the version of the atlas resource policy. example: v1 readOnly: true type: string type: object ApiError: properties: badRequestDetail: $ref: '#/components/schemas/BadRequestDetail' detail: description: Describes the specific conditions or reasons that cause each type of error. type: string error: description: HTTP status code returned with this error. externalDocs: url: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status format: int32 readOnly: true type: integer errorCode: description: Application error code returned with this error. readOnly: true type: string parameters: description: Parameters used to give more information about the error. items: type: object readOnly: true type: array reason: description: Application error message returned with this error. readOnly: true type: string required: - error - errorCode type: object ApiAtlasResourcePolicyMetadataView: properties: policiesCausingNonCompliance: description: List of policies that are in conflict with the current state of the resource. items: $ref: '#/components/schemas/ApiAtlasPolicyMetadataView' readOnly: true type: array resourcePolicyId: description: Unique 24-hexadecimal character string that identifies the atlas resource policy. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string resourcePolicyName: description: Human-readable label that describes the atlas resource policy. readOnly: true type: string type: object BadRequestDetail: description: Bad request detail. properties: fields: description: Describes all violations in a client request. items: $ref: '#/components/schemas/FieldViolation' type: array readOnly: true type: object ApiAtlasNonCompliantResourceView: properties: orgId: description: Unique 24-hexadecimal character string that identifies the organization the resource belongs to. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string resourceId: description: Unique 24-hexadecimal character string that identifies the non-compliant resource. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string resourceName: description: Unique human readable string that identifies the non-compliant resource. readOnly: true type: string resourcePoliciesCausingNonCompliance: description: List of resource policies causing the resource to be considered non-compliant. items: $ref: '#/components/schemas/ApiAtlasResourcePolicyMetadataView' readOnly: true type: array resourceType: description: Human-readable label that displays the type of a resource. enum: - DEPRECATED_PROJECT - DEPRECATED_CLUSTER - PROJECT - CLUSTER readOnly: true type: string type: object ApiAtlasPolicyMetadataView: properties: policyId: description: Unique 24-hexadecimal character string that identifies the policy. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true type: string type: object ApiAtlasResourcePolicyCreateView: properties: description: description: Description of the atlas resource policy. type: string name: description: Human-readable label that describes the atlas resource policy. type: string policies: description: List of policies that make up the atlas resource policy. items: $ref: '#/components/schemas/ApiAtlasPolicyCreateView' type: array required: - name - policies type: object FieldViolation: properties: description: description: A description of why the request element is bad. type: string field: description: A path that leads to a field in the request body. type: string required: - description - field type: object ApiAtlasResourcePolicyEditView: properties: description: description: Description of the atlas resource policy. type: string name: description: Human-readable label that describes the atlas resource policy. type: string policies: description: List of policies that make up the atlas resource policy. items: $ref: '#/components/schemas/ApiAtlasPolicyCreateView' type: array type: object ApiAtlasInvalidResourcePolicyCreateErrorView: properties: errorType: description: Human-readable label that displays the type of an error. enum: - POLICY_PARSING_ERROR - POLICY_HAS_FAILED_VALIDATIONS - POLICY_HAS_INVALID_PRINCIPAL - POLICY_HAS_BODY_EXCEEDING_MAX_SIZE - POLICY_HAS_UNEXPECTED_ENTITIES type: string invalidPolicies: description: List of invalid policies containing details of their validation errors. items: $ref: '#/components/schemas/ApiAtlasInvalidPolicyView' readOnly: true type: array type: object ApiAtlasPolicyCreateView: 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" minLength: 1 type: string required: - body type: object parameters: envelope: description: Flag that indicates whether Application wraps the response in an `envelope` JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body. in: query name: envelope schema: default: false type: boolean pretty: description: Flag that indicates whether the response body should be in the prettyprint format. in: query name: pretty schema: default: false externalDocs: description: Prettyprint url: https://en.wikipedia.org/wiki/Prettyprint type: boolean orgId: description: Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [`/orgs`](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access. in: path name: orgId required: true schema: example: 4888442a3354817a7320eb61 pattern: ^([a-f0-9]{24})$ type: string headers: HeaderRetryAfter: description: The minimum time you should wait, in seconds, before retrying the API request. This header might be returned for 429 or 503 error responses. schema: type: integer HeaderRateLimitLimit: description: The maximum number of requests that a user can make within a specific time window. schema: type: integer HeaderRateLimitRemaining: description: The number of requests remaining in the current rate limit window before the limit is reached. schema: type: integer securitySchemes: DigestAuth: scheme: digest type: http ServiceAccounts: description: Learn more about [Service Accounts](https://www.mongodb.com/docs/atlas/api/service-accounts-overview). flows: clientCredentials: scopes: {} tokenUrl: https://cloud.mongodb.com/api/oauth/token type: oauth2 x-externalLinks: - label: Back to Atlas Docs url: https://www.mongodb.com/docs/atlas/ - label: API Changelog url: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/changelog/ x-topics: - content: The MongoDB Atlas Administration API is rate limited. To learn more about rate limiting, see the [Atlas Documentation on Rate Limiting](http://dochub.mongodb.org/core/atlas-api-rate-limit) title: Rate Limiting