1. Registry
  2. Packages
  3. Oracle Cloud Infrastructure
  4. API Docs
  5. GenerativeAi
  6. getApikey
Viewing docs for Oracle Cloud Infrastructure v5.6.0
published on Thursday, Nov 5, 2026 by Pulumi
oci logo oci logo
Viewing docs for Oracle Cloud Infrastructure v5.6.0
published on Thursday, Nov 5, 2026 by Pulumi

    This data source provides details about a specific Apikey resource in Oracle Cloud Infrastructure Generative Ai service.

    Gets information about an API key.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testApikey = oci.generativeai.getApikey({
        apiKeyId: testApiKey.id,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_apikey = oci.generativeai.get_apikey(api_key_id=test_api_key["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/v5/go/oci/generativeai"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := generativeai.GetApikey(ctx, &generativeai.GetApikeyArgs{
    			ApiKeyId: testApiKey.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testApikey = Oci.GenerativeAi.GetApikey.Invoke(new()
        {
            ApiKeyId = testApiKey.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.GenerativeAi.GenerativeAiFunctions;
    import com.pulumi.oci.GenerativeAi.inputs.GetApikeyArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 testApikey = GenerativeAiFunctions.getApikey(GetApikeyArgs.builder()
                .apiKeyId(testApiKey.get("id"))
                .build());
    
        }
    }
    
    variables:
      testApikey:
        fn::invoke:
          function: oci:GenerativeAi:getApikey
          arguments:
            apiKeyId: ${testApiKey.id}
    
    terraform {
      required_providers {
        oci = {
          source = "pulumi/oci"
        }
      }
    }
    
    data "oci_generative_ai_apikey" "testApikey" {
      api_key_id = testApiKey.id
    }
    

    Using getApikey

    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 getApikey(args: GetApikeyArgs, opts?: InvokeOptions): Promise<GetApikeyResult>
    function getApikeyOutput(args: GetApikeyOutputArgs, opts?: InvokeOutputOptions): Output<GetApikeyResult>
    def get_apikey(api_key_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetApikeyResult
    def get_apikey_output(api_key_id: pulumi.Input[Optional[str]] = None,
                   opts: Optional[InvokeOutputOptions] = None) -> Output[GetApikeyResult]
    func GetApikey(ctx *Context, args *GetApikeyArgs, opts ...InvokeOption) (*GetApikeyResult, error)
    func GetApikeyOutput(ctx *Context, args *GetApikeyOutputArgs, opts ...InvokeOption) GetApikeyResultOutput

    > Note: This function is named GetApikey in the Go SDK.

    public static class GetApikey 
    {
        public static Task<GetApikeyResult> InvokeAsync(GetApikeyArgs args, InvokeOptions? opts = null)
        public static Output<GetApikeyResult> Invoke(GetApikeyInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetApikeyResult> Invoke(GetApikeyInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetApikeyResult> getApikey(GetApikeyArgs args, InvokeOptions options)
    public static Output<GetApikeyResult> getApikey(GetApikeyArgs args, InvokeOptions options)
    public static Output<GetApikeyResult> getApikey(GetApikeyArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: oci:GenerativeAi/getApikey:getApikey
      arguments:
        # arguments dictionary
    data "oci_generative_ai_get_apikey" "name" {
        # arguments
    }

    The following arguments are supported:

    ApiKeyId string
    The OCID of the APIKey.
    ApiKeyId string
    The OCID of the APIKey.
    api_key_id string
    The OCID of the APIKey.
    apiKeyId String
    The OCID of the APIKey.
    apiKeyId string
    The OCID of the APIKey.
    api_key_id str
    The OCID of the APIKey.
    apiKeyId String
    The OCID of the APIKey.

    getApikey Result

    The following output properties are available:

    ApiKeyId string
    CompartmentId string
    The compartment OCID to create the apiKey in.
    DefinedTags Dictionary<string, string>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    An optional description of the Api key.
    DisplayName string
    A user-friendly name. Does not have to be unique, and it's changeable.
    FreeformTags Dictionary<string, string>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    the ApiKey id.
    Keys List<GetApikeyKey>
    The list of keys.
    LifecycleDetails string
    A message describing the current state with detail that can provide actionable information.
    State string
    The current state of the API key.
    SystemTags Dictionary<string, string>
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    TimeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    TimeUpdated string
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    ApiKeyId string
    CompartmentId string
    The compartment OCID to create the apiKey in.
    DefinedTags map[string]string
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    Description string
    An optional description of the Api key.
    DisplayName string
    A user-friendly name. Does not have to be unique, and it's changeable.
    FreeformTags map[string]string
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    the ApiKey id.
    Keys []GetApikeyKey
    The list of keys.
    LifecycleDetails string
    A message describing the current state with detail that can provide actionable information.
    State string
    The current state of the API key.
    SystemTags map[string]string
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    TimeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    TimeUpdated string
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    api_key_id string
    compartment_id string
    The compartment OCID to create the apiKey in.
    defined_tags map(string)
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description string
    An optional description of the Api key.
    display_name string
    A user-friendly name. Does not have to be unique, and it's changeable.
    freeform_tags map(string)
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    the ApiKey id.
    keys list(object)
    The list of keys.
    lifecycle_details string
    A message describing the current state with detail that can provide actionable information.
    state string
    The current state of the API key.
    system_tags map(string)
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    time_created string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    time_updated string
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    apiKeyId String
    compartmentId String
    The compartment OCID to create the apiKey in.
    definedTags Map<String,String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    An optional description of the Api key.
    displayName String
    A user-friendly name. Does not have to be unique, and it's changeable.
    freeformTags Map<String,String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    the ApiKey id.
    keys List<GetApikeyKey>
    The list of keys.
    lifecycleDetails String
    A message describing the current state with detail that can provide actionable information.
    state String
    The current state of the API key.
    systemTags Map<String,String>
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    timeCreated String
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeUpdated String
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    apiKeyId string
    compartmentId string
    The compartment OCID to create the apiKey in.
    definedTags {[key: string]: string}
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description string
    An optional description of the Api key.
    displayName string
    A user-friendly name. Does not have to be unique, and it's changeable.
    freeformTags {[key: string]: string}
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    the ApiKey id.
    keys GetApikeyKey[]
    The list of keys.
    lifecycleDetails string
    A message describing the current state with detail that can provide actionable information.
    state string
    The current state of the API key.
    systemTags {[key: string]: string}
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    timeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeUpdated string
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    api_key_id str
    compartment_id str
    The compartment OCID to create the apiKey in.
    defined_tags Mapping[str, str]
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description str
    An optional description of the Api key.
    display_name str
    A user-friendly name. Does not have to be unique, and it's changeable.
    freeform_tags Mapping[str, str]
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id str
    the ApiKey id.
    keys Sequence[GetApikeyKey]
    The list of keys.
    lifecycle_details str
    A message describing the current state with detail that can provide actionable information.
    state str
    The current state of the API key.
    system_tags Mapping[str, str]
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    time_created str
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    time_updated str
    The date and time the ApiKey was updated, in the format defined by RFC 3339.
    apiKeyId String
    compartmentId String
    The compartment OCID to create the apiKey in.
    definedTags Map<String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    description String
    An optional description of the Api key.
    displayName String
    A user-friendly name. Does not have to be unique, and it's changeable.
    freeformTags Map<String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    the ApiKey id.
    keys List<Property Map>
    The list of keys.
    lifecycleDetails String
    A message describing the current state with detail that can provide actionable information.
    state String
    The current state of the API key.
    systemTags Map<String>
    System tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud.free-tier-retained": "true"}
    timeCreated String
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeUpdated String
    The date and time the ApiKey was updated, in the format defined by RFC 3339.

    Supporting Types

    GetApikeyKey

    Key string
    The key.
    KeyMask string
    The masked key.
    KeyName string
    The key name.
    State string
    The current state of the API key.
    TimeActivated string
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    TimeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    TimeDeactivated string
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    TimeExpiry string
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    TimeLastUsed string
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    TimeRevoked string
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    Key string
    The key.
    KeyMask string
    The masked key.
    KeyName string
    The key name.
    State string
    The current state of the API key.
    TimeActivated string
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    TimeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    TimeDeactivated string
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    TimeExpiry string
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    TimeLastUsed string
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    TimeRevoked string
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    key string
    The key.
    key_mask string
    The masked key.
    key_name string
    The key name.
    state string
    The current state of the API key.
    time_activated string
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    time_created string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    time_deactivated string
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    time_expiry string
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    time_last_used string
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    time_revoked string
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    key String
    The key.
    keyMask String
    The masked key.
    keyName String
    The key name.
    state String
    The current state of the API key.
    timeActivated String
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    timeCreated String
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeDeactivated String
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    timeExpiry String
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    timeLastUsed String
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    timeRevoked String
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    key string
    The key.
    keyMask string
    The masked key.
    keyName string
    The key name.
    state string
    The current state of the API key.
    timeActivated string
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    timeCreated string
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeDeactivated string
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    timeExpiry string
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    timeLastUsed string
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    timeRevoked string
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    key str
    The key.
    key_mask str
    The masked key.
    key_name str
    The key name.
    state str
    The current state of the API key.
    time_activated str
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    time_created str
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    time_deactivated str
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    time_expiry str
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    time_last_used str
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    time_revoked str
    The date and time that the key is revoked in the format of an RFC3339 datetime string.
    key String
    The key.
    keyMask String
    The masked key.
    keyName String
    The key name.
    state String
    The current state of the API key.
    timeActivated String
    The date and time that the key is activated in the format of an RFC3339 datetime string.
    timeCreated String
    The date and time that the ApiKey was created in the format of an RFC3339 datetime string.
    timeDeactivated String
    The date and time that the key is deactivated in the format of an RFC3339 datetime string.
    timeExpiry String
    The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.
    timeLastUsed String
    The date and time that the key is last used in the format of an RFC3339 datetime string.
    timeRevoked String
    The date and time that the key is revoked in the format of an RFC3339 datetime string.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo oci logo
    Viewing docs for Oracle Cloud Infrastructure v5.6.0
    published on Thursday, Nov 5, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial