Contents
On this page

Create Member - Plugixa Team

POST /plugixateam/v1/members

Add a team member, with their groups and custom field values in the same request.

Needs a signed-in WordPress user with the plugixa_team_edit capability, which administrators and editors get when the plugin is activated, or manage_options.

Request

POST https://your-site.example/wp-json/plugixateam/v1/members

Request body

Content type: application/json

Field Type Required Description
first_name string Yes Must not be blank.
last_name string No
slug string No Made from the first and last name when empty. Made unique by appending -1, -2, …
job_title string No
department string No Free text. Members with the same text share a department.
bio string No HTML. Tags not allowed in a post are stripped.
short_bio string No Plain text.
photo_id integer|null No A media library attachment id. null or 0 removes the photo.
email string No Stored as plain text: the format is not checked.
phone string No
mobile string No
website_url string|null No A URL. Anything that is not a safe URL is emptied.
location string No
social_links array No { "platform": "linkedin", "url": "https://..." } objects. An item without a URL is dropped; one without a platform gets website.
skills array No Stored as sent. The front end reads { "name": "...", "percentage": 0-100 } objects.
ribbon_text, ribbon_color string No The ribbon shown on the card.
is_featured boolean No Defaults to false.
status string No published, draft or hidden. When you leave it out, the Default Status setting in Plugixa Team -> Settings applies (published out of the box).
display_order integer No Defaults to 0.
parent_id integer|null No Another member’s id, for a reporting line. Not checked.
hire_date string|null No YYYY-MM-DD.
groups array No Group ids to put the member in. Ids are not checked against existing groups.
meta object|null No Custom field values PRO, keyed by field key: { "pronouns": "she/her" }. Only the keys you send are written; other keys keep their values. An array or object value is stored as JSON text. Values are not checked against the field definitions.
custom_fields object|null No Older free-form data kept on the member row. Send custom field values in meta instead.
source string No Defaults to manual.
language_code string No With WPML or Polylang active: the member’s language. Defaults to the site’s default language.

Text fields you leave out are stored empty (null). The response gives the new id only: read the member back with Get Member.

{
  "first_name": "Amira",
  "last_name": "Haddad",
  "job_title": "Head of Design",
  "department": "Design",
  "email": "amira@example.com",
  "photo_id": 112,
  "social_links": [
    { "platform": "linkedin", "url": "https://www.linkedin.com/in/amira-example" }
  ],
  "groups": [3],
  "meta": { "pronouns": "she/her" }
}

Responses

200 OK. The member was created.

Creating answers 200, not 201.

{
  "success": true,
  "message": "Member created successfully",
  "data": {
    "id": 57
  }
}
Field Type Meaning
data.id integer The new member’s id
message string A translated confirmation

Errors

Status Code When
400 rest_missing_callback_param first_name is not in the body.
400 rest_invalid_param A field has the wrong type, or status is not published, draft or hidden.
400 rest_error Validation failed: first_name is blank. data.errors names the field.
500 rest_error The database refused the row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixateam/v1/members" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"first_name":"Amira","last_name":"Haddad","job_title":"Head of Design","department":"Design","email":"amira@example.com","photo_id":112,"social_links":[{"platform":"linkedin","url":"https://www.linkedin.com/in/amira-example"}],"groups":[3],"meta":{"pronouns":"she/her"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/members');
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([
        'first_name'   => 'Amira',
        'last_name'    => 'Haddad',
        'job_title'    => 'Head of Design',
        'department'   => 'Design',
        'email'        => 'amira@example.com',
        'photo_id'     => 112,
        'social_links' => [
            [
                'platform' => 'linkedin',
                'url'      => 'https://www.linkedin.com/in/amira-example',
            ],
        ],
        'groups'       => [3],
        'meta'         => [
            'pronouns' => 'she/her',
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixateam/v1/members', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    first_name: 'Amira',
    last_name: 'Haddad',
    job_title: 'Head of Design',
    department: 'Design',
    email: 'amira@example.com',
    photo_id: 112,
    social_links: [
      {
        platform: 'linkedin',
        url: 'https://www.linkedin.com/in/amira-example',
      },
    ],
    groups: [3],
    meta: { pronouns: 'she/her' },
  }),
});
const { data } = await response.json();

Quick Links

Share