API Reference

Field Types

Below is a list of Formstack field types that you can use with the API

Listed below are the available field types. Each field may have attributes and subfields.

Subfields only apply for complex fields such as name and address. They are submitted and returned in array format. Below is an example of that array format in JSON and URL encoded.

{
	"field_12345": {
  	"prefix": "Mr",
    "first": "Example"
  }
}
field_12345%5Bprefix%5D=Mr&field_12345%5Bfirst%5D=Example

Short Answer: text

Short Answer fields are used when you need just a few words

Attributes

AttributeDefault ValueDescription
size50Size of text field
maxlength0Max length of text field
placeholderPlaceholder for text field

Long Answer: textarea

Long Answer fields are used when you need more detail

Attributes

AttributeDefault ValueDescription
rows10Number of rows to show
cols50Number of columns show
maxlength0Max length of input
placeholderPlaceholder for textarea field

Name: name

Name fields are used when you need a person's name

Subfields

Subfield
prefix
first
middle
initial
last
suffix

Attributes

AttributeDefault ValueDescription
size20Size of name field
show_prefix0Show prefix field
show_middle0Show middle name field
show_initial0Show middle initial field
show_suffix0Show suffix field

Address: address

Address fields let you collect a person's address

Subfields

Subfield
address
address2
city
state
zip
country

Attributes

AttributeDefault ValueDescription
size50Size of address field
show_country0Show country list
formatUSFormat for address input

Email Address: email

Email fields validate the input to make sure it's an email address

Attributes

AttributeDefault ValueDescription
size50Size of email field
maxlength0Max length of email field
confirmShow a "Confirm Email Address" field
placeholderPlaceholder for email field

Phone Number: phone

Phone Number fields validate the input to make sure it's a phone number

Attributes

AttributeDefault ValueDescription
size20Size of phone field
formatUSFormat for phone number input
placeholderPlaceholder for phone field

Credit Card: creditcard

Credit Card fields validate the input to make sure it's a valid credit card number.

Credit Card fields are only available when using SSL and when a payment integration is added to the form or when database encryption is enabled.

Attributes

AttributeDefault ValueDescription
size20Size of credit card field
accept_visa1Accept Visa cards
accept_mastercard1Accept Mastercard cards
accept_amex1Accept American Express cards
accept_discover1Accept Discover cards
accept_dinersclub0Accept Diner's Club cards
accept_jcb0Accept JCB cards

Date/Time Field: datetime

Date/Time fields let you ask for a specific date or time

Attributes

AttributeDefault ValueDescription
date_formatM d, YFormat for date input
- m/d/y
- m/d/YY
- M d
- Y
- F d, Y
- d/m/YY
- d M Y
- d F Y
- YY-m-d
- M Y
time_formath:i AFormat for time input
- H,i
- H,i,s
- h,i A
- h,i,s A
year_minus5Number of previous years to show
year_plus5Number of future years to show

File Upload: file

File uploads allow you to ask for a file, such as an document or image

Attributes

AttributeDefault ValueDescription
size30Size of file upload field
typesjpg,jpeg,gif,png,bmp,tif,psd,pdf
,doc,docx,xls,xlsx,txt,mp3,mp4
,aac,wav,au,wmv,avi,mpg,mpeg
,zip,gz,rar,z,tgz,tar,sitx
File extensions accepted

Number: number

Number fields restrict input to numbers only

Attributes

AttributeDefault ValueDescription
size5Size of the number field
min_valueMinimum value
max_valueMaximum value
currencyCurrency (dollar, euro, pound, yen)
decimals0Number of decimal places to show
use_slider0Use a slider for number input
placeholderPlaceholder text to show

Select List: select

Select Lists allow the user to choose from a list of options

Attributes

AttributeDefault ValueDescription
option_size1Number of options to show at one time

Radio Buttons: radio

Radio Buttons allow only a single answer in an option list

Attributes

AttributeDefault ValueDescription
option_layoutverticalLayout of radio buttons (vertical, horizontal)
option_other0Show an 'Other' radio button
option_rand0Randomize radio button order
option_storevalueWhat to store for the radio button in the database (value, label, both)
option_show_values0

Checkbox: checkbox

Checkboxes allow more than one answer in an option list

Attributes

AttributeDefault ValueDescription
option_layoutverticalLayout of checkboxes (vertical, horizontal)
option_other0Show an 'Other' checkbox
option_checkall0Show a 'Check All' checkbox
option_rand0Randomize checkbox order
option_storevalueWhat to store for the checkbox in the database (value, label, both)
option_show_values0

Matrix: matrix

A Matrix field allows you to set up a rating scale

Attributes

AttributesDefault ValueDescription
rowchoicesItem 1

Item 2

Item 3
Row choices (separated by newlines)
columnchoicesVery Good

Good

Fair

Poor

Very Poor
Column choices (separated by newlines)
one_per_row1Only allow one column selection per row
one_per_column0Only allow one row selection per column
rowchoices_rand0Randomize row choices

Description Area: richtext

Description areas allow you to place formatted text, images, or HTML within your form

Attributes

AttributeDefault ValueDescription
textThe description area text
text_editorwysiwygEditing mode (wysiwyg, basic)

Embed Code: embed

Embed fields allow you to enter javascript embed code or html in your form

Attributes

AttributeDefault ValueDescription
textThe embed code text

Event/Product Field: product

Event/Product fields allow you to sell things with ease

Subfields

Subfield
unit_price
quantity
total

Attributes

AttributeDefault ValueDescription
charge_typefixed_amountType of charge (fixed_amount, no_charge)
currencydollarCurrency (dollar, euro, pound, yen)
descriptionEvent description
imageImage for the product/event
inventoryThe number of available products/event tickets
inventory_modeunlimitedInventory mode
unit_price3.99The price of the product/event ticket
min_quanitty1The minimum quantity available for purchase at one time
max_quantity10The maximum quantity available for purchase at one time
soldout_actionmessageThe action to take when the product/event is sold out (message, hide_field, waitlist)
is_soldoutIf the product/event is sold out

Section: section

Sections allow you to separate different fields on your form into different areas/pages

Attributes

AttributeDefault ValueDescription
break0Section is a page break
headingSection heading
textSection text
text_editorwysiwygEditing mode (wysiwyg, basic)
label_positiondefaultLabel Position for fields
num_columns0Number of columns in section