# Get Opportunity

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

Get Opportunity

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

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

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-04-15"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/opportunities/{id}": {
      "get": {
        "summary": "Get Opportunity",
        "operationId": "getOpportunity",
        "description": "Get Opportunity",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-04-15"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Opportunity Id",
            "schema": {
              "example": "yWQobCRIhRguQtD2llvk",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetOpportunityByIdResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "opportunities.readonly"
            ]
          }
        ]
      }
    }
  },
  "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": {
      "GetOpportunityByIdResponseDto": {
        "type": "object",
        "properties": {
          "opportunity": {
            "description": "The retrieved opportunity object",
            "example": {},
            "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"
                  },
                  "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"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Identifier of the contact linked to the opportunity",
                    "example": "zT46WSCPbudrq4zhWMk6"
                  },
                  "isAttribute": {
                    "type": "boolean",
                    "description": "Whether the opportunity was created via attribution",
                    "example": false
                  },
                  "internalSource": {
                    "type": "object",
                    "description": "Internal source metadata for the opportunity",
                    "example": {}
                  },
                  "locationId": {
                    "type": "string",
                    "description": "Identifier of the location (sub-account) the opportunity belongs to",
                    "example": "zT46WSCPbudrq4zhW"
                  },
                  "lastActionDate": {
                    "type": "string",
                    "description": "ISO 8601 timestamp of the last action on the opportunity",
                    "example": "2021-08-03T04:55:17.355Z"
                  },
                  "indexVersion": {
                    "type": "number",
                    "description": "Index version of the opportunity record",
                    "example": 1
                  },
                  "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": "string"
                    }
                  },
                  "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
                  },
                  "externalObjectId": {
                    "type": "string",
                    "description": "External object identifier for integrations",
                    "example": "ext_obj_12345"
                  },
                  "externalImportMetaData": {
                    "type": "object",
                    "description": "Metadata captured when the opportunity was imported from an external system",
                    "example": {}
                  },
                  "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"
                            }
                          },
                          "assignedTo": {
                            "type": "string",
                            "description": "Identifier of the user the contact is assigned to",
                            "example": "zT46WSCPbudrq4zhWMk6"
                          },
                          "followers": {
                            "description": "User IDs following this contact",
                            "example": [
                              "sx6wyHhbFdRXh302Lunr"
                            ],
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "title": "GetOpportunityContactResponseSchema"
                      }
                    ]
                  }
                },
                "title": "GetOpportunityResponseSchema"
              }
            ]
          }
        },
        "title": "GetOpportunityByIdResponseDto"
      },
      "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"
      },
      "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"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const response = await ghl.opportunities.getOpportunity('<ID>');
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

response = await client.opportunities.get_opportunity('<ID>')
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$response = $ghl->opportunities->getOpportunity('<ID>');
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/opportunities/<id>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-04-15'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-04-15'
  }
};

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": "2021-04-15"
}

response = requests.get(url, 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 => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-04-15',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/opportunities/<id>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-04-15")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/opportunities/<id>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-04-15")

  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::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-04-15"

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-04-15"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/opportunities/<id>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
