Harness Rules API
The rules API from Harness — 4 operation(s) for rules.
Operations 10
Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay
The rules API from Harness — 4 operation(s) for rules.
Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/harness:harness-rules-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Harness Rules API
version: '1.0'
description: The Harness Software Delivery Platform uses OpenAPI Specification v3.0.
contact:
name: API Support
email: contact@harness.io
url: https://harness.io/
x-logo:
url: https://mma.prnewswire.com/media/779232/Harnes_logo_horizontal.jpg?p=facebook
altText: Harness
termsOfService: https://harness.io/terms-of-use/
servers:
- url: https://app.harness.io
description: Harness host URL
- url: https://{vanity}
description: Vanity URL
variables:
vanity:
default: app.harness.io
security:
- x-api-key: []
tags:
- name: Rules
paths:
/code/api/v1/repos/{repo_identifier}/rules:
get:
operationId: repoRuleList
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- description: The substring by which the repository protection rules are filtered.
in: query
name: query
required: false
schema:
type: string
- description: The order of the output.
in: query
name: order
required: false
schema:
default: asc
enum:
- asc
- desc
type: string
- description: The field by which the protection rules are sorted.
in: query
name: sort
required: false
schema:
default: created_at
enum:
- created_at
- identifier
- uid
- updated_at
type: string
- description: The types of rules to include.
explode: true
in: query
name: type
required: false
schema:
items:
enum:
- branch
- tag
- push
type: string
type: array
style: form
- description: The page to return.
in: query
name: page
required: false
schema:
default: 1
minimum: 1
type: integer
- description: The maximum number of results to return.
in: query
name: limit
required: false
schema:
default: 30
maximum: 100
minimum: 1
type: integer
- description: The result should inherit entities from parent spaces.
in: query
name: inherited
required: false
schema:
default: false
type: boolean
- in: path
name: repo_identifier
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/OpenapiRule'
type: array
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: List repo protection rules
tags:
- Rules
post:
operationId: repoRuleAdd
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: repo_identifier
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
definition:
$ref: '#/components/schemas/OpenapiRuleDefinition'
description:
type: string
identifier:
type: string
pattern:
$ref: '#/components/schemas/ProtectionPattern'
repo_target:
$ref: '#/components/schemas/ProtectionRepoTarget'
state:
$ref: '#/components/schemas/EnumRuleState'
type:
$ref: '#/components/schemas/OpenapiRuleType'
uid:
deprecated: true
type: string
type: object
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: Created
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Add repo protection rule
tags:
- Rules
/code/api/v1/repos/{repo_identifier}/rules/{rule_identifier}:
delete:
operationId: repoRuleDelete
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: repo_identifier
required: true
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
responses:
'204':
description: No Content
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Delete repo protection rule
tags:
- Rules
get:
operationId: repoRuleGet
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: repo_identifier
required: true
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Get repo protection rule
tags:
- Rules
patch:
operationId: repoRuleUpdate
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: repo_identifier
required: true
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
definition:
$ref: '#/components/schemas/OpenapiRuleDefinition'
description:
type:
- string
- 'null'
identifier:
type:
- string
- 'null'
pattern:
$ref: '#/components/schemas/ProtectionPattern'
repo_target:
$ref: '#/components/schemas/ProtectionRepoTarget'
state:
$ref: '#/components/schemas/EnumRuleState'
type:
$ref: '#/components/schemas/OpenapiRuleType'
uid:
deprecated: true
type:
- string
- 'null'
type: object
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Update repo protection rule
tags:
- Rules
/code/api/v1/rules:
get:
operationId: spaceRuleList
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- description: The substring by which the repository protection rules are filtered.
in: query
name: query
required: false
schema:
type: string
- description: The types of rules to include.
explode: true
in: query
name: type
required: false
schema:
items:
enum:
- branch
- tag
- push
type: string
type: array
style: form
- description: The order of the output.
in: query
name: order
required: false
schema:
default: asc
enum:
- asc
- desc
type: string
- description: The field by which the protection rules are sorted.
in: query
name: sort
required: false
schema:
default: created_at
enum:
- created_at
- identifier
- uid
- updated_at
type: string
- description: The page to return.
in: query
name: page
required: false
schema:
default: 1
minimum: 1
type: integer
- description: The maximum number of results to return.
in: query
name: limit
required: false
schema:
default: 30
maximum: 100
minimum: 1
type: integer
- description: The result should inherit entities from parent spaces.
in: query
name: inherited
required: false
schema:
default: false
type: boolean
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/OpenapiRule'
type: array
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: List acc/org/proj protection rules
tags:
- Rules
post:
operationId: spaceRuleAdd
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
definition:
$ref: '#/components/schemas/OpenapiRuleDefinition'
description:
type: string
identifier:
type: string
pattern:
$ref: '#/components/schemas/ProtectionPattern'
repo_target:
$ref: '#/components/schemas/ProtectionRepoTarget'
state:
$ref: '#/components/schemas/EnumRuleState'
type:
$ref: '#/components/schemas/OpenapiRuleType'
uid:
deprecated: true
type: string
type: object
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: Created
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Add acc/org/proj protection rule
tags:
- Rules
/code/api/v1/rules/{rule_identifier}:
delete:
operationId: spaceRuleDelete
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
responses:
'204':
description: No Content
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Delete acc/org/proj protection rule
tags:
- Rules
get:
operationId: spaceRuleGet
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Get acc/org/proj protection rule
tags:
- Rules
patch:
operationId: spaceRuleUpdate
parameters:
- description: Account Identifier for the Entity.
in: query
name: accountIdentifier
required: true
schema:
type: string
- description: Organization Identifier for the Entity.
in: query
name: orgIdentifier
required: false
schema:
type: string
- description: Project Identifier for the Entity.
in: query
name: projectIdentifier
required: false
schema:
type: string
- in: path
name: rule_identifier
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
definition:
$ref: '#/components/schemas/OpenapiRuleDefinition'
description:
type:
- string
- 'null'
identifier:
type:
- string
- 'null'
pattern:
$ref: '#/components/schemas/ProtectionPattern'
repo_target:
$ref: '#/components/schemas/ProtectionRepoTarget'
state:
$ref: '#/components/schemas/EnumRuleState'
type:
$ref: '#/components/schemas/OpenapiRuleType'
uid:
deprecated: true
type:
- string
- 'null'
type: object
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OpenapiRule'
description: OK
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Not Found
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/UsererrorError'
description: Internal Server Error
summary: Update acc/org/proj protection rule
tags:
- Rules
components:
schemas:
EnumMergeMethod:
enum:
- fast-forward
- merge
- rebase
- squash
type: string
ProtectionTag:
properties:
bypass:
$ref: '#/components/schemas/ProtectionDefBypass'
lifecycle:
$ref: '#/components/schemas/ProtectionDefTagLifecycle'
type: object
ProtectionDefComments:
properties:
require_resolve_all:
type: boolean
type: object
EnumPrincipalType:
enum:
- service
- serviceaccount
- user
type: string
ProtectionPush:
properties:
bypass:
$ref: '#/components/schemas/ProtectionDefBypass'
push:
$ref: '#/components/schemas/ProtectionDefPush'
type: object
ProtectionDefMergeQueue:
properties:
checks_concurrency:
type: integer
group_size:
type: integer
max_check_duration_seconds:
type: integer
status_checks:
$ref: '#/components/schemas/ProtectionDefStatusChecks'
type: object
TypesUserGroupInfo:
properties:
description:
type: string
id:
type: integer
identifier:
type: string
name:
type: string
scope:
type: integer
type: object
ProtectionDefApprovals:
properties:
require_code_owners:
type: boolean
require_latest_commit:
type: boolean
require_minimum_count:
type: integer
require_minimum_default_reviewer_count:
type: integer
require_no_change_request:
type: boolean
type: object
ProtectionBranch:
properties:
bypass:
$ref: '#/components/schemas/ProtectionDefBypass'
lifecycle:
$ref: '#/components/schemas/ProtectionDefBranchLifecycle'
pullreq:
$ref: '#/components/schemas/ProtectionDefPullReq'
type: object
OpenapiRule:
properties:
created:
type: integer
created_by:
$ref: '#/components/schemas/TypesPrincipalInfo'
definition:
$ref: '#/components/schemas/OpenapiRuleDefinition'
description:
type: string
identifier:
type: string
pattern:
$ref: '#/components/schemas/ProtectionPattern'
repo_target:
$ref: '#/components/schemas/ProtectionRepoTarget'
repositories:
additionalProperties:
$ref: '#/components/schemas/TypesRepositoryCore'
type:
- object
- 'null'
scope:
type: integer
state:
$ref: '#/components/schemas/EnumRuleState'
type:
$ref: '#/components/schemas/OpenapiRuleType'
updated:
type: integer
user_groups:
additionalProperties:
$ref: '#/components/schemas/TypesUserGroupInfo'
type:
- object
- 'null'
users:
additionalProperties:
$ref: '#/components/schemas/TypesPrincipalInfo'
type:
- object
- 'null'
type: object
EnumRuleState:
enum:
- active
- disabled
- monitor
type:
- string
- 'null'
ProtectionDefPullReq:
properties:
approvals:
$ref: '#/components/schemas/ProtectionDefApprovals'
comments:
$ref: '#/components/schemas/ProtectionDefComments'
commits:
$ref: '#/components/schemas/ProtectionDefCommits'
merge:
$ref: '#/components/schemas/ProtectionDefMerge'
merge_queue:
$ref: '#/components/schemas/ProtectionDefMergeQueue'
reviewers:
$ref: '#/components/schemas/ProtectionDefReviewers'
status_checks:
$ref: '#/components/schemas/ProtectionDefStatusChecks'
type: object
ProtectionPattern:
properties:
default:
type: boolean
exclude:
items:
type: string
type: array
include:
items:
type: string
type: array
type:
- object
- 'null'
ProtectionDefReviewers:
properties:
default_reviewer_ids:
items:
type: integer
type: array
default_user_group_reviewer_ids:
items:
type: integer
type: array
request_code_owners:
type: boolean
type: object
ProtectionDefMerge:
properties:
block:
type: boolean
delete_branch:
type: boolean
require_bypass_message:
type: boolean
strategies_allowed:
items:
$ref: '#/components/schemas/EnumMergeMethod'
type: array
type: object
ProtectionDefBranchLifecycle:
properties:
create_forbidden:
type: boolean
delete_forbidden:
type: boolean
update_forbidden:
type: boolean
update_force_forbidden:
type: boolean
type: object
ProtectionRepoTargetFilter:
properties:
ids:
items:
type: integer
type: array
patterns:
items:
type: string
type: array
type: object
ProtectionDefStatusChecks:
properties:
require_identifiers:
items:
type: string
type: array
type: object
ProtectionDefBypass:
properties:
repo_owners:
type: boolean
user_group_ids:
items:
type: integer
type: array
user_ids:
items:
type: integer
type: array
type: object
ProtectionRepoTarget:
properties:
exclude:
$ref: '#/components/schemas/ProtectionRepoTargetFilter'
include:
$ref: '#/components/schemas/ProtectionRepoTargetFilter'
type:
- object
- 'null'
TypesRepositoryCore:
properties:
default_branch:
type: string
fork_id:
type: integer
id:
type: integer
identifier:
type: string
parent_id:
type: integer
path:
type: string
type:
$ref: '#/components/schemas/EnumRepoType'
type: object
UsererrorError:
properties:
message:
type: string
values:
additionalProperties: {}
type: object
type: object
OpenapiRuleDefinition:
oneOf:
- $ref: '#/components/schemas/ProtectionBranch'
- $ref: '#/components/schemas/ProtectionTag'
- $ref: '#/components/schemas/ProtectionPush'
type: object
ProtectionDefPush:
properties:
file_size_limit:
type: integer
principal_committer_match:
type: boolean
secret_scanning_enabled:
type: boolean
type: object
TypesPrincipalInfo:
properties:
created:
type: integer
display_name:
type: string
email:
type: string
id:
type: integer
type:
$ref: '#/components/schemas/EnumPrincipalType'
uid:
type: string
updated:
type: integer
type:
- object
- 'null'
ProtectionDefCommits:
properties:
require_target_is_ancestor:
type: boolean
type: object
OpenapiRuleType:
enum:
- branch
- tag
- push
type: string
EnumRepoType:
type: string
ProtectionDefTagLifecycle:
properties:
create_forbidden:
type: boolean
delete_forbidden:
type: boolean
update_force_forbidden:
type: boolean
type: object
securitySchemes:
x-api-key:
name: x-api-key
type: apiKey
in: header
description: API key is a token provided while making the API calls. This is used to authenticate the client at the exposed endpoint.
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
x-stoplight:
id: oc91t4vrfnjyi
x-tagGroups:
- name: Organizations
tags:
- Organization
- name: Projects
tags:
- Org Project
- Project
- name: Secrets
tags:
- Account Secret
- Org Secret
- Project Secret
- Secrets
- name: Connectors
tags:
- Account Connector
# --- truncated at 32 KB (38 KB total) ---
# Full source: https://artifacts.apis.io/harness/openapi/harness-rules-api-openapi.yml