Quick start API code example¶
Before being able to communicate with a ftrack server from a Python script, the Python API has to be set up. Follow the 5 simple steps below to get started:
Download the Python API from, or by navigating to the following URL:
<YOUR_FTRACK_SERVER_URL>with the address to your ftrack server, e.g. my-company.ftrackapp.com.
Extract the file and put the contents in a directory on your computer.
Open your favorite text editor, copy and paste the following code block into a new file and change the three lines in the top to be valid for your server. See the notes below for comments on those lines. Save the file in the same directory as before.
import os os.environ['FTRACK_SERVER'] = 'https://<my name>.ftrackapp.com' os.environ['FTRACK_APIKEY'] = '<my API key>' os.environ['LOGNAME'] = '<my username>' import ftrack for project in ftrack.getProjects(): print project.getFullName()
FTRACK_SERVERvariable should point to your server, for example:
FTRACK_APIKEYvariable should be set to an API key. You can get an API key for your server in two ways:
- Copy your private API key from your My account page by clicking your avatar picture in the top right corner of the web interface and selecting My account. If using your private API key, make sure you set the username you are signing in to ftrack with in the next step.
- Copy an existing API key or add a new API key from the page.
LOGNAMEvariable should be set to your username on your ftrack server. This can also be copied from My account.
Launch a terminal window or Command Prompt and navigate to the directory where you saved the file. Enter
myfile.pyis the filename of the Python file you just created, and press
If the output in the terminal contains the names of all your projects, you have successfully set up your API and can start writing more advanced Python scripts! Happy coding!
If you see the error message
ImportError: No module named ftrack, ensure
that you have placed your script in the same directory as the API. The
directory should contain a file called
You can set the environment variable
PYTHONPATH to point to a directory
containing the python API instead of placing the script in the same directory.
If you need any help, let us know by sending an email to firstname.lastname@example.org.
You are now ready to start developing with ftrack and can continue to other pages. For more information on Security and API keys, continue reading this page.
Security and API keys¶
It is sometimes useful to override the user that is used. The environment
USERNAME are used in that order to figure out the current user as
specified by the Python standard
So, for example, setting
LOGNAME to the desired username will cause
all actions through the API to be performed as that user.
- ftrack.py A simple wrapper that allows setting of a few key environment variables and which imports the entire contents of the FTrackCore.egg under the
FTRACK_APIKEYare defined here and should be set to point to your server (or commented out if you want to use a different method for setting these).
- FTrackCore.egg A zipped package that contained the actual files used by the API. When updating the server version FTrackCore.egg will also need to be updated.
The Python API can be downloaded from
<YOUR_FTRACK_SERVER_URL> with the address to your ftrack
server, e.g. my-company.ftrackapp.com.
The following environment variables can be used to configure API usage:
The server URL including protocol, for example
An optional proxy URL to use if required.
Set to ‘true’ to skip feed generation and push notifications. Useful for improving performance in scripts that perform bulk inserts.
Only use for test purposes.
In addition, you must place the ftrack modules on the
With the environment configured, open a Python shell and import ftrack to get started:
The ftrack module works with Python 2.6+