# Create Snapshot Share Link

POST https://services.leadconnectorhq.com/snapshots/share/link

Create a share link for snapshot

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** No scopes required.

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `companyId` | string | Yes |  |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/snapshots/share/link": {
      "post": {
        "summary": "Create Snapshot Share Link",
        "operationId": "createSnapshotShareLink",
        "description": "Create a share link for snapshot",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSnapshotShareLinkRequestDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSnapshotShareLinkSuccessfulResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Location (OR) Personal Integration Token from Location.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Location (OR) Personal Integration Token from Location.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Personal Integration Token from Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateSnapshotShareLinkRequestDTO": {
        "type": "object",
        "properties": {
          "snapshot_id": {
            "type": "string",
            "example": "1eM2UgkfaECOYyUdCo9Pa",
            "description": "id for snapshot to be shared"
          },
          "share_type": {
            "type": "string",
            "example": "permanent_link",
            "description": "Type of share link to generate",
            "enum": [
              "link",
              "permanent_link",
              "agency_link",
              "location_link"
            ]
          },
          "relationship_number": {
            "type": "string",
            "example": "0-128-926,1-208-926,2-008-926",
            "description": "Comma separated Relationship number of Agencies to create agency restricted share link"
          },
          "share_location_id": {
            "type": "string",
            "example": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP",
            "description": "Comma separated Sub-Account ids to create sub-account restricted share link"
          }
        },
        "required": [
          "snapshot_id",
          "share_type"
        ],
        "title": "CreateSnapshotShareLinkRequestDTO"
      },
      "CreateSnapshotShareLinkSuccessfulResponseDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "1eM2UgkfaECOYyUdCo9Pa",
            "description": "id for shared snapshot"
          },
          "shareLink": {
            "type": "string",
            "example": "https://affiliates.gohighlevel.com/?share=1eM2UgkfaECOYyUdCo9Pa",
            "description": "Share Link for snapshot"
          }
        },
        "title": "CreateSnapshotShareLinkSuccessfulResponseDTO"
      },
      "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"
      }
    }
  }
}
```

## HighLevel SDK Examples

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

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

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

const body = {
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
};

const response = await ghl.snapshots.createSnapshotShareLink({ companyId: '<COMPANYID>' }, body);
console.log(response);
```

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

```python
from highlevel import HighLevel

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

body = {
    "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
    "share_type": "permanent_link",
    "relationship_number": "0-128-926,1-208-926,2-008-926",
    "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}

response = await client.snapshots.create_snapshot_share_link(companyId='<COMPANYID>', body=body)
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);

$body = [
    'snapshot_id' => '1eM2UgkfaECOYyUdCo9Pa',
    'share_type' => 'permanent_link',
    'relationship_number' => '0-128-926,1-208-926,2-008-926',
    'share_location_id' => 'l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP'
];

$response = $ghl->snapshots->createSnapshotShareLink(['companyId' => '<COMPANYID>'], $body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
      "share_type": "permanent_link",
      "relationship_number": "0-128-926,1-208-926,2-008-926",
      "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/snapshots/share/link"

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

params = {
    "companyId": "<COMPANYID>"
}

payload = {
    "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
    "share_type": "permanent_link",
    "relationship_number": "0-128-926,1-208-926,2-008-926",
    "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"snapshot_id\":\"1eM2UgkfaECOYyUdCo9Pa\",\"share_type\":\"permanent_link\",\"relationship_number\":\"0-128-926,1-208-926,2-008-926\",\"share_location_id\":\"l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP\"}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>"
  payload := strings.NewReader(`{
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}`)
  req, _ := http.NewRequest("POST", 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/snapshots/share/link?companyId=<COMPANYID>")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}'

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

**PowerShell**

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

$body = '{
  "snapshot_id": "1eM2UgkfaECOYyUdCo9Pa",
  "share_type": "permanent_link",
  "relationship_number": "0-128-926,1-208-926,2-008-926",
  "share_location_id": "l1C08ntBrFjLS0elLIYU, U1C08ntBrFjLS0elKIYP"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/snapshots/share/link?companyId=<COMPANYID>' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
