skip to navigation
skip to content

Not Logged In

itolapi 1.1

API for interacting with

Latest Version: 1.2.1

Python API for the Interactive Tree of Life (iTOL)

Created by Albert Wang (albertyw at

With Complements to: iTOL (Interactive Tree of Life), urllib2_file by Fabien Seisen

This iTOL API allows local software to upload trees to iTOL using and export uploaded trees using using direct Python calls or through shell. An active internet connection to the iTOL website is required.


pip install itolapi

Uploading Trees To iTOL (

From Command Line

(If you need to do anything more than displaying basic tree structures, you must call the Python iTOL API from within a Python program)

$ /path/to/example.tree

From Python

Running from a python program is much more flexible than running from command line and allows access to all iTOL options

from itolapi import Itol
itol_uploader = Itol.Itol()
itol_uploader.add_variable('treeFile', '/path/to/example.tree')
itol_uploader.add_variable('treeFormat', 'newick')
itol_uploader.add_variable('treeName', 'apple')
status = itol_uploader.upload()
assert status != False
# SUCCESS: 1234567890
# 1234567890
# <ItolExport.ItolExport instance at 0x207c5f0>

An example for using the Python iTOL API can found in examples/

Downloading Trees From iTOL (

From Command Line

(If you would like to set any parameters other than the tree id, location to save the file, file format, and whether to display datasets, you must use ItolExport from a Python program)

Options include:
  • -d: show datasets
  • -r: verbose output
  • -h: help

From Python

Running from a Python program allows you to use all the options that iTOL has available.

from itolapi import ItolExport
itol_exporter = ItolExport.ItolExport()
itol_exporter.add_export_param_value('tree', tree_id)
assert format in ['png', 'svg', 'eps', 'ps', 'pdf', 'nexus', 'newick']
itol_exporter.add_export_param_value('format', format)
itol_exporter.add_export_param_value(param_key, param_value)

Valid param_key and param_value values can be found on the iTOL API page.


Send bugs and comments as issues on the Github repository.

  • Downloads (All Versions):
  • 19 downloads in the last day
  • 127 downloads in the last week
  • 549 downloads in the last month