This /development/api/
section of the wiki is intended to be a highly structured section documenting commonly needed API classes and concepts for Foundry Core. This section is intended to supplement the Official API, not replace it, and will link to the official documentation as often as is practical.
If a page appears here which does not conform the to style notes below it may be completely rewritten, moved into the /guides directory, or deleted entirely.
The official API documentation on foundryvtt.com
can be found here.
This is generated from the TypeDoc comments within foundry.js
that is accessible from every local installation of Foundry. It is advisable to open this file up and search it in your IDE, as all of the TypeDoc comments are present and you can easily see what is really going on in the code. The bundled code can be found in yourFoundryInstallLocation/resources/app/public/scripts/foundry.js
, while the unbundled code can be found in yourFoundryInstallLocation/resources/app/client/
, yourFoundryInstallLocation/resources/app/client-esm/
, and yourFoundryInstallLocation/resources/app/common/
.
The standard application window that is rendered for a large variety of UI elements in Foundry VTT.
The Application class is responsible for rendering an HTMLElement into the Foundry Virtual Tabletop user interface. It was introduced in Foundry Version 12 with the intent to slowly phase out use off the original Application class.
Compendiums and how data is stored
The abstract base class which defines the data schema contained within a Document.
API documentation for the Dialog UI class used to inform and prompt users with simple popups.
An extension of the base DataModel which defines a Document. Documents are special in that they are persisted to the database and referenced by _id.
Everything you need to know about using Flags to store arbitrary data on Documents.
Everything you need to know about the core game
object.
Independently useful functions in the Foundry API
Everying you need to know about working with and creating Hook events.
A helper class which assists with localization (i18n) and string translation
Everything you need to know about the rolls that make your game system work
Everything you need to know about using Settings for your package.
API documentation for the Socket functionality available to packages.
Each page in this directory should conform to the following stylistically:
As often as is practical, link between pages of these documents, and to credible external sources of knowledge. The Wikipedia Manual of Style has excellent examples of "underlinking" and "overlinking".
Some guiding questions to ask:
A shield.io badge must be placed at the top of every page which details the "core version we know this document is up to date as of." This allows readers and contributors alike to know at a glance if the document they're looking at is potentially out of date.

Name the page the same as the Class or Concept it documents. The goal is to be intuitive when scanning or searching for a specific chunk of the API a user might be having a problem with.
E.g. Document
describes Document, and some Collection logic. All of these feasibly fit together within one page.
Assets for pages must be in a similarly named subdirectory to the page using them.
/development/api
└── document
└── document-console.png
The development/api/document
page references a document-console
image which is housed under the development/api/document
asset directory.
The following apply to all pages outside of the "Guides" section. Guides are subject to a more relaxed set of guidelines and may exhibit more personal voice if the author chooses.
Write as little as is necessary to get the concept across. Our goal is to be skimmable so that GMs and Players who are in a hurry can find what they are looking for quickly.
Do not reference the user/developer with "you" but instead choose wording such as "the user." Always reference "the user" or an Actor with the pronoun "they."
Emulate something which could be found in official documentation for a company's products, or something akin to large video gaming wikis (e.g. The Official Minecraft Wiki).
This documentation should read as though it were written in one voice, not many. Do your best to mimic the style of an existing page or section which applies to your content.
Do not take it personally if someone's contributions rewrite portions of your own in order to either update them, correct them, or conform them to a shifting standard. We strive for a culture of working together to improve these docs.
Each API page should have the following at Heading Level 2 (as the main title of the page is heading level 1):
Each heading level 2 section should have a horizontal rule between them.
Other sections can be appended to the end of the document as deemed necessary.
If a section has no content yet, place a stub inside a blockquote:
> Stub
> This section is a stub, you can help by contributing to it.