Contents
On this page

Send Request - Plugixa Testimonial

POST /plugixatestimonial/v1/requests

Create a testimonial request and e-mail it: the recipient gets a link to the submission form that pre-fills their name and e-mail.

Administrators only: the user needs WordPress’s manage_options capability. No plugin capability opens this route.

Note. A request is created even when the e-mail could not be sent: the answer is still 200, with the message “Request created but email could not be sent.” and sent_at left null. Check data.sent_at.

Request

POST https://your-site.example/wp-json/plugixatestimonial/v1/requests

Request body

Content type: application/json

Field Type Required Description
recipient_email string Yes A valid e-mail address.
recipient_name string No Replaces {recipient_name} in the message.
subject string No Defaults to the Request subject setting.
message string No Plain text. Defaults to the Request message setting. {recipient_name}, {site_name} and {submission_link} are filled in.

The link points to the Submission page chosen in the request settings (the home page when none is set) with pxt_request_token added, and expires after the Expiry setting, 30 days by default. The e-mail is sent from the From name and From e-mail settings.

{
  "recipient_email": "lucas@example.com",
  "recipient_name": "Lucas Bernard"
}

Responses

200 OK. data is the stored request.

{
  "success": true,
  "message": "Request sent successfully.",
  "data": {
    "id": "15",
    "recipient_email": "lucas@example.com",
    "recipient_name": "Lucas Bernard",
    "subject": "We'd love your feedback!",
    "message": "Hi {recipient_name},\n\nCould you share a few words about working with us?\n\n{submission_link}\n\nThank you!\n{site_name}",
    "token": "kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6",
    "status": "pending",
    "testimonial_id": null,
    "sent_at": "2026-11-12 09:30:00",
    "submitted_at": null,
    "expires_at": "2026-12-12 08:30:00",
    "created_by": "1",
    "created_at": "2026-11-12 09:30:00"
  }
}
Field Type Meaning
data.id string The request’s id
data.recipient_email string Who it was sent to
data.recipient_name string|null Their name
data.subject string|null The e-mail subject
data.message string|null The message, with its {recipient_name}, {site_name} and {submission_link} placeholders
data.token string The single-use key in the recipient’s link
data.status string pending, submitted or expired
data.testimonial_id string|null The testimonial the recipient submitted
data.sent_at string|null Site-time datetime the e-mail last went out, null if it never did
data.submitted_at string|null Site-time datetime of the submission
data.expires_at string|null UTC datetime after which the link stops working
data.created_at string|null Site-time datetime
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
400 rest_error “A valid email address is required.”
500 rest_error The database refused the insert.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixatestimonial/v1/requests" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"recipient_email":"lucas@example.com","recipient_name":"Lucas Bernard"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/requests');
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([
        'recipient_email' => 'lucas@example.com',
        'recipient_name'  => 'Lucas Bernard',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/requests', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ recipient_email: 'lucas@example.com', recipient_name: 'Lucas Bernard' }),
});
const { data } = await response.json();

Quick Links

Share