published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
mongodbatlas.getProjectApiKeys describes all API Keys. This represents API Keys that have been created.
IMPORTANT NOTE The use of
mongodbatlas.getProjectApiKeysdata source is no longer the recommended approach. For new configurations, we recommend using themongodbatlas.ApiKeyresource and themongodbatlas.ApiKeyProjectAssignmentresource to assign the API Keys to projects. This approach is more flexible and aligns with best practices. For existing configurations, the migration to the new pattern is not required. If you want to migrate, see the Migration Guide for step-by-step instructions on migrating frommongodbatlas.ProjectApiKeyto the new pattern.
IMPORTANT WARNING: Managing Atlas Programmatic API Keys (PAKs) with Terraform will expose sensitive organizational secrets in Terraform’s state. We suggest following Terraform’s best practices. You may also want to consider managing your PAKs via a more secure method, such as the HashiCorp Vault MongoDB Atlas Secrets Engine.
NOTE: Groups and projects are synonymous terms. You may find
groupIdin the official documentation.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const test = mongodbatlas.getProjectApiKeys({
pageNum: 1,
itemsPerPage: 5,
projectId: "32b6e34b3d91647abb20e7b8",
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test = mongodbatlas.get_project_api_keys(page_num=1,
items_per_page=5,
project_id="32b6e34b3d91647abb20e7b8")
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/v4/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := mongodbatlas.LookupProjectApiKeys(ctx, &mongodbatlas.LookupProjectApiKeysArgs{
PageNum: pulumi.IntRef(1),
ItemsPerPage: pulumi.IntRef(5),
ProjectId: "32b6e34b3d91647abb20e7b8",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var test = Mongodbatlas.GetProjectApiKeys.Invoke(new()
{
PageNum = 1,
ItemsPerPage = 5,
ProjectId = "32b6e34b3d91647abb20e7b8",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetProjectApiKeysArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var test = MongodbatlasFunctions.getProjectApiKeys(GetProjectApiKeysArgs.builder()
.pageNum(1)
.itemsPerPage(5)
.projectId("32b6e34b3d91647abb20e7b8")
.build());
}
}
variables:
test:
fn::invoke:
function: mongodbatlas:getProjectApiKeys
arguments:
pageNum: 1
itemsPerPage: 5
projectId: 32b6e34b3d91647abb20e7b8
Using getProjectApiKeys
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getProjectApiKeys(args: GetProjectApiKeysArgs, opts?: InvokeOptions): Promise<GetProjectApiKeysResult>
function getProjectApiKeysOutput(args: GetProjectApiKeysOutputArgs, opts?: InvokeOptions): Output<GetProjectApiKeysResult>def get_project_api_keys(items_per_page: Optional[int] = None,
page_num: Optional[int] = None,
project_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProjectApiKeysResult
def get_project_api_keys_output(items_per_page: Optional[pulumi.Input[int]] = None,
page_num: Optional[pulumi.Input[int]] = None,
project_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProjectApiKeysResult]func LookupProjectApiKeys(ctx *Context, args *LookupProjectApiKeysArgs, opts ...InvokeOption) (*LookupProjectApiKeysResult, error)
func LookupProjectApiKeysOutput(ctx *Context, args *LookupProjectApiKeysOutputArgs, opts ...InvokeOption) LookupProjectApiKeysResultOutput> Note: This function is named LookupProjectApiKeys in the Go SDK.
public static class GetProjectApiKeys
{
public static Task<GetProjectApiKeysResult> InvokeAsync(GetProjectApiKeysArgs args, InvokeOptions? opts = null)
public static Output<GetProjectApiKeysResult> Invoke(GetProjectApiKeysInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetProjectApiKeysResult> getProjectApiKeys(GetProjectApiKeysArgs args, InvokeOptions options)
public static Output<GetProjectApiKeysResult> getProjectApiKeys(GetProjectApiKeysArgs args, InvokeOptions options)
fn::invoke:
function: mongodbatlas:index/getProjectApiKeys:getProjectApiKeys
arguments:
# arguments dictionaryThe following arguments are supported:
- Project
Id string - The unique ID for the project.
- Items
Per intPage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - Page
Num int - The page to return. Defaults to
1.
- Project
Id string - The unique ID for the project.
- Items
Per intPage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - Page
Num int - The page to return. Defaults to
1.
- project
Id String - The unique ID for the project.
- items
Per IntegerPage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - page
Num Integer - The page to return. Defaults to
1.
- project
Id string - The unique ID for the project.
- items
Per numberPage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - page
Num number - The page to return. Defaults to
1.
- project_
id str - The unique ID for the project.
- items_
per_ intpage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - page_
num int - The page to return. Defaults to
1.
- project
Id String - The unique ID for the project.
- items
Per NumberPage - Number of items to return per page, up to a maximum of 500. Defaults to
100. - page
Num Number - The page to return. Defaults to
1.
getProjectApiKeys Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Project ID to assign to Access Key
- Results
List<Get
Project Api Keys Result> - A list where each element represents a API Key assigned to the project.
- Items
Per intPage - Page
Num int
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Project ID to assign to Access Key
- Results
[]Get
Project Api Keys Result - A list where each element represents a API Key assigned to the project.
- Items
Per intPage - Page
Num int
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - Project ID to assign to Access Key
- results
List<Get
Project Api Keys Result> - A list where each element represents a API Key assigned to the project.
- items
Per IntegerPage - page
Num Integer
- id string
- The provider-assigned unique ID for this managed resource.
- project
Id string - Project ID to assign to Access Key
- results
Get
Project Api Keys Result[] - A list where each element represents a API Key assigned to the project.
- items
Per numberPage - page
Num number
- id str
- The provider-assigned unique ID for this managed resource.
- project_
id str - Project ID to assign to Access Key
- results
Sequence[Get
Project Api Keys Result] - A list where each element represents a API Key assigned to the project.
- items_
per_ intpage - page_
num int
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - Project ID to assign to Access Key
- results List<Property Map>
- A list where each element represents a API Key assigned to the project.
- items
Per NumberPage - page
Num Number
Supporting Types
GetProjectApiKeysResult
- Api
Key stringId - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- Description string
- Description of this Project API key.
- Private
Key string - Public
Key string - Project
Assignments List<GetProject Api Keys Result Project Assignment>
- Api
Key stringId - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- Description string
- Description of this Project API key.
- Private
Key string - Public
Key string - Project
Assignments []GetProject Api Keys Result Project Assignment
- api
Key StringId - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- description String
- Description of this Project API key.
- private
Key String - public
Key String - project
Assignments List<GetProject Api Keys Result Project Assignment>
- api
Key stringId - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- description string
- Description of this Project API key.
- private
Key string - public
Key string - project
Assignments GetProject Api Keys Result Project Assignment[]
- api_
key_ strid - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- description str
- Description of this Project API key.
- private_
key str - public_
key str - project_
assignments Sequence[GetProject Api Keys Result Project Assignment]
- api
Key StringId - Unique identifier for the API key you want to update. Use the /orgs/{ORG-ID}/apiKeys endpoint to retrieve all API keys to which the authenticated user has access for the specified organization.
- description String
- Description of this Project API key.
- private
Key String - public
Key String - project
Assignments List<Property Map>
GetProjectApiKeysResultProjectAssignment
- Project
Id string - The unique ID for the project.
- Role
Names List<string> - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
- Project
Id string - The unique ID for the project.
- Role
Names []string - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
- project
Id String - The unique ID for the project.
- role
Names List<String> - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
- project
Id string - The unique ID for the project.
- role
Names string[] - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
- project_
id str - The unique ID for the project.
- role_
names Sequence[str] - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
- project
Id String - The unique ID for the project.
- role
Names List<String> - List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The MongoDB Documentation describes the valid roles that can be assigned.
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlasTerraform Provider.
published on Thursday, Mar 12, 2026 by Pulumi
