YouTrack JavaScript API
Apps can provide several types of backend JavaScript modules. Pure workflows use the same backend platform for workflow rules. YouTrack runs these modules in a restricted runtime. These modules use packages under @jetbrains/youtrack-scripting-api to read and update YouTrack entities, search for data, send HTTP requests, display messages, and perform other backend operations.
The same API modules are available to workflow rules and to supported backend modules in apps. The object exported by a script and the context passed to its functions depend on the module type.
Supported Backend Modules
Module | Execution model | Start here |
|---|---|---|
Workflow rule in an app or pure workflow | Runs when an entity changes, on a schedule, when a user invokes an action, or as part of a state machine or SLA policy. | |
HTTP handler | Handles requests sent to an app-defined endpoint. | |
Custom MCP tool | Handles a tool call sent through the YouTrack MCP server. | |
Utility module | Exports reusable functions that another backend module imports. |
Shared API Concepts
Import API modules with
require('@jetbrains/youtrack-scripting-api/<module>').Use the
entitiesmodule to work with issues, projects, users, articles, and other YouTrack entities.Declare requirements when a workflow rule or HTTP handler depends on specific fields, values, or entities.
Use async functions for supported work that should run after the current transaction.
Use the
httpmodule to send requests to external services.
For practical entity and collection examples, see Use the YouTrack JavaScript API. For a complete list of packages, types, properties, and functions, see the YouTrack Workflow API.
Component-specific Behavior
API availability does not make all backend modules interchangeable. Each module type has its own export, invocation context, lifecycle, and permission model.
Workflow rules use the same constructors and transaction engine whether they belong to an app or a pure workflow. Pure workflow rules run as trusted automation and can perform changes that the triggering user cannot perform directly. HTTP handlers run only after app, target, and endpoint access checks, while custom MCP tools use permission-based entity access for the MCP caller.
Use the module-specific reference to determine which ctx properties and APIs are available.
JavaScript Compatibility
The backend runtime supports the latest ECMAScript specification available in the corresponding YouTrack version. Standard JavaScript declarations, values, functions, expressions, and operators can be used together with the YouTrack API.