VayaFlow
Documents

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.

POST
/api/v1/contacts/{contactId}/documents

Authorization

ApiKeyAuth
X-API-Key<token>

API key generated from your Vayaflow dashboard Settings page

In: header

Path Parameters

contactId*string

Request Body

application/json

playbookId?string

Send this playbook's documents. Give playbookId or documentTemplateId, not both.

documents?array<>

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.

documentTemplateId?string

Send one template outside any playbook instead.

sendEmail?boolean

Email the link to the contact. Defaults to true.

sendSms?boolean

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"
  }
}
Empty