# Change status

> Win, lose, abandon or reopen an opportunity.

Source: https://docs.mycrmsim.com/docs/opportunities/change-opportunity-status

```http
PATCH https://backend.mysmsgateway.app/api/v1/ext/opportunities/{id}/status
```

- Category: myCRMSIM Opportunities / Opportunities
- Auth: Bearer access token
- Scope: `opportunities.write`

Runs any workflow that triggers on **Opportunity status changed**. `lost_reason` is kept only while the status is "lost"; reopening clears it.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | number | yes | Opportunity id. Example: `55` |
| `status` | body | enum | yes | The new status. One of: `open`, `won`, `lost`, `abandoned`. Example: `lost` |
| `lost_reason` | body | string | no | Up to 255 characters, for "lost". Example: `Went with another agency` |

## Request body

```json
{
  "status": "lost",
  "lost_reason": "Went with another agency"
}
```

## Response 200

OK

```json
{
  "success": true,
  "message": "Status changed",
  "data": {
    "id": 55,
    "workspace_id": 7,
    "name": "Website redesign",
    "value": 1200,
    "currency": "USD",
    "status": "lost",
    "lost_reason": "Went with another agency",
    "pipeline_id": 3,
    "pipeline": {
      "id": 3,
      "name": "Sales"
    },
    "stage_id": 9,
    "stage": {
      "id": 9,
      "name": "Qualified",
      "color": "#22c55e",
      "position": 1,
      "is_won": false,
      "is_lost": false
    },
    "contact_id": 1234,
    "contact": {
      "id": 1234,
      "first_name": "Ann",
      "last_name": "Lee",
      "email": "ann@example.com",
      "phone_number": "+61412345678",
      "company_name": "Lee Studio"
    },
    "owner_id": null,
    "source": "website",
    "tags": [
      "web"
    ],
    "custom_fields": {},
    "closed_at": "2026-10-28T11:00:00.000Z",
    "stage_changed_at": "2026-10-27T09:00:00.000Z",
    "last_activity_at": "2026-10-27T09:00:00.000Z",
    "created_at": "2026-10-27T09:00:00.000Z",
    "updated_at": "2026-10-27T09:00:00.000Z"
  }
}
```

## Response 400

Unknown status

```json
{
  "success": false,
  "message": "status must be one of: open, won, lost, abandoned"
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): opportunities.write. This integration was granted: …"
}
```

## Response 404

Opportunity does not exist or is not owned by the installer

```json
{
  "success": false,
  "message": "Opportunity not found or not accessible to this token"
}
```
