# Required Parameters for Uploading Assets to a Stitch Project

> Learn the required parameters for uploading assets to a Stitch project. Discover the mandatory `--project-id`, `--file-path`, and `--api-key` arguments for the stitch upload script.

- Repository: [Google Labs Code/stitch-skills](https://github.com/google-labs-code/stitch-skills)
- Tags: how-to-guide
- Published: 2026-07-12

---

**Uploading assets to a Stitch project requires three mandatory command-line arguments: `--project-id`, `--file-path`, and `--api-key`, which are processed by the `stitch::upload-to-stitch` Python script.**

The `google-labs-code/stitch-skills` repository provides the `stitch::upload-to-stitch` skill for ingesting local files—such as images, HTML pages, and markdown design files—into Google Stitch projects. According to the source code in [`plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py), the upload workflow enforces strict parameter validation to ensure proper authentication and target identification.

## Required Parameters for the Upload Script

The [`upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/upload_to_stitch.py) script enforces three mandatory arguments that must be provided via the command line:

### --project-id

The `--project-id` parameter specifies the unique identifier of the Stitch project that will receive the asset. This value tells the Stitch API exactly which project container should store the uploaded file and associate it with the correct design workspace.

### --file-path

The `--file-path` parameter accepts either an absolute or relative path to the local file you want to upload. As implemented in [`upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/upload_to_stitch.py), the MIME type is automatically detected based on the file extension, eliminating the need for manual content-type specification when sending the HTTP request.

### --api-key

The `--api-key` parameter provides a valid Stitch API key used for authentication via the `X-Goog-Api-Key` header. This credential can be extracted from the user's MCP configuration files or supplied directly as a command-line argument, and it validates that the requesting agent has permission to modify the target project.

## Optional Parameters

While not required for successful execution, the script supports additional arguments that modify upload behavior:

- **`--api-url`** – Overrides the default endpoint (`https://stitch.googleapis.com`)
- **`--title`** – Sets a human-readable title for the created screen
- **`--generated-by`** – Identifies the tool or skill that produced the asset (e.g., `stitch::extract-static-html`)

## Command-Line Usage Examples

To upload an image to a Stitch project, execute the script with the required parameters:

```bash
python3 plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py \
  --project-id 1234567890 \
  --file-path assets/logo.png \
  --api-key AIzaSyExampleKey12345 \
  --title "Company Logo" \
  --generated-by "stitch::code-to-design"

```

For uploading static HTML pages, the same required parameters apply:

```bash
python3 plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py \
  --project-id 9876543210 \
  --file-path build/index.html \
  --api-key AIzaSyAnotherExampleKey67890

```

## Summary

- **Three mandatory parameters** control every upload: `--project-id`, `--file-path`, and `--api-key`
- The upload logic resides in [`plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py) within the `google-labs-code/stitch-skills` repository
- **MIME type detection** is automatic based on file extensions, requiring no manual intervention
- Optional parameters such as `--title` and `--generated-by` enhance metadata but do not affect upload success

## Frequently Asked Questions

### What file types can I upload to a Stitch project?

The [`upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/upload_to_stitch.py) script supports any file type that the Stitch API accepts, including images, HTML pages, and markdown design files. The script automatically detects the appropriate MIME type based on the file extension provided in the `--file-path` argument.

### How do I obtain a Stitch API key for the --api-key parameter?

API keys can be extracted from your MCP configuration files or supplied directly as a command-line argument. The key is passed in the `X-Goog-Api-Key` header to authenticate requests against the Stitch API endpoint.

### Can I use a custom API endpoint instead of the default Google Stitch URL?

Yes. While the script defaults to `https://stitch.googleapis.com`, you can override this by providing the `--api-url` parameter followed by your custom endpoint URL. This is useful for testing environments or private Stitch instances.

### Where is the upload functionality documented in the source code?

The required parameters and usage instructions are documented in [`plugins/stitch-design/skills/upload-to-stitch/SKILL.md`](https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-design/skills/upload-to-stitch/SKILL.md). The actual implementation logic resides in [`plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py`](https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py), while high-level skill descriptions appear in [`plugins/stitch-design/plugin.json`](https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-design/plugin.json) and the repository root [`README.md`](https://github.com/google-labs-code/stitch-skills/blob/main/README.md).