Okta.Sdk.Api.ApiTokenApi

October 22, 2025 ยท View on GitHub

All URIs are relative to https://subdomain.okta.com

MethodHTTP requestDescription
GetApiTokenGET /api/v1/api-tokens/{apiTokenId}Retrieve an API token's metadata
ListApiTokensGET /api/v1/api-tokensList all API token metadata
RevokeApiTokenDELETE /api/v1/api-tokens/{apiTokenId}Revoke an API token
RevokeCurrentApiTokenDELETE /api/v1/api-tokens/currentRevoke the current API token
UpsertApiTokenPUT /api/v1/api-tokens/{apiTokenId}Upsert an API token network condition

GetApiToken

ApiToken GetApiToken (string apiTokenId)

Retrieve an API token's metadata

Retrieves the metadata for an active API token by apiTokenId

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class GetApiTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ApiTokenApi(config);
            var apiTokenId = 00Tabcdefg1234567890;  // string | id of the API Token

            try
            {
                // Retrieve an API token's metadata
                ApiToken result = apiInstance.GetApiToken(apiTokenId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApiTokenApi.GetApiToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
apiTokenIdstringid of the API Token

Return type

ApiToken

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListApiTokens

List<ApiToken> ListApiTokens ()

List all API token metadata

Lists all the metadata of the active API tokens

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class ListApiTokensExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ApiTokenApi(config);

            try
            {
                // List all API token metadata
                List<ApiToken> result = apiInstance.ListApiTokens().ToListAsync();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApiTokenApi.ListApiTokens: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

List<ApiToken>

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
403Forbidden-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RevokeApiToken

void RevokeApiToken (string apiTokenId)

Revoke an API token

Revokes an API token by apiTokenId

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class RevokeApiTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ApiTokenApi(config);
            var apiTokenId = 00Tabcdefg1234567890;  // string | id of the API Token

            try
            {
                // Revoke an API token
                apiInstance.RevokeApiToken(apiTokenId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApiTokenApi.RevokeApiToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
apiTokenIdstringid of the API Token

Return type

void (empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RevokeCurrentApiToken

void RevokeCurrentApiToken ()

Revoke the current API token

Revokes the API token provided in the Authorization header

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class RevokeCurrentApiTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";

            var apiInstance = new ApiTokenApi(config);

            try
            {
                // Revoke the current API token
                apiInstance.RevokeCurrentApiToken();
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApiTokenApi.RevokeCurrentApiToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

void (empty response body)

Authorization

apiToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
403Forbidden-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpsertApiToken

ApiToken UpsertApiToken (string apiTokenId, ApiTokenUpdate apiTokenUpdate)

Upsert an API token network condition

Upserts an API Token Network Condition by apiTokenId

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class UpsertApiTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ApiTokenApi(config);
            var apiTokenId = 00Tabcdefg1234567890;  // string | id of the API Token
            var apiTokenUpdate = new ApiTokenUpdate(); // ApiTokenUpdate | 

            try
            {
                // Upsert an API token network condition
                ApiToken result = apiInstance.UpsertApiToken(apiTokenId, apiTokenUpdate);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ApiTokenApi.UpsertApiToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
apiTokenIdstringid of the API Token
apiTokenUpdateApiTokenUpdate

Return type

ApiToken

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
400Bad Request-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]