Contents
On this page

Get Context - Plugixa Chat

GET /plugixa-chat/v1/context

Answer what a cached page cannot know: the site’s current time, the visitor’s country, whether they are logged in, and fresh page tokens for the public routes.

Public: no login, no token and no rate limit.

Note. The response is marked Cache-Control: private, max-age=300 and Vary: Cookie: a browser may reuse it for five minutes, a shared cache may not.

Request

GET https://your-site.example/wp-json/plugixa-chat/v1/context

Responses

200 OK.

{
  "success": true,
  "data": {
    "now": {
      "minutes": 570,
      "weekday": 4,
      "date": "2026-11-12",
      "timezone": "Europe/Paris"
    },
    "country": "FR",
    "loggedIn": false,
    "tokens": {
      "events": "YOUR_EVENTS_TOKEN",
      "lead": "YOUR_LEAD_TOKEN"
    },
    "failMode": "open"
  }
}
Field Type Meaning
data.now.minutes integer Minutes since midnight in the site’s timezone
data.now.weekday integer 0 for Sunday to 6 for Saturday
data.now.date string Today in the site’s timezone, YYYY-MM-DD
data.now.timezone string The site’s timezone
data.country string Two-letter country code from the host’s country header (Cloudflare and others). Empty when it is not known
data.loggedIn boolean Whether the request carries a valid WordPress login cookie
data.tokens.events string The page token for Record Events
data.tokens.lead string The page token for Submit Lead and Look Up Order
data.failMode string open or closed: what the widget does when a visitor check cannot be made

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-chat/v1/context"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/context');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/context');
const { data } = await response.json();

Quick Links

Share