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

Pull Requests

Access and Modify Pull Requests

get
/api/v2/pull-requests/repositories
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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringRequiredExample: Github
repositoryPathstringRequiredExample: Veritatis et nihil necessitatibus.
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Ut sint.
Responses
200

OK response.

application/json
get/api/v2/pull-requests/repositories
GET /gateway/sto/api/v2/pull-requests/repositories?accountId=abcdef1234567890ghijkl&provider=Github&repositoryPath=Veritatis+et+nihil+necessitatibus. HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "pullRequests": [
    {
      "commentUrl": "https://github.com/owner/repo/pull/1#discussion_r12345",
      "pullRequestNumber": 3295656787848523000,
      "pullRequestUrl": "Perspiciatis debitis aut delectus minima quas ducimus.",
      "sourceBranch": "feat/shiny-object"
    },
    {
      "commentUrl": "https://github.com/owner/repo/pull/1#discussion_r12345",
      "pullRequestNumber": 3295656787848523000,
      "pullRequestUrl": "Perspiciatis debitis aut delectus minima quas ducimus.",
      "sourceBranch": "feat/shiny-object"
    }
  ]
}
get
/api/v2/pull-requests/repositories/pulls
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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringRequiredExample: Github
repositoryPathstringRequiredExample: Itaque voluptatibus.
pullRequestNumberinteger · int64 · min: 1Required

The number of the pullRequest to retrieve

Example: 11
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Excepturi molestias ad dolor error quis.
Responses
200

OK response.

application/json
commentUrlstringOptional

Direct URL to the suggestion comment (returned by UpdatePullRequest)

Example: https://github.com/owner/repo/pull/1#discussion_r12345
pullRequestNumberinteger · int64Required

The number of the Pull Request

Example: 7303291359320333000
pullRequestUrlstringRequired

The URL of the Pull Request

Example: Aut est quia ullam.
sourceBranchstringRequired

The source branch of the Pull Request

Example: feat/shiny-object
get/api/v2/pull-requests/repositories/pulls
GET /gateway/sto/api/v2/pull-requests/repositories/pulls?accountId=abcdef1234567890ghijkl&provider=Github&repositoryPath=Itaque+voluptatibus.&pullRequestNumber=11 HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "commentUrl": "https://github.com/owner/repo/pull/1#discussion_r12345",
  "pullRequestNumber": 3295656787848523000,
  "pullRequestUrl": "Perspiciatis debitis aut delectus minima quas ducimus.",
  "sourceBranch": "feat/shiny-object"
}
post
/api/v2/pull-requests/repositories/pulls

Use AI to augment the remediation steps for this Security Issue

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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringRequiredExample: Github
repositoryPathstringRequiredExample: Voluptatem assumenda.
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Explicabo enim sed ut accusamus.
Body
branchstringRequiredExample: develop
descriptionstringRequiredExample: A description of the Pull Request.
idstringRequired

The ID of the Security Issue to create a Pull Request for

Example: 1234567890abcdefghijklPattern: ^[a-zA-Z0-9_-]{22}$
occurrenceIdinteger · int64 · min: 1RequiredExample: 12345
pipelineUrlstringRequiredExample: https://app.harness.io/path/to/pipeline
remediationCodestringRequiredExample: func example() int { return 0 }
remediationCodeEndinteger · int64RequiredExample: 16
remediationCodePathstringRequiredExample: path/to/code
remediationCodeStartinteger · int64RequiredExample: 14
remediationContextstringRequiredExample: Context to the function.
remediationIndentinteger · int64OptionalExample: 9
scanIdstringRequired

The Security Scan execution that detected this Security Issue

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
vulnerableCodestringRequiredExample: func example() int { return 0 }
Responses
200

OK response.

application/json
commentUrlstringOptional

Direct URL to the suggestion comment (returned by UpdatePullRequest)

Example: https://github.com/owner/repo/pull/1#discussion_r12345
pullRequestNumberinteger · int64Required

The number of the Pull Request

Example: 7303291359320333000
pullRequestUrlstringRequired

The URL of the Pull Request

Example: Aut est quia ullam.
sourceBranchstringRequired

The source branch of the Pull Request

Example: feat/shiny-object
post/api/v2/pull-requests/repositories/pulls
POST /gateway/sto/api/v2/pull-requests/repositories/pulls?accountId=abcdef1234567890ghijkl&provider=Github&repositoryPath=Voluptatem+assumenda. 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: 480

{
  "branch": "develop",
  "description": "A description of the Pull Request.",
  "id": "1234567890abcdefghijkl",
  "occurrenceId": 12345,
  "pipelineUrl": "https://app.harness.io/path/to/pipeline",
  "remediationCode": "func example() int {\n  return 0\n}",
  "remediationCodeEnd": 16,
  "remediationCodePath": "path/to/code",
  "remediationCodeStart": 14,
  "remediationContext": "Context to the function.",
  "remediationIndent": 9,
  "scanId": "abcdef1234567890ghijkl",
  "vulnerableCode": "func example() int {\n  return 0\n}"
}
{
  "commentUrl": "https://github.com/owner/repo/pull/1#discussion_r12345",
  "pullRequestNumber": 3295656787848523000,
  "pullRequestUrl": "Perspiciatis debitis aut delectus minima quas ducimus.",
  "sourceBranch": "feat/shiny-object"
}
put
/api/v2/pull-requests/repositories/pulls

Use AI to augment the remediation steps for this Security Issue

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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringRequiredExample: Github
repositoryPathstringRequiredExample: Consequatur enim harum voluptatem.
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Laboriosam et.
Body
idstringRequired

The ID of the Security Issue to create a Pull Request for

Example: 1234567890abcdefghijklPattern: ^[a-zA-Z0-9_-]{22}$
occurrenceIdinteger · int64 · min: 1RequiredExample: 12345
pipelineUrlstringRequiredExample: https://app.harness.io/path/to/pipeline
pullRequestNumberinteger · int64 · min: 1RequiredExample: 11
remediationCodestringRequiredExample: func example() int { return 0 }
remediationCodeEndinteger · int64RequiredExample: 16
remediationCodePathstringRequiredExample: path/to/code
remediationCodeStartinteger · int64RequiredExample: 14
remediationContextstringRequiredExample: Context to the function.
remediationIndentinteger · int64OptionalExample: 9
scanIdstringRequired

The Security Scan execution that detected this Security Issue

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
vulnerableCodestringRequiredExample: func example() int { return 0 }
Responses
200

OK response.

application/json
commentUrlstringOptional

Direct URL to the suggestion comment (returned by UpdatePullRequest)

Example: https://github.com/owner/repo/pull/1#discussion_r12345
pullRequestNumberinteger · int64Required

The number of the Pull Request

Example: 7303291359320333000
pullRequestUrlstringRequired

The URL of the Pull Request

Example: Aut est quia ullam.
sourceBranchstringRequired

The source branch of the Pull Request

Example: feat/shiny-object
put/api/v2/pull-requests/repositories/pulls
PUT /gateway/sto/api/v2/pull-requests/repositories/pulls?accountId=abcdef1234567890ghijkl&provider=Github&repositoryPath=Consequatur+enim+harum+voluptatem. 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: 433

{
  "id": "1234567890abcdefghijkl",
  "occurrenceId": 12345,
  "pipelineUrl": "https://app.harness.io/path/to/pipeline",
  "pullRequestNumber": 11,
  "remediationCode": "func example() int {\n  return 0\n}",
  "remediationCodeEnd": 16,
  "remediationCodePath": "path/to/code",
  "remediationCodeStart": 14,
  "remediationContext": "Context to the function.",
  "remediationIndent": 9,
  "scanId": "abcdef1234567890ghijkl",
  "vulnerableCode": "func example() int {\n  return 0\n}"
}
{
  "commentUrl": "https://github.com/owner/repo/pull/1#discussion_r12345",
  "pullRequestNumber": 3295656787848523000,
  "pullRequestUrl": "Perspiciatis debitis aut delectus minima quas ducimus.",
  "sourceBranch": "feat/shiny-object"
}
get
/api/v2/pull-requests/repositories/pulls/action

Determine the PR action to display for a specific occurrence (create, suggestFix, display, or none).

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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringOptional

Git provider (optional for action query — returns none with reason if empty)

Example: Github
repositoryPathstringOptional

Repository path (optional for action query — returns none with reason if empty)

Example: Impedit non dolore.
idstringRequired

The ID of the Security Issue

Example: 1234567890abcdefghijklPattern: ^[a-zA-Z0-9_-]{22}$
occurrenceIdinteger · int64 · min: 1Required

The internal ID of the occurrence to evaluate

Example: 12345
scanIdstringRequired

The Security Scan execution that detected this Security Issue

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Qui labore corporis dignissimos.
Responses
200

OK response.

application/json
actionstring · enumRequired

The PR action to display: create, suggestFix, display, or none

Example: createPossible values:
commentUrlstringOptional

Direct URL to the suggestion comment (for display action after suggestFix)

Example: Magnam ut aut velit.
disabledbooleanOptional

If true, the action button should be shown but disabled

Example: false
disabledReasonstringOptional

Reason the action is disabled (e.g., missing targetBranch)

Example: Autem quos temporibus odio sint consequuntur.
pullRequestNumberinteger · int64Optional

The PR number (for display or suggestFix actions)

Example: 6821880896199125000
pullRequestUrlstringOptional

The full URL of the PR (for display action)

Example: Fugiat dolores in ea necessitatibus.
remediationCodeEndinteger · int64Optional

End line of the vulnerable code in the file

Example: 8727523548866207000
remediationCodePathstringOptional

The file path for the remediation code, resolved from the occurrence

Example: Architecto reprehenderit sed.
remediationCodeStartinteger · int64Optional

Start line of the vulnerable code in the file

Example: 9208424656144258000
remediationIndentinteger · int64Optional

Column indentation of the vulnerable code

Example: 781280619095246000
targetBranchstringOptional

The target branch for PR creation

Example: Non at quia fuga temporibus.
get/api/v2/pull-requests/repositories/pulls/action
GET /gateway/sto/api/v2/pull-requests/repositories/pulls/action?accountId=abcdef1234567890ghijkl&id=1234567890abcdefghijkl&occurrenceId=12345&scanId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "action": "create",
  "commentUrl": "Ipsa et voluptate.",
  "disabled": true,
  "disabledReason": "Eaque suscipit.",
  "pullRequestNumber": 2194831345472969000,
  "pullRequestUrl": "Et et voluptatem ipsam accusamus qui quae.",
  "remediationCodeEnd": 2776918043627674600,
  "remediationCodePath": "Quo delectus minima.",
  "remediationCodeStart": 3582417294940462600,
  "remediationIndent": 4519595233528984000,
  "targetBranch": "Reiciendis reiciendis voluptatem hic aut."
}

GetPullRequestCorrelation Pull Requests

get
/api/v2/pull-requests/repositories/pulls/correlation

Determine if a path is correlated to a Pull Request.

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: 128Optional

Harness Organization ID

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

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
providerstringRequiredExample: Github
repositoryPathstringRequiredExample: Illum laboriosam a.
pullRequestNumberinteger · int64 · min: 1RequiredExample: 11
codePathstringRequiredExample: path/to/code
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Vel occaecati quis.
Responses
200

OK response.

application/json
isCorrelatedbooleanRequired

True if the path is correlated to the Pull Request

Example: true
get/api/v2/pull-requests/repositories/pulls/correlation
GET /gateway/sto/api/v2/pull-requests/repositories/pulls/correlation?accountId=abcdef1234567890ghijkl&provider=Github&repositoryPath=Illum+laboriosam+a.&pullRequestNumber=11&codePath=path%2Fto%2Fcode HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "isCorrelated": true
}

Last updated

Was this helpful?