Contents
On this page

Get Opportunity - Plugixa CRM

GET /plugixa-crm/v1/opportunities/{id}

Read one opportunity, with its stage history and the stages of its pipeline.

Any user with access to Plugixa CRM. With Plugixa CRM Pro roles, the user’s role must also allow reading this opportunity.

Request

GET https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24

Path parameters

Name Type Description
id integer The opportunity’s id

Responses

200 OK. data is the 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": 3,
    "amount": 12000,
    "currency": "EUR",
    "amount_base": 13020,
    "probability": 50,
    "close_date": "2026-12-15",
    "status": "open",
    "lost_reason": "",
    "source": "",
    "description": "",
    "last_stage_change_at": "2026-11-12 09:30: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 09:30: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
      }
    ],
    "stage": {
      "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"
    },
    "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.id integer The opportunity’s id
data.account_id integer|null The account
data.contact_id integer|null The contact
data.pipeline_id integer The pipeline
data.stage_id integer The current stage
data.status string open, won or lost, taken from the stage’s type
data.amount number The value in currency
data.currency string Three-letter currency code
data.amount_base number amount converted to the site’s currency
data.probability integer 0 to 100
data.close_date string|null Expected close date, YYYY-MM-DD
data.closed_at string|null UTC datetime it reached a won or lost stage
data.last_stage_change_at string UTC datetime of the last stage move
data.assigned_user_id string|null The WordPress user who owns it. A string, unlike the other ids
data.history array Every stage move, with from_stage_name, to_stage_name, amount_at_change, changed_at
data.stage object The current stage: name, type, probability, position
data.stages array Every stage of the opportunity’s pipeline, in order

Errors

Status Code When
404 plugixa_crm_not_found No opportunity with that id, or it is in the trash.

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-crm/v1/opportunities/24');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$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', {
  headers: {
    'Authorization': auth,
  },
});
const { data } = await response.json();

Quick Links

Share