> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GenerateGitCodeStoreProjectDownloadUrl

# Package: gitCodestore

# Namespace: GitCodeStoreManagedProjectManagement

# Method link: https://dev.wix.com/docs/api-reference/account-level/git-codestore/generate-git-code-store-project-download-url.md

## Introduction

Generates a temporary URL to download all tracked files at one revision as a ZIP.

Includes hidden directories, binary files and materialized LFS objects; excludes Git history.
Defaults to main. Omit `revisionId` to download the current branch head.
Supply the returned revision when committing uploaded code unless force is true.
Supports at most 10,000 tracked files, 256 MiB expanded, and a 64 MiB ZIP.
Rejects unsafe paths, submodules, special files, and dangling or escaping symlinks.
Requires an authenticated user with read access to the app or its companion site.

---

## REST API

### Schema

```
 Method: generateGitCodeStoreProjectDownloadUrl
 Description: Generates a temporary URL to download all tracked files at one revision as a ZIP.  Includes hidden directories, binary files and materialized LFS objects; excludes Git history. Defaults to main. Omit `revisionId` to download the current branch head. Supply the returned revision when committing uploaded code unless force is true. Supports at most 10,000 tracked files, 256 MiB expanded, and a 64 MiB ZIP. Rejects unsafe paths, submodules, special files, and dangling or escaping symlinks. Requires an authenticated user with read access to the app or its companion site.
 URL: https://www.wixapis.com/codestore/v2/git-code-store-projects/{managedProjectId}/generate-download-url
 Method: POST
 Method parameters:
   param name: branchName | type: branchName | description: Existing branch. Defaults to main.  | validation: minLength 1, maxLength 250
   param name: revisionId | type: revisionId | description: Optional full commit SHA, reachable from the selected branch. Defaults to its head.  | validation: minLength 40, maxLength 40
 Return type: GenerateGitCodeStoreProjectDownloadUrlResponse
  - name: downloadUrl | type: string | description: Signed URL for downloading the complete ZIP with HTTP GET. Valid for 5 minutes. Anyone holding this URL can download the ZIP until it expires; no additional authorization is required.  | validation: format WEB_URL
  - name: expiresAt | type: string | description: Expiration of the signed URL; credential expiry or revocation can invalidate it earlier.  | validation: format date-time
  - name: revision | type: Revision | description: Revision included in the ZIP. Use its id as the expected head when committing an upload.  
     - name: id | type: string | description: Revision identifier  | read-only: true | validation: maxLength 40
     - name: description | type: string | description: Revision description message  | read-only: true | validation: maxLength 2000
     - name: creationTime | type: string | description: Creation time  | read-only: true | validation: format date-time
     - name: author | type: Author | description: Author details  
        - name: name | type: string | description: Author name  | read-only: true | validation: maxLength 100
        - name: email | type: string | description: Author email  | read-only: true | validation: format EMAIL
  - name: branchName | type: string | description: Resolved branch name.  | validation: maxLength 250

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REPOSITORY_ARCHIVE_TOO_LARGE | Description: The export exceeds 10,000 tracked files, 256 MiB expanded, or 64 MiB compressed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_REPOSITORY_ARCHIVE | Description: The project GUID is malformed, or the repository contains unsafe or unsupported archive entries.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_COMMIT_NOT_FOUND | Description: Couldn't find the requested revision. It may be malformed or unreachable from the selected branch.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_BRANCH_NOT_FOUND | Description: Couldn't find the selected branch.


```

### Examples

### Download the current branch
Generate a signed download URL using an authenticated Wix user and the companion site's context. Replace the illustrative IDs and use the exact URL returned by the API for the ZIP transfer.

```curl
curl -X POST \
'https://www.wixapis.com/codestore/v2/git-code-store-projects/72357e9a-2094-40b3-8626-9354a5089b49/generate-download-url' \
-H 'Authorization: <AUTH>' \
-H 'wix-site-id: 426f1a4c-cc7a-43b0-92d9-e267c56f8d27' \
-H 'Content-Type: application/json' \
-d '{
  "branchName": "main"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.gitCodeStore.projects.generateGitCodeStoreProjectDownloadUrl(managedProjectId, options)
 Description: Generates a temporary URL to download all tracked files at one revision as a ZIP.  Includes hidden directories, binary files and materialized LFS objects; excludes Git history. Defaults to main. Omit `revisionId` to download the current branch head. Supply the returned revision when committing uploaded code unless force is true. Supports at most 10,000 tracked files, 256 MiB expanded, and a 64 MiB ZIP. Rejects unsafe paths, submodules, special files, and dangling or escaping symlinks. Requires an authenticated user with read access to the app or its companion site.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  managedProjectId
 Method parameters: 
   param name: managedProjectId | type: string | description: GUID of the existing AppManagedProject whose code will be downloaded. This identifies the managed project, not its site or a legacy v1 Code Store project. | required: true | validation: format GUID
   param name: options | type: GenerateGitCodeStoreProjectDownloadUrlOptions  none  
        - name: branchName | type: string | description: Existing branch. Defaults to main.  | validation: minLength 1, maxLength 250
        - name: revisionId | type: string | description: Optional full commit SHA, reachable from the selected branch. Defaults to its head.  | validation: minLength 40, maxLength 40
 Return type: PROMISE<GenerateGitCodeStoreProjectDownloadUrlResponse>
  - name: downloadUrl | type: string | description: Signed URL for downloading the complete ZIP with HTTP GET. Valid for 5 minutes. Anyone holding this URL can download the ZIP until it expires; no additional authorization is required.  | validation: format WEB_URL
  - name: expiresAt | type: Date | description: Expiration of the signed URL; credential expiry or revocation can invalidate it earlier.  
  - name: revision | type: Revision | description: Revision included in the ZIP. Use its id as the expected head when committing an upload.  
     - name: _id | type: string | description: Revision identifier  | read-only: true | validation: maxLength 40
     - name: description | type: string | description: Revision description message  | read-only: true | validation: maxLength 2000
     - name: creationTime | type: Date | description: Creation time  | read-only: true 
     - name: author | type: Author | description: Author details  
        - name: name | type: string | description: Author name  | read-only: true | validation: maxLength 100
        - name: email | type: string | description: Author email  | read-only: true | validation: format EMAIL
  - name: branchName | type: string | description: Resolved branch name.  | validation: maxLength 250

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REPOSITORY_ARCHIVE_TOO_LARGE | Description: The export exceeds 10,000 tracked files, 256 MiB expanded, or 64 MiB compressed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_REPOSITORY_ARCHIVE | Description: The project GUID is malformed, or the repository contains unsafe or unsupported archive entries.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_COMMIT_NOT_FOUND | Description: Couldn't find the requested revision. It may be malformed or unreachable from the selected branch.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_BRANCH_NOT_FOUND | Description: Couldn't find the selected branch.


```

### Examples

### Download the current branch
Requires authenticated Wix user and account context, plus the site context for a companion app. IDs and response values are illustrative.

```javascript
import { projects } from "@wix/git-code-store";

async function downloadCurrentBranch() {
  const response = await projects.generateGitCodeStoreProjectDownloadUrl(
    "72357e9a-2094-40b3-8626-9354a5089b49",
    { branchName: "main" },
  );
  return response;
}

/* Promise resolves to:
 * {
 *   downloadUrl: "https://example.com/signed-download-url",
 *   expiresAt: new Date("2026-10-12T10:05:00Z"),
 *   revision: {
 *     _id: "c1531e925af90ed3d1cb105d46e8c7282aecd630",
 *     description: "Update project content",
 *     creationTime: new Date("2026-10-12T09:00:00Z"),
 *     author: { name: "Jane Doe", email: "jane.doe@example.com" }
 *   },
 *   branchName: "main"
 * }
 */

```

### generateGitCodeStoreProjectDownloadUrl (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { projects } from '@wix/git-code-store';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { projects },
  // Include the auth strategy and host as relevant
});


async function generateGitCodeStoreProjectDownloadUrl(managedProjectId,options) {
  const response = await myWixClient.projects.generateGitCodeStoreProjectDownloadUrl(managedProjectId,options);
};
```

---