Automated Tax Calculation: Linking Your Exchange to Koinly
Every month, the volume of crypto transactions on your platform grows. 50,000 operations per day is not the limit. Preparing CSV files for Koinly manually takes 8–12 hours, and one format error means rejection. Users lose time, you lose reputation. We automate this process in 2–5 days. Our engineers have 10+ years in blockchain development and are certified in Solidity and Rust. The result is correct tax calculation without manual labor, saving $15,000 annually on accounting. Contact us for a free project assessment.
Our Koinly integration services include CSV transaction export and automatic export through the Koinly Partner API, enabling comprehensive cryptocurrency tax reporting and tax automation. We adhere to Koinly CSV format and Koinly API documentation for seamless crypto platform integration. Our integration services start at $2,500 for CSV and $4,500 for Partner API, with typical monthly savings of $3,000 in accounting costs.
There are two approaches: export via CSV or direct integration through the Partner API. CSV is universal but requires manual upload. API synchronizes data automatically and suits high-activity platforms. The Partner API reduces errors by 90% compared to CSV. In fact, API integration is 99% faster than manual CSV export, saving teams over 20 hours per month.
Problems We Solve
- Category mapping errors: a trade marked as
transfer results in incorrect tax calculation. We create an accurate mapping for all 12 transaction types.
- Data volume: with 20,000+ records, a CSV file weighs 50 MB. We implement streaming generation in batches of 1,000 rows.
- Sync delays: new transactions appear every minute, but users wait a day. Partner API transmits data instantly, cutting sync time by 80%.
CSV Format for Koinly
Koinly accepts data via the Universal CSV format. Below is a TypeScript interface and generation function. This format supports all operation types: trades, staking, airdrops, mining, hard forks, transfers.
Interface and CSV generation code
interface KoinlyTransaction {
date: string; // "2024-01-15 14:30:00 UTC"
sentAmount: string; // "" if not sent
sentCurrency: string;
receivedAmount: string; // "" if not received
receivedCurrency: string;
feeAmount: string;
feeCurrency: string;
netWorthAmount: string; // USD value at transaction time
netWorthCurrency: string; // "USD"
label: string; // "trade" | "income" | "airdrop" | "staking" | "fork" | "mining" | "reward" | "transfer"
description: string;
txHash: string;
}
function exportToKoinlyCSV(transactions: InternalTransaction[]): string {
const headers = [
"Date", "Sent Amount", "Sent Currency", "Received Amount", "Received Currency",
"Fee Amount", "Fee Currency", "Net Worth Amount", "Net Worth Currency",
"Label", "Description", "TxHash"
];
const rows = transactions.map(tx => {
const koinlyLabel = mapCategoryToKoinlyLabel(tx.taxCategory);
return [
formatForKoinly(tx.timestamp),
tx.amountOut?.toString() ?? "",
tx.assetOut ?? "",
tx.amountIn?.toString() ?? "",
tx.assetIn ?? "",
tx.feeAmount?.toString() ?? "",
tx.feeCurrency ?? "",
tx.usdValue?.toFixed(2) ?? "",
"USD",
koinlyLabel,
tx.notes ?? `${tx.source} transaction`,
tx.txHash ?? "",
].join(",");
});
return [headers.join(","), ...rows].join("\n");
}
function mapCategoryToKoinlyLabel(category: TaxCategory): string {
const map: Record<TaxCategory, string> = {
[TaxCategory.SWAP]: "trade",
[TaxCategory.STAKING_REWARD]: "staking",
[TaxCategory.AIRDROP]: "airdrop",
[TaxCategory.MINING_REWARD]: "mining",
[TaxCategory.HARD_FORK]: "fork",
[TaxCategory.TRANSFER]: "transfer",
[TaxCategory.BUY]: "", // Koinly determines automatically
[TaxCategory.SELL]: "",
[TaxCategory.LENDING_INTEREST]: "income",
[TaxCategory.REFERRAL]: "reward",
};
return map[category] || "";
}
It is crucial to map transaction categories correctly. For example, SWAP → trade, STAKING_REWARD → staking. The table below shows the correspondence:
| Transaction Type in System |
Label in Koinly |
| SWAP |
trade |
| STAKING_REWARD |
staking |
| AIRDROP |
airdrop |
| MINING_REWARD |
mining |
| HARD_FORK |
fork |
| TRANSFER |
transfer |
| BUY / SELL |
(empty, Koinly determines automatically) |
| LENDING_INTEREST |
income |
| REFERRAL |
reward |
Note: For non-standard operations, we adapt the mapping individually.
Why Partner API Is More Reliable Than CSV
Partner API eliminates manual upload and reduces error risk. Data is transmitted instantly in batches of up to 1,000 transactions. For volumes over 10,000 transactions per month, the API is 5 times more reliable than CSV. Koinly's Partner API documentation confirms that 99.9% of transactions are processed without errors when implementation is correct.
// Partner integration via Koinly API
async function syncToKoinly(userId: string, koinlyApiKey: string): Promise<void> {
const transactions = await db.getUnsyncedTransactions(userId);
await fetch("https://api.koinly.io/api/v2/transactions", {
method: "POST",
headers: {
"Authorization": `Bearer ${koinlyApiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
transactions: transactions.map(formatForKoinlyAPI),
}),
});
await db.markSyncedToKoinly(userId, transactions.map(t => t.id));
}
API integration is especially useful for platforms with frequent updates: new transactions appear every minute and must be sent to Koinly immediately.
Common Integration Errors and Their Solutions
| Error |
Cause |
Solution |
| Incorrect date format |
Koinly expects YYYY-MM-DD HH:mm:ss UTC |
Standardize output across the system |
| Missing fees |
feeAmount absent for staking |
Mandatory fee collection from node data |
| Duplicate transactions |
Resend due to network failure |
Implement idempotency at the API level |
| Unsupported label |
Custom type lending not mapped |
Map to income or add manually |
We address these cases during testing with a test set of 1000+ transactions.
How a Real Example Works
One of our clients is an exchange with 20,000 transactions per day. The CSV file weighed 50 MB. We implemented streaming generation: split data into batches of 1,000 records and added a background task for automatic submission via their API (custom endpoint). No upload issues arose; users could export data with one click. Learn more about Koinly's CSV format and cryptocurrency taxation on Wikipedia.
Turnkey Implementation Process
We go through five stages:
- Analysis — study your platform's transaction schema, operation types, fields. Identify non-standard cases.
- Design — select CSV, API, or combined approach. Optimize category mapping for Koinly requirements.
- Implementation — write CSV generation code or API endpoint. Connect webhooks for updates. Stack: TypeScript, Node.js, PostgreSQL.
- Testing — run test set of 1000+ transactions, compare with Koinly output. Use automated scripts.
- Deployment — deploy to production, set up monitoring via Tenderly and logging.
What's Included
- Documentation of CSV format and API (OpenAPI specification).
- Access to Koinly test environment.
- Team training on adding new transaction types.
- 1-month support after release — fix any discrepancies.
Timelines and Guarantee
Basic CSV integration: 1 to 2 days. Full with Partner API: 3 to 5 days. We guarantee correct transaction display in Koinly and compliance with all labels. Get a free project assessment — contact us. We also provide a compliance certificate upon completion.
Get a free integration consultation — our engineers analyze your platform within 1 day. Reach out to us to get started.
Why does your project risk without blockchain compliance services?
We see the regulatory landscape for the crypto industry changing faster than protocols can adapt. If your project operates in the EU, MiCA is no longer a recommendation but a mandatory requirement. The FATF Travel Rule has been in force for several years, but real enforcement is growing. Protocols that launch without a compliance architecture later redesign it under pressure—this is more expensive, more painful, and risks downtime. Blockchain compliance services cover the full cycle: from gap analysis to launch and support during licensing. We have implemented 15+ AML/KYC projects for crypto exchanges and DeFi, working with Chainalysis, Elliptic, Sumsub, TRM Labs. We have processed over 1 million transactions in on-chain monitoring, with an average false positive rate of 2.3% for AML screening.
Why is the Travel Rule a technical, not a legal challenge?
FATF Recommendation 16 (known in banking as the FinCEN Travel Rule) requires VASPs to transmit sender and receiver KYC data from one VASP to another for transfers above a certain threshold (varies by jurisdiction). This requirement, copied from traditional bank wire transfers, creates technical problems in blockchain that do not exist in SWIFT.
The first problem is determining VASP-to-VASP. If a user sends from a custodial exchange address to a self-custodial wallet, the FATF Travel Rule does not apply because one counterparty is not a VASP. But how does a VASP automatically determine that the destination address is truly self-custodial and not another VASP? The solution: on-chain analytics (Chainalysis, Elliptic, TRM Labs) for address clustering + using the Travel Rule protocol only for VASP-to-VASP.
The second problem is interoperability between VASPs. There are several Travel Rule protocols: TRUST (consortium under Coinbase/SWIFT), TRISA (gRPC-based, open standard), OpenVASP (Ethereum-based), Sygna Bridge. They are not interoperable. Most major exchanges support several simultaneously. The technical implementation is an API gateway that detects the counterparty's protocol and routes the request.
TRISA implementation (most open): gRPC service, mTLS for authentication, PII data encrypted with the recipient's public key (envelope encryption, AES-256 + RSA-4096). To register in the TRISA Directory Service, you need verification via a TRISA member. The code is an open SDK in Go and Python.
Specific pain point: timing. Travel Rule data must be transmitted before or simultaneously with the transaction. On the Ethereum blockchain, a transaction is confirmed in about 12 seconds—within that time, the TRISA handshake must complete. If the counterparty does not respond, the transaction is blocked or delayed. The UI must explain this to the user, otherwise a flood of support tickets is guaranteed.
TRISA handshake implementation details
Example gRPC request for Travel Rule data transfer:
service TRISANetwork {
rpc Transfer(TransferRequest) returns (TransferResponse);
}
message TransferRequest {
string identity_payload = 1; // encrypted PII packet
string envelope_public_key = 2;
string transaction_hash = 3;
}
The handshake takes 3-5 HTTP rounds, including verification of the counterparty's mTLS certificate via PKI Directory.
How to choose a KYC/AML provider for a crypto project?
KYC providers for cryptocurrencies fall into several tiers:
Tier 1 (enterprise, regulatory grade): Jumio, Onfido, Sumsub, Veriff. Support 200+ countries, video verification, liveliness checks, AML screening via Refinitiv/Dow Jones. Integration via REST API + webhooks. Sumsub is popular in European crypto projects—good SDK documentation for mobile apps.
Tier 2 (DeFi-native, privacy-focused): Fractal ID, Synaps, Persona. Less regulatory overhead, faster integration, but less global coverage for high-risk jurisdictions.
On-chain KYC via credentials: Quadrata Passport, Civic, PolygonID—user verifies once, gets an on-chain credential, protocols verify it without repeated verification. Privacy-preserving via ZK. Not mainstream yet, but we are laying the groundwork in the architecture.
| Provider |
Tier |
On-chain credentials |
Average integration time |
Jurisdictions |
| Sumsub |
1 |
no |
3–4 weeks |
220+ |
| Fractal ID |
2 |
yes (Ethereum) |
2–3 weeks |
80+ |
| Quadrata |
2 |
yes (zk-proof) |
4–5 weeks |
global (non-custodial) |
Architectural principle: KYC data is never stored on-chain. Personal data is stored with the provider or in your encrypted database; on-chain only a hash (commitment) or credential (if using VC/SBT approach). This ensures GDPR compliance: the right to erasure is achievable if data is off-chain.
Typical mistake: storing wallet-to-identity mapping in plaintext in PostgreSQL without row-level encryption. One SQL injection and the entire KYC database is compromised. Minimum: column encryption for PII fields (PGP or AES via pgcrypto), separate key management (AWS KMS, HashiCorp Vault), audit log for all PII access.
For AML screening, we use Chainalysis, Elliptic, or TRM Labs. Integration is asynchronous via webhook: results come in 1–5 seconds. Threshold-based blocking: HIGH risk — auto-block, MEDIUM — manual review. Hold period for suspicious transactions is 24–72 hours until manual review. Sanctions screening separately: OFAC SDN list updates several times a week; we use direct OFAC list integration (free) with custom address matching logic.
How do we implement MiCA support?
Markets in Crypto-Assets Regulation (EU 2023/1114) requires CASP (Crypto-Asset Service Provider) licensing in one EU state with passporting. Technical requirements affecting development:
White paper is mandatory for issuers of ART (Asset-Referenced Tokens) and EMT (E-Money Tokens)—not a marketing document but a legally binding prospectus with technical description, holder rights, and redemption mechanisms.
Custody requirements: client assets separate from operational assets. Technically: separate wallets/accounts per client (or omnibus with off-chain mapping + regular reconciliation), no possibility to use client funds for operational needs.
Transaction monitoring and reporting: CASPs must keep records of all transactions for at least 5 years and provide them to the regulator upon request.
Travel Rule in MiCA: the threshold for VASP-to-VASP transfers is zero (not the FATF threshold). Implementation requires a Travel Rule endpoint operating 24/7.
| Organization type |
Key MiCA requirements |
Technical impact |
| ART/EMT issuer |
White paper, redemption mechanism, reserve audit |
Smart contract with redemption function, oracle for reserve proof |
| CASP (exchange, custodian) |
License, custody segregation, Travel Rule |
Separate wallets per client, TRISA/TRUST integration |
| DeFi protocol (no issuer) |
Currently out of MiCA scope (review pending) |
Monitor, prepare architecture |
Compliance infrastructure implementation process
Compliance architecture is not added on top of an existing product without pain. The correct order: compliance requirements → data model → business logic → UI. If you already have a product without a compliance layer, we start with a gap analysis: what data is already collected, where the gaps are, what will require schema migration.
-
Gap analysis — audit of current architecture and data flow (1–2 weeks).
-
Design — selection of KYC provider, Travel Rule protocol, AML tool, data model.
-
Integration — connecting KYC API, implementing AML screening in the pipeline, setting up Travel Rule gateway.
-
Testing — end-to-end tests, simulating Travel Rule handshake, verifying sanctions screening.
-
Deployment and monitoring — rollout with feature flags, setting up alerting for compliance service errors, audit trail.
-
License support — preparing documentation for the regulator, assisting with inspections.
What does the blockchain compliance service include?
- Compliance architecture documentation (data flow, ER diagrams, API specifications).
- Integration of KYC/AML/Travel Rule APIs with your backend.
- Setup of monitoring and alerting for compliance services.
- Training your team on tools (Chainalysis, Sumsub, etc.).
- Support during the licensing process (MiCA, FATF).
Timeline benchmarks
- KYC/AML integration with Sumsub or Jumio — from 3 to 6 weeks.
- Travel Rule (TRISA or Sygna) — from 6 to 10 weeks.
- Full compliance infrastructure for CASP licensing — from 4 to 8 months.
- On-chain compliance via VC/SBT with ZK (MiCA-ready) — from 5 to 9 months.
Scope is refined after gap analysis. To evaluate your project, contact us—we will conduct a free analysis of your current architecture and select the optimal set of tools. Get a consultation on compliance architecture for MiCA or Travel Rule. Our team has over 7 years of blockchain development experience and 15+ deployed compliance solutions. Request an audit of your protocol for compliance with current regulatory requirements.