Create or update a file
Creates or updates a file reference for a contact. Upserts by contactId + 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
Contact 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
uriLink where the contact signs or fills out the document (if applicable)
uriSource of the file
"vayaflow" | "docuseal" | "manual_upload" | "system_generated" | "csv_import" | "email_inbound"External provider document ID
Initial status (defaults to "pending")
"pending" | "uploaded" | "viewed" | "in_progress" | "partially_signed" | "signed" | "verified" | "expired" | "declined" | "failed" | "voided"ISO 8601 timestamp when the document was signed or completed
Provider-specific metadata
Response Body
application/json
application/json
application/json
package mainimport ( "fmt" "net/http" "io/ioutil" "strings")func main() { url := "https://api.vayaflow.com/api/v1/files" body := strings.NewReader(`{ "contactId": "contact_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",
"contactId": "contact_xyz789",
"fileKey": "retainer_signed",
"fileName": "retainer_signed.pdf",
"fileType": "pdf",
"documentUrl": "https://storage.example.com/files/retainer_signed.pdf",
"status": "signed",
"provider": "vayaflow",
"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"
}
}