---
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://dataform.googleapis.com`
- URL: `https://dataform.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/repositories`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/bigquery`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/bigquery`
  - 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 new Repository in a given project and location.

## Path parameters

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

## Query parameters

- `repositoryId` string

## Request body

- Repository: Represents a Dataform Git repository.
  - `containingFolder` string: Optional. The name of the containing folder of the repository. The field is immutable and it can be modified via a MoveRepository operation. Format: `projects/*/locations/*/folders/*`. or `projects/*/locations/*/teamFolders/*`.
  - `createTime` string, google-datetime: Output only. The timestamp of when the repository was created.
  - `dataEncryptionState` DataEncryptionState: Describes encryption state of a resource.
    - `kmsKeyVersionName` string: Required. The KMS key version name with which data of a resource is encrypted.
  - `displayName` string: Optional. The repository's user-friendly name.
  - `endUserAuthConfig` EndUserAuthConfig: Includes configuration options for repository end user authentication.
    - `oauthConfig` OAuthConfig: OAuth configuration for end user authentication.
      - `additionalOauthScopes` string[]: Optional. Additional OAuth scopes to use for BigQuery executions. Scopes always in use: `https://www.googleapis.com/auth/bigquery`
  - `gitRemoteSettings` GitRemoteSettings: Controls Git remote configuration for a repository.
    - `authenticationTokenSecretVersion` string: Optional. The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format `projects/*/secrets/*/versions/*`.
    - `defaultBranch` string: Optional. The Git remote's default branch name. If not set, `main` will be used.
    - `effectiveDefaultBranch` string: Output only. The Git remote's effective default branch name. This is the default branch name of the Git remote if it is set, otherwise it is `main`.
    - `gitRepositoryLink` string: Optional. Resource name for the `GitRepositoryLink` used for machine credentials. Must be in the format `projects/*/locations/*/connections/*/gitRepositoryLinks/*`
    - `sshAuthenticationConfig` SshAuthenticationConfig: Configures fields for performing SSH authentication.
      - `hostPublicKey` string: Required. Content of a public SSH key to verify an identity of a remote Git host.
      - `userPrivateKeySecretVersion` string: Required. The name of the Secret Manager secret version to use as a ssh private key for Git operations. Must be in the format `projects/*/secrets/*/versions/*`.
    - `tokenStatus` 'TOKEN_STATUS_UNSPECIFIED' | 'NOT_FOUND' | 'INVALID' | 'VALID': Output only. Deprecated: The field does not contain any token status information.
    - `url` string: Required. The Git remote's URL.
  - `internalMetadata` string: Output only. All the metadata information that is used internally to serve the resource. For example: timestamps, flags, status fields, etc. The format of this field is a JSON string.
  - `kmsKeyName` string: Optional. The reference to a KMS encryption key. If provided, it will be used to encrypt user data in the repository and all child resources. It is not possible to add or update the encryption key after the repository is created. Example: `projects/{kms_project}/locations/{location}/keyRings/{key_location}/cryptoKeys/{key}`
  - `labels` object: Optional. Repository user labels.
  - `name` string: Identifier. The repository's name.
  - `npmrcEnvironmentVariablesSecretVersion` string: Optional. The name of the Secret Manager secret version to be used to interpolate variables into the .npmrc file for package installation operations. Must be in the format `projects/*/secrets/*/versions/*`. The file itself must be in a JSON format.
  - `serviceAccount` string: Optional. The service account to run workflow invocations under.
  - `setAuthenticatedUserAdmin` boolean: Optional. Input only. If set to true, the authenticated user will be granted the roles/dataform.admin role on the created repository.
  - `teamFolderName` string: Output only. The resource name of the TeamFolder that this Repository is associated with. This should take the format: projects/{project}/locations/{location}/teamFolders/{teamFolder}. If this is not set, the Repository is not associated with a TeamFolder.
  - `workspaceCompilationOverrides` WorkspaceCompilationOverrides: Configures workspace compilation overrides for a repository.
    - `defaultDatabase` string: Optional. The default database (Google Cloud project ID).
    - `schemaSuffix` string: Optional. The suffix that should be appended to all schema (BigQuery dataset ID) names.
    - `tablePrefix` string: Optional. The prefix that should be prepended to all table names.

## Response `200`

Successful response

- Repository: Represents a Dataform Git repository.
  - `containingFolder` string: Optional. The name of the containing folder of the repository. The field is immutable and it can be modified via a MoveRepository operation. Format: `projects/*/locations/*/folders/*`. or `projects/*/locations/*/teamFolders/*`.
  - `createTime` string, google-datetime: Output only. The timestamp of when the repository was created.
  - `dataEncryptionState` DataEncryptionState: Describes encryption state of a resource.
    - `kmsKeyVersionName` string: Required. The KMS key version name with which data of a resource is encrypted.
  - `displayName` string: Optional. The repository's user-friendly name.
  - `endUserAuthConfig` EndUserAuthConfig: Includes configuration options for repository end user authentication.
    - `oauthConfig` OAuthConfig: OAuth configuration for end user authentication.
      - `additionalOauthScopes` string[]: Optional. Additional OAuth scopes to use for BigQuery executions. Scopes always in use: `https://www.googleapis.com/auth/bigquery`
  - `gitRemoteSettings` GitRemoteSettings: Controls Git remote configuration for a repository.
    - `authenticationTokenSecretVersion` string: Optional. The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format `projects/*/secrets/*/versions/*`.
    - `defaultBranch` string: Optional. The Git remote's default branch name. If not set, `main` will be used.
    - `effectiveDefaultBranch` string: Output only. The Git remote's effective default branch name. This is the default branch name of the Git remote if it is set, otherwise it is `main`.
    - `gitRepositoryLink` string: Optional. Resource name for the `GitRepositoryLink` used for machine credentials. Must be in the format `projects/*/locations/*/connections/*/gitRepositoryLinks/*`
    - `sshAuthenticationConfig` SshAuthenticationConfig: Configures fields for performing SSH authentication.
      - `hostPublicKey` string: Required. Content of a public SSH key to verify an identity of a remote Git host.
      - `userPrivateKeySecretVersion` string: Required. The name of the Secret Manager secret version to use as a ssh private key for Git operations. Must be in the format `projects/*/secrets/*/versions/*`.
    - `tokenStatus` 'TOKEN_STATUS_UNSPECIFIED' | 'NOT_FOUND' | 'INVALID' | 'VALID': Output only. Deprecated: The field does not contain any token status information.
    - `url` string: Required. The Git remote's URL.
  - `internalMetadata` string: Output only. All the metadata information that is used internally to serve the resource. For example: timestamps, flags, status fields, etc. The format of this field is a JSON string.
  - `kmsKeyName` string: Optional. The reference to a KMS encryption key. If provided, it will be used to encrypt user data in the repository and all child resources. It is not possible to add or update the encryption key after the repository is created. Example: `projects/{kms_project}/locations/{location}/keyRings/{key_location}/cryptoKeys/{key}`
  - `labels` object: Optional. Repository user labels.
  - `name` string: Identifier. The repository's name.
  - `npmrcEnvironmentVariablesSecretVersion` string: Optional. The name of the Secret Manager secret version to be used to interpolate variables into the .npmrc file for package installation operations. Must be in the format `projects/*/secrets/*/versions/*`. The file itself must be in a JSON format.
  - `serviceAccount` string: Optional. The service account to run workflow invocations under.
  - `setAuthenticatedUserAdmin` boolean: Optional. Input only. If set to true, the authenticated user will be granted the roles/dataform.admin role on the created repository.
  - `teamFolderName` string: Output only. The resource name of the TeamFolder that this Repository is associated with. This should take the format: projects/{project}/locations/{location}/teamFolders/{teamFolder}. If this is not set, the Repository is not associated with a TeamFolder.
  - `workspaceCompilationOverrides` WorkspaceCompilationOverrides: Configures workspace compilation overrides for a repository.
    - `defaultDatabase` string: Optional. The default database (Google Cloud project ID).
    - `schemaSuffix` string: Optional. The suffix that should be appended to all schema (BigQuery dataset ID) names.
    - `tablePrefix` string: Optional. The prefix that should be prepended to all table names.

## Changes

- **2026-11-03** `aa7c2fe4d752`: 4 info
  - the security scope `https://www.googleapis.com/auth/bigquery` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/bigquery` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/dataform/changes/v1/projects/:projectsId/locations/:locationsId/repositories/post.md)

---

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