---
title: "Save an API form"
method: POST
path: "/Form/saveAPIForm"
tags: ["Forms"]
---

# Save an API form

`POST /Form/saveAPIForm`

## Request

- Base URL: `https://api.ontraport.com/1`
- URL: `https://api.ontraport.com/1/Form/saveAPIForm`
- Auth: none declared

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.

## Request body

- APIForm
  - `id` integer: The ID of an existing API form to update. Omit to create a new form.
  - `name` string, required: The name of the form. Required when creating. Duplicate names are auto-suffixed with (1), (2), etc.
  - `object_type_id` integer: The object type the form creates or updates records for. Defaults to 0 (Contact). Cannot be changed on update.
  - `fields` APIFormField[], required: The form's fields, in display order. At least one is required when creating; omit on update to keep the current fields.
    - `name` string, required: The object's field name. Must be a real field on the target object; retrieve field names with Retrieve object meta.
    - `required` boolean: Whether the field is required. Enforced server-side on every submission.
    - `label` string: Overrides the field's default display label.
  - `settings` APIFormSettings
    - `redirect` string: Where the visitor is sent after submitting: "default" for Ontraport's default thank you page, or a full http(s) URL.
    - `notification_email` string: An email address to notify on each submission.
    - `tags` integer[]: IDs of tags to apply to the contact on submission. Pass [] on update to clear.
    - `campaigns` integer[]: IDs of automations to add the contact to on submission.
    - `owner` integer: The staff user assigned as owner of new contacts created by this form.
    - `opt_in_settings` 'single' | 'double_optional' | 'double_required': Double opt-in gates tag/sequence/automation application until the contact confirms.

## Response `200`

Successful save

- Response
  - `code` integer, required
  - `data` object, required
  - `account_id` integer, required

## Other responses

- `400`: Invalid request (unknown field, payment settings, bad enum value)
- `403`: No permissions
- `404`: Form not found (update)

## Changes

- **2026-10-07** `fe6b154a277e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ontraport/apis/ontraport-api/changes/Form/saveAPIForm/post.md)

---

[API](https://skmtc.dev/ontraport/apis/ontraport-api.md) - [All operations](https://skmtc.dev/ontraport/apis/ontraport-api/llms.txt) - [OpenAPI document](https://skmtc.dev/ontraport/apis/ontraport-api/revisions/4c878a9f93aa?raw)
