Contents
On this page
Update Opportunity - Plugixa CRM
PUT /plugixa-crm/v1/opportunities/{id}
Change some of an opportunity’s fields, and move it to another stage. Only the fields you send change. PATCH works the same way.
Any user with access to Plugixa CRM. With Plugixa CRM Pro roles, the user’s role must also allow editing this opportunity.
The other fields are saved before the stage is checked. If
stage_idis refused with422, the rest of the body has already been written.
Changing
pipeline_iddoes not move the stage. Send astage_idof the new pipeline with it, or the opportunity keeps a stage from the old pipeline.pipeline_id: 0is stored as0.
Request
PUT https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The opportunity’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | Must not be blank when sent. |
account_id |
integer |
No | The account. Not checked: any id is stored. |
contact_id |
integer |
No | The contact. Not checked. |
lead_id |
integer |
No | The lead it came from. Not checked. |
pipeline_id |
integer |
No | Defaults to the default pipeline. |
stage_id |
integer |
No | Must belong to the pipeline. A different stage moves the opportunity, as Move Opportunity Stage does. |
amount |
number |
No | Negative values become 0. |
currency |
string |
No | Three letters, upper-cased for you. Sent empty, it is ignored. |
probability |
integer |
No | 0 to 100. A stage move afterwards resets it to the new stage’s probability. |
close_date |
string |
No | YYYY-MM-DD. A datetime is cut to its date. Anything else is stored as null. |
source |
string |
No | Free text. |
lost_reason |
string |
No | Free text. |
description |
string |
No | HTML. Tags not allowed in post content are stripped. |
assigned_user_id |
integer |
No | The WordPress user who owns it. 0 or nothing means none. |
modified_at |
string |
No | The modified_at you read. When sent, the update is refused if the opportunity changed since: see Avoiding lost updates. |
Sending amount without currency, or the reverse, keeps the other one and recomputes amount_base. status, closed_at and last_stage_change_at only change through a stage move; values sent for them are ignored.
{
"amount": 15000,
"stage_id": 4
}
Responses
200 OK. data is the updated opportunity.
{
"success": true,
"data": {
"id": 24,
"name": "Northwind Traders: platform licence",
"account_id": 12,
"contact_id": 31,
"lead_id": null,
"pipeline_id": 1,
"stage_id": 4,
"amount": 15000,
"currency": "EUR",
"amount_base": 16275,
"probability": 75,
"close_date": "2026-12-15",
"status": "open",
"lost_reason": "",
"source": "",
"description": "",
"last_stage_change_at": "2026-11-12 10:15:00",
"closed_at": null,
"assigned_user_id": "3",
"created_by": "1",
"modified_by": "1",
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 10:15:00",
"deleted_at": null,
"history": [
{
"id": 31,
"opportunity_id": 24,
"from_stage_id": null,
"to_stage_id": 3,
"from_status": null,
"to_status": "open",
"amount_at_change": 13020,
"seconds_in_from_stage": null,
"changed_by": "1",
"changed_at": "2026-11-12 09:30:00",
"to_stage_name": "Proposal",
"from_stage_name": null
},
{
"id": 36,
"opportunity_id": 24,
"from_stage_id": 3,
"to_stage_id": 4,
"from_status": "open",
"to_status": "open",
"amount_at_change": 16275,
"seconds_in_from_stage": 2700,
"changed_by": "1",
"changed_at": "2026-11-12 10:15:00",
"to_stage_name": "Negotiation",
"from_stage_name": "Proposal"
}
],
"stage": {
"id": 4,
"pipeline_id": 1,
"name": "Negotiation",
"slug": "negotiation",
"type": "open",
"probability": 75,
"color": "#a855f7",
"position": 3,
"created_at": "2026-11-12 09:30:00"
},
"stages": [
{
"id": 1,
"pipeline_id": 1,
"name": "Qualification",
"slug": "qualification",
"type": "open",
"probability": 10,
"color": "#64748b",
"position": 0,
"created_at": "2026-11-12 09:30:00"
},
{
"id": 2,
"pipeline_id": 1,
"name": "Needs Analysis",
"slug": "needs-analysis",
"type": "open",
"probability": 25,
"color": "#0ea5e9",
"position": 1,
"created_at": "2026-11-12 09:30:00"
},
{
"id": 3,
"pipeline_id": 1,
"name": "Proposal",
"slug": "proposal",
"type": "open",
"probability": 50,
"color": "#6366f1",
"position": 2,
"created_at": "2026-11-12 09:30:00"
},
{
"id": 4,
"pipeline_id": 1,
"name": "Negotiation",
"slug": "negotiation",
"type": "open",
"probability": 75,
"color": "#a855f7",
"position": 3,
"created_at": "2026-11-12 09:30:00"
},
{
"id": 5,
"pipeline_id": 1,
"name": "Closed Won",
"slug": "closed-won",
"type": "won",
"probability": 100,
"color": "#16a34a",
"position": 4,
"created_at": "2026-11-12 09:30:00"
},
{
"id": 6,
"pipeline_id": 1,
"name": "Closed Lost",
"slug": "closed-lost",
"type": "lost",
"probability": 0,
"color": "#dc2626",
"position": 5,
"created_at": "2026-11-12 09:30:00"
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
data.stage_id |
integer |
The current stage |
data.amount |
number |
The value in currency |
data.amount_base |
number |
amount converted to the site’s currency |
data.probability |
integer |
0 to 100 |
data.history |
array |
Every stage move, with from_stage_name, to_stage_name, amount_at_change, changed_at |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_crm_not_found |
No opportunity with that id, or it is in the trash. |
422 |
plugixa_crm_invalid_stage |
stage_id is not an existing stage. |
422 |
plugixa_crm_stage_pipeline_mismatch |
stage_id belongs to another pipeline. |
409 |
plugixa_crm_conflict |
You sent modified_at and the opportunity changed since. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"amount":15000,"stage_id":4}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 15000,
'stage_id' => 4,
]),
]);
$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/opportunities/24', {
method: 'PUT',
headers: {
'Authorization': auth,
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: 15000, stage_id: 4 }),
});
const { data } = await response.json();
Quick Links
Share