4. Forms API | Form Forge - Build Forms with AI in Seconds
Download Log in

4. Forms API

Developer Guide

CRUD operations for forms. All endpoints require manage_options capability.

GET /formforge/v1/forms

List all forms.

bash
curl -s -u "admin:XXXX XXXX XXXX XXXX" 
  https://example.com/wp-json/formforge/v1/forms
Response (200):
json
[
  {
    "id": 1,
    "title": "Contact Form",
    "fields": [
      {
        "id": "field_1",
        "type": "text",
        "label": "Name",
        "required": true,
        "placeholder": "Your name"
      },
      {
        "id": "field_2",
        "type": "email",
        "label": "Email",
        "required": true,
        "placeholder": "[email protected]"
      }
    ],
    "settings": {
      "submit_text": "Submit",
      "success_message": "Thank you!",
      "notify_admin": true,
      "notify_email": "[email protected]"
    },
    "status": "publish",
    "created_at": "2025-01-15 10:30:00",
    "updated_at": "2025-01-20 14:00:00"
  }
]

GET /formforge/v1/forms/{id}

Get a single form by ID.

bash
curl -s -u "admin:XXXX XXXX XXXX XXXX" 
  https://example.com/wp-json/formforge/v1/forms/1
Response (200):
json
{
  "id": 1,
  "title": "Contact Form",
  "fields": [
    {
      "id": "field_1",
      "type": "text",
      "label": "Name",
      "required": true,
      "placeholder": "Your name",
      "description": "",
      "min_length": 0,
      "max_length": 0,
      "regex": "",
      "regex_message": ""
    },
    {
      "id": "field_2",
      "type": "email",
      "label": "Email",
      "required": true,
      "placeholder": "[email protected]"
    },
    {
      "id": "field_3",
      "type": "textarea",
      "label": "Message",
      "required": true,
      "placeholder": "How can we help?",
      "rows": 6
    }
  ],
  "settings": {
    "submit_text": "Send Message",
    "success_message": "Thank you! We will get back to you within 24 hours.",
    "redirect_url": "",
    "notify_admin": true,
    "notify_email": "[email protected]",
    "webhook_url": "",
    "css_class": ""
  },
  "conditional_logic": [],
  "status": "publish",
  "created_at": "2025-01-15 10:30:00",
  "updated_at": "2025-01-20 14:00:00"
}

POST /formforge/v1/forms

Create a new form. Send a JSON body with title, fields, and optionally settings and conditional_logic.

bash
curl -s -X POST -u "admin:XXXX XXXX XXXX XXXX" 
  -H "Content-Type: application/json" 
  https://example.com/wp-json/formforge/v1/forms 
  -d '{
    "title": "Newsletter Signup",
    "fields": [
      {
        "id": "field_1",
        "type": "email",
        "label": "Email Address",
        "required": true,
        "placeholder": "[email protected]"
      },
      {
        "id": "field_2",
        "type": "text",
        "label": "First Name",
        "required": false,
        "placeholder": "Your name"
      }
    ],
    "settings": {
      "submit_text": "Subscribe",
      "success_message": "You are subscribed!",
      "notify_admin": true,
      "notify_email": "[email protected]"
    }
  }'
Response (200):
json
{
  "id": 5
}

PUT /formforge/v1/forms/{id}

Update an existing form. Partial updates are supported: only include the keys you want to change.

bash
curl -s -X PUT -u "admin:XXXX XXXX XXXX XXXX" 
  -H "Content-Type: application/json" 
  https://example.com/wp-json/formforge/v1/forms/5 
  -d '{
    "title": "Newsletter Signup v2",
    "settings": {
      "submit_text": "Join Now",
      "success_message": "Welcome aboard!"
    }
  }'
Response (200):
json
{
  "success": true
}

DELETE /formforge/v1/forms/{id}

Delete a form and all its submissions and analytics. This action is irreversible.

bash
curl -s -X DELETE -u "admin:XXXX XXXX XXXX XXXX" 
  https://example.com/wp-json/formforge/v1/forms/5
Response (200):
json
{
  "success": true
}

> Warning: This permanently deletes the form, all submissions, and all analytics data for that form. There is no undo.

Forge AI Assistant Online

Hi! I'm the Form Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs