Contents
Create Contact - Plugixa CRM
POST /plugixa-crm/v1/contacts
Create a contact: a person, optionally linked to an account.
Any user with access to Plugixa CRM. With Plugixa CRM Pro roles, the user’s role must also allow creating contacts.
Request
POST https://your-site.example/wp-json/plugixa-crm/v1/contacts
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
first_name |
string |
One of the two | A contact needs a first or a last name. |
last_name |
string |
One of the two | full_name is made from both. |
salutation |
string |
No | Free text, such as Ms. |
title |
string |
No | Job title. |
account_id |
integer |
No | The primary account. Must be an existing account. The contact is linked to it as its primary account. |
email |
string |
No | The primary e-mail address. A value that is not one is stored empty. Also added to the contact’s e-mail list. |
phone |
string |
No | The primary phone number. Also added to the contact’s phone list. |
do_not_call |
boolean |
No | Defaults to false. |
birthday |
string |
No | YYYY-MM-DD. Anything else is stored as null. |
status |
string |
No | Free text. Defaults to active. |
address_street |
string |
No | Postal address. |
address_city |
string |
No | Postal address. |
address_state |
string |
No | Postal address. |
address_postal_code |
string |
No | Postal address. |
address_country |
string |
No | Postal address. |
description |
string |
No | HTML. Tags not allowed in post content are stripped. |
user_id |
integer |
No | The contact’s own WordPress user, if they have one. |
avatar_attachment_id |
integer |
No | A media library attachment used as the photo. |
assigned_user_id |
integer |
No | The WordPress user who owns the contact. 0 or nothing means none. |
Fields not in this table are ignored. To link the contact to more accounts, use Link Contact to Account.
{
"salutation": "Ms",
"first_name": "Maria",
"last_name": "Anders",
"title": "Purchasing manager",
"account_id": 12,
"email": "maria@northwind.example",
"phone": "+1 202 555 0177",
"address_city": "Seattle",
"address_country": "United States",
"assigned_user_id": 3
}
Responses
201 Created. data is the new contact.
{
"success": true,
"data": {
"id": "31",
"salutation": "Ms",
"first_name": "Maria",
"last_name": "Anders",
"full_name": "Maria Anders",
"account_id": "12",
"title": "Purchasing manager",
"email": "maria@northwind.example",
"phone": "+1 202 555 0177",
"description": "",
"avatar_attachment_id": null,
"user_id": null,
"status": "active",
"assigned_user_id": "3",
"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,
"do_not_call": "0",
"birthday": null,
"address_street": "",
"address_city": "Seattle",
"address_state": "",
"address_postal_code": "",
"address_country": "United States",
"emails": [
{
"id": 58,
"parent_type": "contact",
"parent_id": 31,
"address": "maria@northwind.example",
"type": "office",
"is_primary": 1,
"opted_out": 0,
"is_invalid": 0,
"created_at": "2026-11-12 09:30:00"
}
],
"phones": [
{
"id": 44,
"parent_type": "contact",
"parent_id": 31,
"number": "+1 202 555 0177",
"type": "office",
"is_primary": 1,
"created_at": "2026-11-12 09:30:00",
"digits": "12025550177",
"opted_out": 0,
"is_invalid": 0
}
],
"affiliations": [
{
"id": 7,
"account_id": 12,
"contact_id": 31,
"role": "Buyer",
"is_primary": 1,
"is_inactive": 0,
"created_at": "2026-11-12 09:30:00",
"account_name": "Northwind Traders",
"account_type": "customer"
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
string |
The contact’s id. Contact fields come back as strings, numbers included |
data.full_name |
string |
First and last name, kept in step with them |
data.account_id |
string|null |
The primary account |
data.email |
string |
The primary e-mail address |
data.phone |
string |
The primary phone number |
data.do_not_call |
string |
"1" or "0" |
data.birthday |
string|null |
YYYY-MM-DD |
data.assigned_user_id |
string|null |
The WordPress user who owns the contact |
data.created_at |
string |
UTC datetime |
data.modified_at |
string |
UTC datetime of the last change |
data.emails |
array |
Every e-mail address on the contact: address, type, is_primary, opted_out, is_invalid |
data.phones |
array |
Every phone number: number, digits, type, is_primary, opted_out, is_invalid |
data.affiliations |
array |
The accounts the contact is linked to, as in List Contact Accounts |
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_crm_invalid_name |
Both first_name and last_name are missing or blank. |
422 |
plugixa_crm_unknown_account |
account_id is not an existing account. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-crm/v1/contacts" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"salutation":"Ms","first_name":"Maria","last_name":"Anders","title":"Purchasing manager","account_id":12,"email":"maria@northwind.example","phone":"+1 202 555 0177","address_city":"Seattle","address_country":"United States","assigned_user_id":3}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-crm/v1/contacts');
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([
'salutation' => 'Ms',
'first_name' => 'Maria',
'last_name' => 'Anders',
'title' => 'Purchasing manager',
'account_id' => 12,
'email' => 'maria@northwind.example',
'phone' => '+1 202 555 0177',
'address_city' => 'Seattle',
'address_country' => 'United States',
'assigned_user_id' => 3,
]),
]);
$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-crm/v1/contacts', {
method: 'POST',
headers: {
'Authorization': auth,
'Content-Type': 'application/json',
},
body: JSON.stringify({
salutation: 'Ms',
first_name: 'Maria',
last_name: 'Anders',
title: 'Purchasing manager',
account_id: 12,
email: 'maria@northwind.example',
phone: '+1 202 555 0177',
address_city: 'Seattle',
address_country: 'United States',
assigned_user_id: 3,
}),
});
const { data } = await response.json();
Quick Links
Share