Use a Server-Side Script (REST API) 

In this Article
Related Articles


In addition to our iFrame and HTML snippet publishing methods, you can embed your FormAssembly form on your website using our REST API. This publishing method requires a basic understanding of programming for the web and may not work with all server environments. Our Support team is also not able to assist with writing or editing custom code. Embedded forms require that your site is secured with TLS 1.2 or greater.

If you are using the reCAPTCHA or save & resume features on your form, this is the recommended option for embedding your forms.


Using a website editor, copy & paste the following code sample for your code on the web page where you want your form to be visible. When doing this, make sure that you are editing the HTML code directly (often called "HTML view" or "code view").

Your form URL is shown on the Publish page, under the REST API section. Change the URL in the code sample below to match your form's URL. Only the last part (INSERT_FORM_ID_HERE) should be different. If you are an Enterprise Cloud or Compliance Cloud customer, replace in the examples below with your FormAssembly instance URL.

Servers running PHP

//Set stream options
$context = stream_context_create(array('http' => array('ignore_errors' => true)));
if(!isset($_GET['tfa_next'])) {
$qs = ' ';
if(isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])){$qs='?'.$_SERVER['QUERY_STRING'];};
echo file_get_contents(''.$qs);
} else {
echo file_get_contents(''.$_GET['tfa_next'],false,$context);

Servers running ASP

Dim objWinHttp
Dim strHTML
Set objWinHttp = Server.CreateObject('WinHttp.WinHttpRequest.5.1')
if(request.querystring('tfa_next')='') then
objWinHttp.Open 'GET', ''
objWinHttp.Open 'GET', '' & request.querystring('tfa_next')
end if
Response.Write objWinHttp.ResponseText
Set objWinHttp = Nothing

Servers running IIS/.NET


@model FAFormModel
    ViewData["Title"] = "Embedded FormAssembly Form";
    Layout = null;   //Remove this line to embed the form inside an existing layout


using Microsoft.AspNetCore.Mvc.RazorPages;

namespace DotNetWebApp.Pages;

public class FAFormModel : PageModel
    private readonly ILogger<IndexModel> _logger;
    public string FAForm { get; private set; } = "PageModel in C#";
    public FAFormModel(ILogger<IndexModel> logger)
        _logger = logger;

    public void OnGet()
      var tfa_next = HttpContext.Request.Query["tfa_next"];
      var url = string.IsNullOrWhiteSpace(tfa_next) ? "" : $"{tfa_next}";
      FAForm = GetFAForm(url).Result;

    public async Task<String> GetFAForm(String url)
      using var client = new HttpClient();
      var response = await client.GetAsync(url);
      var responseBody = await response.Content.ReadAsStringAsync();
      return responseBody;

Servers running Ruby on Rails

In your controller:

def feedback
if params[:tfa_next]
url = "/rest/#{params[:tfa_next]}"
url = '/rest/forms/view/INSERT_FORM_ID_HERE'
response = Net::HTTP.get_response(URI(''+url))
@form_head, @form_body = response.split('<!-- FORM: BODY SECTION -->')

In your view:

<% content_for('head') do %>
<%= @form_head %>
<% end %>
<%= @form_body %>
In your layout:
<%= yield :head %>

Servers running Java

Download Package
Note: Java 1.6.0 is not supported

JSP Example

<%@ page language='java' contentType='text/html; charset=UTF-8' pageEncoding='UTF-8'%>
<%@ page import='' %>
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' ''>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>FormAssembly REST API JAVA Example</title>
<%=Form.getHTML(INSERT_FORM_ID_HERE, request.getParameter('tfa_next') )%>

Servers running a different server-side technology

Regardless of what technology is available, if your server is capable of doing HTTP requests, you should be able to retrieve and display the form. Please refer to your server documentation or Google for more information.

We'd love to expand this section. If you have a working method not documented here, please email it to us at Thank you!
Terms of Service · Privacy Policy