Reference error - Api is not defined

Im using the <script type="text/javascript" src="http://localhost/web-apps/apps/api/documents/api.js"></script> to create document editor in web page and i want to insert text via the api method, but i’m getting this error when i try to access Api object : “Api is not defined” this is the code snippet: const oDocument = Api.GetDocument() const oParagraph = Api.CreateParagraph() oParagraph.AddText('Hello world!') oDocument.InsertContent([oParagraph])

Hello @MehdiDi

Are you trying to execute this snippet from browser console?

In general, please take a look at these two articles about macros and plugins in case you want to use your sample inside the editor:

Additionally, take a look at connector class that allows you to interact with editors from outside:

Please note that the connector is available only for ONLYOFFICE Developer Edition.