Contents
On this page

Update Availability - Plugixa Chauffeur

PUT /plugixa-chauffeur/v1/availability

Replace the availability rules. POST /availability does exactly the same.

Needs a signed-in user with the plugixa_chauffeur_manage capability (administrators have it after activation).

Note. This is a full replace, not a merge. A key you leave out goes back to its default, and a weekday you leave out of business_hours becomes closed. Read the rules first with Get Availability and send them all back.

Request

PUT https://your-site.example/wp-json/plugixa-chauffeur/v1/availability

Request body

Content type: application/json

Field Type Required Description
enabled boolean No Omitted means false: the rules stop being enforced.
lead_time_minutes integer No 0 or more. Default 60.
horizon_days integer No 0 or more, 0 for no limit. Default 0.
business_hours object No Keys 1 (Monday) to 7 (Sunday). Each day: open (boolean, omitted means closed), start and end (HH:MM; an invalid time falls back to 09:00 and 18:00).
blackout_dates array No Each { start, end, label }. An entry without a valid start (YYYY-MM-DD) is dropped; a missing or earlier end becomes start.

The rules are checked by the public quote and booking endpoints, in the site’s time zone. See Availability.

{
  "enabled": true,
  "lead_time_minutes": 120,
  "horizon_days": 180,
  "business_hours": {
    "1": {
      "open": true,
      "start": "06:00",
      "end": "23:00"
    },
    "2": {
      "open": true,
      "start": "06:00",
      "end": "23:00"
    },
    "3": {
      "open": true,
      "start": "06:00",
      "end": "23:00"
    },
    "4": {
      "open": true,
      "start": "06:00",
      "end": "23:00"
    },
    "5": {
      "open": true,
      "start": "06:00",
      "end": "23:00"
    },
    "6": {
      "open": true,
      "start": "08:00",
      "end": "20:00"
    },
    "7": {
      "open": false,
      "start": "09:00",
      "end": "18:00"
    }
  },
  "blackout_dates": [
    {
      "start": "2026-12-24",
      "end": "2026-12-26",
      "label": "Christmas"
    }
  ]
}

Responses

200 Saved. data is the rules as stored.

{
  "success": true,
  "message": "Availability saved.",
  "data": {
    "enabled": true,
    "lead_time_minutes": 120,
    "horizon_days": 180,
    "business_hours": {
      "1": {
        "open": true,
        "start": "06:00",
        "end": "23:00"
      },
      "2": {
        "open": true,
        "start": "06:00",
        "end": "23:00"
      },
      "3": {
        "open": true,
        "start": "06:00",
        "end": "23:00"
      },
      "4": {
        "open": true,
        "start": "06:00",
        "end": "23:00"
      },
      "5": {
        "open": true,
        "start": "06:00",
        "end": "23:00"
      },
      "6": {
        "open": true,
        "start": "08:00",
        "end": "20:00"
      },
      "7": {
        "open": false,
        "start": "09:00",
        "end": "18:00"
      }
    },
    "blackout_dates": [
      {
        "start": "2026-12-24",
        "end": "2026-12-26",
        "label": "Christmas"
      }
    ]
  }
}
Field Type Meaning
data.enabled boolean Whether the rules are enforced. When false, any pickup time is accepted
data.lead_time_minutes integer Minutes of notice a booking needs. 0 only forbids the past
data.horizon_days integer How many days ahead a booking can be made. 0 means no limit
data.business_hours object Keys 1 (Monday) to 7 (Sunday), each { open, start, end } with times as HH:MM, end excluded
data.blackout_dates array Closed date ranges { start, end, label }, dates as YYYY-MM-DD, both ends included

Errors

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-chauffeur/v1/availability" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"lead_time_minutes":120,"horizon_days":180,"business_hours":{"1":{"open":true,"start":"06:00","end":"23:00"},"2":{"open":true,"start":"06:00","end":"23:00"},"3":{"open":true,"start":"06:00","end":"23:00"},"4":{"open":true,"start":"06:00","end":"23:00"},"5":{"open":true,"start":"06:00","end":"23:00"},"6":{"open":true,"start":"08:00","end":"20:00"},"7":{"open":false,"start":"09:00","end":"18:00"}},"blackout_dates":[{"start":"2026-12-24","end":"2026-12-26","label":"Christmas"}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chauffeur/v1/availability');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'enabled'           => true,
        'lead_time_minutes' => 120,
        'horizon_days'      => 180,
        'business_hours'    => [
            '1' => [
                'open'  => true,
                'start' => '06:00',
                'end'   => '23:00',
            ],
            '2' => [
                'open'  => true,
                'start' => '06:00',
                'end'   => '23:00',
            ],
            '3' => [
                'open'  => true,
                'start' => '06:00',
                'end'   => '23:00',
            ],
            '4' => [
                'open'  => true,
                'start' => '06:00',
                'end'   => '23:00',
            ],
            '5' => [
                'open'  => true,
                'start' => '06:00',
                'end'   => '23:00',
            ],
            '6' => [
                'open'  => true,
                'start' => '08:00',
                'end'   => '20:00',
            ],
            '7' => [
                'open'  => false,
                'start' => '09:00',
                'end'   => '18:00',
            ],
        ],
        'blackout_dates'    => [
            [
                'start' => '2026-12-24',
                'end'   => '2026-12-26',
                'label' => 'Christmas',
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-chauffeur/v1/availability', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    enabled: true,
    lead_time_minutes: 120,
    horizon_days: 180,
    business_hours: {
      '1': { open: true, start: '06:00', end: '23:00' },
      '2': { open: true, start: '06:00', end: '23:00' },
      '3': { open: true, start: '06:00', end: '23:00' },
      '4': { open: true, start: '06:00', end: '23:00' },
      '5': { open: true, start: '06:00', end: '23:00' },
      '6': { open: true, start: '08:00', end: '20:00' },
      '7': { open: false, start: '09:00', end: '18:00' },
    },
    blackout_dates: [{ start: '2026-12-24', end: '2026-12-26', label: 'Christmas' }],
  }),
});
const { data } = await response.json();

Quick Links

Share