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

# API Calls

> Make single API requests with flexible output formats and field filtering

## Basic Syntax

```bash theme={null}
anysite api <endpoint> [key=value ...] [OPTIONS]
```

Parameters are passed as `key=value` pairs. The CLI automatically converts types based on the cached schema.

## Examples

<CodeGroup>
  ```bash LinkedIn User theme={null}
  anysite api /api/linkedin/user user=satyanadella
  ```

  ```bash LinkedIn Company theme={null}
  anysite api /api/linkedin/company company=anthropic
  ```

  ```bash LinkedIn Search theme={null}
  anysite api /api/linkedin/search/users keywords="CTO" count=50
  ```

  ```bash Instagram User theme={null}
  anysite api /api/instagram/user user=natgeo
  ```

  ```bash Twitter User theme={null}
  anysite api /api/twitter/user user=elonmusk
  ```
</CodeGroup>

## Output Formats

Control how results are displayed with `--format` (or `-f`):

<Tabs>
  <Tab title="JSON (default)">
    ```bash theme={null}
    anysite api /api/linkedin/user user=satyanadella --format json
    ```

    ```json theme={null}
    {
      "name": "Satya Nadella",
      "headline": "Chairman and CEO at Microsoft",
      "urn": {
        "value": "ACoAAA8BYqEBCGLg_vT_ca6mMEqkR9bc",
        "type": "member"
      },
      ...
    }
    ```
  </Tab>

  <Tab title="CSV">
    ```bash theme={null}
    anysite api /api/linkedin/search/users keywords="CTO" count=10 --format csv
    ```

    Generates a CSV file suitable for spreadsheets and further processing.
  </Tab>

  <Tab title="JSONL">
    ```bash theme={null}
    anysite api /api/linkedin/company/employees companies=anthropic --format jsonl
    ```

    One JSON object per line — ideal for streaming and piping to other tools.
  </Tab>

  <Tab title="Table">
    ```bash theme={null}
    anysite api /api/linkedin/user user=satyanadella --format table
    ```

    Human-readable table format for quick visual inspection.
  </Tab>
</Tabs>

## Field Filtering

### Include Specific Fields

Select only the fields you need:

```bash theme={null}
anysite api /api/linkedin/user user=satyanadella --fields "name,headline,urn.value"
```

Supports dot-notation for nested fields.

### Exclude Fields

Remove verbose or unnecessary fields:

```bash theme={null}
anysite api /api/linkedin/user user=satyanadella --exclude "certifications,courses,honors"
```

### Field Presets

Use built-in presets for common use cases:

```bash theme={null}
anysite api /api/linkedin/user user=satyanadella --fields-preset minimal
anysite api /api/linkedin/user user=satyanadella --fields-preset contact
anysite api /api/linkedin/user user=satyanadella --fields-preset recruiting
```

## Saving Output

### Save to File

```bash theme={null}
anysite api /api/linkedin/search/users keywords="CTO" count=50 \
  --format csv --output ctos.csv
```

### Compact JSON

Minify JSON output for smaller file sizes:

```bash theme={null}
anysite api /api/linkedin/user user=satyanadella --compact
```

### Quiet Mode

Suppress progress messages for clean piping:

```bash theme={null}
anysite api /api/linkedin/user user=satyanadella -q --format jsonl
```

## Piping to Other Tools

Combine with database loading or other CLI commands:

```bash theme={null}
# API → Database
anysite api /api/linkedin/user user=satyanadella -q --format jsonl | \
  anysite db insert mydb --table profiles --stdin --auto-create

# API → File
anysite api /api/linkedin/search/users keywords="engineer" count=100 \
  -q --format csv > engineers.csv

# API → jq filtering
anysite api /api/linkedin/user user=satyanadella -q | jq '.name, .headline'
```

## Options Reference

| Option            | Short | Description                                                      |
| ----------------- | ----- | ---------------------------------------------------------------- |
| `--format`        | `-f`  | Output format: `json`, `jsonl`, `csv`, `table` (default: `json`) |
| `--fields`        |       | Include only specified fields (comma-separated, dot-notation)    |
| `--exclude`       |       | Exclude specified fields from output                             |
| `--fields-preset` |       | Built-in field preset: `minimal`, `contact`, `recruiting`        |
| `--compact`       |       | Minify JSON output                                               |
| `--output`        | `-o`  | Save output to file                                              |
| `-q`              |       | Quiet mode — suppress progress messages                          |

## Next Steps

<CardGroup cols={2}>
  <Card title="Batch Processing" icon="layer-group" href="/cli/batch-processing">
    Process multiple inputs with parallelism and rate limiting
  </Card>

  <Card title="Dataset Pipelines" icon="diagram-project" href="/cli/datasets/overview">
    Build multi-source workflows with dependency chains
  </Card>
</CardGroup>
