Open Source CLI for Vtiger CRM

Manage your Vtiger CRM
from the terminal

A command-line tool to query, create, update and sync data across multiple Vtiger CRM instances. One binary, zero overhead.

curl get.javanile.org/vtc | sh

Quick Start

Install vtc with a single command. For manual installation or building from source, follow the instructions on the GitHub repository.

$ curl get.javanile.org/vtc | sh

Then connect to your Vtiger CRM in three simple steps.

Initialize config

This creates a vtiger.config.json file with default values.

$ vtc init

Edit your credentials

Set your CRM URL, username and access key.

$ nano $(vtc config:file)
{
    "vtiger_url":  "https://yourcrm.example.com/vtigercrm/",
    "username":    "admin",
    "access_key":  "your-access-key-here"
}

Test the connection

If you see "success": true, you're connected.

$ vtc ping
{"success":true,"result":{"sessionName":"...","userId":"19x1"}}

Multiple CRM

The CRM environment variable is the most powerful feature of vtc. It lets you manage multiple Vtiger instances from the same terminal without switching directories.

How it works

When you set the CRM variable, vtc reads configuration from ~/.vtc/<name>/vtiger.config.json instead of the current directory.

CRM not set ./vtiger.config.json
CRM=production ~/.vtc/production/vtiger.config.json
CRM=staging ~/.vtc/staging/vtiger.config.json
CRM=client-mumbai ~/.vtc/client-mumbai/vtiger.config.json
CRM=client-delhi ~/.vtc/client-delhi/vtiger.config.json

Setting up multiple CRM instances

Initialize each instance

Run vtc init with the CRM variable for each instance you want to manage.

$ CRM=production    vtc init
$ CRM=staging       vtc init
$ CRM=client-mumbai vtc init

Edit each config file

Set the correct URL, username and access key for each CRM.

$ nano $(CRM=production vtc config:file)
$ nano $(CRM=staging vtc config:file)
$ nano $(CRM=client-mumbai vtc config:file)

Test all connections

$ CRM=production    vtc ping
$ CRM=staging       vtc ping
$ CRM=client-mumbai vtc ping

Listing all configured instances

Use vtc crm-list to see all your configured CRM instances at a glance:

$ vtc crm-list

Using CRM in daily work

Every vtc command respects the CRM variable. Just prefix it:

# Query contacts on production
$ CRM=production vtc query "SELECT * FROM Contacts LIMIT 10"

# Describe module on staging
$ CRM=staging vtc describe Accounts

# Retrieve a record from client instance
$ CRM=client-mumbai vtc retrieve 12x1020

Export for the entire session

If you're working on one instance for a while, export it once:

$ export CRM=production
$ vtc ping                              # uses production
$ vtc query "SELECT * FROM Leads"        # uses production
$ vtc describe Contacts                  # uses production

# Switch back to local config:
$ unset CRM

Shell aliases for quick access

Add these to your .bashrc or .zshrc for faster workflows:

# Add to ~/.bashrc or ~/.zshrc
alias vtc-prod='CRM=production vtc'
alias vtc-stag='CRM=staging vtc'
alias vtc-mum='CRM=client-mumbai vtc'

Then use them directly:

$ vtc-prod query "SELECT * FROM Accounts"
$ vtc-stag describe Leads
$ vtc-mum ping

Command Reference

Complete list of all available vtc commands with usage examples.

vtc init

Creates the vtiger.config.json configuration file with default values.

$ vtc init                        # in current directory
$ CRM=mycrm vtc init              # in ~/.vtc/mycrm/

vtc ping

Tests the connection by performing a challenge + login against the CRM.

$ vtc ping
$ CRM=production vtc ping

vtc config:dir

Prints the directory containing the config file.

$ vtc config:dir
/home/user/myproject

$ CRM=production vtc config:dir
/home/user/.vtc/production

vtc config:file

Prints the full path to the config file. Useful for piping to an editor.

$ nano $(vtc config:file)
$ nano $(CRM=production vtc config:file)

vtc crm-list

Lists all configured CRM instances with their name and URL. Also available as crm:list, list-crm, list:crm.

$ vtc crm-list
NAME          URL
------------------------------------------
(local)       https://demo.vtiger.com/vtigercrm/
production    https://crm.example.com/vtigercrm/
staging       https://staging.example.com/vtigercrm/

vtc query "QUERY"

Executes a Vtiger Webservice query. SQL-like syntax with Vtiger limitations.

# Fetch all contacts
$ vtc query "SELECT * FROM Contacts"

# With filters
$ vtc query "SELECT firstname, lastname FROM Contacts WHERE lastname = 'Sharma'"

# With LIMIT
$ vtc query "SELECT * FROM Leads LIMIT 20"

# Accounts by industry
$ vtc query "SELECT accountname, phone FROM Accounts WHERE industry = 'IT Services'"

vtc listtypes

Lists all available modules (entity types) in the CRM.

$ vtc listtypes

vtc describe MODULE [DEPTH]

Describes the structure of a module: fields, types, mandatory flags, picklist values. The DEPTH parameter resolves referenced modules recursively.

# Basic module structure
$ vtc describe Contacts

# With reference resolution
$ vtc describe Contacts 1
$ vtc describe Contacts 2

vtc retrieve CRMID [DEPTH]

Fetches a single record by its CRMID (format: NUMBERxNUMBER, e.g. 12x1020).

$ vtc retrieve 12x1020
$ vtc retrieve 12x1020 1    # with depth

vtc create MODULE ELEMENT

Creates a new record. Pass data as inline JSON or from a file with @ prefix.

# Inline JSON
$ vtc create Contacts '{"firstname":"Ravi","lastname":"Kumar","email":"ravi@example.com"}'

# From JSON file
$ vtc create Contacts @contact.json

vtc update MODULE ELEMENT

Updates an existing record. The id field must be present in the element.

# Inline JSON with id
$ vtc update Contacts '{"id":"12x1020","phone":"+91 22 12345678"}'

# From file
$ vtc update Contacts @update.json

# With separate id and file
$ vtc update Contacts 12x1020 @data.json

vtc revise MODULE ELEMENT

Partially updates a record. Only the specified fields are modified; other fields remain unchanged.

# From file
$ vtc revise Contacts @revision.json

# Single field update
$ vtc revise Contacts 12x1020 phone "+91 22 9999999"

# With separate id and file
$ vtc revise Contacts 12x1020 @partial.json

Recipes & Use Cases

Practical examples for common workflows.

📋

Multi-CRM Health Check

Monitor all your CRM instances with a simple loop.

#!/bin/bash
for crm in production staging; do
  echo "=== $crm ==="
  CRM=$crm vtc ping
  echo
done
💾

Export Data to JSON

Pull CRM data and save it for analysis or reporting.

$ CRM=production vtc query \
  "SELECT * FROM Contacts" \
  > contacts.json

# Pipe to jq for formatting
$ CRM=production vtc query \
  "SELECT * FROM Leads" \
  | jq '.result'

Cron Automation

Schedule periodic data pulls or sync checks.

# crontab -e
0 */6 * * * CRM=production \
  /usr/local/bin/vtc query \
  "SELECT * FROM Leads \
  WHERE createdtime > '2024-01-01'" \
  >> /var/log/crm-leads.json
🚀

CI/CD Pipeline

Validate CRM connectivity before deployment steps.

# In your CI script
export CRM=test
vtc ping || exit 1
vtc listtypes
echo "CRM connection verified"
🔭

Bulk Create from File

Prepare records in a JSON file and push them to CRM.

# Create contact.json with your data
$ CRM=production vtc create \
  Contacts @contact.json

# Loop over multiple files
for f in records/*.json; do
  CRM=production vtc create Leads @$f
done
🔎

Module Discovery

Explore what modules and fields are available in a CRM.

# List all modules
$ vtc listtypes | jq '.result.types'

# Get field details
$ vtc describe Accounts \
  | jq '.result.fields[].name'

Configuration

The vtiger.config.json file contains everything needed to connect to a Vtiger instance.

ParameterDescriptionExample
vtiger_url Full URL of the Vtiger CRM instance (with trailing slash) https://crm.example.com/vtigercrm/
username Webservice username admin
access_key Webservice access key from Vtiger UI PcC1w0COZDYbqBi
{
    "vtiger_url":  "https://crm.example.com/vtigercrm/",
    "username":    "admin",
    "access_key":  "your-access-key-here"
}

Where to find the Access Key

In Vtiger CRM, navigate to My Preferences (user icon at the top-right corner). Scroll down to the User Advanced Options section and copy the Access Key value.

Requirements

PHP >= 7.0

PHP runtime with ext-json enabled

Network Access

The CRM must be reachable via HTTPS from your machine

Webservice Enabled

Vtiger Webservices must be active on the CRM instance

Need Help?

We are here to help you. If you have questions, found a bug, or need assistance with vtc, the best way to get support is by opening an issue on our GitHub repository.

Our team actively monitors issues and will respond as soon as possible. When opening an issue, please include:

Open an Issue on GitHub