Was this page helpful?
Yes No

Tableau JavaScript API

Access the API

The JavaScript API runs on Tableau Online, Tableau Public, and Tableau Server versions 8.0 and later. To use the JavaScript API, you need to include the JavaScript API file in your web page.

Note: The JavaScript API files are located on the server (including Tableau Online and Tableau Public). There is no separate download for the files. You just specify the URL to the JavaScript API file in your web page, as described in the following section.

The JavaScript API file is a library that contains functions for interacting with the JavaScript API. The JavaScript API file is available in multiple versions, and each version of the Tableau JavaScript library corresponds to a specific version of Tableau Server. Additionally, for each version of the JavaScript API file, there is also a minified file that you can use in production environments to reduce the amount of data that browsers need to download.

JavaScript API Versions

The following table lists the JavaScript API files and the corresponding versions of Tableau Server:

Tableau Server version JavaScript API files

10.3

10.2

10.1

10.0

9.3

9.2

9.1

tableau-2.min.js

9.0

tableau-2.0.0.min.js

8.x

tableau_v8.js

For Tableau Online and Tableau Public, use the latest version of the JavaScript API file.

Versioning Notes

  • Starting with Tableau Server 9.1, you can link to the JavaScript API file using only the major version number. Tableau Server returns the latest minor version of the JavaScript API file available. For example, if you link to the tableau-2.js file, Tableau Server might return the tableau-2.0.2.js file. Use the major version of the file to avoid updating code references for minor version changes. However, you can still get a specific minor version of the JavaScript API file by linking to it directly.

  • The version numbers for JavaScript API files has changed since the first release. Starting with Tableau Server 9.0, the version of the JavaScript API file is independent of the Tableau Server version. Each version uses the following convention:

    tableau_major-release.minor-release.update-release.js

    Previously, JavaScript API file versions matched the version of Tableau Server. For example, the tableau_v8.js file corresponded to Tableau Server 8.0.

  • Starting with Tableau Server 9.0, you can get the JavaScript API file from any location, including your own server, Tableau Public, and Tableau Online. JavaScript API files in all these locations are identical for a given version of the JavaScript API file.

  • Starting with Tableau Server 9.0, minified versions of the JavaScript API file are designated with the .min naming convention. Previously, the minified version did not use a naming convention. Instead, the full version of the file was designated with the .debug naming convention.

  • You can access non-minified versions of the library by removing .min from the filename. For example, for the latest version, you can use tableau-2.js

Where to Get the JavaScript API File

Starting with Tableau Server version 9.0, you can get the JavaScript API file from multiple locations, including Tableau Online and Tableau Public. However, if you get the JavaScript API file from the same server that hosts your visualizations, you can ensure that you always use a version of the file that is compatible with the server. Additionally, for versions of Tableau Server before 9.0, you must get the JavaScript API file from the same server that hosts your visualizations. Otherwise, the code may not work.

Add the following code to a web page to get the JavaScript API file:

<script src="https://YOUR-SERVER/javascripts/api/tableau-version.min.js"></script>

For example, you might enter the following code:

<script src="https://www.example.com/javascripts/api/tableau-2.min.js"></script>

For Tableau Online and Tableau Public, enter one of the following:

<script src="https://online.tableau.com/javascripts/api/tableau-version.min.js"></script>
<script src="https://public.tableau.com/javascripts/api/tableau-version.min.js"></script>

Note: On Tableau Server, the JavaScript API files are stored in the following location:
Program Files\Tableau\Tableau Server\10.3\wgserver\public\javascripts\api