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

Exemption Rules

Manage admin-defined rules that gate Exemption creation

get
/api/v2/exemption-rules

List a collection of Exemption Rules

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
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Aliquam quae illum ullam nisi.
Responses
200

OK response.

application/json
get/api/v2/exemption-rules
GET /gateway/sto/api/v2/exemption-rules?accountId=abcdef1234567890ghijkl 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": [
    {
      "actions": {
        "duration": {
          "maxDurationDays": 3
        }
      },
      "conditions": {
        "epss_score": {
          "gte": 90
        },
        "reachable": true,
        "severity_code": [
          "Critical"
        ]
      },
      "created": 1651578240,
      "createdBy": "user111111111111111111",
      "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
      "enabled": true,
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "lastModifiedBy": "user111111111111111111",
      "name": "Critical reachable issues: 3 days max",
      "priority": 0
    },
    {
      "actions": {
        "duration": {
          "maxDurationDays": 3
        }
      },
      "conditions": {
        "epss_score": {
          "gte": 90
        },
        "reachable": true,
        "severity_code": [
          "Critical"
        ]
      },
      "created": 1651578240,
      "createdBy": "user111111111111111111",
      "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
      "enabled": true,
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "lastModifiedBy": "user111111111111111111",
      "name": "Critical reachable issues: 3 days max",
      "priority": 0
    }
  ]
}
post
/api/v2/exemption-rules

Create a new Exemption Rule

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}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Voluptas maiores quos quia omnis aut mollitia.
Body
descriptionstring · max: 1024Optional

Free-form rule description.

Example: Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.
enabledbooleanOptional

Whether the rule is active. Disabled rules are retained and still listed, but are skipped during evaluation. OPTIONAL: defaults to true on create; on update, omit to keep the current state or send false/true to toggle.

Example: true
namestring · min: 1 · max: 256Required

Human-readable rule name. Must be unique within an account.

Example: Critical reachable issues: 3 days max
priorityinteger · int64Optional

0-based rank within an account. Lower fires first (first-match-wins). OPTIONAL on both create and update: if omitted on CREATE the new rule is appended at the bottom (rank = current rule count); if omitted on UPDATE the rule keeps its current rank. When supplied, send 0 to insert at the top, 1..n to insert at that rank, or any value >= rule count to land at the tail.

Example: 0
userIdstringRequired

Harness User ID

Example: abcdef1234567890ghijkl
Responses
200

OK response.

application/json
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
post/api/v2/exemption-rules
POST /gateway/sto/api/v2/exemption-rules?accountId=abcdef1234567890ghijkl 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: 361

{
  "actions": {
    "duration": {
      "maxDurationDays": 3
    }
  },
  "conditions": {
    "epss_score": {
      "gte": 90
    },
    "reachable": true,
    "severity_code": [
      "Critical"
    ]
  },
  "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
  "enabled": true,
  "name": "Critical reachable issues: 3 days max",
  "priority": 0,
  "userId": "abcdef1234567890ghijkl"
}
{
  "id": "abcdef1234567890ghijkl"
}
get
/api/v2/exemption-rules/{id}

Find Exemption Rule 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 Exemption Rule to retrieve

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

Harness Account ID

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

Harness personal or service access token

Example: Dolores sapiente enim omnis rerum qui.
Responses
200

OK response.

application/json

An admin-defined rule that gates Exemption creation and approval. Rules are evaluated against an exemption request; if a rule matches, its actions fire — typically capping the requested duration.

createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
createdBystringRequired

ID of the user who created the rule.

Example: user111111111111111111Pattern: ^[a-zA-Z0-9_-]{22}$
descriptionstring · max: 1024Optional

Free-form rule description.

Example: Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.
enabledbooleanRequired

Whether the rule is active. Disabled rules are retained and still listed, but are skipped during evaluation. OPTIONAL: defaults to true on create; on update, omit to keep the current state or send false/true to toggle.

Example: true
idstringRequired

Resource identifier

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

Unix timestamp at which the resource was most recently modified

Example: 1651578240
lastModifiedBystringRequired

ID of the user who last modified the rule.

Example: user111111111111111111Pattern: ^[a-zA-Z0-9_-]{22}$
namestring · min: 1 · max: 256Required

Human-readable rule name. Must be unique within an account.

Example: Critical reachable issues: 3 days max
priorityinteger · int64Required

0-based rank within an account. Lower fires first (first-match-wins). OPTIONAL on both create and update: if omitted on CREATE the new rule is appended at the bottom (rank = current rule count); if omitted on UPDATE the rule keeps its current rank. When supplied, send 0 to insert at the top, 1..n to insert at that rank, or any value >= rule count to land at the tail.

Example: 0
get/api/v2/exemption-rules/{id}
GET /gateway/sto/api/v2/exemption-rules/{id}?accountId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "actions": {
    "duration": {
      "maxDurationDays": 3
    }
  },
  "conditions": {
    "epss_score": {
      "gte": 90
    },
    "reachable": true,
    "severity_code": [
      "Critical"
    ]
  },
  "created": 1651578240,
  "createdBy": "user111111111111111111",
  "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
  "enabled": true,
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "lastModifiedBy": "user111111111111111111",
  "name": "Critical reachable issues: 3 days max",
  "priority": 0
}
put
/api/v2/exemption-rules/{id}

Update an existing Exemption Rule

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 Exemption Rule to update

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

Harness Account ID

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

Harness personal or service access token

Example: Qui et.
Body
descriptionstring · max: 1024Optional

Free-form rule description.

Example: Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.
enabledbooleanOptional

Whether the rule is active. Disabled rules are retained and still listed, but are skipped during evaluation. OPTIONAL: defaults to true on create; on update, omit to keep the current state or send false/true to toggle.

Example: true
namestring · min: 1 · max: 256Optional

Human-readable rule name. Must be unique within an account.

Example: Critical reachable issues: 3 days max
priorityinteger · int64Optional

0-based rank within an account. Lower fires first (first-match-wins). OPTIONAL on both create and update: if omitted on CREATE the new rule is appended at the bottom (rank = current rule count); if omitted on UPDATE the rule keeps its current rank. When supplied, send 0 to insert at the top, 1..n to insert at that rank, or any value >= rule count to land at the tail.

Example: 0
userIdstringRequired

Harness User ID

Example: abcdef1234567890ghijkl
Responses
200

OK response.

application/json

An admin-defined rule that gates Exemption creation and approval. Rules are evaluated against an exemption request; if a rule matches, its actions fire — typically capping the requested duration.

createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
createdBystringRequired

ID of the user who created the rule.

Example: user111111111111111111Pattern: ^[a-zA-Z0-9_-]{22}$
descriptionstring · max: 1024Optional

Free-form rule description.

Example: Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.
enabledbooleanRequired

Whether the rule is active. Disabled rules are retained and still listed, but are skipped during evaluation. OPTIONAL: defaults to true on create; on update, omit to keep the current state or send false/true to toggle.

Example: true
idstringRequired

Resource identifier

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

Unix timestamp at which the resource was most recently modified

Example: 1651578240
lastModifiedBystringRequired

ID of the user who last modified the rule.

Example: user111111111111111111Pattern: ^[a-zA-Z0-9_-]{22}$
namestring · min: 1 · max: 256Required

Human-readable rule name. Must be unique within an account.

Example: Critical reachable issues: 3 days max
priorityinteger · int64Required

0-based rank within an account. Lower fires first (first-match-wins). OPTIONAL on both create and update: if omitted on CREATE the new rule is appended at the bottom (rank = current rule count); if omitted on UPDATE the rule keeps its current rank. When supplied, send 0 to insert at the top, 1..n to insert at that rank, or any value >= rule count to land at the tail.

Example: 0
put/api/v2/exemption-rules/{id}
PUT /gateway/sto/api/v2/exemption-rules/{id}?accountId=abcdef1234567890ghijkl 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: 361

{
  "actions": {
    "duration": {
      "maxDurationDays": 3
    }
  },
  "conditions": {
    "epss_score": {
      "gte": 90
    },
    "reachable": true,
    "severity_code": [
      "Critical"
    ]
  },
  "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
  "enabled": true,
  "name": "Critical reachable issues: 3 days max",
  "priority": 0,
  "userId": "abcdef1234567890ghijkl"
}
{
  "actions": {
    "duration": {
      "maxDurationDays": 3
    }
  },
  "conditions": {
    "epss_score": {
      "gte": 90
    },
    "reachable": true,
    "severity_code": [
      "Critical"
    ]
  },
  "created": 1651578240,
  "createdBy": "user111111111111111111",
  "description": "Critical findings that are reachable in production must be remediated quickly; cap exemptions at 3 days.",
  "enabled": true,
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "lastModifiedBy": "user111111111111111111",
  "name": "Critical reachable issues: 3 days max",
  "priority": 0
}

Get exemption constraints for issues or occurrences

post
/api/v2/exemption-rules/constraints

Evaluate the exemption rule engine and return the strictest constraint that applies to an exemption request. Pass items[] (max 100); a single exemption is just a one-element list. Each item self-describes its own scope and kind:

• target-scoped issue: set targetId. • pipeline-scoped issue: set pipelineId (mutually exclusive with targetId). • project-scoped issue: set neither (scope comes from the request-level orgId/projectId). • occurrence-level: set occurrences[], or set scanId (with targetId) to evaluate all non-exempted occurrences from that scan — used when "Exempt all future occurrences" is unchecked.

Items in a single batch may mix scopes and kinds freely. The response carries the strictest matched constraint across everything evaluated: maxDurationDays is the minimum of every non-null per-item cap (or null if all are unconstrained), and matchedRuleId names the rule contributing that minimum. Optional type carries the FE "Reason" dropdown value (same enum as POST /exemptions.type) so rules with reason conditions evaluate correctly.

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}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Perferendis earum incidunt laborum libero dignissimos.
Body
orgIdstring · max: 128Required

Harness Organization id this exemption request is scoped to. Required: the backend resolves the project hierarchy (parent_unique_id) from orgId/projectId to scope attribute resolution for project- and pipeline-level evaluation, and rules conditioned on org_id evaluate correctly.

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

Harness Project id this exemption request is scoped to. Required: the backend resolves the project hierarchy (parent_unique_id) from orgId/projectId to scope attribute resolution for project- and pipeline-level evaluation, and rules conditioned on project_id evaluate correctly.

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

Value of the FE's "Reason" dropdown — i.e. the same enum sent as type on POST /exemptions ("False Positive", "Acceptable Risk", "Compensating Controls", "Acceptable Use", "Fix Unavailable", "Other"). When set, it is merged into every issue's context so rules with reason conditions evaluate correctly. Omit if the user has not picked from the dropdown yet — rules with reason conditions will be skipped in that case. Named type here for parity with POST /exemptions.type; internally the rule engine surfaces it as the reason axis (which matches the FE dropdown label customers see).

Example: False PositivePossible values:
Responses
200

OK response.

application/json

Constraints that apply to an exemption request for a specific issue, computed by evaluating account-level exemption rules against the issue's attributes.

matchedRuleIdstringRequired

ID of the rule that fired. Empty string if no rule matched (request is unconstrained by policy).

Example: rule11111111111111111a
maxDurationDaysinteger · int64 · min: 1Optional

Maximum duration in days that this exemption may run. Null means no cap and indefinite ("All Time") is allowed; a non-null value forbids "All Time".

Example: 7
post/api/v2/exemption-rules/constraints
POST /gateway/sto/api/v2/exemption-rules/constraints?accountId=abcdef1234567890ghijkl 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: 552

{
  "items": [
    {
      "issueId": "abcdef1234567890ghijkl",
      "occurrences": [
        101,
        102
      ],
      "pipelineId": "my_pipeline",
      "scanId": "abcdef1234567890ghijkl",
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "issueId": "abcdef1234567890ghijkl",
      "occurrences": [
        101,
        102
      ],
      "pipelineId": "my_pipeline",
      "scanId": "abcdef1234567890ghijkl",
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "issueId": "abcdef1234567890ghijkl",
      "occurrences": [
        101,
        102
      ],
      "pipelineId": "my_pipeline",
      "scanId": "abcdef1234567890ghijkl",
      "targetId": "abcdef1234567890ghijkl"
    }
  ],
  "orgId": "default",
  "projectId": "my_project",
  "type": "False Positive"
}
{
  "matchedRuleId": "rule11111111111111111a",
  "maxDurationDays": 7
}

Last updated

Was this helpful?