Create or update a file
Creates or updates a file reference for a lead. Upserts by leadId + fileKey — if a file with the same key already exists, it will be updated. The file must already be hosted at a publicly accessible URL.
Authorization
ApiKeyAuth API key generated from your Vayaflow dashboard Settings page
In: header
Request Body
application/json
Lead ID to associate the file with
1 <= lengthUnique key for this file type (lowercase alphanumeric + underscores, e.g. "retainer_signed")
1 <= lengthOriginal filename (e.g. "retainer_signed.pdf")
1 <= lengthFile extension (e.g. "pdf", "png", "jpg")
1 <= lengthPublicly accessible URL to the file
uriSigning provider URL (if applicable)
uriSource of the file
"docuseal" | "manual_upload" | "system_generated" | "csv_import"External provider document ID
Initial status (defaults to "pending")
"pending" | "uploaded" | "viewed" | "in_progress" | "signed" | "verified" | "expired" | "declined" | "failed"ISO 8601 timestamp when document was signed
Submission ID that created this file
Provider-specific metadata
Response Body
application/json
application/json
application/json
package mainimport ( "fmt" "net/http" "io/ioutil" "strings")func main() { url := "https://api.leadsail.app/api/v1/files" body := strings.NewReader(`{ "leadId": "lead_xyz789", "fileKey": "retainer_signed", "fileName": "retainer_signed.pdf", "fileType": "pdf", "documentUrl": "https://storage.example.com/files/retainer_signed.pdf", "status": "uploaded" }`) 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": {
"fileId": "file_abc123",
"leadId": "lead_xyz789",
"fileKey": "retainer_signed",
"fileName": "retainer_signed.pdf",
"fileType": "pdf",
"documentUrl": "https://storage.example.com/files/retainer_signed.pdf",
"status": "signed",
"provider": "docuseal",
"createdAt": "2024-06-15T10:30:00Z",
"updatedAt": "2024-06-15T14:22:00Z",
"signedAt": "2024-06-15T14:22:00Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
"string"
]
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}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.
Get all files for a lead
Returns all file references associated with a lead.