# gram push

The `push` command deploys the staged sources in your deployment configuration
to your Gram project.

For more information on staging sources, see the [`gram stage`
reference](/docs/mcp/reference/command-line/stage).

<Callout type="info">
    The `gram push` command requires you to specify an API key and project
    slug. For more information on these values, see the [global CLI
    options](../command-line).
</Callout>

## Usage

```bash
gram push --api-key YOUR_API_KEY --project my-project --config gram.json
```

## Deployment file

The deployment file contains the configuration for all sources that will be
pushed to Gram. Below is a sample deployment file:

```json filename="gram.json"
{
  "schema_version": "1.0.0",
  "type": "deployment",
  "sources": [
    {
      "type": "openapiv3",
      "location": "/path/to/spec.yaml",
      "name": "My API",
      "slug": "my-api"
    }
  ]
}
```

<Callout type="info" title="Note on slugs">
    Names and slugs must be unique across all sources in the target project.
</Callout>

## Options

### <code>config</code>

This specifies the path to the deployment file. If not specified, the deployment file defaults to `gram.json` in the current working directory.

```bash
gram push --config ./path/to/deployment.json [command options]
```

### <code>method</code>

This specifies the deployment method for handling existing artifacts. If not specified, it defaults to `merge`.

- **`merge`:** The deployment merges with any existing deployment artifacts in the Gram project.
- **`replace`:** The deployment replaces any existing deployment artifacts in the Gram project.

```bash
gram push --method replace [command options]
```

### <code>idempotency-key</code>

This adds a unique key to identify the deployment request for idempotency. It ensures the same deployment isn't applied multiple times if the command is run
again with the same key.

```bash
gram push --idempotency-key unique-deployment-id [command options]
```

### <code>skip-poll</code>

Use this option to skip polling for deployment completion and return immediately. By default, this is set to `false`.

```bash
gram push --skip-poll [command options]
```
