Contents
On this page

Create Booking Form - Plugixa Car Parking

POST /plugixa-car-parking/v1/booking-forms

Create a booking form: which locations and space types it offers, the steps the customer walks through, its look, and the extra questions it asks.

The signed-in user needs the plugixa_carparking_create capability (create records).

Note. The first form created on a site becomes the default form even without is_default. Sending is_default: true makes the new form the default and takes the flag off every other form.

Request

POST https://your-site.example/wp-json/plugixa-car-parking/v1/booking-forms

Request body

Content type: application/json

Field Type Required Description
name string Yes Must not be blank. Plain text.
slug string No Made from the name when empty. Made unique by appending -2, -3, …
status string No active (the default) or inactive.
is_default boolean No Make this the default form. The default form must be active.
location_ids array No Ids of live locations the form offers. Empty means every location.
all_locations boolean No true offers every location and empties location_ids. false requires at least one id in location_ids.
space_type_ids array No Ids of live space types the form offers. Empty means every space type.
steps array No The steps, see below. Left out, the form uses the default five.
fields array No Extra questions, see below.
style object No primary_color: a hex colour, #1976d2 when missing or invalid. design: classic (the default), split or minimal.
settings object No PRO With the map module, settings.map (boolean) shows or hides the map on this form. Any other key is ignored.

Steps

Each step is {"key": "...", "enabled": true, "options": {...}}.

Step field Type Description
key string dates, space, details, payment or confirm, plus extras PRO. Any other key is refused.
enabled boolean Defaults to true.
options object Named on/off switches. The space step reads coupon: false means this form takes no coupon.

dates is always moved first and confirm last; the rest keep the order sent. The payment step is only shown when the site offers two or more payment methods. A form with no enabled step runs dates, space, details and confirm.

Fields

Each extra question is {"key": "...", "label": "...", "type": "...", "required": false, "options": []}.

Question field Type Description
label string The question. A row without a label is dropped.
type string text (the default), email, tel, select, checkbox or textarea. Any other type is refused.
key string The answer’s key on the booking. Lowercase letters, digits, - and _. Made field_<position> when empty, counting from 0.
required boolean Whether the customer must answer.
options array The choices of a select, as strings.
{
  "name": "Airport parking",
  "location_ids": [4],
  "steps": [
    { "key": "dates", "enabled": true },
    { "key": "space", "enabled": true, "options": { "coupon": false } },
    { "key": "details", "enabled": true },
    { "key": "confirm", "enabled": true }
  ],
  "fields": [
    { "key": "flight_number", "label": "Flight number", "type": "text", "required": true }
  ],
  "style": { "primary_color": "#0f766e", "design": "split" }
}

Responses

201 Created. data is the new form.

{
  "success": true,
  "data": {
    "id": 3,
    "name": "Airport parking",
    "slug": "airport-parking",
    "status": "active",
    "steps": [
      { "key": "dates", "enabled": true, "options": [] },
      { "key": "space", "enabled": true, "options": { "coupon": false } },
      { "key": "details", "enabled": true, "options": [] },
      { "key": "confirm", "enabled": true, "options": [] }
    ],
    "style": { "primary_color": "#0f766e", "design": "split" },
    "location_ids": [4],
    "space_type_ids": null,
    "is_default": false,
    "settings": {
      "fields": [
        { "key": "flight_number", "label": "Flight number", "type": "text", "required": true, "options": [] }
      ]
    },
    "created_by": 1,
    "modified_by": 1,
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-12 09:30:00",
    "deleted_at": null,
    "fields": [
      { "key": "flight_number", "label": "Flight number", "type": "text", "required": true, "options": [] }
    ],
    "all_locations": false,
    "location_names": ["Terminal 2"],
    "space_type_names": []
  }
}
Field Type Meaning
data.id integer The new form’s id, used as form_id by the public booking routes
data.steps array The steps as stored. A step without options comes back with options as an empty list []
data.location_ids array|null Locations offered, null or empty for every location
data.space_type_ids array|null Space types offered, null or empty for every space type
data.is_default boolean Whether this is now the default form
data.fields array The extra questions as stored
data.all_locations boolean true when the form offers every location
data.location_names, data.space_type_names array Names of the ids, in the same order

Errors

Status Code When
422 plugixa_carparking_missing_name name is missing or blank.
422 plugixa_carparking_invalid_choice status, a step key or a question type is not allowed. For a step or question, data.field is steps or fields and data.line its position from 1.
422 plugixa_carparking_no_locations all_locations is false and no location is chosen.
422 plugixa_carparking_unknown_scope An id in location_ids or space_type_ids is not a live location or space type.
422 plugixa_carparking_default_form The form would be the default while not active. That includes the first form on a site, which is always made the default.
422 plugixa_carparking_too_long name or slug is longer than its column holds.
500 plugixa_carparking_insert_failed The database refused the row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/booking-forms" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Airport parking","location_ids":[4],"steps":[{"key":"dates","enabled":true},{"key":"space","enabled":true,"options":{"coupon":false}},{"key":"details","enabled":true},{"key":"confirm","enabled":true}],"fields":[{"key":"flight_number","label":"Flight number","type":"text","required":true}],"style":{"primary_color":"#0f766e","design":"split"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/booking-forms');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'         => 'Airport parking',
        'location_ids' => [4],
        'steps'        => [
            ['key' => 'dates', 'enabled' => true],
            ['key' => 'space', 'enabled' => true, 'options' => ['coupon' => false]],
            ['key' => 'details', 'enabled' => true],
            ['key' => 'confirm', 'enabled' => true],
        ],
        'fields'       => [
            ['key' => 'flight_number', 'label' => 'Flight number', 'type' => 'text', 'required' => true],
        ],
        'style'        => ['primary_color' => '#0f766e', 'design' => 'split'],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/booking-forms', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Airport parking',
    location_ids: [4],
    steps: [
      { key: 'dates', enabled: true },
      { key: 'space', enabled: true, options: { coupon: false } },
      { key: 'details', enabled: true },
      { key: 'confirm', enabled: true },
    ],
    fields: [
      { key: 'flight_number', label: 'Flight number', type: 'text', required: true },
    ],
    style: { primary_color: '#0f766e', design: 'split' },
  }),
});
const { data } = await response.json();

Quick Links

Share