ApiKey

This fetches API keys defined in Harness

Fetches the list of API Keys 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

identifiers
Array of strings

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

Responses
400

Bad Request

500

Internal server error

default

Returns the list of API keys.

get/ng/api/apikey
Request samples
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/apikey?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string&identifiers=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Creates an API key

Request
Security:
ApiKey (readwrite)
Request Body schema:
identifier
string
name
string
description
string [ 0 .. 1024 ] characters
object
apiKeyType
string
Enum: "USER" "SERVICE_ACCOUNT"
parentIdentifier
string
defaultTimeToExpireToken
integer <int64>
accountIdentifier
string
projectIdentifier
string
orgIdentifier
string
Responses
400

Bad Request

500

Internal server error

default

Returns the created API key

post/ng/api/apikey
Request samples
{
  • "identifier": "string",
  • "name": "string",
  • "description": "string",
  • "tags": {
    },
  • "apiKeyType": "USER",
  • "parentIdentifier": "string",
  • "defaultTimeToExpireToken": 0,
  • "accountIdentifier": "string",
  • "projectIdentifier": "string",
  • "orgIdentifier": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Fetches the list of Aggregated API Keys 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

identifiers
Array of strings

This is the list of API Key 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 API keys. Any API key having the specified string in its Name, ID and Tag would be filtered.

Responses
400

Bad Request

500

Internal server error

default

Returns the Paginated list of Aggregated API keys.

get/ng/api/apikey/aggregate
Request samples
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/apikey/aggregate?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=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": [
    ]
}

Fetches the API Keys details corresponding to the provided ID and Scope.

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

This is the API key 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

Responses
400

Bad Request

500

Internal server error

default

Returns the API key

get/ng/api/apikey/aggregate/{identifier}
Request samples
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/apikey/aggregate/:identifier?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Updates API Key for the provided ID

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

This is the API key ID

Request Body schema:
identifier
string
name
string
description
string [ 0 .. 1024 ] characters
object
apiKeyType
string
Enum: "USER" "SERVICE_ACCOUNT"
parentIdentifier
string
defaultTimeToExpireToken
integer <int64>
accountIdentifier
string
projectIdentifier
string
orgIdentifier
string
Responses
400

Bad Request

500

Internal server error

default

Returns the updated API key

put/ng/api/apikey/{identifier}
Request samples
{
  • "identifier": "string",
  • "name": "string",
  • "description": "string",
  • "tags": {
    },
  • "apiKeyType": "USER",
  • "parentIdentifier": "string",
  • "defaultTimeToExpireToken": 0,
  • "accountIdentifier": "string",
  • "projectIdentifier": "string",
  • "orgIdentifier": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Deletes the API Key corresponding to the provided ID.

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

This is the API key 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

Responses
400

Bad Request

500

Internal server error

default

Returns a boolean value. The value is True if the API Key is successfully deleted, else it is False.

delete/ng/api/apikey/{identifier}
Request samples
curl -i -X DELETE \
  'https://app.harness.io/gateway/ng/api/apikey/:identifier?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&apiKeyType=USER&parentIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}