JAVASCRIPT DOCUMENTATION When you first begin a html document always add <script src="https://instantiated.xyz/API_Download/instantiated.js"><script> Once you have that implemented add in to your script.js fill with: InstanceAPI.Connect(); InstanceAPI.onOpen(() => { InstanceAPI.CreateSession("Example document", 2, 0, "password", "root password", 0, 0, 1); setInterval(InstanceAPI.Ping, 5000); }); InstanceAPI.onMessage((event) => { var id=JSON.parse(event.data); switch(id["MSG"]) { case "SocketID": console.log("SocketID granted!"); InstanceAPI.SetSocketID(id["SocketID"]); break; case "created_session": console.log("Session created!"); InstanceAPI.SetSessionID(id["SessionGUID"]); break; } }); List of all functions you can use. InstanceAPI.Connect() - Connects to the instantiated server. (wss://instantiated.xyz:12701) InstanceAPI.onOpen(callback) - Creates a onopen event on the api to listen for an open event. InstanceAPI.onMessage(callback) - Creates a onmessage event on the api to listen for an message event received from the server. InstanceAPI.onClose(callback) - Creates a onclose event when the socket is closed. InstanceAPI.onError(callback) - Creates a onerror event when the socket receives an error during the connection. InstanceAPI.SetSocketID(socket_id) - Sets the socket id to use when referring to the api. InstanceAPI.SetSessionID(session_id) - Sets the session id to use when sending data to the host or client. InstanceAPI.GetSocketID() - Grabs the socket id set by the api. InstanceAPI.GetSessionID() - Grabs the session id set by the api. InstanceAPI.CreateSession(AppTitle, MaxConnections, Whitelist, Password, RootPassword, DefaultValues, ForceHostTransfer, KillHostServer) - Creates a session instance that lets you control the instance's packets, rules, roles, temp storages and message of the day. InstanceAPI.CreateServer(Session_ID, AppTitle, MaxConnections, Whitelist, Password, DefaultValues) - Creates a server only instance and allows you to do the same thing as CreateSession function except you aren't included in the client list (perfect for headless solutions.) InstanceAPI.Disconnect() - Disconnects from the current session (use InstanceAPI.SetSessionID before calling this.) InstanceAPI.Send(JSON_Data) - Sends data to the instance host. The host will receive a Tx packet to handle. InstanceAPI.Receive(JSON_Data) - Sends data to the connected clients. The clients will receive a Rx packet to handle. (Host will not receive this packet however.) InstanceAPI.PrivateSend(JSON_Data, SocketID) - Sends data to a client connected to the instance. They will receive a Secure_Rx packet to handle. InstanceAPI.SocketSend(JSON_Data, SocketID) - Sends data to a client even if they aren't connected to the same session that you are connected. The connected socket will receive a SocketRx packet to handle. InstanceAPI.Ping() - This sends a ping to the server to notify that you are still alive and kicking. The server will send you a pong MSG packet if you wish to handle it. (The server will time you out after a minute has passed. So important to use timers that repeat) InstanceAPI.TransferOwnership(SocketID) - Transfers ownership over to a new client. (WARNING: Doing so means you relinquish ownership of that instance so please be sure you really want to transfer ownership.) InstanceAPI.CreateInvite(Max Uses) - Creates an invite code for you to use to invite a friend over to your new instance. You will receive "Invite_Created" MSG packet which includes the "Code" and "Limits". InstanceAPI.DeleteInvite(Invite Code) - Destroys the created invite code to make it un-usable to join the instance with. You will receive "Invite_Deleted" MSG along with the invite "Code" to handle the packets with. InstanceAPI.AccountExport() - Exports the account data into a JSON string. (Only the host will receive the "AccountExported" MSG with "Account" packet to handle.) InstanceAPI.AccountImport(Account_JSON) - Imports the account data to the session. (Only the host will receive the "AccountImported" MSG with "Account" packet to handle. If it fails to import then the server will send back a "InvalidJSON" packet.) InstanceAPI.AccountLogin(Username, Password) - Logs in to the instance account assigned to that session. (The client will receive if successful "LoggedIn" packet otherwise "AccountAuthFailed" if they failed to provide the correct authentication details.) --- Theres more account stuff but i'll work on that a bit later. --- InstanceAPI.ChangeInstancePassword(New Password) - Changes the instance's password. (You will receive a "InstancePasswordChanged" packet.) InstanceAPI.AnnounceOnDiscord(Message, Type) - Announces things to the discord server from #session-info text channel. Set the type to maintenance, event, shutdown, scheduled-restart, alert or any custom naming schemes. No packet to receive back. --- Cloud API documentation will be worked on later. --- Mail API documentation will be worked on later. InstanceAPI.ExposeClientsIP() - Sends a packet "ExposedIPClients" that also includes "List_IPAddress" and "SocketIDs" both contain arrays. InstanceAPI.Check_Newsletters() - Sends back all the latest news from Instantiated servers. The client will receive "Newsletter_Announcements" packet along with "Newsletter". InstanceAPI.SetInstanceMOTD(Message of the day) - Sets the instance's message of the day. The host client will receive "InstanceUpdatedMotd" MSG along with "Message" packet to handle. InstanceAPI.GetInstanceMOTD() - Grabs the instance's message of the day. Any client can request this packet without permission and will receive "InstanceMotd" MSG along with "Message". InstanceAPI.AddInstanceRule(Rule) - Adds a rule to the list created by you or others who have the permission. You will receive "InstanceRuleAdded" MSG, A number where your rule is placed "RuleNo" and "Rule" with your added rule. InstanceAPI.RemoveInstanceRule(0) - Removes the rule from the list. You will receive "InstanceRuleRemoved" MSG and "RuleNo". InstanceAPI.UpdateInstanceRule(0, Rule) - Update the rule from the list with a new rule. You will receive "InstanceRuleUpdated" MSG, RuleNo and Rule. InstanceAPI.GetInstanceRules() - Grabs an array of the instance rules (anyone can use this command without permission). "InstanceRules" MSG and an array list from "Rules" packet.