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

# CLI Reference

> Reference for the telnyx-edge CLI, the primary tool for deploying, managing, and observing Telnyx Edge Compute functions from your terminal.

The `telnyx-edge` CLI is the primary tool for deploying and managing Edge Compute functions.

## Installation

```bash theme={null}
# macOS (Homebrew)
brew tap telnyx/tap
brew install telnyx-edge

# Linux / macOS (direct download)
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/

# Verify installation
telnyx-edge --help
```

## Authentication

### Login with OAuth

```bash theme={null}
telnyx-edge auth login
```

Opens a browser window for OAuth authentication. After successful login, credentials are stored locally.

### API Key Authentication

```bash theme={null}
# Set API key directly
telnyx-edge auth api-key set YOUR_API_KEY

# Clear stored API key
telnyx-edge auth api-key clear
```

### Check Authentication Status

```bash theme={null}
telnyx-edge auth status
```

Returns your authenticated organization and user info.

### Logout

```bash theme={null}
telnyx-edge auth logout
```

Clears stored credentials.

***

## Function Management

### Create a New Function

```bash theme={null}
telnyx-edge new-func -l=<language> -n=<name>
```

| Flag               | Description       | Options                               |
| ------------------ | ----------------- | ------------------------------------- |
| `-l`, `--language` | Function language | `ts`, `js`, `go`, `python`, `quarkus` |
| `-n`, `--name`     | Function name     | Alphanumeric, hyphens allowed         |

`--language` defaults to `ts` when omitted.

**Examples:**

```bash theme={null}
# Create a TypeScript function (default)
telnyx-edge new-func -l=ts -n=my-webhook

# Create a Python function
telnyx-edge new-func -l=python -n=my-webhook

# Create a Go function
telnyx-edge new-func -l=go -n=call-handler

# Create a Java (Quarkus) function
telnyx-edge new-func -l=quarkus -n=enterprise-app
```

This creates a new directory with `func.toml` plus language-specific files:

| Language  | Scaffolded files                                             |
| --------- | ------------------------------------------------------------ |
| `ts`      | `index.ts`, `package.json`, `tsconfig.json`                  |
| `js`      | `index.js`, `package.json`                                   |
| `go`      | `handler.go`, `go.mod`                                       |
| `python`  | `function`, `pyproject.toml`                                 |
| `quarkus` | `src/`, `pom.xml`, `mvnw`, `.mvn`, `README.md`, `.gitignore` |

### Deploy a Function

```bash theme={null}
telnyx-edge ship
```

Deploys the function from the current directory. Reads configuration from `func.toml`.

**Options:**

| Flag         | Description                                                               |
| ------------ | ------------------------------------------------------------------------- |
| `--from-dir` | Deploy from a specific directory                                          |
| `--timeout`  | Deployment monitoring timeout (Go duration: `2m`, `300s`; default `5m0s`) |

**Examples:**

```bash theme={null}
# Deploy from current directory
cd my-function
telnyx-edge ship

# Deploy from a specific directory
telnyx-edge ship --from-dir=./my-function
```

After deployment, the CLI outputs your function URL:

```
✓ Function deployed successfully
  URL: https://my-webhook-abc123.telnyxcompute.com
```

### Delete a Function

```bash theme={null}
telnyx-edge delete-func <function-name>
```

<Warning>
  This permanently deletes the function and all its versions. This action cannot be undone.
</Warning>

**Example:**

```bash theme={null}
telnyx-edge delete-func my-old-function
```

### List Functions

```bash theme={null}
telnyx-edge list
```

Lists all functions in your organization with their status and URLs.

### Inspect Revisions

```bash theme={null}
telnyx-edge revisions list <function-name>
```

Lists the most recent revisions for a function (newest first). Each successful `ship` produces an immutable revision that can be rolled back to with `rollback`.

### Roll Back a Function

```bash theme={null}
telnyx-edge rollback <function-name> <revision-id>
```

Instantly retargets traffic to an existing, immutable revision across all clusters — there is no rebuild or re-upload. Only revisions that reached `deploy_ok` can be rolled back to. Use `revisions list <function-name>` to see available revision ids.

***

## Secrets Management

Secrets are encrypted environment variables that are injected at runtime.

### Add a Secret

```bash theme={null}
telnyx-edge secrets add <name> "<value>"
```

**Examples:**

```bash theme={null}
# Add a single secret
telnyx-edge secrets add DATABASE_URL "postgres://user:pass@host:5432/db"

# Add an API key
telnyx-edge secrets add OPENAI_API_KEY "sk-..."
```

Secrets are available as environment variables in your function:

```python theme={null}
import os
db_url = os.environ.get('DATABASE_URL')
```

### List Secrets

```bash theme={null}
telnyx-edge secrets list
```

Lists secret names (values are not displayed for security).

### Delete a Secret

```bash theme={null}
telnyx-edge secrets delete <name>
```

**Example:**

```bash theme={null}
telnyx-edge secrets delete OLD_API_KEY
```

***

## Bindings

These commands manage the **org-level Telnyx credential** (one per organization) behind the [Telnyx API binding](/docs/edge-compute/telnyx-api/index). They're account-level — the per-function flow needs none of them: declaring `[telnyx]` in `func.toml` wires the binding automatically on `ship`.

### Create a Binding

```bash theme={null}
telnyx-edge bindings create
```

Provisions the org-level Telnyx credential. One per organization.

### View Current Binding

```bash theme={null}
telnyx-edge bindings get
```

Shows binding configuration and status.

### Validate Binding

```bash theme={null}
telnyx-edge bindings validate
```

Tests that the binding is working correctly by making a test API call.

### Regenerate Binding Tokens

```bash theme={null}
telnyx-edge bindings update
```

Regenerates binding tokens. Use this if you suspect credentials have been compromised.

### Delete Binding

```bash theme={null}
telnyx-edge bindings delete
```

Removes the binding. Functions will no longer have automatic Telnyx API access.

### Generate Binding Types

```bash theme={null}
telnyx-edge types
```

Writes `telnyx-env.d.ts` at the project root so `env.<BINDING>` is type-safe in function code, folding every declared binding into one global `Env` interface. Re-run after changing a binding declaration.

<Note>
  The `[telnyx]` binding and `telnyx-edge types` are **TypeScript-only**. `types` generates a `.d.ts` declaration file consumed by `tsc`; it has no effect on `js`, `go`, `python`, or `quarkus` runtimes.
</Note>

***

## System Commands

### Check CLI Status

```bash theme={null}
telnyx-edge status
```

Shows authentication status and connectivity to Edge Compute services.

### Get Help

```bash theme={null}
# General help
telnyx-edge --help

# Command-specific help
telnyx-edge new-func --help
telnyx-edge ship --help
```

### Update CLI

```bash theme={null}
# macOS (Homebrew)
brew upgrade telnyx-edge

# Linux / direct install
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
```

***

## Configuration File

Each function has a `func.toml` configuration file. The `new-func` scaffold generates the `[edge_compute]` block (`func_id`, `func_name`); the runtime infers the language from the files you scaffolded with `-l`. Add a `[telnyx]` block to wire the [Telnyx API binding](/docs/edge-compute/telnyx-api/index):

```toml theme={null}
# func.toml
[edge_compute]
func_id   = "60c5ce48-…"   # created by new-func
func_name = "my-webhook"

[telnyx]
binding = "MY_TELNYX"      # becomes env.MY_TELNYX after `telnyx-edge types`

[env_vars]
LOG_LEVEL = "info"
API_ENDPOINT = "https://api.example.com"

[build]
# Optional build settings
entry_point = "main.py"
```

### Configuration Fields

| Field        | Description                                                | Required                         |
| ------------ | ---------------------------------------------------------- | -------------------------------- |
| `func_id`    | Function id (created by `new-func`, reused on later ships) | Yes                              |
| `func_name`  | Function name (used in URL)                                | Yes                              |
| `language`   | Runtime language                                           | No — inferred from `new-func -l` |
| `[telnyx]`   | Telnyx API binding declaration (`binding = "NAME"`)        | No                               |
| `[env_vars]` | Environment variables                                      | No                               |
| `[build]`    | Build configuration                                        | No                               |

See [Environment Variables](/docs/edge-compute/configuration/environment-variables) for more configuration options.

***

## Common Workflows

### First Deployment

```bash theme={null}
# 1. Login
telnyx-edge auth login

# 2. Create function
telnyx-edge new-func -l=python -n=my-first-function

# 3. Edit code
cd my-first-function
# ... edit your code ...

# 4. Deploy
telnyx-edge ship
```

### Adding Secrets

```bash theme={null}
# 1. Add secrets
telnyx-edge secrets add DATABASE_URL "postgres://..."
telnyx-edge secrets add API_KEY "secret-key"

# 2. Redeploy to pick up secrets
telnyx-edge ship
```

***

## Troubleshooting

### "Not authenticated" Error

```bash theme={null}
# Re-authenticate
telnyx-edge auth logout
telnyx-edge auth login
```

### Deployment Fails

```bash theme={null}
# Check function configuration
cat func.toml

# Verify you're in the right directory
ls -la

# Check CLI status
telnyx-edge status
```

### Function Not Responding

```bash theme={null}
# Check function exists
telnyx-edge list

# Redeploy
telnyx-edge ship
```

## Next Steps

* [Quickstart](/docs/edge-compute/quickstart) — Deploy your first function
* [Secrets](/docs/edge-compute/configuration/secrets) — Secure credential management
* [Bindings](/docs/edge-compute/runtime/bindings) — Access Telnyx services
