LeadSail
Documents

Send a document for signing

Sends a document template (e.g. retainer agreement) to a lead for electronic signing via DocuSeal. Provide a documentTemplateId to send a specific template, or a campaignId to let the system select one based on configured conditions and the fileKey. The signing link is sent via email by default. Set sendSms to true to also send via SMS, or sendEmail to false to skip email and use the returned signingUrl directly. A File record is created on the lead with the given fileKey, and the status progresses automatically through pending, viewed, in_progress, and signed via webhooks.

POST
/api/v1/document-templates/send

Authorization

ApiKeyAuth
X-API-Key<token>

API key generated from your Vayaflow dashboard Settings page

In: header

Request Body

application/json

leadId*string

The lead to send the document to

fileKey*string

Storage key for this document type (e.g. "retainerSigning", "proof_of_income"). Used to track the signing status on the lead.

documentTemplateId?string

Explicit document template ID. If provided, sends this specific template. If omitted, campaignId is used for condition-based selection (or derived from the lead).

campaignId?string

Campaign ID for condition-based template selection. Optional — if omitted, derived from the lead's current campaign.

sendEmail?boolean

Send the signing link via email. Defaults to true.

Defaulttrue
sendSms?boolean

Send the signing link via SMS. Defaults to false.

Defaultfalse
data?

Data overrides for template field mapping. Values here take priority over lead data when resolving template fields.

testMode?boolean

Use the test DocuSeal API key instead of production. Defaults to false.

Defaultfalse
completedRedirectUrl?string

URL to redirect the signer to after they complete signing. Only applies to the hosted/emailed DocuSeal signing experience — ignored by embedded signing (intake flows). Must be a fully qualified URL.

Formaturi

Response Body

application/json

application/json

application/json

application/json

package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "https://api.leadsail.app/api/v1/document-templates/send"  body := strings.NewReader(`{    "leadId": "lead_abc123",    "fileKey": "retainerSigning"  }`)  req, _ := http.NewRequest("POST", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
{
  "success": true,
  "data": {
    "submissionId": "98765",
    "signingUrl": "https://docuseal.com/s/ABC123...",
    "leadId": "string",
    "templateId": "string",
    "templateName": "string"
  }
}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input data",
    "details": [
      "string"
    ]
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Resource not found"
  }
}