Contents
On this page

Set Profile PIN - Plugixa Stream

PUT /plugixa-stream/v1/me/profiles/pin

Set, change or clear the PIN that a kids profile needs to switch to an adult profile.

Any signed-in user (an Application Password, or the login cookie with an X-WP-Nonce header). Signed out, it answers 401 plugixa_stream_login_required. It always acts on the caller’s own account. Not from a kids profile: there it answers 403 plugixa_stream_kids_profile.

Request

PUT https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/pin

Request body

Content type: application/json

Field Type Required Description
pin string No 4 digits. Empty clears the PIN.
current string When a PIN is set The PIN now in use.
{
  "current": "4821",
  "pin": "7305"
}

Responses

200 OK. data is every profile, with has_pin.

{
  "success": true,
  "data": {
    "profiles": [
      {
        "id": 0,
        "name": "Maya",
        "avatar": 0,
        "kids": false,
        "main": true
      },
      {
        "id": 1,
        "name": "Leo",
        "avatar": 3,
        "kids": true,
        "main": false
      }
    ],
    "active": 0,
    "kids": false,
    "has_pin": true,
    "max": 5,
    "can_add": true,
    "avatars": 8
  }
}

Errors

Status Code When
401 plugixa_stream_login_required Signed out.
403 plugixa_stream_kids_profile The session is on a kids profile.
403 plugixa_stream_pin_wrong current is wrong.
429 plugixa_stream_pin_locked 5 wrong PINs: wait 15 minutes.
422 plugixa_stream_invalid pin is not 4 digits.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/pin" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"current":"4821","pin":"7305"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/pin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'current' => '4821',
        'pin'     => '7305',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/me/profiles/pin', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ current: '4821', pin: '7305' }),
});
const { data } = await response.json();

Quick Links

Share