curl --request POST \
--url https://api.onlyform.com/v1/forms \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Contact us",
"workspace_id": "507f1f77bcf86cd799439012",
"type": "MULTI"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Contact us', workspace_id: '507f1f77bcf86cd799439012', type: 'MULTI'})
};
fetch('https://api.onlyform.com/v1/forms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.onlyform.com/v1/forms"
payload = {
"name": "Contact us",
"workspace_id": "507f1f77bcf86cd799439012",
"type": "MULTI"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.onlyform.com/v1/forms"
payload := strings.NewReader("{\n \"name\": \"Contact us\",\n \"workspace_id\": \"507f1f77bcf86cd799439012\",\n \"type\": \"MULTI\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "507f1f77bcf86cd799439011",
"public_id": "<string>",
"workspace_id": "507f1f77bcf86cd799439011",
"name": "<string>",
"status": "draft",
"is_closed": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"links": {
"self": "<string>",
"submissions": "<string>"
},
"type": "SINGLE",
"definition": {
"blocks": [
{
"id": "<string>",
"type": "welcome",
"label": "<string>",
"description": "<string>",
"required": true,
"properties": {
"buttonText": "<string>",
"buttonLink": "<string>",
"shareButtons": true,
"maxChars": 0,
"min": 123,
"max": 123,
"minVal": true,
"maxVal": true,
"dateFormat": "DDMMYYYY",
"dateSeparator": "<string>",
"disabledDays": 5,
"beforeDate": "2023-11-07T05:31:56Z",
"afterDate": "2023-11-07T05:31:56Z",
"specificDates": [
"2023-11-07T05:31:56Z"
],
"weekStartsOn": 4,
"quotationMarks": true,
"multiSelection": true,
"randomize": true,
"alphaOrder": true,
"defaultCountry": "<string>",
"from": 123,
"to": 123,
"scaleStep": 123,
"limit": 2,
"currency": "<string>",
"amount": "<string>",
"paymentGateway": "<string>",
"showFields": true,
"showDatePicker": true,
"showLabels": true,
"superSize": true,
"otherOption": true,
"otherText": "<string>",
"horizontalAlign": true,
"verticalAlign": true,
"perRow": 2,
"imageAlign": "left",
"altText": true,
"imageAlt": "<string>",
"imageWidth": 123,
"icon": "star",
"firstLabel": "<string>",
"secondLabel": "<string>",
"thirdLabel": "<string>",
"leftLabel": true,
"centerLabel": true,
"rightLabel": true,
"addressOrContact": {
"firstName": {
"hide": true,
"required": true
},
"lastName": {
"hide": true,
"required": true
},
"email": {
"hide": true,
"required": true
},
"phone": {
"hide": true,
"required": true
},
"company": {
"hide": true,
"required": true
},
"address": {
"hide": true,
"required": true
},
"address2": {
"hide": true,
"required": true
},
"city": {
"hide": true,
"required": true
},
"state": {
"hide": true,
"required": true
},
"zip": {
"hide": true,
"required": true
},
"country": {
"hide": true,
"required": true
}
},
"legalText": "<string>",
"legalType": 1,
"legalStopFurther": true,
"showSeconds": true,
"showTimePicker": true,
"videoLink": "<string>",
"pdfLink": "<string>",
"embedLink": "<string>",
"captchaType": "turnstile",
"placeholderText": "<string>",
"numberFormat": "<string>",
"allowedFiles": [
"<string>"
],
"multipleFiles": true,
"maxFileSize": true,
"hide": true,
"showActions": true,
"badgeType": "off",
"colorOption": true,
"rule": {},
"image": {}
},
"part_of": "<string>",
"row_id": "<string>",
"choices": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
],
"children": "<array>",
"matrix_columns": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
],
"matrix_rows": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
]
}
],
"settings": {
"branding": true,
"navigation": true,
"progressBar": true,
"singlePage": true,
"inlineFields": true,
"borderRadius": 123,
"numberedQuestions": true,
"responseLimit": 0,
"darkMode": true,
"closed": true,
"utm": {
"campaign": true,
"content": true,
"medium": true,
"source": true,
"term": true
},
"showTitle": true,
"closeAt": "2023-11-07T05:31:56Z",
"closedMessage": "<string>",
"duplicateField": "<string>",
"redirectUrl": "<string>",
"submitLabel": "<string>",
"cover": {
"color": "<string>",
"image": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
},
"position": {
"x": 123,
"y": 123
}
}
},
"theme": {
"logo": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
},
"background": {
"brightness": 50,
"layout": "fullscreen",
"image": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
}
},
"colors": {
"background": "#3969D9",
"foreground": "#3969D9",
"card": "#3969D9",
"cardForeground": "#3969D9",
"popover": "#3969D9",
"popoverForeground": "#3969D9",
"primary": "#3969D9",
"primaryForeground": "#3969D9",
"secondary": "#3969D9",
"secondaryForeground": "#3969D9",
"muted": "#3969D9",
"mutedForeground": "#3969D9",
"accent": "#3969D9",
"accentForeground": "#3969D9",
"destructive": "#3969D9",
"destructiveForeground": "#3969D9",
"border": "#3969D9",
"input": "#3969D9",
"ring": "#3969D9",
"text": "#3969D9",
"chart1": "#3969D9",
"chart2": "#3969D9",
"chart3": "#3969D9",
"chart4": "#3969D9",
"chart5": "#3969D9",
"sidebar": "#3969D9",
"sidebarForeground": "#3969D9",
"sidebarPrimary": "#3969D9",
"sidebarPrimaryForeground": "#3969D9",
"sidebarAccent": "#3969D9",
"sidebarAccentForeground": "#3969D9",
"sidebarBorder": "#3969D9",
"sidebarRing": "#3969D9",
"dark": {
"background": "#3969D9",
"foreground": "#3969D9",
"card": "#3969D9",
"cardForeground": "#3969D9",
"popover": "#3969D9",
"popoverForeground": "#3969D9",
"primary": "#3969D9",
"primaryForeground": "#3969D9",
"secondary": "#3969D9",
"secondaryForeground": "#3969D9",
"muted": "#3969D9",
"mutedForeground": "#3969D9",
"accent": "#3969D9",
"accentForeground": "#3969D9",
"destructive": "#3969D9",
"destructiveForeground": "#3969D9",
"border": "#3969D9",
"input": "#3969D9",
"ring": "#3969D9",
"text": "#3969D9",
"chart1": "#3969D9",
"chart2": "#3969D9",
"chart3": "#3969D9",
"chart4": "#3969D9",
"chart5": "#3969D9",
"sidebar": "#3969D9",
"sidebarForeground": "#3969D9",
"sidebarPrimary": "#3969D9",
"sidebarPrimaryForeground": "#3969D9",
"sidebarAccent": "#3969D9",
"sidebarAccentForeground": "#3969D9",
"sidebarBorder": "#3969D9",
"sidebarRing": "#3969D9"
}
},
"alignment": {
"welcomeAndEndings": 0,
"questions": 0,
"logo": 1
},
"size": {
"welcomeAndEndings": 0,
"questions": 0
},
"font": "Inter",
"corners": 0,
"logoPlacement": {
"align": "left",
"vertical": "inside"
},
"layout": {
"pageWidth": "<string>",
"baseFontSize": "<string>"
},
"logoSize": {
"width": 123,
"height": 123,
"radius": 123
},
"coverHeight": "<string>",
"inputs": {
"width": "<string>",
"height": "<string>",
"background": "<string>",
"placeholder": "<string>",
"border": "<string>",
"borderWidth": 123,
"radius": 123,
"marginBottom": 123,
"paddingX": 123
},
"buttons": {
"width": "<string>",
"height": "<string>",
"alignment": "left",
"fontSize": 123,
"radius": 123,
"background": "<string>",
"text": "<string>",
"marginY": 123,
"paddingX": 123
},
"customCss": "<string>",
"theme": "light"
},
"variables": {
"score": 0,
"price": 0,
"segment": "enterprise"
},
"hidden_fields": [
"campaign_id",
"account-id"
]
}
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}Create a form
Creates a draft form. Include definition.blocks, definition.settings, definition.theme, definition.variables, and definition.hidden_fields to create a complete form in one request. Variables and hidden fields can only be declared during creation in this API version. Requires forms:write.
curl --request POST \
--url https://api.onlyform.com/v1/forms \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Contact us",
"workspace_id": "507f1f77bcf86cd799439012",
"type": "MULTI"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Contact us', workspace_id: '507f1f77bcf86cd799439012', type: 'MULTI'})
};
fetch('https://api.onlyform.com/v1/forms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.onlyform.com/v1/forms"
payload = {
"name": "Contact us",
"workspace_id": "507f1f77bcf86cd799439012",
"type": "MULTI"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.onlyform.com/v1/forms"
payload := strings.NewReader("{\n \"name\": \"Contact us\",\n \"workspace_id\": \"507f1f77bcf86cd799439012\",\n \"type\": \"MULTI\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "507f1f77bcf86cd799439011",
"public_id": "<string>",
"workspace_id": "507f1f77bcf86cd799439011",
"name": "<string>",
"status": "draft",
"is_closed": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"links": {
"self": "<string>",
"submissions": "<string>"
},
"type": "SINGLE",
"definition": {
"blocks": [
{
"id": "<string>",
"type": "welcome",
"label": "<string>",
"description": "<string>",
"required": true,
"properties": {
"buttonText": "<string>",
"buttonLink": "<string>",
"shareButtons": true,
"maxChars": 0,
"min": 123,
"max": 123,
"minVal": true,
"maxVal": true,
"dateFormat": "DDMMYYYY",
"dateSeparator": "<string>",
"disabledDays": 5,
"beforeDate": "2023-11-07T05:31:56Z",
"afterDate": "2023-11-07T05:31:56Z",
"specificDates": [
"2023-11-07T05:31:56Z"
],
"weekStartsOn": 4,
"quotationMarks": true,
"multiSelection": true,
"randomize": true,
"alphaOrder": true,
"defaultCountry": "<string>",
"from": 123,
"to": 123,
"scaleStep": 123,
"limit": 2,
"currency": "<string>",
"amount": "<string>",
"paymentGateway": "<string>",
"showFields": true,
"showDatePicker": true,
"showLabels": true,
"superSize": true,
"otherOption": true,
"otherText": "<string>",
"horizontalAlign": true,
"verticalAlign": true,
"perRow": 2,
"imageAlign": "left",
"altText": true,
"imageAlt": "<string>",
"imageWidth": 123,
"icon": "star",
"firstLabel": "<string>",
"secondLabel": "<string>",
"thirdLabel": "<string>",
"leftLabel": true,
"centerLabel": true,
"rightLabel": true,
"addressOrContact": {
"firstName": {
"hide": true,
"required": true
},
"lastName": {
"hide": true,
"required": true
},
"email": {
"hide": true,
"required": true
},
"phone": {
"hide": true,
"required": true
},
"company": {
"hide": true,
"required": true
},
"address": {
"hide": true,
"required": true
},
"address2": {
"hide": true,
"required": true
},
"city": {
"hide": true,
"required": true
},
"state": {
"hide": true,
"required": true
},
"zip": {
"hide": true,
"required": true
},
"country": {
"hide": true,
"required": true
}
},
"legalText": "<string>",
"legalType": 1,
"legalStopFurther": true,
"showSeconds": true,
"showTimePicker": true,
"videoLink": "<string>",
"pdfLink": "<string>",
"embedLink": "<string>",
"captchaType": "turnstile",
"placeholderText": "<string>",
"numberFormat": "<string>",
"allowedFiles": [
"<string>"
],
"multipleFiles": true,
"maxFileSize": true,
"hide": true,
"showActions": true,
"badgeType": "off",
"colorOption": true,
"rule": {},
"image": {}
},
"part_of": "<string>",
"row_id": "<string>",
"choices": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
],
"children": "<array>",
"matrix_columns": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
],
"matrix_rows": [
{
"id": "<string>",
"label": "<string>",
"image": "<unknown>",
"color": "<string>",
"row_id": "<string>",
"alt": "<string>"
}
]
}
],
"settings": {
"branding": true,
"navigation": true,
"progressBar": true,
"singlePage": true,
"inlineFields": true,
"borderRadius": 123,
"numberedQuestions": true,
"responseLimit": 0,
"darkMode": true,
"closed": true,
"utm": {
"campaign": true,
"content": true,
"medium": true,
"source": true,
"term": true
},
"showTitle": true,
"closeAt": "2023-11-07T05:31:56Z",
"closedMessage": "<string>",
"duplicateField": "<string>",
"redirectUrl": "<string>",
"submitLabel": "<string>",
"cover": {
"color": "<string>",
"image": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
},
"position": {
"x": 123,
"y": 123
}
}
},
"theme": {
"logo": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
},
"background": {
"brightness": 50,
"layout": "fullscreen",
"image": {
"id": "<string>",
"url": "<string>",
"width": 1,
"height": 1,
"base64": "<string>"
}
},
"colors": {
"background": "#3969D9",
"foreground": "#3969D9",
"card": "#3969D9",
"cardForeground": "#3969D9",
"popover": "#3969D9",
"popoverForeground": "#3969D9",
"primary": "#3969D9",
"primaryForeground": "#3969D9",
"secondary": "#3969D9",
"secondaryForeground": "#3969D9",
"muted": "#3969D9",
"mutedForeground": "#3969D9",
"accent": "#3969D9",
"accentForeground": "#3969D9",
"destructive": "#3969D9",
"destructiveForeground": "#3969D9",
"border": "#3969D9",
"input": "#3969D9",
"ring": "#3969D9",
"text": "#3969D9",
"chart1": "#3969D9",
"chart2": "#3969D9",
"chart3": "#3969D9",
"chart4": "#3969D9",
"chart5": "#3969D9",
"sidebar": "#3969D9",
"sidebarForeground": "#3969D9",
"sidebarPrimary": "#3969D9",
"sidebarPrimaryForeground": "#3969D9",
"sidebarAccent": "#3969D9",
"sidebarAccentForeground": "#3969D9",
"sidebarBorder": "#3969D9",
"sidebarRing": "#3969D9",
"dark": {
"background": "#3969D9",
"foreground": "#3969D9",
"card": "#3969D9",
"cardForeground": "#3969D9",
"popover": "#3969D9",
"popoverForeground": "#3969D9",
"primary": "#3969D9",
"primaryForeground": "#3969D9",
"secondary": "#3969D9",
"secondaryForeground": "#3969D9",
"muted": "#3969D9",
"mutedForeground": "#3969D9",
"accent": "#3969D9",
"accentForeground": "#3969D9",
"destructive": "#3969D9",
"destructiveForeground": "#3969D9",
"border": "#3969D9",
"input": "#3969D9",
"ring": "#3969D9",
"text": "#3969D9",
"chart1": "#3969D9",
"chart2": "#3969D9",
"chart3": "#3969D9",
"chart4": "#3969D9",
"chart5": "#3969D9",
"sidebar": "#3969D9",
"sidebarForeground": "#3969D9",
"sidebarPrimary": "#3969D9",
"sidebarPrimaryForeground": "#3969D9",
"sidebarAccent": "#3969D9",
"sidebarAccentForeground": "#3969D9",
"sidebarBorder": "#3969D9",
"sidebarRing": "#3969D9"
}
},
"alignment": {
"welcomeAndEndings": 0,
"questions": 0,
"logo": 1
},
"size": {
"welcomeAndEndings": 0,
"questions": 0
},
"font": "Inter",
"corners": 0,
"logoPlacement": {
"align": "left",
"vertical": "inside"
},
"layout": {
"pageWidth": "<string>",
"baseFontSize": "<string>"
},
"logoSize": {
"width": 123,
"height": 123,
"radius": 123
},
"coverHeight": "<string>",
"inputs": {
"width": "<string>",
"height": "<string>",
"background": "<string>",
"placeholder": "<string>",
"border": "<string>",
"borderWidth": 123,
"radius": 123,
"marginBottom": 123,
"paddingX": 123
},
"buttons": {
"width": "<string>",
"height": "<string>",
"alignment": "left",
"fontSize": 123,
"radius": 123,
"background": "<string>",
"text": "<string>",
"marginY": 123,
"paddingX": 123
},
"customCss": "<string>",
"theme": "light"
},
"variables": {
"score": 0,
"price": 0,
"segment": "enterprise"
},
"hidden_fields": [
"campaign_id",
"account-id"
]
}
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"status": 123,
"request_id": "<string>",
"details": [
{}
]
}Authorizations
A scoped key with the of_live_ prefix, generated from Profile > API keys.
Body
1 - 120^[0-9a-fA-F]{24}$"507f1f77bcf86cd799439011"
Form presentation model. CONVERSATIONAL is reserved for a future renderer and currently returns 422 UNSUPPORTED_FORM_TYPE when used for creation.
SINGLE, MULTI, CONVERSATIONAL Optional internal category. When omitted, Onlyform uses the default category.
^[0-9a-fA-F]{24}$"507f1f77bcf86cd799439011"
Show child attributes
Show child attributes
Response
Form created.
^[0-9a-fA-F]{24}$"507f1f77bcf86cd799439011"
^[0-9a-fA-F]{24}$"507f1f77bcf86cd799439011"
draft, published, deleted Show child attributes
Show child attributes
Form presentation model. CONVERSATIONAL is reserved for a future renderer and currently returns 422 UNSUPPORTED_FORM_TYPE when used for creation.
SINGLE, MULTI, CONVERSATIONAL Show child attributes
Show child attributes
Was this page helpful?