# Send document

POST https://services.leadconnectorhq.com/proposals/document/send

Send document to a client

## Authentication

Send `Authorization: Bearer <token>` using any one of:

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

## Parameters

### Header Parameters

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

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/proposals/document/send": {
      "post": {
        "summary": "Send document",
        "operationId": "sendDocument",
        "description": "Send document to a client",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendDocumentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document sent successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendDocumentResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": []
          },
          {
            "Agency-Access": []
          }
        ]
      }
    }
  },
  "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"
      },
      "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"
      },
      "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"
      }
    },
    "schemas": {
      "SendDocumentDto": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location Id",
            "example": "hTlkh7t8gujsahgg93"
          },
          "documentId": {
            "type": "string",
            "description": "Document Id",
            "example": "hTlkh7t8gujsahgg93"
          },
          "documentName": {
            "type": "string",
            "description": "Document Name",
            "example": "new Document"
          },
          "medium": {
            "type": "string",
            "enum": [
              "link",
              "email"
            ],
            "description": "Medium to be used for sending the document",
            "example": "email"
          },
          "ccRecipients": {
            "description": "CC Recipient",
            "example": [
              {
                "id": "u240JcS0E5qE0ziHnwMm",
                "email": "jim@gmail.com",
                "imageUrl": "",
                "contactName": "Jim Anton",
                "firstName": "Jim",
                "lastName": "Anton"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "Email",
                  "example": "jim@gmail.com"
                },
                "id": {
                  "type": "string",
                  "description": "Contact ID",
                  "example": "contactId"
                },
                "imageUrl": {
                  "type": "string",
                  "description": "Contact Image URL",
                  "example": "https://example.com/image.jpg"
                },
                "contactName": {
                  "type": "string",
                  "description": "Contact Name",
                  "example": "Jim Anton"
                },
                "firstName": {
                  "type": "string",
                  "description": "First Name",
                  "example": "Jim"
                },
                "lastName": {
                  "type": "string",
                  "description": "Last Name",
                  "example": "Anton"
                }
              },
              "required": [
                "email",
                "id",
                "imageUrl",
                "contactName",
                "firstName",
                "lastName"
              ],
              "title": "CCRecipientItem"
            }
          },
          "notificationSettings": {
            "example": {
              "sender": {
                "fromName": "",
                "fromEmail": ""
              },
              "receive": {
                "subject": "",
                "templateId": ""
              }
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "receive": {
                    "type": "object",
                    "properties": {
                      "templateId": {
                        "type": "string"
                      },
                      "subject": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "templateId",
                      "subject"
                    ],
                    "title": "NotificationSendSettingDto"
                  },
                  "sender": {
                    "type": "object",
                    "properties": {
                      "fromEmail": {
                        "type": "string"
                      },
                      "fromName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "fromEmail",
                      "fromName"
                    ],
                    "title": "NotificationSenderSettingDto"
                  }
                },
                "required": [
                  "receive",
                  "sender"
                ],
                "title": "NotificationSettingsDto"
              }
            ]
          },
          "sentBy": {
            "type": "string",
            "description": "Sent ByUser Id",
            "example": "1234567890"
          }
        },
        "required": [
          "locationId",
          "documentId",
          "sentBy"
        ],
        "title": "SendDocumentDto"
      },
      "SendDocumentResponseDto": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success status",
            "example": true
          },
          "links": {
            "description": "Links for all recipients",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "referenceId": {
                  "type": "string",
                  "description": "Reference ID",
                  "example": "550e8400-e29b-41d4-a716-446655440000"
                },
                "documentId": {
                  "type": "string",
                  "description": "Document ID",
                  "example": "c1e87a91-93b2-4b78-821f-85cf0e1f925b"
                },
                "recipientId": {
                  "type": "string",
                  "description": "Recipient ID",
                  "example": "u240JcS0E5qE0ziHnwMm"
                },
                "entityName": {
                  "type": "string",
                  "enum": [
                    "contacts",
                    "users"
                  ],
                  "description": "Entity name that the recipient belongs to",
                  "example": "contacts"
                },
                "recipientCategory": {
                  "type": "string",
                  "enum": [
                    "recipient",
                    "cc",
                    "bcc"
                  ],
                  "description": "Recipient category (recipient, cc, or bcc)",
                  "example": "recipient"
                },
                "documentRevision": {
                  "type": "number",
                  "description": "Document revision number",
                  "example": 1
                },
                "createdBy": {
                  "type": "string",
                  "description": "Created by user ID",
                  "example": "b6d8fa28-1112-4dc7-b9d2-f22b75a477ea"
                },
                "deleted": {
                  "type": "boolean",
                  "description": "Whether the document is deleted",
                  "example": false
                }
              },
              "required": [
                "referenceId",
                "documentId",
                "recipientId",
                "entityName",
                "recipientCategory",
                "documentRevision",
                "createdBy",
                "deleted"
              ],
              "title": "ProposalEstimateLinksDto"
            }
          }
        },
        "required": [
          "success",
          "links"
        ],
        "title": "SendDocumentResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/proposals/document/send' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "hTlkh7t8gujsahgg93",
  "documentId": "hTlkh7t8gujsahgg93",
  "documentName": "new Document",
  "medium": "email",
  "ccRecipients": [
    {
      "id": "u240JcS0E5qE0ziHnwMm",
      "email": "jim@gmail.com",
      "imageUrl": "",
      "contactName": "Jim Anton",
      "firstName": "Jim",
      "lastName": "Anton"
    }
  ],
  "notificationSettings": {
    "sender": {
      "fromName": "",
      "fromEmail": ""
    },
    "receive": {
      "subject": "",
      "templateId": ""
    }
  },
  "sentBy": "1234567890"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "hTlkh7t8gujsahgg93",
      "documentId": "hTlkh7t8gujsahgg93",
      "documentName": "new Document",
      "medium": "email",
      "ccRecipients": [
        {
          "id": "u240JcS0E5qE0ziHnwMm",
          "email": "jim@gmail.com",
          "imageUrl": "",
          "contactName": "Jim Anton",
          "firstName": "Jim",
          "lastName": "Anton"
        }
      ],
      "notificationSettings": {
        "sender": {
          "fromName": "",
          "fromEmail": ""
        },
        "receive": {
          "subject": "",
          "templateId": ""
        }
      },
      "sentBy": "1234567890"
  })
};

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

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/proposals/document/send"

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

payload = {
    "locationId": "hTlkh7t8gujsahgg93",
    "documentId": "hTlkh7t8gujsahgg93",
    "documentName": "new Document",
    "medium": "email",
    "ccRecipients": [
        {
            "id": "u240JcS0E5qE0ziHnwMm",
            "email": "jim@gmail.com",
            "imageUrl": "",
            "contactName": "Jim Anton",
            "firstName": "Jim",
            "lastName": "Anton"
        }
    ],
    "notificationSettings": {
        "sender": {
            "fromName": "",
            "fromEmail": ""
        },
        "receive": {
            "subject": "",
            "templateId": ""
        }
    },
    "sentBy": "1234567890"
}

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/proposals/document/send',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "hTlkh7t8gujsahgg93",
  "documentId": "hTlkh7t8gujsahgg93",
  "documentName": "new Document",
  "medium": "email",
  "ccRecipients": [
    {
      "id": "u240JcS0E5qE0ziHnwMm",
      "email": "jim@gmail.com",
      "imageUrl": "",
      "contactName": "Jim Anton",
      "firstName": "Jim",
      "lastName": "Anton"
    }
  ],
  "notificationSettings": {
    "sender": {
      "fromName": "",
      "fromEmail": ""
    },
    "receive": {
      "subject": "",
      "templateId": ""
    }
  },
  "sentBy": "1234567890"
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/proposals/document/send")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"hTlkh7t8gujsahgg93\",\"documentId\":\"hTlkh7t8gujsahgg93\",\"documentName\":\"new Document\",\"medium\":\"email\",\"ccRecipients\":[{\"id\":\"u240JcS0E5qE0ziHnwMm\",\"email\":\"jim@gmail.com\",\"imageUrl\":\"\",\"contactName\":\"Jim Anton\",\"firstName\":\"Jim\",\"lastName\":\"Anton\"}],\"notificationSettings\":{\"sender\":{\"fromName\":\"\",\"fromEmail\":\"\"},\"receive\":{\"subject\":\"\",\"templateId\":\"\"}},\"sentBy\":\"1234567890\"}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/proposals/document/send"
  payload := strings.NewReader(`{
  "locationId": "hTlkh7t8gujsahgg93",
  "documentId": "hTlkh7t8gujsahgg93",
  "documentName": "new Document",
  "medium": "email",
  "ccRecipients": [
    {
      "id": "u240JcS0E5qE0ziHnwMm",
      "email": "jim@gmail.com",
      "imageUrl": "",
      "contactName": "Jim Anton",
      "firstName": "Jim",
      "lastName": "Anton"
    }
  ],
  "notificationSettings": {
    "sender": {
      "fromName": "",
      "fromEmail": ""
    },
    "receive": {
      "subject": "",
      "templateId": ""
    }
  },
  "sentBy": "1234567890"
}`)
  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/proposals/document/send")

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 = '{
  "locationId": "hTlkh7t8gujsahgg93",
  "documentId": "hTlkh7t8gujsahgg93",
  "documentName": "new Document",
  "medium": "email",
  "ccRecipients": [
    {
      "id": "u240JcS0E5qE0ziHnwMm",
      "email": "jim@gmail.com",
      "imageUrl": "",
      "contactName": "Jim Anton",
      "firstName": "Jim",
      "lastName": "Anton"
    }
  ],
  "notificationSettings": {
    "sender": {
      "fromName": "",
      "fromEmail": ""
    },
    "receive": {
      "subject": "",
      "templateId": ""
    }
  },
  "sentBy": "1234567890"
}'

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

**PowerShell**

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

$body = '{
  "locationId": "hTlkh7t8gujsahgg93",
  "documentId": "hTlkh7t8gujsahgg93",
  "documentName": "new Document",
  "medium": "email",
  "ccRecipients": [
    {
      "id": "u240JcS0E5qE0ziHnwMm",
      "email": "jim@gmail.com",
      "imageUrl": "",
      "contactName": "Jim Anton",
      "firstName": "Jim",
      "lastName": "Anton"
    }
  ],
  "notificationSettings": {
    "sender": {
      "fromName": "",
      "fromEmail": ""
    },
    "receive": {
      "subject": "",
      "templateId": ""
    }
  },
  "sentBy": "1234567890"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/proposals/document/send' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
