Token

This contains APIs related to Token as defined in Harness

Create a Token

Creates a Token for the given API Key Type.

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:
required
identifier
required
string

Identifier of the Token

name
required
string

Name of the Token

validFrom
integer <int64>

This is the time from which the Token is valid. The time is in milliseconds.

validTo
integer <int64>

This is the time till which the Token is valid. The time is in milliseconds.

scheduledExpireTime
integer <int64>

Scheduled expiry time in milliseconds.

valid
boolean

Boolean value to indicate if Token is valid or not.

accountIdentifier
string

Account Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

apiKeyIdentifier
required
string

This is the API Key Id within which the Token is created.

parentIdentifier
string

This is the ID of the Parent entity from which the Token inherits its role bindings.

apiKeyType
string

Type of the API Key

Enum: "USER" "SERVICE_ACCOUNT" "SSH_KEY"
description
string [ 0 .. 1024 ] characters

Description of the Token

object

Tags for the Token

sshKeyContent
string

SSH key content from a public key, this is only present if API_KEY Type is SSH_KEY

sshKeyUsage
Array of strings

SSH key Usage: SSH keys can be used to authenticate or sign

Items Enum: "AUTH" "SIGN"
Responses
400

Bad Request

500

Internal server error

default

Returns created Token details

post/ng/api/token
Request samples
{
  • "identifier": "string",
  • "name": "string",
  • "validFrom": 0,
  • "validTo": 0,
  • "scheduledExpireTime": 0,
  • "valid": true,
  • "accountIdentifier": "string",
  • "projectIdentifier": "string",
  • "orgIdentifier": "string",
  • "apiKeyIdentifier": "string",
  • "parentIdentifier": "string",
  • "apiKeyType": "USER",
  • "description": "string",
  • "tags": {
    },
  • "sshKeyContent": "string",
  • "sshKeyUsage": [
    ]
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Update a Token

Updates a Token for the given API Key Type.

Securityx-api-key
Request
path Parameters
identifier
required
string

Token ID

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:
identifier
required
string

Identifier of the Token

name
required
string

Name of the Token

validFrom
integer <int64>

This is the time from which the Token is valid. The time is in milliseconds.

validTo
integer <int64>

This is the time till which the Token is valid. The time is in milliseconds.

scheduledExpireTime
integer <int64>

Scheduled expiry time in milliseconds.

valid
boolean

Boolean value to indicate if Token is valid or not.

accountIdentifier
string

Account Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

apiKeyIdentifier
required
string

This is the API Key Id within which the Token is created.

parentIdentifier
string

This is the ID of the Parent entity from which the Token inherits its role bindings.

apiKeyType
string

Type of the API Key

Enum: "USER" "SERVICE_ACCOUNT" "SSH_KEY"
description
string [ 0 .. 1024 ] characters

Description of the Token

object

Tags for the Token

sshKeyContent
string

SSH key content from a public key, this is only present if API_KEY Type is SSH_KEY

sshKeyUsage
Array of strings

SSH key Usage: SSH keys can be used to authenticate or sign

Items Enum: "AUTH" "SIGN"
Responses
400

Bad Request

500

Internal server error

default

Returns updated Token details

put/ng/api/token/{identifier}
Request samples
{
  • "identifier": "string",
  • "name": "string",
  • "validFrom": 0,
  • "validTo": 0,
  • "scheduledExpireTime": 0,
  • "valid": true,
  • "accountIdentifier": "string",
  • "projectIdentifier": "string",
  • "orgIdentifier": "string",
  • "apiKeyIdentifier": "string",
  • "parentIdentifier": "string",
  • "apiKeyType": "USER",
  • "description": "string",
  • "tags": {
    },
  • "sshKeyContent": "string",
  • "sshKeyUsage": [
    ]
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Delete a Token

Deletes a Token for the given API Key Type.

Securityx-api-key
Request
path Parameters
identifier
required
string

Token ID

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

apiKeyType
required
string

This is the API Key type like Personal Access Key or Service Account Key.

Enum: "USER" "SERVICE_ACCOUNT" "SSH_KEY"
parentIdentifier
required
string

ID of API key's Parent Service Account

apiKeyIdentifier
required
string

API key ID

Responses
400

Bad Request

500

Internal server error

default

It returns true if the Token is deleted successfully and false if the Token is not deleted.

delete/ng/api/token/{identifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

List all Tokens

Lists all the Tokens matching the given search criteria.

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

apiKeyType
required
string

This is the API Key type like Personal Access Key or Service Account Key.

Enum: "USER" "SERVICE_ACCOUNT" "SSH_KEY"
parentIdentifier
string

ID of API key's Parent Service Account

apiKeyIdentifier
string

API key ID

identifiers
Array of strings

This is the list of Token IDs. Details specific to these IDs would be fetched.

pageIndex
integer <int32>
Default: 0

Page Index of the results to fetch.Default Value: 0

pageSize
integer <int32> <= 100
Default: 50

Results per page(max 100)Default Value: 50

Array of objects (SortOrder)

Sort criteria for the elements.

pageToken
string

Page Token of the next results to fetch.Default Value: ''

searchTerm
string

This would be used to filter Tokens. Any Token having the specified string in its Name, ID and Tag would be filtered.

includeOnlyActiveTokens
boolean

Boolean value to indicate whether to list only active tokens or all tokens. By default, all tokens will be listed.

Responses
400

Bad Request

500

Internal server error

default

Returns the list of Aggregated Tokens.

get/ng/api/token/aggregate
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Rotate a Token

Rotates a Token for the given API Key Type.

Securityx-api-key
Request
path Parameters
identifier
required
string

Token Identifier

query Parameters
rotateTimestamp
integer <int64>

Time stamp till when the old token will be valid post rotation.

accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

apiKeyType
required
string

This is the API Key type like Personal Access Key or Service Account Key.

Enum: "USER" "SERVICE_ACCOUNT" "SSH_KEY"
parentIdentifier
required
string

ID of API key's Parent Service Account

apiKeyIdentifier
required
string

API key ID

Responses
400

Bad Request

500

Internal server error

default

Returns the rotated Token

post/ng/api/token/rotate/{identifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Validate a Token

Validate a Token for the given account.

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:
required
string
Responses
400

Bad Request

500

Internal server error

default

Validate a Token for the given account

post/ng/api/token/validate
Request samples
"string"
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}