published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Use this resource to programmatically create and manage the following types of keys:
- User API keys
- License (or ingest) keys, including:
- General license key used for APM
- Browser license key
Please visit the New Relic article ‘Use NerdGraph to manage license keys and User API keys’ for more information.
IMPORTANT! Please be very careful when updating existing
newrelic.ApiAccessKeyresources as onlynewrelic_api_access_key.nameandnewrelic_api_access_key.notesare updatable. All other resource attributes will force a resource recreation which will invalidate the previous API key(s).
Example Usage
using System.Collections.Generic;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var foobar = new NewRelic.ApiAccessKey("foobar", new()
{
AccountId = 1234567,
IngestType = "LICENSE",
KeyType = "INGEST",
Notes = "To be used with service X",
});
});
package main
import (
"github.com/pulumi/pulumi-newrelic/sdk/v4/go/newrelic"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := newrelic.NewApiAccessKey(ctx, "foobar", &newrelic.ApiAccessKeyArgs{
AccountId: pulumi.Int(1234567),
IngestType: pulumi.String("LICENSE"),
KeyType: pulumi.String("INGEST"),
Notes: pulumi.String("To be used with service X"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.ApiAccessKey;
import com.pulumi.newrelic.ApiAccessKeyArgs;
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) {
var foobar = new ApiAccessKey("foobar", ApiAccessKeyArgs.builder()
.accountId(1234567)
.ingestType("LICENSE")
.keyType("INGEST")
.notes("To be used with service X")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foobar = new newrelic.ApiAccessKey("foobar", {
accountId: 1234567,
ingestType: "LICENSE",
keyType: "INGEST",
notes: "To be used with service X",
});
import pulumi
import pulumi_newrelic as newrelic
foobar = newrelic.ApiAccessKey("foobar",
account_id=1234567,
ingest_type="LICENSE",
key_type="INGEST",
notes="To be used with service X")
resources:
foobar:
type: newrelic:ApiAccessKey
properties:
accountId: 1.234567e+06
ingestType: LICENSE
keyType: INGEST
notes: To be used with service X
Create ApiAccessKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiAccessKey(name: string, args: ApiAccessKeyArgs, opts?: CustomResourceOptions);@overload
def ApiAccessKey(resource_name: str,
args: ApiAccessKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiAccessKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[int] = None,
key_type: Optional[str] = None,
ingest_type: Optional[str] = None,
name: Optional[str] = None,
notes: Optional[str] = None,
user_id: Optional[int] = None)func NewApiAccessKey(ctx *Context, name string, args ApiAccessKeyArgs, opts ...ResourceOption) (*ApiAccessKey, error)public ApiAccessKey(string name, ApiAccessKeyArgs args, CustomResourceOptions? opts = null)
public ApiAccessKey(String name, ApiAccessKeyArgs args)
public ApiAccessKey(String name, ApiAccessKeyArgs args, CustomResourceOptions options)
type: newrelic:ApiAccessKey
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 ApiAccessKeyArgs
- 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 ApiAccessKeyArgs
- 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 ApiAccessKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiAccessKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiAccessKeyArgs
- 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 apiAccessKeyResource = new NewRelic.ApiAccessKey("apiAccessKeyResource", new()
{
AccountId = 0,
KeyType = "string",
IngestType = "string",
Name = "string",
Notes = "string",
UserId = 0,
});
example, err := newrelic.NewApiAccessKey(ctx, "apiAccessKeyResource", &newrelic.ApiAccessKeyArgs{
AccountId: pulumi.Int(0),
KeyType: pulumi.String("string"),
IngestType: pulumi.String("string"),
Name: pulumi.String("string"),
Notes: pulumi.String("string"),
UserId: pulumi.Int(0),
})
var apiAccessKeyResource = new ApiAccessKey("apiAccessKeyResource", ApiAccessKeyArgs.builder()
.accountId(0)
.keyType("string")
.ingestType("string")
.name("string")
.notes("string")
.userId(0)
.build());
api_access_key_resource = newrelic.ApiAccessKey("apiAccessKeyResource",
account_id=0,
key_type="string",
ingest_type="string",
name="string",
notes="string",
user_id=0)
const apiAccessKeyResource = new newrelic.ApiAccessKey("apiAccessKeyResource", {
accountId: 0,
keyType: "string",
ingestType: "string",
name: "string",
notes: "string",
userId: 0,
});
type: newrelic:ApiAccessKey
properties:
accountId: 0
ingestType: string
keyType: string
name: string
notes: string
userId: 0
ApiAccessKey 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 ApiAccessKey resource accepts the following input properties:
- Account
Id int - The New Relic account ID of the account you wish to create the API access key.
- Key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - Ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - Name string
- The name of the key.
- Notes string
- Any notes about this ingest key.
- User
Id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- Account
Id int - The New Relic account ID of the account you wish to create the API access key.
- Key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - Ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - Name string
- The name of the key.
- Notes string
- Any notes about this ingest key.
- User
Id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id Integer - The New Relic account ID of the account you wish to create the API access key.
- key
Type String - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - ingest
Type String - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - name String
- The name of the key.
- notes String
- Any notes about this ingest key.
- user
Id Integer - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id number - The New Relic account ID of the account you wish to create the API access key.
- key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - name string
- The name of the key.
- notes string
- Any notes about this ingest key.
- user
Id number - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account_
id int - The New Relic account ID of the account you wish to create the API access key.
- key_
type str - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - ingest_
type str - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - name str
- The name of the key.
- notes str
- Any notes about this ingest key.
- user_
id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id Number - The New Relic account ID of the account you wish to create the API access key.
- key
Type String - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - ingest
Type String - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - name String
- The name of the key.
- notes String
- Any notes about this ingest key.
- user
Id Number - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiAccessKey resource produces the following output properties:
Look up Existing ApiAccessKey Resource
Get an existing ApiAccessKey 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?: ApiAccessKeyState, opts?: CustomResourceOptions): ApiAccessKey@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[int] = None,
ingest_type: Optional[str] = None,
key: Optional[str] = None,
key_type: Optional[str] = None,
name: Optional[str] = None,
notes: Optional[str] = None,
user_id: Optional[int] = None) -> ApiAccessKeyfunc GetApiAccessKey(ctx *Context, name string, id IDInput, state *ApiAccessKeyState, opts ...ResourceOption) (*ApiAccessKey, error)public static ApiAccessKey Get(string name, Input<string> id, ApiAccessKeyState? state, CustomResourceOptions? opts = null)public static ApiAccessKey get(String name, Output<String> id, ApiAccessKeyState state, CustomResourceOptions options)resources: _: type: newrelic:ApiAccessKey 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.
- Account
Id int - The New Relic account ID of the account you wish to create the API access key.
- Ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - Key string
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- Key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - Name string
- The name of the key.
- Notes string
- Any notes about this ingest key.
- User
Id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- Account
Id int - The New Relic account ID of the account you wish to create the API access key.
- Ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - Key string
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- Key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - Name string
- The name of the key.
- Notes string
- Any notes about this ingest key.
- User
Id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id Integer - The New Relic account ID of the account you wish to create the API access key.
- ingest
Type String - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - key String
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- key
Type String - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - name String
- The name of the key.
- notes String
- Any notes about this ingest key.
- user
Id Integer - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id number - The New Relic account ID of the account you wish to create the API access key.
- ingest
Type string - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - key string
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- key
Type string - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - name string
- The name of the key.
- notes string
- Any notes about this ingest key.
- user
Id number - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account_
id int - The New Relic account ID of the account you wish to create the API access key.
- ingest_
type str - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - key str
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- key_
type str - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - name str
- The name of the key.
- notes str
- Any notes about this ingest key.
- user_
id int - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
- account
Id Number - The New Relic account ID of the account you wish to create the API access key.
- ingest
Type String - Required if
key_type = INGEST. Valid options areBROWSERorLICENSE, case-sensitive. - key String
- The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
- key
Type String - What type of API key to create. Valid options are
INGESTorUSER, case-sensitive. - name String
- The name of the key.
- notes String
- Any notes about this ingest key.
- user
Id Number - Required if
key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
Import
Existing API access keys can be imported using a composite ID of <api_access_key_id>:<key_type>. <key_type> will be either INGEST or USER. For example
$ pulumi import newrelic:index/apiAccessKey:ApiAccessKey foobar "1234567:INGEST"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- New Relic pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.
published on Monday, Mar 9, 2026 by Pulumi
