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

# Introduction

> Automate social media posting from the command line with the Postiz CLI

<Note>
  Create AI-powered UGC videos for your social media with [Agent Media](https://agent-media.ai) — generate engaging video content and schedule it directly with Postiz. Perfect for OpenClaw 🦞
</Note>

<Warning>
  For your AI agent to work best with Postiz, install the skill by running:

  ```bash theme={null}
  npx skills add gitroomhq/postiz-agent
  ```

  Or load the SKILL md file from [github.com/gitroomhq/postiz-agent](https://github.com/gitroomhq/postiz-agent).
</Warning>

The Postiz CLI is a command-line tool for automating social media posting across 28+ platforms. It wraps the [Public API](/public-api/introduction) so you can schedule posts, manage integrations, and upload media directly from your terminal or shell scripts.

## Installation

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install -g postiz
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm install -g postiz
    ```
  </Tab>
</Tabs>

Verify the installation:

```bash theme={null}
postiz --help
```

## Authentication

### Option 1: OAuth2 (Recommended)

Authenticate using the device flow — no client ID or secret needed:

```bash theme={null}
postiz auth:login
```

This will:

1. Display a one-time code in your terminal
2. Open your browser to authorize
3. Automatically save credentials to `~/.postiz/credentials.json`

```bash theme={null}
# Check current auth status
postiz auth:status

# Remove stored credentials
postiz auth:logout
```

### Option 2: API Key

Set your Postiz API key as an environment variable. You can get your API key from the Postiz Settings page.

```bash theme={null}
export POSTIZ_API_KEY=your_api_key_here
```

<Tip>
  Add this to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.) so it persists across sessions.
</Tip>

<Note>
  OAuth2 credentials take priority over the API key when both are present.
</Note>

### Custom API URL (self-hosted)

If you're running a self-hosted Postiz instance, point the CLI to your server:

```bash theme={null}
export POSTIZ_API_URL=https://your-postiz-server.com
```

### Self-Hosting the Auth Server

By default, `postiz auth:login` uses the hosted auth server at `cli-auth.postiz.com`. If you want to self-host the OAuth2 device flow server, see the [Authentication](/cli/authentication) page for the full setup guide.

## Quick Start

```bash theme={null}
# 1. List your connected social media accounts
postiz integrations:list

# 2. Create a scheduled post
postiz posts:create \
  -c "Hello from the Postiz CLI!" \
  -s "2025-01-15T10:00:00Z" \
  -i "your-integration-id"

# 3. List your scheduled posts
postiz posts:list
```

## Commands Overview

| Command                 | Description                                                             |
| ----------------------- | ----------------------------------------------------------------------- |
| `auth:login`            | Authenticate via OAuth2 device flow                                     |
| `auth:status`           | Check current authentication status                                     |
| `auth:logout`           | Remove stored credentials                                               |
| `integrations:list`     | List all connected social media accounts                                |
| `integrations:settings` | Get the settings schema for an integration                              |
| `integrations:trigger`  | Trigger a dynamic tool on an integration                                |
| `posts:create`          | Create a new post                                                       |
| `posts:list`            | List posts with optional date filtering                                 |
| `posts:delete`          | Delete a post by ID                                                     |
| `posts:missing`         | List available content from provider for a post with missing release ID |
| `posts:connect`         | Connect a post to its published content by release ID                   |
| `analytics:platform`    | Get analytics for an integration/channel                                |
| `analytics:post`        | Get analytics for a specific post                                       |
| `upload`                | Upload a media file                                                     |

<Note>
  All commands output JSON, making the CLI easy to use in scripts and automation pipelines.
</Note>
