For Scripts to do anything useful, Trilium publishes “Script API”. Actually there are two such APIs:
Note that Script API is now experimental and subject to change in the future.