4.1 Introduction to Revit's API

Revit's API has been developed over nearly two decades; let's get to know it!

Introduction to Revit's API

Revit has had an accessible API since the early 2000s, which can be used to drive nearly every aspect of the software. As the Revit application is very complex and built to suit multiple audiences (structure, MEP etc) it is no surprise that its API is very large and takes a while to grasp intuitively.

I often find it easiest to think of Revit as primarily being a database that we're constantly updating as we use the application. The database stores our content (its element ID, category, location, etc). On top of this is a GUI, which represents the elements' geometry/location in a 3D space and lets us interact with our elements. Finally, there's a bit of networking magic to allow us to set up worksharing across a local network / Revit Server / BIM360.

Thinking of Revit in this way is totally different to how most users will experience the software. In reality, when we're writing scripts targeting Revit's API, we're just making a series of calls to a database, constrained by the rules of that API.

Versions and History

With every release and sub-release of Revit, the Autodesk Revit team makes minor updates or additions to its API. These changes mostly relate to functional changes within the software itself (e.g. the recent egress analysis API).

This long history sometimes means that the Revit API can seem inconsistent or structured in unexpected ways - this often happens with older APIs, which cannot change without affecting lots of people.

The Structure of Revit's API

Given its size, it can help to take a step back and understand how this API is generally structured. The Revit API exposes around 1700 classes, 50 interfaces and 500 enumerations which cover almost every aspect and function of the application. The classes are subdivided between several namespaces, often relating to a specific usage (e.g. plumbing or structural steel). The vast majority of classes reside in the Autodesk.Revit.DB namespace.

On your machine, the API classes are split between two .dll files: RevitAPI.dll and RevitAPIUI.dll which can be found at: C:\Program Files\Autodesk\Revit [Version]

The Revit SDK & API Documentation

Software Development Kit (SDKs) are a common way for software vendors to distribute information about their APIs to developers. The official Revit SDK can be found here.

All APIs need technical documentation so programmers can pick them up and learn how to drive the application using code. The Revit SDK contains both official API documentation in a .chm file as well as code examples (written in Visual Basic and C#).

However, this guide recommends reading the Revit API in the APIDocs.co website, which is far more convenient than opening a .chm file. Make sure to bookmark it and find our guide to using the site here:

page4.2 How to Read Revit's API Documentation

This page also contains a quick guide to help explain some of the key terms you'll find in Revit's API documentation. Make sure to check it out!

Revit API Resources

Autodesk has many resources for getting acquainted with Revit's API, although many of these give examples in C# rather than Python.

Last updated