---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/repositories"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/repositories"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/repositories

`POST /v1/projects/{projectsId}/locations/{locationsId}/repositories`

## Request

- Base URL: `https://artifactregistry.googleapis.com`
- URL: `https://artifactregistry.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/repositories`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/cloud-platform`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string
- `repositoryId` string

## Request body

- Repository: A Repository for storing artifacts with a specific format.
  - `cleanupPolicies` object: Optional. Cleanup policies for this repository. Cleanup policies indicate when certain package versions can be automatically deleted. Map keys are policy IDs supplied by users during policy creation. They must unique within a repository and be under 128 characters in length.
  - `cleanupPolicyDryRun` boolean: Optional. If true, the cleanup pipeline is prevented from deleting versions in this repository.
  - `createTime` string, google-datetime: Output only. The time when the repository was created.
  - `description` string: The user-provided description of the repository.
  - `disallowUnspecifiedMode` boolean: Optional. If this is true, an unspecified repo type will be treated as error rather than defaulting to standard.
  - `dockerConfig` DockerRepositoryConfig: DockerRepositoryConfig is docker related repository details. Provides additional configuration details for repositories of the docker format type.
    - `immutableTags` boolean: The repository which enabled this flag prevents all tags from being modified, moved or deleted. This does not prevent tags from being created.
  - `format` 'FORMAT_UNSPECIFIED' | 'DOCKER' | 'MAVEN' | 'NPM' | 'APT' | 'YUM' | 'GOOGET' | 'PYTHON' | 'KFP' | 'GO' | 'GENERIC' | 'RUBY' | 'CONDA': Optional. The format of packages that are stored in the repository.
  - `kmsKeyName` string: The Cloud KMS resource name of the customer managed encryption key that's used to encrypt the contents of the Repository. Has the form: `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. This value may not be changed after the Repository has been created.
  - `labels` object: Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 characters. Label keys must begin with a lowercase letter and may only contain lowercase letters, numeric characters, underscores, and dashes.
  - `mavenConfig` MavenRepositoryConfig: MavenRepositoryConfig is maven related repository details. Provides additional configuration details for repositories of the maven format type.
    - `allowSnapshotOverwrites` boolean: The repository with this flag will allow publishing the same snapshot versions.
    - `versionPolicy` 'VERSION_POLICY_UNSPECIFIED' | 'RELEASE' | 'SNAPSHOT': Version policy defines the versions that the registry will accept.
  - `mode` 'MODE_UNSPECIFIED' | 'STANDARD_REPOSITORY' | 'VIRTUAL_REPOSITORY' | 'REMOTE_REPOSITORY' | 'AOSS_REPOSITORY' | 'ASSURED_OSS_REPOSITORY': Optional. The mode of the repository.
  - `name` string: The name of the repository, for example: `projects/p1/locations/us-central1/repositories/repo1`. For each location in a project, repository names must be unique.
  - `platformLogsConfig` PlatformLogsConfig: The platform logs config for a project or a repository.
    - `loggingState` 'LOGGING_STATE_UNSPECIFIED' | 'ENABLED' | 'DISABLED': Optional. The state of the platform logs: enabled or disabled.
    - `severityLevel` 'SEVERITY_LEVEL_UNSPECIFIED' | 'DEBUG' | 'INFO' | 'NOTICE' | 'WARNING' | 'ERROR' | 'CRITICAL' | 'ALERT' | 'EMERGENCY': Optional. The severity level for the logs. Logs will be generated if their severity level is >= than the value of the severity level mentioned here.
  - `registryUri` string: Output only. The repository endpoint, for example: `us-docker.pkg.dev/my-proj/my-repo`.
  - `remoteRepositoryConfig` RemoteRepositoryConfig: Remote repository configuration.
    - `aptRepository` AptRepository: Configuration for an Apt remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the upstream remote repository, for ex: "https://my.apt.registry/".
      - `publicRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryPublicRepository: Publicly available Apt repositories constructed from a common repository base and a custom repository path.
        - `repositoryBase` 'REPOSITORY_BASE_UNSPECIFIED' | 'DEBIAN' | 'UBUNTU' | 'DEBIAN_SNAPSHOT': A common public repository base for Apt.
        - `repositoryPath` string: A custom field to define a path to a specific repository from the base.
    - `commonRepository` CommonRemoteRepository: Common remote repository settings type.
      - `uri` string: Required. A common public repository base for remote repository.
    - `description` string: The description of the remote source.
    - `disableUpstreamValidation` boolean: Input only. A create/update remote repo option to avoid making a HEAD/GET request to validate a remote repo and any supplied upstream credentials.
    - `dockerRepository` DockerRepository: Configuration for a Docker remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigDockerRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the custom remote repository, for ex: "https://registry-1.docker.io".
      - `publicRepository` 'PUBLIC_REPOSITORY_UNSPECIFIED' | 'DOCKER_HUB': One of the publicly available Docker repositories supported by Artifact Registry.
    - `mavenRepository` MavenRepository: Configuration for a Maven remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigMavenRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the upstream remote repository, for ex: "https://my.maven.registry/".
      - `publicRepository` 'PUBLIC_REPOSITORY_UNSPECIFIED' | 'MAVEN_CENTRAL': One of the publicly available Maven repositories supported by Artifact Registry.
    - `noCache` NoCacheFetching: The configuration for the no-cache fetching mode, which acts as a non-caching proxy.
    - `npmRepository` NpmRepository: Configuration for a Npm remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigNpmRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the upstream remote repository, for ex: "https://my.npm.registry/".
      - `publicRepository` 'PUBLIC_REPOSITORY_UNSPECIFIED' | 'NPMJS': One of the publicly available Npm repositories supported by Artifact Registry.
    - `pythonRepository` PythonRepository: Configuration for a Python remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigPythonRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the upstream remote repository, for ex: "https://my.python.registry/".
      - `publicRepository` 'PUBLIC_REPOSITORY_UNSPECIFIED' | 'PYPI': One of the publicly available Python repositories supported by Artifact Registry.
    - `upstreamCredentials` UpstreamCredentials: The credentials to access the remote repository.
      - `usernamePasswordCredentials` UsernamePasswordCredentials: Username and password credentials.
        - `passwordSecretVersion` string: The Secret Manager key version that holds the password to access the remote repository. Must be in the format of `projects/{project}/secrets/{secret}/versions/{version}`.
        - `username` string: The username to access the remote repository.
    - `yumRepository` YumRepository: Configuration for a Yum remote repository.
      - `customRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryCustomRepository: Customer-specified publicly available remote repository.
        - `uri` string: An https uri reference to the upstream remote repository, for ex: "https://my.yum.registry/".
      - `publicRepository` GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryPublicRepository: Publicly available Yum repositories constructed from a common repository base and a custom repository path.
        - `repositoryBase` 'REPOSITORY_BASE_UNSPECIFIED' | 'CENTOS' | 'CENTOS_DEBUG' | 'CENTOS_VAULT' | 'CENTOS_STREAM' | 'ROCKY' | 'EPEL': A common public repository base for Yum.
        - `repositoryPath` string: A custom field to define a path to a specific repository from the base.
  - `satisfiesPzi` boolean: Output only. Whether or not this repository satisfies PZI.
  - `satisfiesPzs` boolean: Output only. Whether or not this repository satisfies PZS.
  - `sizeBytes` string, int64: Output only. The size, in bytes, of all artifact storage in this repository. Repositories that are generally available or in public preview use this to calculate storage costs.
  - `updateTime` string, google-datetime: Output only. The time when the repository was last updated.
  - `virtualRepositoryConfig` VirtualRepositoryConfig: Virtual repository configuration.
    - `upstreamPolicies` UpstreamPolicy[]: Policies that configure the upstream artifacts distributed by the Virtual Repository. Upstream policies cannot be set on a standard repository.
      - `id` string: The user-provided ID of the upstream policy.
      - `priority` integer: Entries with a greater priority value take precedence in the pull order.
      - `repository` string: A reference to the repository resource, for example: `projects/p1/locations/us-central1/repositories/repo1`.
  - `vulnerabilityScanningConfig` VulnerabilityScanningConfig: Config on whether to perform vulnerability scanning for resources in this repository, as well as output fields describing current state.
    - `enablementConfig` 'ENABLEMENT_CONFIG_UNSPECIFIED' | 'INHERITED' | 'DISABLED': Optional. Config for whether this repository has vulnerability scanning disabled. When unset (ENABLEMENT_CONFIG_UNSPECIFIED), this is treated as INHERITED for Docker repositories and DISABLED for non-Docker repositories.
    - `enablementState` 'ENABLEMENT_STATE_UNSPECIFIED' | 'SCANNING_UNSUPPORTED' | 'SCANNING_DISABLED' | 'SCANNING_ACTIVE': Output only. State of feature enablement, combining repository enablement config and API enablement state.
    - `enablementStateReason` string: Output only. Reason for the repository state.
    - `lastEnableTime` string, google-datetime: Output only. The last time this repository config was enabled.

## Response `200`

Successful response

- Operation: This resource represents a long-running operation that is the result of a network API call.
  - `done` boolean: If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
  - `error` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer: The status code, which should be an enum value of google.rpc.Code.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  - `metadata` object: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
  - `name` string: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
  - `response` object: The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.

---

[API](https://skmtc.dev/google/apis/artifactregistry.md) - [All operations](https://skmtc.dev/google/apis/artifactregistry/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/artifactregistry/revisions/83834d32294c?raw)
