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
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}.
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.
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.
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.
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}.
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}.
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}.
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}.
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}.
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}.
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}.
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}.
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}.
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}.
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}.
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.
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}.
Documentation
📖
Documentation
https://apidocs.harness.io
📖
APIReference
https://apidocs.harness.io
📖
GettingStarted
https://developer.harness.io/docs/platform/automation/api/api-quickstart/
📖
Authentication
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/authentication/harness-authentication.yml
📖
RateLimits
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/rate-limits/harness-rate-limits.yml
Specifications
Other Resources
🔗
OAuthScopes
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/scopes/harness-scopes.yml
🔗
ErrorCatalog
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/errors/harness-error-codes.yml
🔗
Conventions
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/conventions/harness-conventions.yml
🔗
Idempotency
https://raw.githubusercontent.com/api-evangelist/harness/refs/heads/main/conventions/harness-conventions.yml