---
schema: rendered-html/v1
title: "Form API Reference | Developer Portal for YouTrack and Hub Documentation"
source_url: https://www.jetbrains.com/help/youtrack/devportal/form-api-reference.html
generated_at: 2026-06-11T15:02:44.854448+00:00
---

Feedback

Thanks for your feedback!

Was this page helpful?

YesNo

Developer Portal for YouTrack and Hub

- Developer Portal
- Apps
- MCP Tools
- YouTrack Workflows
- YouTrack Import Scripts
- YouTrack Form API
- Sample Script
- [Form API Reference](form-api-reference.html)
- YouTrack REST API
- Hub REST API

1. YouTrack Form API
2. [Form API Reference](#0)

# Form API Reference﻿

Last modified: 07 May 2026

Here you can find the reference for the Form API and learn how to establish a connection to the form.

## Establish a Connection﻿

The first step for using the Form API is establishing a connection to the form. To do that, use the sample code below with the ID of the form you're working with.

```
YTFeedbackForm.getClientJSApi('680e7600-000f-4029-bfe9-ddf479c73ef7').then(async form => {
    // Your code goes here
})
```

You can get the form ID from the embed code for the form.

Popup Mode

Inline Mode

[![The form ID in the embed code viewed in Popup mode.](https://crawler.prototype.prolicht.digital/l/T0xsf8)](https://resources.jetbrains.com/help/img/youtrack/form-id-popup-mode.png)

[![The form ID in the embed code viewed in Popup mode.](https://crawler.prototype.prolicht.digital/l/IHzS4g)](https://resources.jetbrains.com/help/img/youtrack/form-id-inline-mode.png)

## Predefined Fields﻿

There are three predefined form fields that you can refer to by their names:

- `email`
- `summary`
- `description`

Sample code:

```
// Setting the email value to jane.doe@example.com.
form.setBlockValue('email', 'jane.doe@example.com');

// Setting the summary.
form.setBlockValue('summary', 'Assistance Required');

// Setting the description.
form.setBlockValue('description', 'I need assistance, please get back to me.');
```

## Methods﻿

### getBlocks﻿

The `getBlocks` method lets you get the blocks available for the form.

Sample: `getBlocks()`

#### Returned Value﻿

| Type | Description |
| --- | --- |
| Array<Block> | An array of blocks available for the form. |

### getBlockValue﻿

The `getBlockValue` method lets you get the value of the particular block in the form. This method is useful when you need to prefill a block value based on a value entered by the user in another block.

Sample: `getBlockValue(blockReference)`

#### Parameters﻿

| Name | Type | Description |
| --- | --- | --- |
| blockReference | String | The ID or the title of the block. |

#### Returned Value﻿

| Type | Description |
| --- | --- |
| Value | The value of the block. |

### getBlockValues﻿

The `getBlockValues` method lets you get the list of available values for the particular block in the form. Works only when the block is represented by an enumerated custom field in YouTrack.

Sample: `getBlockValues(blockReference)`

> ### note
>
> Always call the `getBlockValues` method with the `await` operator. To learn more about this operator, see the [JavaScript reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await).

#### Parameters﻿

| Name | Type | Description |
| --- | --- | --- |
| blockReference | String | The ID or the title of the block. |

#### Returned Value﻿

| Type | Description |
| --- | --- |
| Array<Value> | An array of available values for the block. |

### setBlockValue﻿

The `setBlockValue` method lets you set the value in a block in the form.

Sample: `setBlockValue(blockReference, newValue)`

#### Parameters﻿

| Name | Type | Description |
| --- | --- | --- |
| blockReference | String | The ID or the title of the block. |
| newValue | String | The new value for the block. For the values of an enumerated field, you can use the ID of the corresponding block value. |

- [Form API Reference](/help/youtrack/devportal/form-api-reference.html)
- [Establish a Connection](/help/youtrack/devportal/form-api-reference.html#establish-connection)
- [Predefined Fields](/help/youtrack/devportal/form-api-reference.html#predefined-fields)
- [Methods](/help/youtrack/devportal/form-api-reference.html#methods)
- [getBlocks](/help/youtrack/devportal/form-api-reference.html#getblocks)
- [Returned Value](/help/youtrack/devportal/form-api-reference.html#y13y3s_33)
- [getBlockValue](/help/youtrack/devportal/form-api-reference.html#getblockvalue)
- [Parameters](/help/youtrack/devportal/form-api-reference.html#y13y3s_46)
- [Returned Value](/help/youtrack/devportal/form-api-reference.html#y13y3s_47)
- [getBlockValues](/help/youtrack/devportal/form-api-reference.html#getblockvalues)
- [Parameters](/help/youtrack/devportal/form-api-reference.html#y13y3s_70)
- [Returned Value](/help/youtrack/devportal/form-api-reference.html#y13y3s_71)
- [setBlockValue](/help/youtrack/devportal/form-api-reference.html#setblockvalue)
- [Parameters](/help/youtrack/devportal/form-api-reference.html#y13y3s_97)

Sample ScriptYouTrack REST API

- Privacy & Security
- Terms Of Use
- Trademarks
- Legal

Copyright © 2000–2026 JetBrains s.r.o.
