Perimattic
Guides

Tally API Integration: A Developer Guide to TallyPrime's XML Gateway, TDL & REST Interface

ERPPlugs Team10 March 202611 min read7 sections
TallyPrime does not expose a conventional REST API. Its integration surface is an XML-over-HTTP gateway on port 9000 that accepts TDL-flavoured XML requests and returns XML responses, supplemented by a COM-based Tally.Connector interface for .NET applications. Developers can query and push data this way, but production-grade bidirectional sync — with retry logic, GST compliance, and multi-entity support — is where a managed bridge like ERPPlugs saves months of engineering.
1

Tally Does Not Have a REST API — Here Is What It Has Instead

If you have ever searched for "Tally API," you have probably noticed that the documentation is sparse and the terminology is confusing. That is because TallyPrime was not designed around a modern API paradigm. It predates REST, predates JSON, and predates the assumption that every application should expose HTTP endpoints for third-party consumption.

What Tally actually offers is an XML-over-HTTP gateway. When TallyPrime is running, it listens on a configurable port (default 9000) for incoming HTTP POST requests. You send it an XML payload describing what you want — fetch a list of ledgers, export a day-book, import a voucher — and it responds with XML. There is no authentication token, no versioned endpoint path, no OpenAPI spec. It is a single URL (`http://localhost:9000`) that accepts everything as a POST body.

This is not a limitation born of negligence. Tally's integration model was designed when desktop applications ruled Indian business computing, and the assumption was that the integration layer (TDL or a COM client) would run on the same machine. It works — millions of Indian businesses depend on it — but it is a fundamentally different model from what most developers expect in 2026.


2

The Three Integration Surfaces

TallyPrime exposes three distinct ways to integrate. Each has different trade-offs, and choosing the right one depends on your use case.

1. XML/HTTP Gateway (Port 9000) — This is the most common approach. You craft an XML request using TDL syntax, POST it to Tally's listening port, and parse the XML response. It supports both data export (reading ledgers, vouchers, stock items, trial balances) and data import (creating vouchers, ledgers, cost centres). The XML format is specific to Tally and does not follow any standard schema — you need to learn TDL's request/response conventions.

2. TDL (Tally Definition Language) — TDL is Tally's built-in scripting language. It can define custom reports, modify the Tally UI, create computed fields, and generate export formats. For integration, TDL is used to define the shape of data you want to pull from or push into Tally. When you send an XML request to port 9000, the request body is essentially a TDL expression wrapped in XML. TDL is powerful but has a steep learning curve — it is not a general-purpose language and its documentation is scattered.

3. Tally.Connector (COM Interface) — This is a COM-based API that ships with Tally. It allows .NET applications to interact with TallyPrime programmatically without crafting raw XML. You instantiate a `Tally.Connector` COM object, call methods to send requests and receive responses, and the COM layer handles the HTTP transport. This is convenient if you are building a Windows-native integration in C# or VB.NET, but it ties you to Windows and the .NET runtime.


3

A Practical Example: Fetching Ledgers via the XML Gateway

To give you a concrete feel for how the XML gateway works, here is what a request to fetch all ledger names from TallyPrime looks like. You POST this XML body to `http://localhost:9000`:

``` <ENVELOPE> <HEADER> <VERSION>1</VERSION> <TALLYREQUEST>Export</TALLYREQUEST> <TYPE>Collection</TYPE> <ID>All Ledgers</ID> </HEADER> <BODY> <DESC> <STATICVARIABLES> <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT> </STATICVARIABLES> <TDL> <TDLMESSAGE> <COLLECTION NAME="All Ledgers"> <TYPE>Ledger</TYPE> <FETCH>NAME, PARENT, OPENINGBALANCE</FETCH> </COLLECTION> </TDLMESSAGE> </TDL> </DESC> </BODY> </ENVELOPE> ```

Tally responds with XML containing every ledger in the active company, along with the parent group and opening balance for each. The response looks something like:

``` <ENVELOPE> <COLLECTION> <LEDGER NAME="Cash"> <PARENT>Cash-in-Hand</PARENT> <OPENINGBALANCE>50000.00</OPENINGBALANCE> </LEDGER> <LEDGER NAME="HDFC Bank"> <PARENT>Bank Accounts</PARENT> <OPENINGBALANCE>247500.00</OPENINGBALANCE> </LEDGER> ... </COLLECTION> </ENVELOPE> ```

This looks straightforward, but the reality gets complicated fast. Want to fetch vouchers for a specific date range? The TDL syntax changes. Want to import a sales voucher with line items, GST details, and inventory allocations? The XML nesting is deep and the field names are not always intuitive. Error handling is minimal — Tally often returns a 200 status with an error message buried in the XML body.


4

What Makes Tally Integration Genuinely Hard

The XML gateway works. Developers have built integrations on it for years. But there are real engineering challenges that do not surface in a hello-world example:

1

No formal schema: Tally's XML does not conform to a published XSD or JSON Schema. The structure varies by object type, Tally version, and even company configuration. You end up reverse-engineering the format from examples and trial-and-error.

2

TDL is its own world: TDL is not XML, not SQL, not a scripting language you already know. It has its own syntax for filtering, aggregation, and computed fields. Mastering it takes weeks, and the official documentation assumes familiarity with Tally's internal object model.

3

Single-threaded listener: Tally's HTTP listener processes requests sequentially. If you send a heavy export request (say, an entire year of vouchers), it blocks all other requests until it finishes. In production integrations, this means you need queuing and request throttling on your side.

4

No webhook or push model: Tally does not notify you when data changes. There is no event stream, no webhook, no change-data-capture mechanism. You must poll — repeatedly querying Tally to detect new or modified records. Efficient polling without hammering the server requires careful timestamp tracking and diff logic.

5

Company context switching: If the Tally instance has multiple company files, you need to ensure the correct company is active when you send a request. There is no per-request company selector in the standard XML API — you rely on Tally's currently-loaded company. Handling multi-company setups requires coordination.

6

GST and compliance nuance: Importing a sales voucher is not just about amounts and ledger names. The voucher needs correct GST ledger allocations (CGST, SGST, IGST), HSN/SAC codes, party GSTIN, place of supply, and e-invoice fields if applicable. Getting any of these wrong means the voucher fails GST validation inside Tally.


5

When to Build It Yourself

There are legitimate reasons to build a custom Tally integration from scratch:

1

Simple, one-direction reads: If you only need to pull a daily trial balance or ledger balances from Tally into a dashboard, the XML gateway is perfectly adequate. Write a script, parse the XML, store the result. Done.

2

Internal tooling for a single company: If you are building an internal tool for one business with one Tally company file, the scope is manageable. You know the ledger names, the voucher types, and the company structure. You do not need to handle arbitrary configurations.

3

Learning exercise: If you want to understand how Tally works under the hood, building a small integration teaches you more than any documentation. Start with reading data (ledgers, stock items) before attempting writes (vouchers).

4

You have a TDL expert on staff: If someone on your team already knows TDL, the hardest part of the integration is already solved. TDL expertise is rare, but if you have it, custom integrations are very feasible.


6

When to Use a Managed Bridge Instead

The calculus changes when the integration needs to be production-grade, bidirectional, or multi-tenant. Here is where a managed bridge like ERPPlugs earns its keep:

1

Bidirectional sync: Reading from Tally is one thing. Writing back — creating vouchers with correct GST treatment, handling inventory allocations, managing cost centres — is significantly harder. A bridge that has already solved these edge cases saves months of development.

2

Production reliability: Retry logic, error recovery, queue management, dead-letter handling, sync conflict resolution — these are not Tally-specific problems, but they are essential for any integration that runs unattended. Building these from scratch is engineering overhead that has nothing to do with your core product.

3

GST compliance: India's GST rules change frequently. A managed bridge that stays current with e-invoicing thresholds, HSN code requirements, and filing format changes means you do not have to maintain compliance logic yourself.

4

Multi-company and multi-branch: If you are integrating for multiple Tally companies — yours or your clients' — you need to handle company switching, different ledger structures, and potentially different Tally versions. A bridge abstracts this complexity.

5

Support and maintenance: Tally releases updates that can change XML response formats or TDL behavior. A managed bridge absorbs these breaking changes so you do not have to.


7

How ERPPlugs Approaches Tally Integration Differently

ERPPlugs does not ask you to learn TDL or craft XML. The bridge app — a lightweight Windows application that runs alongside TallyPrime — handles all the low-level communication. It maintains a persistent connection to Tally's port 9000, manages company context, throttles requests to avoid blocking Tally's listener, and implements the retry and queuing logic that production integrations need.

On the other side, the ERPPlugs cloud dashboard connects to your business tools (Shopify, Amazon, Razorpay, and others) via their standard APIs. The bridge app and the cloud layer sync through a secure channel, so your Tally data never needs to be directly exposed to the internet.

The result is that you can connect TallyPrime to a Shopify store, an Amazon seller account, or a payment gateway in about 5 minutes — without writing a single line of TDL, XML, or integration code. If you are a developer evaluating whether to build or buy, the honest answer is: build if your use case is simple and read-only; use a bridge like ERPPlugs if you need production-grade bidirectional sync with GST compliance.

You can browse the full set of available connectors at the ERPPlugs connector catalog to see which integrations are ready to go.

FAQ

Frequently Asked Questions

Quick answers about topics covered in this article

TallyPrime does not have a conventional REST API with JSON endpoints. Instead, it exposes an XML-over-HTTP gateway that listens on port 9000 (configurable). You send XML requests using TDL (Tally Definition Language) syntax via HTTP POST and receive XML responses. There is also a COM-based Tally.Connector interface for .NET applications. Neither follows REST conventions — there are no versioned URLs, no authentication tokens, and no JSON support.

To send data to TallyPrime, you craft an XML import request containing the voucher or master data (ledger, stock item, etc.) in TDL-compatible format and POST it to TallyPrime's HTTP listener at http://localhost:9000. The XML must include the correct voucher type, ledger allocations, and — for GST-compliant vouchers — the appropriate tax ledger entries with HSN codes and party GSTIN. Tally responds with XML indicating success or failure, though error messages can be cryptic and are embedded in the response body rather than HTTP status codes.

Build custom if your use case is simple and one-directional — for example, pulling a daily trial balance into a dashboard. Use a managed bridge like ERPPlugs when you need bidirectional sync (reading and writing data), production reliability (retries, queuing, error recovery), GST compliance that stays current with regulatory changes, or multi-company support. The XML gateway works, but building a production-grade integration around it typically takes 2-3 months of development and ongoing maintenance.

Get Started

Ready to automate your ERP workflows?

Connect your ERP with your business tools in under 5 minutes. No coding required.