Forms

Save an API form

Changed on

Creates a new API form, or updates an existing one when an id is passed. API forms hold a simple list of object fields plus backend settings (tags, automations, redirect, notification email, opt-in; sequences are not supported on API forms). They are processed exactly like regular Ontraport forms on submission, but are not editable in the visual form editors. The response includes the form's uid and submit_url, which are everything needed to build a plain HTML form that posts into Ontraport.

post/Form/saveAPIForm

Request

  • Base URL
    https://api.ontraport.com/1
  • Auth
    none declared

Request body

idinteger

The ID of an existing API form to update. Omit to create a new form.

namestring required

The name of the form. Required when creating. Duplicate names are auto-suffixed with (1), (2), etc.

object_type_idinteger

The object type the form creates or updates records for. Defaults to 0 (Contact). Cannot be changed on update.

Example request

{
  "name": "Newsletter Signup",
  "object_type_id": 0,
  "fields": [
    {
      "name": "firstname",
      "required": true
    },
    {
      "name": "email",
      "required": true
    },
    {
      "name": "sms_number",
      "label": "Mobile Number"
    }
  ],
  "settings": {
    "redirect": "https://example.com/thanks",
    "notification_email": "sales@example.com",
    "tags": [
      123,
      456
    ],
    "campaigns": [],
    "owner": 1,
    "opt_in_settings": "single"
  }
}

Response

Successful save

codeinteger required
dataobject required
account_idinteger required

Changes