Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Test Targets

Access and modify Scan Targets

get
/api/v2/targets

List a collection of Test Targets

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
pageinteger · int64Optional

Page number to fetch (starting from 0)

Default: 0Example: 4
pageSizeinteger · int64 · min: 1 · max: 100Optional

Number of results per page

Default: 30Example: 50
namestringOptional

Resource name

Example: NodeGoat
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Explicabo tenetur libero.
Responses
200

OK response.

application/json
get/api/v2/targets
GET /gateway/sto/api/v2/targets?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "pagination": {
    "link": "",
    "page": 4,
    "pageSize": 20,
    "totalItems": 230,
    "totalPages": 12
  },
  "results": [
    {
      "baselineRegEx": "release_.*",
      "baselineVariantId": "abcdef1234567890ghijkl",
      "created": 1651578240,
      "directory": "app/src",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "name": "NodeGoat",
      "orgId": "example_org",
      "projectId": "example_project",
      "type": "repository",
      "url": "https://github.com/example/repo"
    },
    {
      "baselineRegEx": "release_.*",
      "baselineVariantId": "abcdef1234567890ghijkl",
      "created": 1651578240,
      "directory": "app/src",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "name": "NodeGoat",
      "orgId": "example_org",
      "projectId": "example_project",
      "type": "repository",
      "url": "https://github.com/example/repo"
    },
    {
      "baselineRegEx": "release_.*",
      "baselineVariantId": "abcdef1234567890ghijkl",
      "created": 1651578240,
      "directory": "app/src",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "name": "NodeGoat",
      "orgId": "example_org",
      "projectId": "example_project",
      "type": "repository",
      "url": "https://github.com/example/repo"
    }
  ]
}
post
/api/v2/targets

Create a new Test Target

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Nostrum cupiditate dolorem quod sit molestiae.
Body
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
namestring · max: 128Required

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
typestring · enumRequired

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
Responses
200

OK response.

application/json
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
post/api/v2/targets
POST /gateway/sto/api/v2/targets?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 175

{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "directory": "app/src",
  "name": "NodeGoat",
  "type": "repository",
  "url": "https://github.com/example/repo"
}
{
  "id": "abcdef1234567890ghijkl"
}
get
/api/v2/targets/{id}

Find Test Target by ID

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
idstringRequired

The ID of the Test Target to retrieve

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Optio deleniti sed est eos.
Responses
200

OK response.

application/json
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
lastModifiedinteger · int64Required

Unix timestamp at which the resource was most recently modified

Example: 1651578240
namestring · max: 128Required

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
typestring · enumRequired

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
get/api/v2/targets/{id}
GET /gateway/sto/api/v2/targets/{id}?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "created": 1651578240,
  "directory": "app/src",
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "name": "NodeGoat",
  "orgId": "example_org",
  "projectId": "example_project",
  "type": "repository",
  "url": "https://github.com/example/repo"
}
put
/api/v2/targets/{id}

Update an existing Test Target

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
idstringRequired

The ID of the Test Target to update

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Sint sed voluptas aliquam saepe possimus.
Body
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
namestring · max: 128Required

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
typestring · enumRequired

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
Responses
200

OK response.

application/json
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
lastModifiedinteger · int64Required

Unix timestamp at which the resource was most recently modified

Example: 1651578240
namestring · max: 128Required

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
typestring · enumRequired

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
put/api/v2/targets/{id}
PUT /gateway/sto/api/v2/targets/{id}?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 175

{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "directory": "app/src",
  "name": "NodeGoat",
  "type": "repository",
  "url": "https://github.com/example/repo"
}
{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "created": 1651578240,
  "directory": "app/src",
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "name": "NodeGoat",
  "orgId": "example_org",
  "projectId": "example_project",
  "type": "repository",
  "url": "https://github.com/example/repo"
}
patch
/api/v2/targets/{id}

Update only certain fields on an existing Test Target

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
idstringRequired

The ID of the Test Target to update

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Rerum iusto accusantium id minima mollitia quibusdam.
Body
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
namestring · max: 128Optional

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
typestring · enumOptional

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
Responses
200

OK response.

application/json
baselineRegExstring · max: 128Optional

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

Example: release_.*
baselineVariantIdstringOptional

ID of baseline Target Variant for Issue comparison

Example: abcdef1234567890ghijklPattern: ^([a-zA-Z0-9_-]{22}|)$
createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
directorystring · max: 1024Optional

Directory within the Test Target to be scanned

Example: app/src
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
lastModifiedinteger · int64Required

Unix timestamp at which the resource was most recently modified

Example: 1651578240
namestring · max: 128Required

Name of the Test Target

Example: NodeGoatPattern: ^[a-zA-Z0-9_.:/|()-]+$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
typestring · enumRequired

Test Target's type

Example: repositoryPossible values:
urlstring · max: 1024Optional

URL used to access the Test Target

Example: https://github.com/example/repo
patch/api/v2/targets/{id}
PATCH /gateway/sto/api/v2/targets/{id}?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 175

{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "directory": "app/src",
  "name": "NodeGoat",
  "type": "repository",
  "url": "https://github.com/example/repo"
}
{
  "baselineRegEx": "release_.*",
  "baselineVariantId": "abcdef1234567890ghijkl",
  "created": 1651578240,
  "directory": "app/src",
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "name": "NodeGoat",
  "orgId": "example_org",
  "projectId": "example_project",
  "type": "repository",
  "url": "https://github.com/example/repo"
}

Last updated

Was this helpful?