crm
Affinity CLI for CI
Use the Affinity CLI for CI with headless JSON commands, schema discovery, credentials, and permission controls.
8 functions 6 read 2 write API key auth
Affinity CLI for CI
Run integration calls from CI jobs with JSON output, explicit credentials, and predictable exit status.
Use this shape when a pipeline needs to read or update an external service. The Affinity CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Affinity CLI for CI
kosmokrator integrations:configure affinity --set api_key="$AFFINITY_API_KEY" --enable --read allow --write ask --json
kosmo integrations:call affinity.affinity_list_contacts '{"limit":1,"page":1}' --json Discovery Before Execution
Agents and scripts can inspect Affinity docs and schemas before choosing a function.
kosmo integrations:docs affinity --json
kosmo integrations:docs affinity.affinity_list_contacts --json
kosmo integrations:schema affinity.affinity_list_contacts --json
kosmo integrations:search "Affinity" --json
kosmo integrations:list --json Useful Affinity CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
affinity.affinity_list_contacts | Read | limit, page | List contacts from Affinity CRM. Returns contact names, emails, phone numbers, and associated organizations. Use pagination to retrieve large result sets. |
affinity.affinity_get_contact | Read | id | Get details for a specific contact in Affinity by its ID. Returns the contact's full profile including name, emails, phone numbers, organization, and custom fields. |
affinity.affinity_create_contact | Write | first_name, last_name, emails, organization_ids | Create a new contact in Affinity CRM. Provide at least a first name or last name. Optionally include email addresses. |
affinity.affinity_list_organizations | Read | limit, page | List organizations from Affinity CRM. Returns organization names, domains, and details. Use pagination to retrieve large result sets. |
affinity.affinity_get_organization | Read | id | Get details for a specific organization in Affinity by its ID. Returns the organization's full profile including name, domain, people, and custom fields. |
affinity.affinity_create_organization | Write | name, domain | Create a new organization in Affinity CRM. Provide a name (required) and optionally a domain. |
affinity.affinity_list_lists | Read | none | List all lists in Affinity CRM. Returns list names, types (contact or organization), and ownership details. |
affinity.affinity_get_current_user | Read | none | Get the currently authenticated Affinity user's profile. Useful for verifying API credentials and identifying the active account. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.