> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/argoproj/argo-cd/llms.txt
> Use this file to discover all available pages before exploring further.

# Repository Service

> gRPC API reference for RepositoryService - CRUD operations for Argo CD repository configurations

# Repository Service

Repository Service API performs CRUD actions against repository resources.

## Service Definition

**Package:** `repository`

**Service:** `RepositoryService`

The RepositoryService manages Git, Helm, and OCI repository configurations that Argo CD uses to fetch application manifests.

## RPC Methods

### ListRepositories

Gets a list of all configured repositories.

**Request:** `RepoQuery`

<ParamField path="repo" type="string">
  Repo URL for query
</ParamField>

<ParamField path="forceRefresh" type="bool">
  Whether to force a cache refresh on repo's connection state
</ParamField>

<ParamField path="appProject" type="string">
  App project for query
</ParamField>

**Response:** `RepositoryList`

**REST Endpoint:** `GET /api/v1/repositories`

***

### ListWriteRepositories

Gets a list of all configured write repositories.

**Request:** `RepoQuery`

**Response:** `RepositoryList`

**REST Endpoint:** `GET /api/v1/write-repositories`

***

### Get

Returns a repository or its credentials.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

<ParamField path="forceRefresh" type="bool">
  Whether to force a cache refresh on repo's connection state
</ParamField>

<ParamField path="appProject" type="string">
  App project for query
</ParamField>

**Response:** `Repository`

**REST Endpoint:** `GET /api/v1/repositories/{repo}`

***

### GetWrite

Returns a repository or its write credentials.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

**Response:** `Repository`

**REST Endpoint:** `GET /api/v1/write-repositories/{repo}`

***

### CreateRepository

Creates a new repository configuration.

**Request:** `RepoCreateRequest`

<ParamField path="repo" type="Repository" required>
  Repository definition
</ParamField>

<ParamField path="upsert" type="bool">
  Whether to create in upsert mode
</ParamField>

<ParamField path="credsOnly" type="bool">
  Whether to operate on credential set instead of repository
</ParamField>

**Response:** `Repository`

**REST Endpoint:** `POST /api/v1/repositories`

***

### CreateWriteRepository

Creates a new write repository configuration.

**Request:** `RepoCreateRequest`

**Response:** `Repository`

**REST Endpoint:** `POST /api/v1/write-repositories`

***

### UpdateRepository

Updates a repository configuration.

**Request:** `RepoUpdateRequest`

<ParamField path="repo" type="Repository" required>
  Repository definition to update
</ParamField>

**Response:** `Repository`

**REST Endpoint:** `PUT /api/v1/repositories/{repo.repo}`

***

### UpdateWriteRepository

Updates a write repository configuration.

**Request:** `RepoUpdateRequest`

**Response:** `Repository`

**REST Endpoint:** `PUT /api/v1/write-repositories/{repo.repo}`

***

### DeleteRepository

Deletes a repository from the configuration.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL to delete
</ParamField>

**Response:** `RepoResponse`

**REST Endpoint:** `DELETE /api/v1/repositories/{repo}`

***

### DeleteWriteRepository

Deletes a write repository from the configuration.

**Request:** `RepoQuery`

**Response:** `RepoResponse`

**REST Endpoint:** `DELETE /api/v1/write-repositories/{repo}`

***

### ValidateAccess

Validates access to a repository with given parameters.

**Request:** `RepoAccessQuery`

<ParamField path="repo" type="string" required>
  The URL to the repo
</ParamField>

<ParamField path="username" type="string">
  Username for accessing repo
</ParamField>

<ParamField path="password" type="string">
  Password for accessing repo
</ParamField>

<ParamField path="sshPrivateKey" type="string">
  Private key data for accessing SSH repository
</ParamField>

<ParamField path="insecure" type="bool">
  Whether to skip certificate or host key validation
</ParamField>

<ParamField path="tlsClientCertData" type="string">
  TLS client cert data for accessing HTTPS repository
</ParamField>

<ParamField path="tlsClientCertKey" type="string">
  TLS client cert key for accessing HTTPS repository
</ParamField>

<ParamField path="type" type="string">
  The type of the repo
</ParamField>

<ParamField path="name" type="string">
  The name of the repo
</ParamField>

<ParamField path="enableOci" type="bool">
  Whether helm-oci support should be enabled for this repo
</ParamField>

<ParamField path="githubAppPrivateKey" type="string">
  Github App Private Key PEM data
</ParamField>

<ParamField path="githubAppID" type="int64">
  Github App ID of the app used to access the repo
</ParamField>

<ParamField path="githubAppInstallationID" type="int64">
  Github App Installation ID of the installed GitHub App
</ParamField>

<ParamField path="githubAppEnterpriseBaseUrl" type="string">
  Github App Enterprise base url if empty will default to [https://api.github.com](https://api.github.com)
</ParamField>

<ParamField path="proxy" type="string">
  HTTP/HTTPS proxy to access the repository
</ParamField>

<ParamField path="project" type="string">
  Reference between project and repository
</ParamField>

<ParamField path="gcpServiceAccountKey" type="string">
  Google Cloud Platform service account key
</ParamField>

<ParamField path="forceHttpBasicAuth" type="bool">
  Whether to force HTTP basic auth
</ParamField>

**Response:** `RepoResponse`

**REST Endpoint:** `POST /api/v1/repositories/{repo}/validate`

***

### ValidateWriteAccess

Validates write access to a repository with given parameters.

**Request:** `RepoAccessQuery`

**Response:** `RepoResponse`

**REST Endpoint:** `POST /api/v1/write-repositories/{repo}/validate`

***

### ListRefs

Lists branches and tags in a Git repository.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

**Response:** `Refs`

<ResponseField name="branches" type="string[]">
  List of branch names
</ResponseField>

<ResponseField name="tags" type="string[]">
  List of tag names
</ResponseField>

**REST Endpoint:** `GET /api/v1/repositories/{repo}/refs`

***

### ListOCITags

Lists tags in an OCI repository.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

**Response:** `Refs`

<ResponseField name="tags" type="string[]">
  List of OCI tags
</ResponseField>

**REST Endpoint:** `GET /api/v1/repositories/{repo}/oci-tags`

***

### ListApps

Returns list of apps in the repo.

**Request:** `RepoAppsQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

<ParamField path="revision" type="string">
  The revision to scan
</ParamField>

<ParamField path="appName" type="string">
  The application name
</ParamField>

<ParamField path="appProject" type="string">
  The application project
</ParamField>

**Response:** `RepoAppsResponse`

<ResponseField name="items" type="AppInfo[]">
  List of applications found in the repository
</ResponseField>

**AppInfo Fields:**

* `type` (string): Application type (e.g., "Kustomize", "Helm", "Directory")
* `path` (string): Path to the application in the repository

**REST Endpoint:** `GET /api/v1/repositories/{repo}/apps`

***

### GetAppDetails

Returns application details by given path.

**Request:** `RepoAppDetailsQuery`

<ParamField path="source" type="ApplicationSource" required>
  The application source
</ParamField>

<ParamField path="appName" type="string">
  The application name
</ParamField>

<ParamField path="appProject" type="string">
  The application project
</ParamField>

<ParamField path="sourceIndex" type="int32">
  Source index (for multi source apps)
</ParamField>

<ParamField path="versionId" type="int32">
  Version ID from historical data (for multi source apps)
</ParamField>

**Response:** `RepoAppDetailsResponse`

<ResponseField name="type" type="string">
  Application type
</ResponseField>

<ResponseField name="helm" type="HelmAppSpec">
  Helm application details (if type is Helm)
</ResponseField>

<ResponseField name="kustomize" type="KustomizeAppSpec">
  Kustomize application details (if type is Kustomize)
</ResponseField>

<ResponseField name="directory" type="DirectoryAppSpec">
  Directory application details (if type is Directory)
</ResponseField>

<ResponseField name="plugin" type="PluginAppSpec">
  Plugin application details (if type is Plugin)
</ResponseField>

**REST Endpoint:** `POST /api/v1/repositories/{source.repoURL}/appdetails`

***

### GetHelmCharts

Returns list of helm charts in the specified repository.

**Request:** `RepoQuery`

<ParamField path="repo" type="string" required>
  The repository URL
</ParamField>

**Response:** `HelmChartsResponse`

<ResponseField name="items" type="HelmChart[]">
  List of Helm charts
</ResponseField>

**HelmChart Fields:**

* `name` (string): Chart name
* `versions` (string\[]): Available chart versions

**REST Endpoint:** `GET /api/v1/repositories/{repo}/helmcharts`

***

## gRPC Example

```go theme={null}
import (
    "context"
    "google.golang.org/grpc"
    repositorypkg "github.com/argoproj/argo-cd/v3/pkg/apiclient/repository"
    "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)

// Create a gRPC connection
conn, err := grpc.Dial("argocd-server:443", grpc.WithInsecure())
if err != nil {
    log.Fatal(err)
}
defer conn.Close()

// Create repository service client
client := repositorypkg.NewRepositoryServiceClient(conn)

// List repositories
repos, err := client.ListRepositories(context.Background(), &repositorypkg.RepoQuery{})
if err != nil {
    log.Fatal(err)
}

// Get a specific repository
repo, err := client.Get(context.Background(), &repositorypkg.RepoQuery{
    Repo: "https://github.com/argoproj/argocd-example-apps",
})
if err != nil {
    log.Fatal(err)
}

// Create a new repository
newRepo := &v1alpha1.Repository{
    Repo: "https://github.com/my-org/my-repo",
    Type: "git",
    Username: "git",
    Password: "my-token",
}

createdRepo, err := client.CreateRepository(context.Background(), &repositorypkg.RepoCreateRequest{
    Repo:   newRepo,
    Upsert: false,
})
if err != nil {
    log.Fatal(err)
}

// List branches and tags
refs, err := client.ListRefs(context.Background(), &repositorypkg.RepoQuery{
    Repo: "https://github.com/argoproj/argocd-example-apps",
})
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Branches: %v\n", refs.Branches)
fmt.Printf("Tags: %v\n", refs.Tags)

// List apps in repository
apps, err := client.ListApps(context.Background(), &repositorypkg.RepoAppsQuery{
    Repo:     "https://github.com/argoproj/argocd-example-apps",
    Revision: "HEAD",
})
if err != nil {
    log.Fatal(err)
}

for _, app := range apps.Items {
    fmt.Printf("Found app: %s at path %s\n", app.Type, app.Path)
}

// Validate repository access
validateResp, err := client.ValidateAccess(context.Background(), &repositorypkg.RepoAccessQuery{
    Repo:     "https://github.com/my-org/my-repo",
    Username: "git",
    Password: "my-token",
})
if err != nil {
    log.Fatal(err)
}
```
