1. Registry
  2. Packages
  3. Netbox Provider
  4. API Docs
  5. getToken
Viewing docs for netbox 6.0.1
published on Monday, Nov 16, 2026 by e-breuninger
netbox
Viewing docs for netbox 6.0.1
published on Monday, Nov 16, 2026 by e-breuninger

    An API token of a user (users.token).

    From the official documentation:

    A token is a secret credential associated with a user which authenticates requests to NetBox’s REST and GraphQL APIs. A user may hold multiple tokens; each can be independently expired, restricted, or revoked.

    Beginning with NetBox v4.5, two token versions are supported. v2 tokens (the default for newly-created tokens) are stored only as a salted HMAC digest, and the plaintext is shown to the user only once at creation time. Legacy v1 tokens store the plaintext directly; their use is deprecated and support will be removed in NetBox v5.0. See the REST API authentication documentation for the request header formats used by each version.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const test = netbox.getToken({
        id: 123,
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test = netbox.get_token(id=123)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v6/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := netbox.LookupToken(ctx, &netbox.LookupTokenArgs{
    			Id: pulumi.Float64Ref(123),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Netbox.GetToken.Invoke(new()
        {
            Id = 123,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.NetboxFunctions;
    import com.pulumi.netbox.inputs.GetTokenArgs;
    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 = NetboxFunctions.getToken(GetTokenArgs.builder()
                .id(123)
                .build());
    
        }
    }
    
    variables:
      test:
        fn::invoke:
          function: netbox:getToken
          arguments:
            id: 123
    
    Example coming soon!
    

    Using getToken

    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 getToken(args: GetTokenArgs, opts?: InvokeOptions): Promise<GetTokenResult>
    function getTokenOutput(args: GetTokenOutputArgs, opts?: InvokeOutputOptions): Output<GetTokenResult>
    def get_token(created: Optional[str] = None,
                  description: Optional[str] = None,
                  enabled: Optional[bool] = None,
                  expires: Optional[str] = None,
                  id: Optional[float] = None,
                  key: Optional[str] = None,
                  last_used: Optional[str] = None,
                  pepper_id: Optional[float] = None,
                  q: Optional[str] = None,
                  user_id: Optional[float] = None,
                  user_name: Optional[str] = None,
                  version: Optional[float] = None,
                  write_enabled: Optional[bool] = None,
                  opts: Optional[InvokeOptions] = None) -> GetTokenResult
    def get_token_output(created: pulumi.Input[Optional[str]] = None,
                  description: pulumi.Input[Optional[str]] = None,
                  enabled: pulumi.Input[Optional[bool]] = None,
                  expires: pulumi.Input[Optional[str]] = None,
                  id: pulumi.Input[Optional[float]] = None,
                  key: pulumi.Input[Optional[str]] = None,
                  last_used: pulumi.Input[Optional[str]] = None,
                  pepper_id: pulumi.Input[Optional[float]] = None,
                  q: pulumi.Input[Optional[str]] = None,
                  user_id: pulumi.Input[Optional[float]] = None,
                  user_name: pulumi.Input[Optional[str]] = None,
                  version: pulumi.Input[Optional[float]] = None,
                  write_enabled: pulumi.Input[Optional[bool]] = None,
                  opts: Optional[InvokeOutputOptions] = None) -> Output[GetTokenResult]
    func LookupToken(ctx *Context, args *LookupTokenArgs, opts ...InvokeOption) (*LookupTokenResult, error)
    func LookupTokenOutput(ctx *Context, args *LookupTokenOutputArgs, opts ...InvokeOption) LookupTokenResultOutput

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

    public static class GetToken 
    {
        public static Task<GetTokenResult> InvokeAsync(GetTokenArgs args, InvokeOptions? opts = null)
        public static Output<GetTokenResult> Invoke(GetTokenInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetTokenResult> Invoke(GetTokenInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
    public static Output<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
    public static Output<GetTokenResult> getToken(GetTokenArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: netbox:index/getToken:getToken
      arguments:
        # arguments dictionary
    data "netbox_get_token" "name" {
        # arguments
    }

    The following arguments are supported:

    Created string
    Description string
    Enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    Expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    Id double
    NetBox id.
    Key string
    Identification key NetBox generated for the token; not the secret.
    LastUsed string
    When the token was last used.
    PepperId double
    Id of the pepper the secret was hashed with.
    Q string
    Search term, matched against the fields NetBox searches for this object type.
    UserId double
    Id of the user the token belongs to.
    UserName string
    Name of the user.
    Version double
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    WriteEnabled bool
    Whether the token permits write operations.
    Created string
    Description string
    Enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    Expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    Id float64
    NetBox id.
    Key string
    Identification key NetBox generated for the token; not the secret.
    LastUsed string
    When the token was last used.
    PepperId float64
    Id of the pepper the secret was hashed with.
    Q string
    Search term, matched against the fields NetBox searches for this object type.
    UserId float64
    Id of the user the token belongs to.
    UserName string
    Name of the user.
    Version float64
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    WriteEnabled bool
    Whether the token permits write operations.
    created string
    description string
    enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id number
    NetBox id.
    key string
    Identification key NetBox generated for the token; not the secret.
    last_used string
    When the token was last used.
    pepper_id number
    Id of the pepper the secret was hashed with.
    q string
    Search term, matched against the fields NetBox searches for this object type.
    user_id number
    Id of the user the token belongs to.
    user_name string
    Name of the user.
    version number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    write_enabled bool
    Whether the token permits write operations.
    created String
    description String
    enabled Boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires String
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id Double
    NetBox id.
    key String
    Identification key NetBox generated for the token; not the secret.
    lastUsed String
    When the token was last used.
    pepperId Double
    Id of the pepper the secret was hashed with.
    q String
    Search term, matched against the fields NetBox searches for this object type.
    userId Double
    Id of the user the token belongs to.
    userName String
    Name of the user.
    version Double
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled Boolean
    Whether the token permits write operations.
    created string
    description string
    enabled boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id number
    NetBox id.
    key string
    Identification key NetBox generated for the token; not the secret.
    lastUsed string
    When the token was last used.
    pepperId number
    Id of the pepper the secret was hashed with.
    q string
    Search term, matched against the fields NetBox searches for this object type.
    userId number
    Id of the user the token belongs to.
    userName string
    Name of the user.
    version number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled boolean
    Whether the token permits write operations.
    created str
    description str
    enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires str
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id float
    NetBox id.
    key str
    Identification key NetBox generated for the token; not the secret.
    last_used str
    When the token was last used.
    pepper_id float
    Id of the pepper the secret was hashed with.
    q str
    Search term, matched against the fields NetBox searches for this object type.
    user_id float
    Id of the user the token belongs to.
    user_name str
    Name of the user.
    version float
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    write_enabled bool
    Whether the token permits write operations.
    created String
    description String
    enabled Boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires String
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id Number
    NetBox id.
    key String
    Identification key NetBox generated for the token; not the secret.
    lastUsed String
    When the token was last used.
    pepperId Number
    Id of the pepper the secret was hashed with.
    q String
    Search term, matched against the fields NetBox searches for this object type.
    userId Number
    Id of the user the token belongs to.
    userName String
    Name of the user.
    version Number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled Boolean
    Whether the token permits write operations.

    getToken Result

    The following output properties are available:

    Created string
    Description string
    Enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    Expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    Id double
    NetBox id.
    Key string
    Identification key NetBox generated for the token; not the secret.
    LastUsed string
    When the token was last used.
    PepperId double
    Id of the pepper the secret was hashed with.
    Token string
    Url string
    UserId double
    Id of the user the token belongs to.
    Version double
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    WriteEnabled bool
    Whether the token permits write operations.
    Q string
    Search term, matched against the fields NetBox searches for this object type.
    UserName string
    Name of the user.
    Created string
    Description string
    Enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    Expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    Id float64
    NetBox id.
    Key string
    Identification key NetBox generated for the token; not the secret.
    LastUsed string
    When the token was last used.
    PepperId float64
    Id of the pepper the secret was hashed with.
    Token string
    Url string
    UserId float64
    Id of the user the token belongs to.
    Version float64
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    WriteEnabled bool
    Whether the token permits write operations.
    Q string
    Search term, matched against the fields NetBox searches for this object type.
    UserName string
    Name of the user.
    created string
    description string
    enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id number
    NetBox id.
    key string
    Identification key NetBox generated for the token; not the secret.
    last_used string
    When the token was last used.
    pepper_id number
    Id of the pepper the secret was hashed with.
    token string
    url string
    user_id number
    Id of the user the token belongs to.
    version number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    write_enabled bool
    Whether the token permits write operations.
    q string
    Search term, matched against the fields NetBox searches for this object type.
    user_name string
    Name of the user.
    created String
    description String
    enabled Boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires String
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id Double
    NetBox id.
    key String
    Identification key NetBox generated for the token; not the secret.
    lastUsed String
    When the token was last used.
    pepperId Double
    Id of the pepper the secret was hashed with.
    token String
    url String
    userId Double
    Id of the user the token belongs to.
    version Double
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled Boolean
    Whether the token permits write operations.
    q String
    Search term, matched against the fields NetBox searches for this object type.
    userName String
    Name of the user.
    created string
    description string
    enabled boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires string
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id number
    NetBox id.
    key string
    Identification key NetBox generated for the token; not the secret.
    lastUsed string
    When the token was last used.
    pepperId number
    Id of the pepper the secret was hashed with.
    token string
    url string
    userId number
    Id of the user the token belongs to.
    version number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled boolean
    Whether the token permits write operations.
    q string
    Search term, matched against the fields NetBox searches for this object type.
    userName string
    Name of the user.
    created str
    description str
    enabled bool
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires str
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id float
    NetBox id.
    key str
    Identification key NetBox generated for the token; not the secret.
    last_used str
    When the token was last used.
    pepper_id float
    Id of the pepper the secret was hashed with.
    token str
    url str
    user_id float
    Id of the user the token belongs to.
    version float
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    write_enabled bool
    Whether the token permits write operations.
    q str
    Search term, matched against the fields NetBox searches for this object type.
    user_name str
    Name of the user.
    created String
    description String
    enabled Boolean
    Whether the token can authenticate; disabling keeps the token but rejects its use.
    expires String
    Expiry as an RFC 3339 timestamp with milliseconds (2030-01-01T00:00:00.000Z); never expires when unset.
    id Number
    NetBox id.
    key String
    Identification key NetBox generated for the token; not the secret.
    lastUsed String
    When the token was last used.
    pepperId Number
    Id of the pepper the secret was hashed with.
    token String
    url String
    userId Number
    Id of the user the token belongs to.
    version Number
    Token format version (1 legacy plaintext, 2 hashed). Defaults to 2. Changing it replaces the token. One of: 1, 2.
    writeEnabled Boolean
    Whether the token permits write operations.
    q String
    Search term, matched against the fields NetBox searches for this object type.
    userName String
    Name of the user.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox
    Viewing docs for netbox 6.0.1
    published on Monday, Nov 16, 2026 by e-breuninger

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial