> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Commit and upload

> Upload a new application to Square Cloud or commit new files to an existing one.

```go theme={null}
client := rest.NewClient(os.Getenv("SQUARECLOUD_API_KEY"))
defer client.Close()

api := rest.New(client)
```

## Uploading a new application

`api.PostApplications(reader)` uploads a zip from any `io.Reader` and creates a brand-new application, returning a `*squarecloud.ApplicationUploaded`.

```go theme={null}
file, err := os.Open("app.zip")
if err != nil {
	panic(err)
}
defer file.Close()

uploaded, err := api.PostApplications(file)
if err != nil {
	panic(err)
}

fmt.Println(uploaded.ID)               // newly created application ID
fmt.Println(uploaded.Name)             // display name
fmt.Println(uploaded.RAM)              // allocated RAM in MB
fmt.Println(uploaded.CPU)              // allocated CPU shares
fmt.Println(uploaded.Language.Name)    // e.g. "go"
fmt.Println(uploaded.Language.Version) // e.g. "1.24"
```

`Description` and `Subdomain` are only present when set in the config file.

<Note>
  The zip must contain your application's entry point, its dependencies file and the `squarecloud.app`/`squarecloud.config` configuration file. See the [config file guide](/en/getting-started/config-file).
</Note>

## Committing files to an existing application

`api.PostApplicationCommit(appID, reader)` uploads a zip into an already-deployed application, replacing the matching files.

```go theme={null}
file, err := os.Open("dist.zip")
if err != nil {
	panic(err)
}
defer file.Close()

err = api.PostApplicationCommit("abc123def456abc123def456", file)
if err != nil {
	panic(err)
}
```

To commit into a subdirectory instead of the application root, pass the `path` query parameter with `rest.WithQueryParam`:

```go theme={null}
err = api.PostApplicationCommit(
	"abc123def456abc123def456",
	file,
	rest.WithQueryParam("path", "src"),
)
```

Committing does not restart the application — send a restart signal afterwards if your change requires one:

```go theme={null}
err = api.PostApplicationSignal("abc123def456abc123def456", squarecloud.ApplicationSignalRestart)
```
