Token

This contains APIs related to Token as defined in Harness

Create a Token

Creates a Token for the given API Key Type.

SecurityApiKey
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:
identifier
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
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"
description
string [ 0 .. 1024 ] characters

Description of the Token

object

Tags for the Token

email
string

Email Id of the user who created the Token.

username
string

Name of the user who created the Token.

encodedPassword
string

This is the encoded password of the Token.

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": {
    },
  • "email": "string",
  • "username": "string",
  • "encodedPassword": "string"
}
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.

SecurityApiKey
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"
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.

SecurityApiKey
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"
parentIdentifier
required
string

ID of API key's Parent Service Account

apiKeyIdentifier
required
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.

searchTerm
string

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

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.

SecurityApiKey
Request
path Parameters
identifier
required
string

Token Identifier

query Parameters
rotateTimestamp
integer <int64>

Time stamp when the Token is to be rotated

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"
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": [
    ]
}

Update a Token

Updates a Token for the given API Key Type.

SecurityApiKey
Request
path Parameters
identifier
required
string

Token ID

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:
identifier
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
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"
description
string [ 0 .. 1024 ] characters

Description of the Token

object

Tags for the Token

email
string

Email Id of the user who created the Token.

username
string

Name of the user who created the Token.

encodedPassword
string

This is the encoded password of the Token.

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": {
    },
  • "email": "string",
  • "username": "string",
  • "encodedPassword": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}