# YouTrack Import API

YouTrack lets you import content from any external source using JavaScript import scripts that map imported data to YouTrack entities. This section of the documentation describes the YouTrack import API, which you can use to create and update existing import scripts.

To learn more about working with import scripts in YouTrack, see [Get Started with Import Scripts](get-started-custom-import-scripts.html). There, you can also find a [demo import script](demo-import-script.html) to examine and use as a base for your own script.

## Working With the Import API

The YouTrack import API supports various definitions for the entities that you can import from an external source.

This API also includes the definition for a [DemoClient](Import-DemoClient.html) class. This class lets you generate an interface for a client that imports entities from an external source to YouTrack.

Use the [demo import script](demo-import-script.html) as a foundation for building your own import script without starting from scratch. If you access the demo import script in your YouTrack, you'll find the API reference and examples embedded in the script itself.

## Entities and Value Types

The following entities and value types are available to custom import scripts:

| Entity or value type | Description |
| --- | --- |
| [Article](Import-Article.html) | Represents an article entity for custom import scripts. |
| [Attachment](Import-Attachment.html) | Represents an attachment entity for custom import scripts. |
| [AttachmentContentWithMetadata](Import-AttachmentContentWithMetadata.html) | Represents the content of an attachment with metadata for custom import scripts. |
| [AttachmentMetaData](Import-AttachmentMetaData.html) | Represents the metadata of an attachment for custom import scripts. |
| [Build](Import-Build.html) | Represents a value of a custom field of build type for custom import scripts. |
| [Comment](Import-Comment.html) | Represents a comment entity for custom import scripts. |
| [DateFieldValue](Import-DateFieldValue.html) | Represents a value of a custom field of date type for custom import scripts. |
| [DateTimeFieldValue](Import-DateTimeFieldValue.html) | Represents a value of a custom field of date and time type for custom import scripts. |
| [DocumentFieldValue](Import-DocumentFieldValue.html) | Represents a value for a custom field in an issue or an article for custom import scripts. |
| [DocumentFieldValues](Import-DocumentFieldValues.html) | Represents field values for custom import scripts. |
| [DocumentFieldValuesStringPresentation](Import-DocumentFieldValuesStringPresentation.html) | Represents a string presentation for a custom field value in an issue or an article for custom import scripts. |
| [DocumentFields](Import-DocumentFields.html) | Represents predefined fields of a document that could be either issue or article for custom import scripts. |
| [DocumentInfo](Import-DocumentInfo.html) | The base class containing information about an issue or an article for custom import scripts. |
| [EnumElement](Import-EnumElement.html) | Represents a value of a custom field of enum type for custom import scripts. |
| [EnumerableFieldPresentation](Import-EnumerableFieldPresentation.html) | Represents a presentation of an enum custom field for custom import scripts. |
| [FieldChange](Import-FieldChange.html) | Represents a field change entity for custom import scripts. |
| [FieldValue](Import-FieldValue.html) | The ancestor for custom field value entities for custom import scripts. |
| [FloatFieldValue](Import-FloatFieldValue.html) | Represents a value of a custom field of float type for custom import scripts. |
| [GroupProjectField](Import-GroupProjectField.html) | Represents a group project custom field entity for custom import scripts. |
| [HistoryItem](Import-HistoryItem.html) | Represents a change in the document history for custom import scripts. |
| [IntegerFieldValue](Import-IntegerFieldValue.html) | Represents a value of a custom field of integer type for custom import scripts. |
| [Issue](Import-Issue.html) | Represents an issue entity for custom import scripts. |
| [LinkType](Import-LinkType.html) | Represents an issue link type entity for custom import scripts. |
| [LinkValue](Import-LinkValue.html) | Represents a link from one issue to another for custom import scripts. |
| [OwnedValue](Import-OwnedValue.html) | Represents a value of a custom field of ownedField type for custom import scripts. |
| [PeriodFieldValue](Import-PeriodFieldValue.html) | Represents a value of a custom field of period type for custom import scripts. |
| [Project](Import-Project.html) | Represents a project entity for custom import scripts. |
| [ProjectField](Import-ProjectField.html) | Represents a project custom field entity for custom import scripts. |
| [ProjectFieldInfo](Import-ProjectFieldInfo.html) | The base class containing information about a project custom field for custom import scripts. |
| [ProjectInfo](Import-ProjectInfo.html) | The base class containing information about a project for custom import scripts. |
| [ProjectValue](Import-ProjectValue.html) | Represents the project that is set in an issue or article that belongs to this project for custom import scripts. |
| [Reference](Import-Reference.html) | Represents a reference entity for custom import scripts. |
| [ServerInfo](Import-ServerInfo.html) | Represents a set of server properties for custom import scripts. |
| [StringFieldValue](Import-StringFieldValue.html) | Represents a value of a custom field of string type for custom import scripts. |
| [SubItem](Import-SubItem.html) | The base class for authored entities that are associated with an issue for custom import scripts. |
| [Tag](Import-Tag.html) | Represents an issue tag entity for custom import scripts. |
| [TextFieldValue](Import-TextFieldValue.html) | Represents a value of a custom field of text type for custom import scripts. |
| [User](Import-User.html) | Represents a user entity for custom import scripts. |
| [UserGroup](Import-UserGroup.html) | Represents a user group entity for custom import scripts. |
| [Version](Import-Version.html) | Represents a value of a custom field of version type for custom import scripts. |
| [WorkItem](Import-WorkItem.html) | Represents a work item entity for custom import scripts. |

## Client Methods

Implement these entry points and methods in your import client. For required and optional methods, see [DemoClient](Import-DemoClient.html#required-and-optional-methods).

| Entry point or method | Description |
| --- | --- |
| [exports.Client(context)](Import-DemoClient.html#required-and-optional-methods) | Returns the client instance that YouTrack calls during import. |
| [constructor(context)](Import-DemoClient.html#required-and-optional-methods) | Reads import parameters, prepares credentials, and creates reusable connections. |
| [prepareToImport()](Import-DemoClient.html#required-and-optional-methods) | Runs startup checks or caches source metadata before YouTrack starts reading entities. |
| [getServerInfo()](Import-DemoClient.html#required-and-optional-methods) | Returns source version and time information for diagnostics and import logs. |
| [getProjects()](Import-DemoClient.html#required-and-optional-methods) | Lists projects that can be imported from the source system. |
| [getProject(projectInfo)](Import-DemoClient.html#required-and-optional-methods) | Returns full project data for a selected source project. |
| [getIssues(projectInfo, after, top)](Import-DemoClient.html#required-and-optional-methods) | Returns one page of issues for a project. |
| [getUsers(group, skip, top)](Import-DemoClient.html#required-and-optional-methods) | Returns users for a group or page of users requested by YouTrack. |
| [getArticles(projectInfo, after, top)](Import-DemoClient.html#required-and-optional-methods) | Returns one page of articles for a project. |
| [getAttachmentContent(project, document, attachment)](Import-DemoClient.html#required-and-optional-methods) | Returns binary content and metadata for attachments referenced by imported entities. |
| [getLinkTypes()](Import-DemoClient.html#required-and-optional-methods) | Returns link type definitions used by imported issues. |
| [getTimestampFormats()](Import-DemoClient.html#required-and-optional-methods) | Lists date and date-time formats that the importer can parse from source data. |
| [getUserTimeZoneId()](Import-DemoClient.html#required-and-optional-methods) | Defines the time zone used when source timestamps do not include one. |
| [getIssueUpdates(projectInfo, after, updatedAfter, top)](Import-DemoClient.html#continuous-import-methods) | Returns changed issues for a project since the previous synchronization. |
| [getArticleUpdates(projectInfo, after, updatedAfter, top)](Import-DemoClient.html#continuous-import-methods) | Returns changed articles for a project since the previous synchronization. |

> **Note: Predefined Import Scripts**
> To learn more about importing content using a predefined import script, refer to the instructions that correspond to your [YouTrack Server](https://www.jetbrains.com.cn/en-us/help/youtrack/server/imports.html) installation or [YouTrack Cloud](https://www.jetbrains.com.cn/en-us/help/youtrack/cloud/imports.html) instance.

## See also

[Get Started with Import Scripts](get-started-custom-import-scripts.html) [Demo Import Script](demo-import-script.html) [DemoClient](Import-DemoClient.html)

