Submissions API
Retrieve, list, and delete form submissions. All submission data returned by the API is encrypted — you must decrypt it client-side using your private key.
Submit a Form
Request Body:
{
"formId": "vf-abc123",
"submissionId": "vf-xyz789",
"payload": {
"encrypted": true,
"version": "vf-e1",
"data": "base64-encrypted-data...",
"key": "base64-encrypted-aes-key...",
"iv": "base64-initialization-vector..."
},
"timestamp": 1699920000000,
"meta": {
"sdk": "veilforms-js",
"version": "1.0.0"
}
}
Response:
{
"success": true,
"submissionId": "vf-xyz789",
"timestamp": 1699920000000
}
List Submissions
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | The form ID |
limit | integer | No | Max results (default: 50, max: 100) |
offset | integer | No | Pagination offset (default: 0) |
Example Request:
curl "https://veilforms.com/api/submissions?formId=vf-abc123&limit=10" \
-H "Authorization: Bearer vf_live_xxx"
Response:
{
"formId": "vf-abc123",
"submissions": [
{
"submissionId": "vf-xyz789",
"payload": {
"encrypted": true,
"version": "vf-e1",
"data": "base64...",
"key": "base64...",
"iv": "base64..."
},
"timestamp": 1699920000000,
"receivedAt": 1699920001000,
"meta": {
"sdk": "veilforms-js",
"version": "1.0.0"
}
}
],
"total": 142,
"limit": 10,
"offset": 0
}
Get Single Submission
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | The form ID |
Example Request:
curl "https://veilforms.com/api/submissions/vf-xyz789?formId=vf-abc123" \
-H "Authorization: Bearer vf_live_xxx"
Response:
{
"submission": {
"submissionId": "vf-xyz789",
"payload": {
"encrypted": true,
"version": "vf-e1",
"data": "base64...",
"key": "base64...",
"iv": "base64..."
},
"timestamp": 1699920000000,
"receivedAt": 1699920001000
}
}
Delete Submission
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | The form ID |
Example Request:
curl -X DELETE "https://veilforms.com/api/submissions/vf-xyz789?formId=vf-abc123" \
-H "Authorization: Bearer vf_live_xxx"
Response:
{
"success": true,
"deleted": "vf-xyz789"
}
Decrypting Submissions
Submissions are encrypted. Here’s how to decrypt them:
JavaScript (Browser)
import { decryptSubmission } from 'veilforms/core/encryption';
// Your private key (from localStorage or secure storage)
const privateKey = JSON.parse(localStorage.getItem('veilforms_private_keys'))['vf-abc123'];
// Encrypted submission from API
const encrypted = submission.payload;
// Decrypt in browser
const decrypted = await decryptSubmission(encrypted, privateKey);
console.log(decrypted);
// { name: "John", message: "Hello!" }
Node.js (Server-Side)
import { decryptSubmission } from 'veilforms/core/encryption';
import fs from 'fs';
// Load your private key from secure storage
const privateKey = JSON.parse(fs.readFileSync('./private-key.json'));
// Fetch submissions from API
const response = await fetch('https://veilforms.com/api/submissions?formId=vf-abc123', {
headers: { 'Authorization': 'Bearer vf_live_xxx' }
});
const { submissions } = await response.json();
// Decrypt each submission
for (const sub of submissions) {
const decrypted = await decryptSubmission(sub.payload, privateKey);
console.log(sub.submissionId, decrypted);
}
Export All Submissions
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | The form ID |
format | string | No | json (default) or csv |
Example Request:
curl "https://veilforms.com/api/submissions/export?formId=vf-abc123&format=json" \
-H "Authorization: Bearer vf_live_xxx"
Purge All Submissions
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | The form ID |
confirm | string | Yes | Must be DELETE_ALL_SUBMISSIONS |
Example Request:
curl -X DELETE "https://veilforms.com/api/submissions?formId=vf-abc123&confirm=DELETE_ALL_SUBMISSIONS" \
-H "Authorization: Bearer vf_live_xxx"
Response:
{
"success": true,
"deleted": 142
}