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

# CLI

> Discover, run, wait for, and export SocQ tasks from a terminal.

# CLI

Use the SocQ CLI for terminal workflows, automation, and exporting normalized task results as JSON, JSONL, CSV, or tables.

## Install and authenticate

```bash theme={"system"}
npm install -g @socq/cli
socq auth login
```

For CI, set `SOCQ_API_KEY` instead of using interactive login. Avoid `--api-key` in normal terminal use because command arguments may remain in shell history or process listings.

## Discover endpoints

```bash theme={"system"}
socq platforms
socq tools youtube
socq describe youtube/comments
```

Use `describe` before building automation so the command uses the current input schema and billing information from the Capability Registry.

## Complete your first collection

```bash theme={"system"}
socq youtube comments \
  --urls "https://www.youtube.com/watch?v=VIDEO_ID" \
  --sort-by newest \
  --wait
```

The dynamic command maps directly to:

```text theme={"system"}
REST:      POST /v1/youtube/comments
Endpoint:  youtube/comments
MCP tool:  socq_youtube_comments
CLI:       socq youtube comments
```

Use the stable generic form when inputs come from a file:

```bash theme={"system"}
socq run youtube comments \
  --input-file request.json \
  --format jsonl \
  --output results.jsonl \
  --wait
```

## Resume without resubmitting

If a command returns before the collection finishes, keep the task ID:

```bash theme={"system"}
socq task get TASK_ID
socq task wait TASK_ID --timeout 180
socq task results TASK_ID --result-fields id,url,text,author.username --format csv --output results.csv
socq task files TASK_ID
```

Task results use the fixed resource schema. Use optional `--result-fields` for a smaller projection.

Do not submit the original collection again just because a local wait timed out. Resume the existing task.

## Attribute Agent Skill executions

Normal CLI submissions are recorded with `request_source="cli"`. When an Agent Skill falls back to the CLI, pass the source marker on the submission command:

```bash theme={"system"}
socq youtube comments --urls "https://www.youtube.com/watch?v=VIDEO_ID" --request-source skill
```

`SOCQ_REQUEST_SOURCE=skill` provides the same behavior. New tasks are then recorded as `skill-cli`; task polling commands do not need the marker.

## Output formats

| Format | Best for |
| - | - |
| `table` | Reading a small result in a terminal |
| `json` | Structured output and scripts |
| `jsonl` | Streaming or large exports |
| `csv` | Spreadsheets and data analysis |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.