Token

This contains APIs related to Token as defined in Harness

Creates a Token

Request
Security:
ApiKey (readwrite)
Request Body schema:
identifier
string
name
string
validFrom
integer <int64>
validTo
integer <int64>
scheduledExpireTime
integer <int64>
valid
boolean
accountIdentifier
string
projectIdentifier
string
orgIdentifier
string
apiKeyIdentifier
string
parentIdentifier
string
apiKeyType
string
Enum: "USER" "SERVICE_ACCOUNT"
description
string [ 0 .. 1024 ] characters
object
email
string
username
string
encodedPassword
string
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": [
    ]
}

Updates a Token by ID

Request
Security:
ApiKey (readwrite)
path Parameters
identifier
required
string

Token ID

Request Body schema:
identifier
string
name
string
validFrom
integer <int64>
validTo
integer <int64>
scheduledExpireTime
integer <int64>
valid
boolean
accountIdentifier
string
projectIdentifier
string
orgIdentifier
string
apiKeyIdentifier
string
parentIdentifier
string
apiKeyType
string
Enum: "USER" "SERVICE_ACCOUNT"
description
string [ 0 .. 1024 ] characters
object
email
string
username
string
encodedPassword
string
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": [
    ]
}

Deletes a Token by ID

Request
Security:
ApiKey (readwrite)
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
curl -i -X DELETE \
  'https://app.harness.io/gateway/ng/api/token/:identifier?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string&apiKeyIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Rotates a Token by ID

Request
Security:
ApiKey (readwrite)
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
curl -i -X POST \
  'https://app.harness.io/gateway/ng/api/token/rotate/:identifier?rotateTimestamp=0&accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string&apiKeyIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Fetches the list of Aggregated Tokens corresponding to the request's filter criteria.

Request
Security:
ApiKey (readwrite)
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

Indicates the number of pages. Results for these pages will be retrieved.

pageSize
integer <int32>
Default: 50

The number of the elements to fetch

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
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/token/aggregate?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string&apiKeyIdentifier=string&identifiers=string&pageIndex=0&pageSize=50&sortOrders=%5Bobject%20Object%5D&searchTerm=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}