1. Packages
  2. Okta Provider
  3. API Docs
  4. ApiToken
Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi
okta logo
Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const example = new okta.ApiToken("example", {
        idProperty: "00T1fxzubpqiepH11d38",
        name: "token-api-token-test",
        userId: "00unkw1sfbTw08c0g1d7",
        network: {
            connection: "ZONE",
            excludes: ["nzonkw1sfwwi79Hat2d7"],
        },
        clientName: "Okta API",
    });
    
    import pulumi
    import pulumi_okta as okta
    
    example = okta.ApiToken("example",
        id_property="00T1fxzubpqiepH11d38",
        name="token-api-token-test",
        user_id="00unkw1sfbTw08c0g1d7",
        network={
            "connection": "ZONE",
            "excludes": ["nzonkw1sfwwi79Hat2d7"],
        },
        client_name="Okta API")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v6/go/okta"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := okta.NewApiToken(ctx, "example", &okta.ApiTokenArgs{
    			IdProperty: pulumi.String("00T1fxzubpqiepH11d38"),
    			Name:       pulumi.String("token-api-token-test"),
    			UserId:     pulumi.String("00unkw1sfbTw08c0g1d7"),
    			Network: &okta.ApiTokenNetworkArgs{
    				Connection: pulumi.String("ZONE"),
    				Excludes: pulumi.StringArray{
    					pulumi.String("nzonkw1sfwwi79Hat2d7"),
    				},
    			},
    			ClientName: pulumi.String("Okta API"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Okta = Pulumi.Okta;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Okta.ApiToken("example", new()
        {
            IdProperty = "00T1fxzubpqiepH11d38",
            Name = "token-api-token-test",
            UserId = "00unkw1sfbTw08c0g1d7",
            Network = new Okta.Inputs.ApiTokenNetworkArgs
            {
                Connection = "ZONE",
                Excludes = new[]
                {
                    "nzonkw1sfwwi79Hat2d7",
                },
            },
            ClientName = "Okta API",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.okta.ApiToken;
    import com.pulumi.okta.ApiTokenArgs;
    import com.pulumi.okta.inputs.ApiTokenNetworkArgs;
    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 example = new ApiToken("example", ApiTokenArgs.builder()
                .idProperty("00T1fxzubpqiepH11d38")
                .name("token-api-token-test")
                .userId("00unkw1sfbTw08c0g1d7")
                .network(ApiTokenNetworkArgs.builder()
                    .connection("ZONE")
                    .excludes("nzonkw1sfwwi79Hat2d7")
                    .build())
                .clientName("Okta API")
                .build());
    
        }
    }
    
    resources:
      example:
        type: okta:ApiToken
        properties:
          idProperty: 00T1fxzubpqiepH11d38
          name: token-api-token-test
          userId: 00unkw1sfbTw08c0g1d7
          network:
            connection: ZONE
            excludes:
              - nzonkw1sfwwi79Hat2d7
          clientName: Okta API
    

    Nested Schema for network

    Optional:

    • connection (String) The connection type of the Network Condition.

    Blocks:

    • exclude (List of String) List of excluded network zones.
    • include (List of String) List of included network zones.

    Import

    API tokens can be imported using their ID:

    terraform import okta_api_token.example <api_token_id>
    

    Create ApiToken Resource

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

    Constructor syntax

    new ApiToken(name: string, args: ApiTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ApiToken(resource_name: str,
                 args: ApiTokenArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiToken(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 id_property: Optional[str] = None,
                 client_name: Optional[str] = None,
                 created: Optional[str] = None,
                 name: Optional[str] = None,
                 network: Optional[ApiTokenNetworkArgs] = None,
                 user_id: Optional[str] = None)
    func NewApiToken(ctx *Context, name string, args ApiTokenArgs, opts ...ResourceOption) (*ApiToken, error)
    public ApiToken(string name, ApiTokenArgs args, CustomResourceOptions? opts = null)
    public ApiToken(String name, ApiTokenArgs args)
    public ApiToken(String name, ApiTokenArgs args, CustomResourceOptions options)
    
    type: okta:ApiToken
    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 ApiTokenArgs
    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 ApiTokenArgs
    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 ApiTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiTokenArgs
    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 apiTokenResource = new Okta.ApiToken("apiTokenResource", new()
    {
        IdProperty = "string",
        ClientName = "string",
        Created = "string",
        Name = "string",
        Network = new Okta.Inputs.ApiTokenNetworkArgs
        {
            Connection = "string",
            Excludes = new[]
            {
                "string",
            },
            Includes = new[]
            {
                "string",
            },
        },
        UserId = "string",
    });
    
    example, err := okta.NewApiToken(ctx, "apiTokenResource", &okta.ApiTokenArgs{
    	IdProperty: pulumi.String("string"),
    	ClientName: pulumi.String("string"),
    	Created:    pulumi.String("string"),
    	Name:       pulumi.String("string"),
    	Network: &okta.ApiTokenNetworkArgs{
    		Connection: pulumi.String("string"),
    		Excludes: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Includes: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	UserId: pulumi.String("string"),
    })
    
    var apiTokenResource = new ApiToken("apiTokenResource", ApiTokenArgs.builder()
        .idProperty("string")
        .clientName("string")
        .created("string")
        .name("string")
        .network(ApiTokenNetworkArgs.builder()
            .connection("string")
            .excludes("string")
            .includes("string")
            .build())
        .userId("string")
        .build());
    
    api_token_resource = okta.ApiToken("apiTokenResource",
        id_property="string",
        client_name="string",
        created="string",
        name="string",
        network={
            "connection": "string",
            "excludes": ["string"],
            "includes": ["string"],
        },
        user_id="string")
    
    const apiTokenResource = new okta.ApiToken("apiTokenResource", {
        idProperty: "string",
        clientName: "string",
        created: "string",
        name: "string",
        network: {
            connection: "string",
            excludes: ["string"],
            includes: ["string"],
        },
        userId: "string",
    });
    
    type: okta:ApiToken
    properties:
        clientName: string
        created: string
        idProperty: string
        name: string
        network:
            connection: string
            excludes:
                - string
            includes:
                - string
        userId: string
    

    ApiToken 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 ApiToken resource accepts the following input properties:

    IdProperty string
    The ID of the API token.
    ClientName string
    The name of the API token client.
    Created string
    The date and time the API token was created.
    Name string
    The name of the API token.
    Network ApiTokenNetwork
    The Network Condition of the API Token.
    UserId string
    The userId of the user who created the API Token.
    IdProperty string
    The ID of the API token.
    ClientName string
    The name of the API token client.
    Created string
    The date and time the API token was created.
    Name string
    The name of the API token.
    Network ApiTokenNetworkArgs
    The Network Condition of the API Token.
    UserId string
    The userId of the user who created the API Token.
    idProperty String
    The ID of the API token.
    clientName String
    The name of the API token client.
    created String
    The date and time the API token was created.
    name String
    The name of the API token.
    network ApiTokenNetwork
    The Network Condition of the API Token.
    userId String
    The userId of the user who created the API Token.
    idProperty string
    The ID of the API token.
    clientName string
    The name of the API token client.
    created string
    The date and time the API token was created.
    name string
    The name of the API token.
    network ApiTokenNetwork
    The Network Condition of the API Token.
    userId string
    The userId of the user who created the API Token.
    id_property str
    The ID of the API token.
    client_name str
    The name of the API token client.
    created str
    The date and time the API token was created.
    name str
    The name of the API token.
    network ApiTokenNetworkArgs
    The Network Condition of the API Token.
    user_id str
    The userId of the user who created the API Token.
    idProperty String
    The ID of the API token.
    clientName String
    The name of the API token client.
    created String
    The date and time the API token was created.
    name String
    The name of the API token.
    network Property Map
    The Network Condition of the API Token.
    userId String
    The userId of the user who created the API Token.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ApiToken Resource

    Get an existing ApiToken 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?: ApiTokenState, opts?: CustomResourceOptions): ApiToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_name: Optional[str] = None,
            created: Optional[str] = None,
            id_property: Optional[str] = None,
            name: Optional[str] = None,
            network: Optional[ApiTokenNetworkArgs] = None,
            user_id: Optional[str] = None) -> ApiToken
    func GetApiToken(ctx *Context, name string, id IDInput, state *ApiTokenState, opts ...ResourceOption) (*ApiToken, error)
    public static ApiToken Get(string name, Input<string> id, ApiTokenState? state, CustomResourceOptions? opts = null)
    public static ApiToken get(String name, Output<String> id, ApiTokenState state, CustomResourceOptions options)
    resources:  _:    type: okta:ApiToken    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:
    ClientName string
    The name of the API token client.
    Created string
    The date and time the API token was created.
    IdProperty string
    The ID of the API token.
    Name string
    The name of the API token.
    Network ApiTokenNetwork
    The Network Condition of the API Token.
    UserId string
    The userId of the user who created the API Token.
    ClientName string
    The name of the API token client.
    Created string
    The date and time the API token was created.
    IdProperty string
    The ID of the API token.
    Name string
    The name of the API token.
    Network ApiTokenNetworkArgs
    The Network Condition of the API Token.
    UserId string
    The userId of the user who created the API Token.
    clientName String
    The name of the API token client.
    created String
    The date and time the API token was created.
    idProperty String
    The ID of the API token.
    name String
    The name of the API token.
    network ApiTokenNetwork
    The Network Condition of the API Token.
    userId String
    The userId of the user who created the API Token.
    clientName string
    The name of the API token client.
    created string
    The date and time the API token was created.
    idProperty string
    The ID of the API token.
    name string
    The name of the API token.
    network ApiTokenNetwork
    The Network Condition of the API Token.
    userId string
    The userId of the user who created the API Token.
    client_name str
    The name of the API token client.
    created str
    The date and time the API token was created.
    id_property str
    The ID of the API token.
    name str
    The name of the API token.
    network ApiTokenNetworkArgs
    The Network Condition of the API Token.
    user_id str
    The userId of the user who created the API Token.
    clientName String
    The name of the API token client.
    created String
    The date and time the API token was created.
    idProperty String
    The ID of the API token.
    name String
    The name of the API token.
    network Property Map
    The Network Condition of the API Token.
    userId String
    The userId of the user who created the API Token.

    Supporting Types

    ApiTokenNetwork, ApiTokenNetworkArgs

    Connection string
    The connection type of the Network Condition.
    Excludes List<string>
    The IP address the excluded zone.
    Includes List<string>
    The IP address the included zone.
    Connection string
    The connection type of the Network Condition.
    Excludes []string
    The IP address the excluded zone.
    Includes []string
    The IP address the included zone.
    connection String
    The connection type of the Network Condition.
    excludes List<String>
    The IP address the excluded zone.
    includes List<String>
    The IP address the included zone.
    connection string
    The connection type of the Network Condition.
    excludes string[]
    The IP address the excluded zone.
    includes string[]
    The IP address the included zone.
    connection str
    The connection type of the Network Condition.
    excludes Sequence[str]
    The IP address the excluded zone.
    includes Sequence[str]
    The IP address the included zone.
    connection String
    The connection type of the Network Condition.
    excludes List<String>
    The IP address the excluded zone.
    includes List<String>
    The IP address the included zone.

    Package Details

    Repository
    Okta pulumi/pulumi-okta
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the okta Terraform Provider.
    okta logo
    Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate