# Functions

> Status: Beta

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Every page is available as Markdown by adding .md to its URL.

> Closed beta. Create and manage functions using the Rippling CLI.

Source: https://developer.rippling.com/documentation/rippling-platform/rippling-cli/functions

> **Rippling:**
> Access to the Rippling CLI is gated behind the **Developer Program**, which is currently in a closed beta.

## Deploy & download

### `rippling function deploy`

Creates a function deployment from `function.yaml` or JSON. `--code-path` cannot be combined with `--data` or `--data-file`.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | no | API name of the function. |
| `--code-path` | string | no | Source file to inline in `function.yaml` mode. Relative paths resolve from the current directory and must stay under the `function.yaml` directory. |
| `--dependencies` | key=value list | no | npm dependencies. Separate entries with `;`. |
| `--options` | key=value list | no | Runtime-specific deployment options. Separate entries with `;`. |
| `--func-config` | string | no | Path to `function.yaml`. Used when `--data` and `--data-file` are omitted. |
| `--data` | string | no | Request body as inline JSON. |
| `--data-file` | string | no | Path to a JSON request body. |
| `--watch` | boolean | no | Poll deployment status and logs until success or failure. |
| `--json` | boolean | no | Pretty-print JSON. |

*Example:*

```bash
rippling --context sandbox-editor function deploy \
   --function-api-name my_function \
   --code-path functions/my_function/src/function.ts \
   --dependencies "@rippling/rippling-sdk=YOUR_SDK_VERSION" \
   --watch \
   --json
```

### `rippling function download`

Downloads a dev-bundle zip of the function draft.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--output` | string | no | Path for the zip. Default is `<function-api-name>-dev-bundle.zip`. |
| `--data` | string | no | Request body as inline JSON. |
| `--data-file` | string | no | Path to a JSON request body. |
| `--json` | boolean | no | Pretty-print JSON. |

*Example:*

```bash
rippling function download --function-api-name my_function
rippling function download --function-api-name my_function --output ./my_function.zip
```

## Functions

### `rippling api functions create`

Creates a function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--name` | string | no | Function name. |
| `--api-name` | string | no | Function API name. |
| `--description` | string | no | Function description. |
| `--code-draft` | string | no | Current draft source. |
| `--dependencies-file` | file | no | JSON object of dependencies. `-` reads `stdin`. |
| `--is-async` | boolean | no | Run the function asynchronously. |
| `--type` | string | no | Function type at creation. Allowed values: `event`, `request`. Defaults to `event` and cannot be changed later. |
| `--source-upload-file` | file | no | Source zip checksum and size for request functions. JSON fields: `sha256` (string), `size_bytes` (int). |
| `--input` | file | no | Full JSON body. Cannot be combined with field flags. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api functions create --name "My function" --api-name my_function --type event --json
```

### `rippling api functions list`

Lists functions.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--cursor` | string | no | Pagination cursor. |
| `--limit` | string | no | Maximum results. Default 10. Maximum 100. |
| `--order-by` | string | no | Sort expression. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api functions list
rippling api functions list --json
```

### `rippling api functions get`

Reads a specific function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api functions get --function-api-name my_function
rippling api functions get --function-api-name my_function --json
```

### `rippling api functions update`

Updates a function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--name` | string | no | Function name. |
| `--description` | string | no | Function description. |
| `--code-draft` | string | no | Current draft source. |
| `--dependencies-file` | file | no | JSON object of dependencies. `-` reads `stdin`. |
| `--source-upload-file` | file | no | Source zip checksum and size for request functions. JSON fields: `sha256` (string), `size_bytes` (int). |
| `--input` | file | no | Full JSON body. Cannot be combined with field flags. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api functions update --function-api-name my_function --description "Updated description" --json
```

## Deployments

### `rippling api function-deployments create`

Creates a deployment.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | no | API name of the function. |
| `--code-path` | string | no | Source file to inline. Cannot be combined with `--data` or `--data-file`. |
| `--dependencies` | key=value list | no | npm dependencies. Separate entries with `;`. |
| `--options` | key=value list | no | Runtime options. Separate entries with `;`. |
| `--func-config` | string | no | Path to `function.yaml`. Used when `--data` and `--data-file` are omitted. |
| `--data` | string | no | Inline JSON body. |
| `--data-file` | string | no | Path to a JSON body. |
| `--watch` | boolean | no | Poll until success or failure. |
| `--json` | boolean | no | Pretty-print JSON. |

*Example:*

```bash
rippling api function-deployments create --function-api-name my_function --code-path functions/my_function/src/function.ts --watch --json
```

### `rippling api function-deployments list`

Lists deployments for a specific function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-deployments list --function-api-name my_function
rippling api function-deployments list --function-api-name my_function --json
```

### `rippling api function-deployments get`

Reads a specific function deployment.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--deployment-id` | string | yes | Deployment ID. |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-deployments get --deployment-id <deployment-id> --function-api-name my_function --json
```

## Executions

### `rippling api function-executions create`

Runs a function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--inputs-file` | file | yes | Execution inputs. `-` reads `stdin`. The file is the `inputs` object. |
| `--input` | file | no | Full JSON body. Cannot be combined with field flags. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-executions create --function-api-name my_function --inputs-file ./request.json
rippling api function-executions create --function-api-name my_function --inputs-file ./request.json --json
```

### `rippling api function-executions list`

Lists executions for a specific function.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--function-api-name` | string | yes | API name of the function. |
| `--cursor` | string | no | Pagination cursor. |
| `--limit` | string | no | Maximum results. Default 10; maximum 100. |
| `--order-by` | string | no | Sort expression. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-executions list --function-api-name my_function
rippling api function-executions list --function-api-name my_function --json
```

### `rippling api function-executions get`

Reads a specific function execution.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--execution-id` | string | yes | Execution ID. |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-executions get --execution-id <execution-id> --function-api-name my_function --json
```

## Logs

### `rippling api function-deployment-logs list`

Lists logs for a specific deployment.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--deployment-id` | string | yes | Deployment ID. |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-deployment-logs list --deployment-id <deployment-id> --function-api-name my_function --json
```

### `rippling api function-execution-logs list`

Lists logs for a specific execution.

| Flag | Type | Required | Description |
| --- | --- | --- | --- |
| `--execution-id` | string | yes | Execution ID. |
| `--function-api-name` | string | yes | API name of the function. |
| `--json` | boolean | no | Print the response as indented JSON. |

*Example:*

```bash
rippling api function-execution-logs list --execution-id <execution-id> --function-api-name my_function --json
```
