Harness Repository API

The repository API from Harness — 38 operation(s) for repository.

Operations 49

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

GET /code/api/v1/repos List code repositories · List repositories #
Ask an LLM
“Which Git repositories exist in my Harness Code project?”
“Can I list only the repositories I've marked as favorites?”
Tell an agent
List the repositories in project {project}.
Find repositories whose path contains {text}.
POST /code/api/v1/repos Create a new code repository · Create repository #
Ask an LLM
“How do I create a new Git repository in Harness Code?”
“Can I initialize a new repo with a README, license and .gitignore?”
Tell an agent
Create a repository named {identifier} with default branch {branch}.
Create a new public repo {identifier} with a README and a {license} license.
DELETE /code/api/v1/repos/{repo_identifier} Soft delete a repository · Soft delete repository #
Ask an LLM
“How do I delete a repository in Harness Code?”
“Does deleting a repo remove it permanently or can it be recovered later?”
Tell an agent destructive · confirm first
Soft delete repository {repo}.
Move repo {repo} to the deleted state so it can still be restored.
GET /code/api/v1/repos/{repo_identifier} Get a repository's details · Get repository #
Ask an LLM
“Where can I see the details of a single code repository?”
“What default branch and visibility does a given repo have?”
Tell an agent
Get the details of repository {repo}.
Show me the metadata for repo {repo}.
PATCH /code/api/v1/repos/{repo_identifier} Update a repository's description or tags · Update repository #
Ask an LLM
“Can I change a repository's description after it's created?”
“How do I update the tags or state on an existing repository?”
Tell an agent
Change the description of repository {repo} to {description}.
Set the state of repo {repo} to {state}.
GET /code/api/v1/repos/{repo_identifier}/activities List activity on a repository · List repository activities #
Ask an LLM
“What recent activity has happened in a repository?”
“Can I see a repository's activity feed within a time window?”
Tell an agent
Show the activity log for repository {repo}.
List activity on repo {repo} after {after}.
GET /code/api/v1/repos/{repo_identifier}/archive/{git_ref}.{format} Download a repository as an archive · Download repo in archived format #
Ask an LLM
“Can I download a snapshot of a repo at a specific branch or tag as a zip or tarball?”
“Is it possible to archive only one subdirectory of a repository?”
Tell an agent
Download repo {repo} at {ref} as a {format} archive.
Export only the {path} folder of repository {repo} at {ref} in {format} format.
GET /code/api/v1/repos/{repo_identifier}/blame/{path} Show git blame for a file · Get git blame #
Ask an LLM
“Who last changed each line of a file in my repo?”
“Can I run blame for just a range of lines in a file?”
Tell an agent
Show git blame for {path} in repository {repo}.
Blame lines {from} to {to} of {path} in repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/branches List branches in a repository · List branches #
Ask an LLM
“Which branches exist in a repository?”
“Can I see pull request and check status alongside each branch?”
Tell an agent
List all branches in repository {repo}.
Find branches in repo {repo} matching {text}.
POST /code/api/v1/repos/{repo_identifier}/branches Create a branch · Create branch #
Ask an LLM
“How do I create a new branch from an existing commit or branch?”
“Can I dry-run branch protection rules before creating a branch?”
Tell an agent
Create branch {name} in repository {repo} from {target}.
Cut a new branch {name} in repo {repo}.
DELETE /code/api/v1/repos/{repo_identifier}/branches/{branch_name} Delete a branch · Delete branch #
Ask an LLM
“How do I delete a branch that's already been merged?”
“Can I bypass branch rules when deleting a protected branch?”
Tell an agent destructive · confirm first
Delete branch {branch} from repository {repo}.
Remove the {branch} branch in repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/branches/{branch_name} Get a single branch · Get branch #
Ask an LLM
“What's the latest commit on a particular branch?”
“How far has a specific branch diverged from the default branch?”
Tell an agent
Get branch {branch} in repository {repo}.
Show the details and checks for branch {branch} of repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/codeowners/validate Validate a CODEOWNERS file · Validate code owners file #
Ask an LLM
“Is my CODEOWNERS file valid?”
“Can I check the code owners file on a specific branch for errors?”
Tell an agent
Validate the CODEOWNERS file in repository {repo}.
Check the code owners file of repo {repo} on {ref}.
GET /code/api/v1/repos/{repo_identifier}/commits List commits in a repository · List commits #
Ask an LLM
“What commits were made to a branch recently?”
“Can I filter a repo's commit history by author or date range?”
Tell an agent
List commits in repository {repo} on {ref}.
Show commits by {author} in repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/commits Commit file changes to a branch · Commit files #
Ask an LLM
“Can I create, update or delete files in a repo through the API without cloning it?”
“How do I commit file changes onto a new branch?”
Tell an agent
Commit these file changes to branch {branch} of repository {repo} with message {message}.
Push a commit to repo {repo} on a new branch {new_branch}.
GET /code/api/v1/repos/{repo_identifier}/commits/{commit_sha} Get a commit · Get commit #
Ask an LLM
“Who authored a given commit and what was its message?”
“Where can I look up a single commit by its SHA?”
Tell an agent
Get commit {sha} in repository {repo}.
Show the author and message of commit {sha} in repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/commits/{commit_sha}/diff Get the raw diff of a commit · Get raw git diff of a commit #
Ask an LLM
“Can I see exactly what changed in one commit as a raw patch?”
“What lines did a specific commit add and remove?”
Tell an agent
Get the raw diff for commit {sha} in repository {repo}.
Show the patch introduced by commit {sha} in repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/commits/calculate-divergence Calculate how far branches have diverged · Get commit divergence #
Ask an LLM
“How many commits ahead or behind is my branch compared to another?”
“Can I compute divergence for several branch pairs in one request?”
Tell an agent
Calculate commit divergence for these branch pairs in repository {repo}.
Count ahead and behind commits in repo {repo}, capped at {max}.
GET /code/api/v1/repos/{repo_identifier}/content/{path} Get the contents of a file or directory · Get content of a file #
Ask an LLM
“How do I read a file's contents from a repository?”
“Can I list what's inside a directory at a particular branch or commit?”
Tell an agent
Get the content of {path} in repository {repo}.
Show what's in {path} of repo {repo} at {ref}, including the latest commit.
POST /code/api/v1/repos/{repo_identifier}/default-branch Change a repository's default branch · Update default branch #
Ask an LLM
“How do I change the default branch of a repo from master to main?”
“Can I point a repository's default branch at a different existing branch?”
Tell an agent
Set the default branch of repository {repo} to {name}.
Make {name} the default branch for repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/diff-stats/{range} Get diff statistics between two refs · Get diff stats #
Ask an LLM
“How many files and lines changed between two branches?”
“Can I get just a summary of changes between commits without the full diff?”
Tell an agent
Get the diff stats for range {range} in repository {repo}.
Summarize files and lines changed in {range} of repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/diff/{range} Get the raw diff between two refs · Get raw diff #
Ask an LLM
“What's the full raw diff between two branches in a repo?”
“Can I limit a branch comparison diff to one file path?”
Tell an agent
Compare {range} in repository {repo} and return the raw diff.
Show the unified diff of {range} in repo {repo} for {path} only.
POST /code/api/v1/repos/{repo_identifier}/diff/{range} Get a raw diff for selected paths via POST · Get raw diff #
Ask an LLM
“Is there a POST variant of the raw diff that takes the file list in the body?”
“Can I request a raw diff for a long list of files that won't fit in a query string?”
Tell an agent
Fetch the raw diff for {range} in repository {repo} using the POST endpoint with a list of paths.
Post a path list and return the raw diff of {range} in repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/fork Fork a repository · Fork create #
Ask an LLM
“How do I fork a repository in Harness Code?”
“Can I fork only a single branch of a repo?”
Tell an agent
Fork repository {repo} as {identifier}.
Create a fork of repo {repo} containing only branch {branch}.
POST /code/api/v1/repos/{repo_identifier}/fork-sync Sync a fork branch with its upstream · Fork sync branch #
Ask an LLM
“How do I pull upstream changes into my forked repository?”
“Can I bring a fork's branch up to date with the parent repo's branch?”
Tell an agent
Sync branch {branch} of fork {repo} with upstream {upstream}.
Update my fork {repo} branch {branch} from its upstream.
GET /code/api/v1/repos/{repo_identifier}/languages Get a repository's language breakdown · Get repository language statistics #
Ask an LLM
“What programming languages is a repository written in?”
“What percentage of a repo's code is in each language?”
Tell an agent
Show the language statistics for repository {repo}.
Break down repo {repo} by programming language.
GET /code/api/v1/repos/{repo_identifier}/linked/source Get the external source of a linked repo · Get linked source #
Ask an LLM
“Where does a linked repository mirror its code from?”
“Which connector and upstream repo is a linked repository tied to?”
Tell an agent
Get the linked source for repository {repo}.
Show which external repo {repo} is linked to.
POST /code/api/v1/repos/{repo_identifier}/linked/sync Sync branches of a linked repository · Linked sync #
Ask an LLM
“Can I pull the latest branches into a linked repository from its external source?”
“How do I refresh a linked repo that's out of date with its upstream?”
Tell an agent
Sync linked repository {repo} from its source.
Refresh branches {branches} on linked repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/merge-check/{range} Check whether two refs can merge cleanly · Check mergeability #
Ask an LLM
“Will my branch merge without conflicts?”
“Can I see which files would conflict before merging two branches?”
Tell an agent
Check mergeability of {range} in repository {repo}.
Tell me if {range} in repo {repo} has merge conflicts.
POST /code/api/v1/repos/{repo_identifier}/merge-commit Merge a base branch into a head branch · Creates a merge commit on the head branch with changes from the base #
Ask an LLM
“How do I bring the latest changes from main into my feature branch with a merge commit?”
“Can I dry-run a merge commit before actually creating it?”
Tell an agent
Merge {base} into {head} in repository {repo}.
Create a merge commit on {head} from {base} in repo {repo} with message {message}.
DELETE /code/api/v1/repos/{repo_identifier}/mergequeue/{branch_name} Clear a branch's merge queue · Merge queue clear #
Ask an LLM
“How do I empty a stuck merge queue?”
“Can I remove everything waiting in a branch's merge queue at once?”
Tell an agent destructive · confirm first
Clear the merge queue for branch {branch} in repository {repo}.
Empty the {branch} merge queue on repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/mergequeue/{branch_name} List entries in a branch's merge queue · Merge queue list entries #
Ask an LLM
“What pull requests are waiting in the merge queue for a branch?”
“Can I see the current merge queue for main?”
Tell an agent
List the merge queue for branch {branch} in repository {repo}.
Show what's queued to merge into {branch} of repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/path-details Get last-commit details for file paths · Get commit details #
Ask an LLM
“Which commit last touched each of these files?”
“Can I get the latest commit info for several paths in one call?”
Tell an agent
Get the last commit for paths {paths} in repository {repo}.
Show last-change details for these files in repo {repo} at {ref}.
GET /code/api/v1/repos/{repo_identifier}/paths List all file paths in a repository · List all paths #
Ask an LLM
“Can I get a flat list of every file in a repository?”
“Is there a way to include directories when listing all paths in a repo?”
Tell an agent
List every file path in repository {repo}.
List all paths in repo {repo} at {ref} including directories.
POST /code/api/v1/repos/{repo_identifier}/purge Permanently purge a deleted repository · Purge repository #
Ask an LLM
“How do I permanently remove a repository that was soft deleted?”
“Once a repo is purged, can it ever be restored?”
Tell an agent destructive · confirm first
Purge repository {repo} deleted at {deleted_at}.
Permanently erase soft-deleted repo {repo} from {deleted_at}.
GET /code/api/v1/repos/{repo_identifier}/raw/{path} Download a file's raw content · Get raw file content #
Ask an LLM
“Can I download the raw bytes of a file from a repo?”
“What's the endpoint for getting a file's plain raw content at a given branch?”
Tell an agent
Download the raw file {path} from repository {repo}.
Get raw bytes of {path} in repo {repo} at {ref}.
POST /code/api/v1/repos/{repo_identifier}/rebase Rebase a branch onto another branch · Rebase a branch relative to another branch or a commit #
Ask an LLM
“How do I rebase my feature branch onto the latest main?”
“Can I rebase a branch onto a specific commit instead of a branch?”
Tell an agent
Rebase {head} onto {base} in repository {repo}.
Rebase branch {head} of repo {repo} onto commit {sha}.
POST /code/api/v1/repos/{repo_identifier}/restore Restore a soft-deleted repository · Restore repository #
Ask an LLM
“Can I recover a repository I deleted by mistake?”
“Is it possible to restore a deleted repo under a new name?”
Tell an agent
Restore repository {repo} deleted at {deleted_at}.
Bring back deleted repo {repo} from {deleted_at} as {new_identifier}.
GET /code/api/v1/repos/{repo_identifier}/settings/general Get a repository's general settings · Get general settings #
Ask an LLM
“Is Git LFS or auto-merge turned on for a repository?”
“What file size limit is set on a repo?”
Tell an agent
Show the general settings of repository {repo}.
Get LFS, auto-merge and file size settings for repo {repo}.
PATCH /code/api/v1/repos/{repo_identifier}/settings/general Update a repository's general settings · Update general settings #
Ask an LLM
“How do I enable Git LFS on a repository?”
“Can I change the maximum file size allowed in a repo?”
Tell an agent
Enable Git LFS on repository {repo}.
Set the file size limit on repo {repo} to {limit}.
GET /code/api/v1/repos/{repo_identifier}/settings/security Get a repository's security settings · Get security settings #
Ask an LLM
“Is secret scanning enabled on a repository?”
“What vulnerability scanning mode does a repo use?”
Tell an agent
Show the security settings of repository {repo}.
Check whether secret scanning is on for repo {repo}.
PATCH /code/api/v1/repos/{repo_identifier}/settings/security Update a repository's security settings · Update security settings #
Ask an LLM
“How do I turn on secret scanning for a repository?”
“Can I require committers to match the authenticated principal on a repo?”
Tell an agent
Enable secret scanning on repository {repo}.
Set vulnerability scanning mode on repo {repo} to {mode}.
POST /code/api/v1/repos/{repo_identifier}/squash Squash a branch's commits into one · Squashes commits in a branch relative to another branch or a commit #
Ask an LLM
“How do I squash all the commits on my branch into a single commit?”
“Can I preview a squash with a dry run before rewriting the branch?”
Tell an agent
Squash the commits on {head} relative to {base} in repository {repo}.
Squash branch {head} of repo {repo} into one commit titled {title}.
GET /code/api/v1/repos/{repo_identifier}/summary Get a repository summary · Get repository summary #
Ask an LLM
“How many branches, tags, commits and pull requests does a repo have?”
“Where do I get quick counts for a repository's overview page?”
Tell an agent
Get the summary counts for repository {repo}.
Give me an at-a-glance summary of repo {repo}.
GET /code/api/v1/repos/{repo_identifier}/tags List tags in a repository · List tags #
Ask an LLM
“Which release tags exist in a repository?”
“Can I search a repo's tags by name?”
Tell an agent
List the tags in repository {repo}.
Find tags matching {text} in repo {repo}.
POST /code/api/v1/repos/{repo_identifier}/tags Create a tag · Create tag #
Ask an LLM
“How do I tag a commit as a release?”
“Can I create an annotated tag with a message?”
Tell an agent
Create tag {name} on {target} in repository {repo}.
Tag repo {repo} at {target} as {name} with message {message}.
DELETE /code/api/v1/repos/{repo_identifier}/tags/{tag_name} Delete a tag · Delete tag #
Ask an LLM
“How do I remove a tag I created by mistake?”
“Can tag protection rules be bypassed when deleting a tag?”
Tell an agent destructive · confirm first
Delete tag {tag} from repository {repo}.
Remove the {tag} tag in repo {repo}.
POST /code/api/v1/repos/import Import a repository from another Git host · Import repository #
Ask an LLM
“How do I migrate an existing Git repository into Harness Code?”
“Can I import a repo's pipelines along with its code?”
Tell an agent
Import {provider_repo} from {provider} as repository {identifier}.
Bring external repo {provider_repo} into Harness Code.
POST /code/api/v1/repos/link Create a repository linked to an external repo · Linked create #
Ask an LLM
“Can I link an external repository through a connector instead of importing it?”
“Is it possible to create a Harness repo that mirrors a remote repo via a connector?”
Tell an agent
Create linked repository {identifier} using connector {connector}.
Link external repo {external} as {identifier} via connector {connector}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/harness:harness-repository-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API 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 Specification

harness-repository-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Harness Repository 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:


# --- truncated at 32 KB (149 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/openapi/harness-repository-api-openapi.yml