Contents
On this page

Create Recipient - Plugixa Inventory

POST /plugixa-inventory/v1/recipients

Create a recipient: a person stock can be checked out to.

The user needs the plugixa_inventory_create capability (administrators have every inventory capability). With Pro Roles and permissions enforcing, their role must also allow creating recipients.

Request

POST https://your-site.example/wp-json/plugixa-inventory/v1/recipients

Request body

Content type: application/json

Field Type Required Description
name string Yes Must not be blank. At most 255 characters.
email string No Must be a valid address when given.
phone string No At most 50 characters.
department string No At most 100 characters.
user_id integer No An existing WordPress user this person is. 0 or null for none.
notes string No HTML. Tags not allowed in a WordPress post are removed.
status string No published (the default) or unpublished.

Only name is required.

{
  "name": "Lucas Bernard",
  "email": "lucas.bernard@example.com",
  "phone": "+44 113 496 0000",
  "department": "Maintenance"
}

Responses

201 Created. data is the new recipient.

{
  "success": true,
  "data": {
    "id": 8,
    "name": "Lucas Bernard",
    "email": "lucas.bernard@example.com",
    "phone": "+44 113 496 0000",
    "department": "Maintenance",
    "user_id": null,
    "notes": "",
    "custom_fields": null,
    "status": "published",
    "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
  }
}
Field Type Meaning
data.id integer The new recipient’s id
data.user_id integer|null The linked WordPress user, or null
data.created_at string UTC datetime

Errors

Status Code When
422 plugixa_inventory_missing_name name is missing or blank.
422 plugixa_inventory_invalid_choice status is not one of the allowed values. data.allowed lists them.
422 plugixa_inventory_too_long A text field is longer than its column. data.field names it and data.max gives the limit.
422 plugixa_inventory_invalid_email email is not a valid address.
422 plugixa_inventory_unknown_user user_id is not a WordPress user.
500 plugixa_inventory_insert_failed The database refused to save the recipient.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-inventory/v1/recipients" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Lucas Bernard","email":"lucas.bernard@example.com","phone":"+44 113 496 0000","department":"Maintenance"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/recipients');
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'       => 'Lucas Bernard',
        'email'      => 'lucas.bernard@example.com',
        'phone'      => '+44 113 496 0000',
        'department' => 'Maintenance',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-inventory/v1/recipients', {
  method: 'POST',
  headers: { 'Authorization': auth, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'Lucas Bernard',
    email: 'lucas.bernard@example.com',
    phone: '+44 113 496 0000',
    department: 'Maintenance',
  }),
});
const { data } = await response.json();

Quick Links

Share