VayaFlow
Documents

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.

POST
/api/v1/document-templates/{documentTemplateId}/send

Authorization

ApiKeyAuth
X-API-Key<token>

API key generated from your Vayaflow dashboard Settings page

In: header

Path Parameters

documentTemplateId*string

Request Body

application/json

contactId*string

The contact to send the document to.

fileKey?string

Where the finished document saves on the contact (e.g. "retainer"). Defaults to "document".

sendEmail?boolean

Email the link to each person. Defaults to true.

sendSms?boolean

Also text the link. Defaults to false.

prefillOverrides?

Values for this send only, keyed by the field binding token. They win over the contact data.

submitterOverrides?array<>

Who takes each role on this send, when the template does not already say.

replaceInProgress?boolean

Replace an open copy that someone already started. Their entries are voided.

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/document-templates/stpl_abc123/send"  body := strings.NewReader(`{    "contactId": "contact_abc123"  }`)  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": "ssub_abc123",
    "signingUrl": "string",
    "contactId": "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"
  }
}