Skip to main content

Output Formats

Control how the CLI renders command results with TTY-aware defaults and multiple output formats.
The App Store Connect CLI supports multiple output formats and automatically adapts to your environment.

Format Options

All commands that return data support three output formats:
  • json - Machine-parseable JSON (default for non-interactive contexts)
  • table - Human-readable table (default for interactive terminals)
  • markdown - Markdown-formatted tables

TTY-Aware Defaults

The CLI automatically detects whether it’s running in an interactive terminal:
# Interactive terminal (TTY detected)
asc apps list
# Output: table format

# Piped or CI environment (no TTY)
asc apps list | jq '.data[0].id'
# Output: json format
This behavior follows the principle: human-friendly in terminals, machine-friendly in pipes and scripts.

Explicit Format Selection

Override the default with the --output flag:
# Force JSON in an interactive terminal
asc apps list --output json

# Force table format in a script
asc apps list --output table

# Markdown format (alias: md)
asc apps list --output markdown

Environment Variable

Set a default format across all commands with ASC_DEFAULT_OUTPUT:
export ASC_DEFAULT_OUTPUT=json
asc apps list  # Uses JSON even in interactive terminals

# Explicit --output flag always overrides ASC_DEFAULT_OUTPUT
asc apps list --output table
Valid values: json, table, markdown, md
The --output flag always takes precedence over ASC_DEFAULT_OUTPUT and TTY detection.

Pretty-Printing JSON

For human-readable JSON output, use the --pretty flag:
asc apps list --output json --pretty
Example output:
{
  "data": [
    {
      "id": "123456789",
      "type": "apps",
      "attributes": {
        "name": "My App",
        "bundleId": "com.example.app"
      }
    }
  ]
}
The --pretty flag only works with --output json. Using --pretty with table or markdown returns an error.

Format Examples

Table Format

asc apps list --limit 2 --output table
ID          NAME        BUNDLE ID           SKU
123456789   My App      com.example.app     APP001
987654321   Other App   com.example.other   APP002

JSON Format

asc apps list --limit 1 --output json
{"data":[{"id":"123456789","type":"apps","attributes":{"name":"My App","bundleId":"com.example.app","sku":"APP001"}}]}

Markdown Format

asc apps list --limit 2 --output markdown
| ID        | NAME      | BUNDLE ID         | SKU    |
|-----------|-----------|-------------------|--------|
| 123456789 | My App    | com.example.app   | APP001 |
| 987654321 | Other App | com.example.other | APP002 |

Implementation Details

Output format resolution follows this priority order:
  1. Explicit --output flag (highest priority)
  2. ASC_DEFAULT_OUTPUT environment variable
  3. TTY detection (lowest priority)
    • TTY detected → table
    • No TTY → json
The CLI uses term.IsTerminal() to check stdout’s file descriptor. This works correctly with:
  • Pipes: asc apps list | jq
  • Redirects: asc apps list > output.json
  • CI environments: GitHub Actions, GitLab CI, Jenkins
  • Docker containers (non-interactive)

Format Registry

The CLI uses a type-safe output registry system (internal/asc/output_registry.go) that maps response types to rendering functions. This ensures:
  • Consistent formatting across all commands
  • Type-safe row extraction
  • Automatic handling of single vs. list responses
Most commands automatically support all three formats without additional code.

Best Practices

In Scripts

Always use --output json for reliability and parsing.

In CI/CD

The CLI defaults to JSON automatically in non-interactive environments.

For Debugging

Use --output json --pretty to inspect API responses.

For Reports

Use --output markdown to generate documentation snippets.