1. Packages
  2. Pinecone
  3. API Docs
  4. ApiKey
Pinecone v2.0.2 published on Wednesday, Nov 5, 2025 by pinecone-io

pinecone.ApiKey

Get Started
pinecone logo
Pinecone v2.0.2 published on Wednesday, Nov 5, 2025 by pinecone-io

    The pinecone.ApiKey resource lets you create and manage API keys in Pinecone. Learn more about API keys in the docs.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pinecone from "@pulumi/pinecone";
    
    // Create API key with default roles (ProjectEditor)
    const example = new pinecone.ApiKey("example", {
        name: "example-api-key",
        projectId: "your-project-id",
    });
    // Create API key with custom roles
    const customRoles = new pinecone.ApiKey("custom_roles", {
        name: "custom-roles-api-key",
        projectId: "your-project-id",
        roles: [
            "ProjectViewer",
            "DataPlaneViewer",
        ],
    });
    // Create an API key that can be updated later
    const updatable = new pinecone.ApiKey("updatable", {
        name: "example-updatable-key",
        projectId: "your-project-id",
        roles: ["ProjectEditor"],
    });
    export const apiKeyRoles = example.roles;
    
    import pulumi
    import pulumi_pinecone as pinecone
    
    # Create API key with default roles (ProjectEditor)
    example = pinecone.ApiKey("example",
        name="example-api-key",
        project_id="your-project-id")
    # Create API key with custom roles
    custom_roles = pinecone.ApiKey("custom_roles",
        name="custom-roles-api-key",
        project_id="your-project-id",
        roles=[
            "ProjectViewer",
            "DataPlaneViewer",
        ])
    # Create an API key that can be updated later
    updatable = pinecone.ApiKey("updatable",
        name="example-updatable-key",
        project_id="your-project-id",
        roles=["ProjectEditor"])
    pulumi.export("apiKeyRoles", example.roles)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/pinecone/v2/pinecone"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create API key with default roles (ProjectEditor)
    		example, err := pinecone.NewApiKey(ctx, "example", &pinecone.ApiKeyArgs{
    			Name:      pulumi.String("example-api-key"),
    			ProjectId: pulumi.String("your-project-id"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create API key with custom roles
    		_, err = pinecone.NewApiKey(ctx, "custom_roles", &pinecone.ApiKeyArgs{
    			Name:      pulumi.String("custom-roles-api-key"),
    			ProjectId: pulumi.String("your-project-id"),
    			Roles: pulumi.StringArray{
    				pulumi.String("ProjectViewer"),
    				pulumi.String("DataPlaneViewer"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Create an API key that can be updated later
    		_, err = pinecone.NewApiKey(ctx, "updatable", &pinecone.ApiKeyArgs{
    			Name:      pulumi.String("example-updatable-key"),
    			ProjectId: pulumi.String("your-project-id"),
    			Roles: pulumi.StringArray{
    				pulumi.String("ProjectEditor"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("apiKeyRoles", example.Roles)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pinecone = Pulumi.Pinecone;
    
    return await Deployment.RunAsync(() => 
    {
        // Create API key with default roles (ProjectEditor)
        var example = new Pinecone.ApiKey("example", new()
        {
            Name = "example-api-key",
            ProjectId = "your-project-id",
        });
    
        // Create API key with custom roles
        var customRoles = new Pinecone.ApiKey("custom_roles", new()
        {
            Name = "custom-roles-api-key",
            ProjectId = "your-project-id",
            Roles = new[]
            {
                "ProjectViewer",
                "DataPlaneViewer",
            },
        });
    
        // Create an API key that can be updated later
        var updatable = new Pinecone.ApiKey("updatable", new()
        {
            Name = "example-updatable-key",
            ProjectId = "your-project-id",
            Roles = new[]
            {
                "ProjectEditor",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["apiKeyRoles"] = example.Roles,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pinecone.ApiKey;
    import com.pulumi.pinecone.ApiKeyArgs;
    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) {
            // Create API key with default roles (ProjectEditor)
            var example = new ApiKey("example", ApiKeyArgs.builder()
                .name("example-api-key")
                .projectId("your-project-id")
                .build());
    
            // Create API key with custom roles
            var customRoles = new ApiKey("customRoles", ApiKeyArgs.builder()
                .name("custom-roles-api-key")
                .projectId("your-project-id")
                .roles(            
                    "ProjectViewer",
                    "DataPlaneViewer")
                .build());
    
            // Create an API key that can be updated later
            var updatable = new ApiKey("updatable", ApiKeyArgs.builder()
                .name("example-updatable-key")
                .projectId("your-project-id")
                .roles("ProjectEditor")
                .build());
    
            ctx.export("apiKeyRoles", example.roles());
        }
    }
    
    resources:
      # Create API key with default roles (ProjectEditor)
      example:
        type: pinecone:ApiKey
        properties:
          name: example-api-key
          projectId: your-project-id
      # Create API key with custom roles
      customRoles:
        type: pinecone:ApiKey
        name: custom_roles
        properties:
          name: custom-roles-api-key
          projectId: your-project-id
          roles:
            - ProjectViewer
            - DataPlaneViewer
      # Create an API key that can be updated later
      updatable:
        type: pinecone:ApiKey
        properties:
          name: example-updatable-key
          projectId: your-project-id
          roles:
            - ProjectEditor
    outputs:
      # Example of how to update the API key
      # resource "pinecone_api_key" "updatable" {
      #   name  = "updated-name"
      #   roles = ["ProjectViewer", "DataPlaneViewer"]
      # }
      apiKeyRoles: ${example.roles}
    

    Create ApiKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ApiKey(name: string, args?: ApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ApiKey(resource_name: str,
               args: Optional[ApiKeyArgs] = None,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               name: Optional[str] = None,
               project_id: Optional[str] = None,
               roles: Optional[Sequence[str]] = None)
    func NewApiKey(ctx *Context, name string, args *ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
    public ApiKey(string name, ApiKeyArgs? args = null, CustomResourceOptions? opts = null)
    public ApiKey(String name, ApiKeyArgs args)
    public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
    
    type: pinecone:ApiKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var apiKeyResource = new Pinecone.ApiKey("apiKeyResource", new()
    {
        Name = "string",
        ProjectId = "string",
        Roles = new[]
        {
            "string",
        },
    });
    
    example, err := pinecone.NewApiKey(ctx, "apiKeyResource", &pinecone.ApiKeyArgs{
    	Name:      pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Roles: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
        .name("string")
        .projectId("string")
        .roles("string")
        .build());
    
    api_key_resource = pinecone.ApiKey("apiKeyResource",
        name="string",
        project_id="string",
        roles=["string"])
    
    const apiKeyResource = new pinecone.ApiKey("apiKeyResource", {
        name: "string",
        projectId: "string",
        roles: ["string"],
    });
    
    type: pinecone:ApiKey
    properties:
        name: string
        projectId: string
        roles:
            - string
    

    ApiKey Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ApiKey resource accepts the following input properties:

    Name string
    The name of the API key to be created. Must be 1-80 characters long.
    ProjectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    Roles List<string>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    Name string
    The name of the API key to be created. Must be 1-80 characters long.
    ProjectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    Roles []string
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    name String
    The name of the API key to be created. Must be 1-80 characters long.
    projectId String
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles List<String>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    name string
    The name of the API key to be created. Must be 1-80 characters long.
    projectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles string[]
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    name str
    The name of the API key to be created. Must be 1-80 characters long.
    project_id str
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles Sequence[str]
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    name String
    The name of the API key to be created. Must be 1-80 characters long.
    projectId String
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles List<String>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The generated API key value.
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The generated API key value.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The generated API key value.
    id string
    The provider-assigned unique ID for this managed resource.
    key string
    The generated API key value.
    id str
    The provider-assigned unique ID for this managed resource.
    key str
    The generated API key value.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The generated API key value.

    Look up Existing ApiKey Resource

    Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            roles: Optional[Sequence[str]] = None) -> ApiKey
    func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
    public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
    public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
    resources:  _:    type: pinecone:ApiKey    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Key string
    The generated API key value.
    Name string
    The name of the API key to be created. Must be 1-80 characters long.
    ProjectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    Roles List<string>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    Key string
    The generated API key value.
    Name string
    The name of the API key to be created. Must be 1-80 characters long.
    ProjectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    Roles []string
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    key String
    The generated API key value.
    name String
    The name of the API key to be created. Must be 1-80 characters long.
    projectId String
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles List<String>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    key string
    The generated API key value.
    name string
    The name of the API key to be created. Must be 1-80 characters long.
    projectId string
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles string[]
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    key str
    The generated API key value.
    name str
    The name of the API key to be created. Must be 1-80 characters long.
    project_id str
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles Sequence[str]
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].
    key String
    The generated API key value.
    name String
    The name of the API key to be created. Must be 1-80 characters long.
    projectId String
    The project ID where the API key will be created. Required for creation, optional for updates.
    roles List<String>
    The roles assigned to the API key. Valid values are: ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, DataPlaneViewer. Defaults to ["ProjectEditor"].

    Package Details

    Repository
    pinecone pinecone-io/pulumi-pinecone
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pinecone Terraform Provider.
    pinecone logo
    Pinecone v2.0.2 published on Wednesday, Nov 5, 2025 by pinecone-io
      Meet Neo: Your AI Platform Teammate