# Update Opportunity

PUT https://services.leadconnectorhq.com/opportunities/{id}

Update an opportunity. Unless the location allows duplicate opportunities (`allowDuplicateOpportunity`), a contact can have only one opportunity per pipeline. Opportunities without a contact are never treated as duplicates. Moving an opportunity to a pipeline where its contact already has an opportunity returns 400 with `code: OPPORTUNITY_NO_DUPLICATE`.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `opportunities.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version. Send `v3`. |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | Yes | Opportunity Id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/opportunities/{id}": {
      "put": {
        "summary": "Update Opportunity",
        "operationId": "updateOpportunity",
        "description": "Update an opportunity. Unless the location allows duplicate opportunities (`allowDuplicateOpportunity`), a contact can have only one opportunity per pipeline. Opportunities without a contact are never treated as duplicates. Moving an opportunity to a pipeline where its contact already has an opportunity returns 400 with `code: OPPORTUNITY_NO_DUPLICATE`.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version. Send `v3`.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Opportunity Id",
            "schema": {
              "example": "yWQobCRIhRguQtD2llvk",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOpportunityDtoV3"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPostOpportunitySuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Unexpected errors inside the handler can also be returned as 400 with a `traceId`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "404": {
            "description": "Opportunity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceNotFoundDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: the rate limit for this app and location was exceeded. Retry after the burst window (`X-RateLimit-Interval-Milliseconds`) when `X-RateLimit-Remaining` is 0 or less, or after 00:00 UTC when `X-RateLimit-Daily-Remaining` is 0 or less.",
            "headers": {
              "X-RateLimit-Max": {
                "description": "Requests allowed in the burst window",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the current burst window; when 0 or less, retry after the window resets",
                "schema": {
                  "type": "integer",
                  "example": 0
                }
              },
              "X-RateLimit-Interval-Milliseconds": {
                "description": "Length of the burst window in milliseconds; wait this long before retrying a burst-limited request",
                "schema": {
                  "type": "integer",
                  "example": 10000
                }
              },
              "X-RateLimit-Limit-Daily": {
                "description": "Requests allowed per UTC calendar day; the count resets at 00:00 UTC",
                "schema": {
                  "type": "integer",
                  "example": 200000
                }
              },
              "X-RateLimit-Daily-Remaining": {
                "description": "Requests left today (UTC); when 0 or less, retry after 00:00 UTC",
                "schema": {
                  "type": "integer",
                  "example": 0
                }
              },
              "X-RateLimit-Daily-Reset": {
                "description": "Milliseconds until the current daily window ends and X-RateLimit-Daily-Remaining returns to the full X-RateLimit-Limit-Daily. A duration, not a timestamp: add it to the time the response was received to get the reset time. One-second precision, so always a multiple of 1000. When no daily window is running yet, reports the full window, 86400000 (24 hours), and the window starts with that request",
                "schema": {
                  "type": "integer",
                  "example": 86400000
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TooManyRequestsDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        },
        "security": [
          {
            "bearer": [
              "opportunities.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateOpportunityDtoV3": {
        "type": "object",
        "properties": {
          "pipelineId": {
            "type": "string",
            "description": "pipeline Id",
            "example": "bCkKGpDsyPP4peuKowkG"
          },
          "name": {
            "type": "string",
            "description": "Name of the opportunity, up to 150 characters. A longer name returns 422, unless it is the name already stored.",
            "example": "First Opps",
            "maxLength": 150
          },
          "pipelineStageId": {
            "type": "string",
            "description": "Identifier of the pipeline stage",
            "example": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
          },
          "status": {
            "type": "string",
            "description": "Current status of the opportunity",
            "enum": [
              "open",
              "won",
              "lost",
              "abandoned"
            ],
            "example": "open"
          },
          "monetaryValue": {
            "type": "number",
            "description": "Monetary value of the opportunity. `null` leaves the stored value unchanged, and the response shows the stored value. An empty string is ignored the same way. Send `0` to clear the value.",
            "example": 220,
            "minimum": 0
          },
          "forecastExpectedCloseDate": {
            "type": "string",
            "description": "Expected close date. Supported formats: YYYY/MM/DD, MM/DD/YYYY, YYYY-MM-DD, MM-DD-YYYY, YYYY.MM.DD, MM.DD.YYYY, or ISO 8601",
            "example": "2026-04-23"
          },
          "forecastProbability": {
            "type": "number",
            "description": "Forecast probability",
            "example": 20
          },
          "assignedTo": {
            "type": "string",
            "description": "Identifier of the user the opportunity is assigned to",
            "example": "082goXVW3lIExEQPOnd3"
          },
          "lostReasonId": {
            "type": "string",
            "description": "Lost reason id (24-character hex) from `GET /opportunities/lost-reason`. Used only when the opportunity's status is, or is set to, `lost`; any other status clears the stored lost reason, and `null` clears it too. A malformed id returns 400 `LOST_REASON_NOT_FOUND`; an id that is unknown, deleted or from another location is saved as `null`.",
            "example": "65f1c2a4e8b9d3f7a2c4e6b8"
          },
          "customFields": {
            "type": "array",
            "description": "Custom field values to update, each with `fieldValue`. Identify each field by `id` or by `key` (without the `opportunity.` prefix). Entries that match no opportunity custom field in the location are ignored, not rejected. `field_value` is the 2021-07-28 name and is ignored in v3.",
            "example": [
              {
                "id": "6dvNaf7VhkQ9snc5vnjJ",
                "fieldValue": "9039160788"
              }
            ],
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "6dvNaf7VhkQ9snc5vnjJ",
                      "description": "Custom field id. Pass either `id` or `key`. An id that matches no opportunity custom field in the location is ignored."
                    },
                    "key": {
                      "type": "string",
                      "example": "my_custom_field",
                      "description": "Custom field key without the `opportunity.` prefix (for `opportunity.my_custom_field`, send `my_custom_field`). Pass either `id` or `key`. A key sent with the prefix, or one that matches no custom field, is ignored."
                    },
                    "fieldValue": {
                      "type": "string",
                      "description": "Value of the custom field",
                      "example": "9039160788"
                    }
                  },
                  "title": "customFieldsInputStringSchemaV3"
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Custom field id. Pass either `id` or `key`. An id that matches no opportunity custom field in the location is ignored.",
                      "example": "6dvNaf7VhkQ9snc5vnjJ"
                    },
                    "key": {
                      "type": "string",
                      "description": "Custom field key without the `opportunity.` prefix (for `opportunity.my_custom_field`, send `my_custom_field`). Pass either `id` or `key`. A key sent with the prefix, or one that matches no custom field, is ignored.",
                      "example": "my_custom_field"
                    },
                    "fieldValue": {
                      "description": "Value of the custom field",
                      "example": [
                        "test",
                        "test2"
                      ],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "title": "customFieldsInputArraySchemaV3"
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Custom field id. Pass either `id` or `key`. An id that matches no opportunity custom field in the location is ignored.",
                      "example": "6dvNaf7VhkQ9snc5vnjJ"
                    },
                    "key": {
                      "type": "string",
                      "description": "Custom field key without the `opportunity.` prefix (for `opportunity.my_custom_field`, send `my_custom_field`). Pass either `id` or `key`. A key sent with the prefix, or one that matches no custom field, is ignored.",
                      "example": "my_custom_field"
                    },
                    "fieldValue": {
                      "type": "object",
                      "description": "Value of the custom field",
                      "example": {
                        "url": "https://example.com/file.pdf",
                        "size": 1024
                      }
                    }
                  },
                  "title": "customFieldsInputObjectSchemaV3"
                }
              ]
            }
          }
        },
        "title": "UpdateOpportunityDtoV3"
      },
      "GetPostOpportunitySuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "opportunity": {
            "description": "The created or retrieved opportunity object",
            "example": {
              "id": "yWQobCRIhRguQtD2llvk",
              "name": "New website build",
              "monetaryValue": 500,
              "pipelineId": "VDm7RPYC2GLUvdpKmBfC",
              "pipelineStageId": "e93ba61a-53b3-45e7-985a-c7732dbcdb69",
              "assignedTo": "zT46WSCPbudrq4zhWMk6",
              "status": "open",
              "source": "website",
              "lastStatusChangeAt": "2026-05-01T10:30:00.000Z",
              "lastStageChangeAt": "2026-05-01T10:30:00.000Z",
              "createdAt": "2026-05-01T10:30:00.000Z",
              "updatedAt": "2026-05-01T10:30:00.000Z",
              "contactId": "byMEV0NQinDhq8ZfiOi2",
              "locationId": "ve9EPM428h8vShlRW1KT",
              "lostReasonId": null,
              "followers": [
                "sx6wyHhbFdRXh302Lunr"
              ],
              "customFields": [
                {
                  "id": "MgobCB14YMVKuE4Ka8p1",
                  "fieldValue": "custom field value"
                }
              ]
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique identifier of the opportunity",
                    "example": "yWQobCRIhRguQtD2llvk"
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the opportunity",
                    "example": "testing"
                  },
                  "monetaryValue": {
                    "type": "number",
                    "description": "Monetary value of the opportunity",
                    "example": 500
                  },
                  "pipelineId": {
                    "type": "string",
                    "description": "Identifier of the pipeline the opportunity belongs to",
                    "example": "VDm7RPYC2GLUvdpKmBfC"
                  },
                  "pipelineStageId": {
                    "type": "string",
                    "description": "Identifier of the pipeline stage the opportunity is in",
                    "example": "e93ba61a-53b3-45e7-985a-c7732dbcdb69"
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "Identifier of the user the opportunity is assigned to",
                    "example": "zT46WSCPbudrq4zhWMk6"
                  },
                  "status": {
                    "type": "string",
                    "description": "Current status of the opportunity",
                    "example": "open"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source of the opportunity",
                    "example": ""
                  },
                  "lastStatusChangeAt": {
                    "type": "string",
                    "description": "ISO 8601 timestamp of the last status change",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "lastStageChangeAt": {
                    "type": "string",
                    "description": "ISO 8601 timestamp of the last stage change",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "lastActionDate": {
                    "type": "string",
                    "description": "ISO 8601 timestamp of the last action on the opportunity",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "ISO 8601 timestamp when the opportunity was created",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "description": "ISO 8601 timestamp when the opportunity was last updated",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "forecastExpectedCloseDate": {
                    "type": "string",
                    "description": "Expected close date for the forecast (YYYY-MM-DD)",
                    "example": "2026-05-20"
                  },
                  "forecastOriginalCloseDate": {
                    "type": "string",
                    "description": "Original forecast close date before any slippage (YYYY-MM-DD)",
                    "example": "2026-05-01"
                  },
                  "forecastSlippageCount": {
                    "type": "number",
                    "description": "Number of times the close date has slipped",
                    "example": 2
                  },
                  "forecastDaysSlipped": {
                    "type": "number",
                    "description": "Total days the close date has slipped",
                    "example": 19
                  },
                  "forecastLastSlippedAt": {
                    "type": "string",
                    "description": "ISO 8601 timestamp of the last close-date slip",
                    "example": "2026-05-22T10:30:00.000Z"
                  },
                  "forecastProbability": {
                    "type": "number",
                    "description": "Forecast win probability percentage (0–100)",
                    "example": 20
                  },
                  "effectiveProbability": {
                    "type": "number",
                    "description": "Effective win probability after stage and forecast adjustments (0–100)",
                    "example": 40
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Identifier of the contact linked to the opportunity. Absent/null for contactless opportunities.",
                    "example": "zT46WSCPbudrq4zhWMk6",
                    "nullable": true
                  },
                  "locationId": {
                    "type": "string",
                    "description": "Identifier of the location (sub-account) the opportunity belongs to",
                    "example": "zT46WSCPbudrq4zhW"
                  },
                  "contact": {
                    "description": "Contact details associated with the opportunity",
                    "example": {},
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Unique identifier of the contact",
                            "example": "byMEV0NQinDhq8ZfiOi2"
                          },
                          "name": {
                            "type": "string",
                            "description": "Full name of the contact",
                            "example": "John Deo"
                          },
                          "companyName": {
                            "type": "string",
                            "description": "Company name associated with the contact",
                            "example": "Tesla Inc"
                          },
                          "email": {
                            "type": "string",
                            "description": "Email address of the contact",
                            "example": "john@deo.com"
                          },
                          "phone": {
                            "type": "string",
                            "description": "Phone number of the contact",
                            "example": "+1202-555-0107"
                          },
                          "tags": {
                            "description": "Tags associated with the contact",
                            "example": [
                              "lead",
                              "vip"
                            ],
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "title": "SearchOpportunitiesContactResponseSchema"
                      }
                    ]
                  },
                  "notes": {
                    "description": "Notes attached to the opportunity",
                    "example": [],
                    "type": "array",
                    "items": {
                      "type": "array"
                    }
                  },
                  "tasks": {
                    "description": "Tasks attached to the opportunity",
                    "example": [],
                    "type": "array",
                    "items": {
                      "type": "array"
                    }
                  },
                  "calendarEvents": {
                    "description": "Calendar events attached to the opportunity",
                    "example": [],
                    "type": "array",
                    "items": {
                      "type": "array"
                    }
                  },
                  "lostReasonId": {
                    "type": "string",
                    "description": "Identifier of the lost reason if the opportunity was marked lost",
                    "example": "zT46WSCPbudrq4zhWMk6"
                  },
                  "customFields": {
                    "description": "Custom fields associated with the opportunity",
                    "example": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique identifier of the custom field",
                          "example": "MgobCB14YMVKuE4Ka8p1"
                        },
                        "fieldValue": {
                          "description": "The value of the custom field",
                          "example": "custom field value",
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "fieldValue"
                      ],
                      "title": "CustomFieldResponseSchema"
                    }
                  },
                  "followers": {
                    "description": "User IDs following this opportunity",
                    "example": [
                      "sx6wyHhbFdRXh302Lunr"
                    ],
                    "type": "array",
                    "items": {
                      "type": "array"
                    }
                  },
                  "externalObjectId": {
                    "type": "string",
                    "description": "External object identifier for integrations",
                    "example": "ext_obj_12345"
                  }
                },
                "title": "SearchOpportunitiesResponseSchema"
              }
            ]
          }
        },
        "title": "GetPostOpportunitySuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "ResourceNotFoundDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 404
          },
          "error": {
            "type": "string",
            "description": "HTTP error name",
            "example": "Not Found"
          },
          "message": {
            "type": "string",
            "description": "Error message describing which resource was not found",
            "example": "Opportunity not found"
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code naming the missing resource, such as `OPPORTUNITY_NOT_FOUND`, `PIPELINE_NOT_FOUND` or `OPPORTUNITY_CONTACT_NOT_FOUND`",
            "example": "OPPORTUNITY_NOT_FOUND"
          }
        },
        "title": "ResourceNotFoundDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "TooManyRequestsDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 429
          },
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Rate limit exceeded."
          },
          "error": {
            "type": "string",
            "description": "HTTP error name",
            "example": "Too Many Requests"
          }
        },
        "title": "TooManyRequestsDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the internal server error",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/opportunities/<id>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "name": "First Opps",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "status": "open",
  "monetaryValue": 220,
  "forecastExpectedCloseDate": "2026-04-23",
  "forecastProbability": 20,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
  "customFields": [
    {
      "id": "6dvNaf7VhkQ9snc5vnjJ",
      "fieldValue": "9039160788"
    }
  ]
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "pipelineId": "bCkKGpDsyPP4peuKowkG",
      "name": "First Opps",
      "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
      "status": "open",
      "monetaryValue": 220,
      "forecastExpectedCloseDate": "2026-04-23",
      "forecastProbability": 20,
      "assignedTo": "082goXVW3lIExEQPOnd3",
      "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
      "customFields": [
        {
          "id": "6dvNaf7VhkQ9snc5vnjJ",
          "fieldValue": "9039160788"
        }
      ]
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/opportunities/<id>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/opportunities/{id}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "pipelineId": "bCkKGpDsyPP4peuKowkG",
    "name": "First Opps",
    "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
    "status": "open",
    "monetaryValue": 220,
    "forecastExpectedCloseDate": "2026-04-23",
    "forecastProbability": 20,
    "assignedTo": "082goXVW3lIExEQPOnd3",
    "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
    "customFields": [
        {
            "id": "6dvNaf7VhkQ9snc5vnjJ",
            "fieldValue": "9039160788"
        }
    ]
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/opportunities/<id>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "name": "First Opps",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "status": "open",
  "monetaryValue": 220,
  "forecastExpectedCloseDate": "2026-04-23",
  "forecastProbability": 20,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
  "customFields": [
    {
      "id": "6dvNaf7VhkQ9snc5vnjJ",
      "fieldValue": "9039160788"
    }
  ]
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/opportunities/<id>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"pipelineId\":\"bCkKGpDsyPP4peuKowkG\",\"name\":\"First Opps\",\"pipelineStageId\":\"7915dedc-8f18-44d5-8bc3-77c04e994a10\",\"status\":\"open\",\"monetaryValue\":220,\"forecastExpectedCloseDate\":\"2026-04-23\",\"forecastProbability\":20,\"assignedTo\":\"082goXVW3lIExEQPOnd3\",\"lostReasonId\":\"65f1c2a4e8b9d3f7a2c4e6b8\",\"customFields\":[{\"id\":\"6dvNaf7VhkQ9snc5vnjJ\",\"fieldValue\":\"9039160788\"}]}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/opportunities/<id>"
  payload := strings.NewReader(`{
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "name": "First Opps",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "status": "open",
  "monetaryValue": 220,
  "forecastExpectedCloseDate": "2026-04-23",
  "forecastProbability": 20,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
  "customFields": [
    {
      "id": "6dvNaf7VhkQ9snc5vnjJ",
      "fieldValue": "9039160788"
    }
  ]
}`)
  req, _ := http.NewRequest("PUT", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/opportunities/<id>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "name": "First Opps",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "status": "open",
  "monetaryValue": 220,
  "forecastExpectedCloseDate": "2026-04-23",
  "forecastProbability": 20,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
  "customFields": [
    {
      "id": "6dvNaf7VhkQ9snc5vnjJ",
      "fieldValue": "9039160788"
    }
  ]
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "name": "First Opps",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "status": "open",
  "monetaryValue": 220,
  "forecastExpectedCloseDate": "2026-04-23",
  "forecastProbability": 20,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "65f1c2a4e8b9d3f7a2c4e6b8",
  "customFields": [
    {
      "id": "6dvNaf7VhkQ9snc5vnjJ",
      "fieldValue": "9039160788"
    }
  ]
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/opportunities/<id>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
