Show quick reference for using the xaffinity CLI
Provides quick reference for the xaffinity CLI with common patterns and gotchas for querying and exporting CRM data. Use this when you need to search people/companies, export lists, or parse JSON output with jq.
/plugin marketplace add yaniv-golan/affinity-sdk/plugin install cli@xaffinityShow a quick reference for using the xaffinity CLI.
Always use --readonly unless the user explicitly approves data modification. CRM data is sensitive!
First: Run xaffinity config check-key --json to get the CLI pattern, then use it for all commands.
# Standard pattern for queries
xaffinity --readonly person search "John Smith" --json
xaffinity --readonly person get 123 --json
xaffinity --readonly company get domain:acme.com --json
# Export to CSV (no --json needed)
xaffinity --readonly person ls --all --csv people.csv --csv-bom
# Export list with associations
xaffinity --readonly list export LIST_ID --expand people --all --csv output.csv
# Parse JSON with jq
xaffinity --readonly person ls --json --all | jq '.data.persons[]'
--json: For structured, parseable output--readonly: Only allow writes when user explicitly approvescheck-key: Run xaffinity config check-key --json and use the pattern field for all commands--all can be slow: Exports with --all paginate through entire dataset - may take minutes for large CRMslist export --filter is client-side: Fetches ALL data then filters locally (slow). Use --saved-view instead for large liststype, name, domain, etc.--help: Never guess command options| Task | Command |
|---|---|
| Find person by email | person get email:user@example.com |
| Find company by domain | company get domain:acme.com |
| Export all contacts | person ls --all --csv contacts.csv --csv-bom |
| Export pipeline | list export LIST_ID --all --csv out.csv |
xaffinity --helpxaffinity <command> --help (e.g., xaffinity person --help)