Send documents to a contact
Sends a playbook's documents (or one template) to a contact as one send with one link to the contact's documents page. With no documents list, every outstanding document whose conditions match the contact and that the playbook includes by default goes. Documents already done, or already sent and still open, are skipped and listed, never sent twice. The link is reused across sends for the same contact and playbook, and each send extends it. Responds 409 NOTHING_TO_SEND when every document is done, already out, or does not apply.
Authorization
ApiKeyAuth API key generated from your Vayaflow dashboard Settings page
In: header
Path Parameters
Request Body
application/json
Send this playbook's documents. Give playbookId or documentTemplateId, not both.
fileKeys of the playbook's documents to send. Omit to send every outstanding document whose conditions match the contact and that the playbook includes by default.
Send one template outside any playbook instead.
Email the link to the contact. Defaults to true.
Text the link to the contact. Defaults to false.
Response Body
application/json
application/json
application/json
application/json
package mainimport ( "fmt" "net/http" "io/ioutil" "strings")func main() { url := "https://api.vayaflow.com/api/v1/contacts/cont_abc123/documents" body := strings.NewReader(`{}`) 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": {
"envelopeId": "env_abc123",
"portalLinkId": "plnk_abc123",
"portalUrl": "string",
"expiresAt": "string",
"sent": [
"string"
],
"skipped": [
{
"fileKey": "string",
"reason": "already_done",
"detail": "string"
}
],
"items": [
{
"fileKey": "retainer",
"name": "Retainer agreement",
"kind": "esign",
"required": true,
"includeByDefault": true,
"status": "not_sent",
"documentId": "string",
"variant": "string",
"documentTemplateId": "string",
"inEnvelopeIds": [
"string"
]
}
],
"delivery": {
"email": "sent",
"sms": "sent",
"emailCode": "string",
"smsCode": "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"
}
}Send a document
Sends one document template to a contact: an e-sign document (it has a signature field) or a form (no signature field). Each person on it gets their own link by email (and SMS when asked), in order. The finished copy saves on the contact under fileKey, and a document_completed event fires when everyone is done. Responds 409 when an open copy someone already started exists, unless replaceInProgress is true.
List a contact's documents
Every document the contact owes or receives for a playbook, where each stands, and the state of the contact's link. Omit playbookId for documents sent outside any playbook.