Diagnostic Submissions
If you run a diagnostic form (quiz, assessment, self-test) that delivers a result to the lead, this API logs every submission attempt in Sendeasy: who filled it in, the result, and whether the WhatsApp delivery and the ActiveCampaign contact creation succeeded.
The history shows up under Leads → Diagnostic Submissions, with search and CSV export.
This API only records the history. It does not send the message or create the contact — that is still done by your form, by the WABA API, or by the integration you already use.
Before you start
- Register the project. Under Leads → Diagnostic Submissions, open Allowed projects and register an identifier for your diagnostic (e.g.
mydiagnostic). While the list is empty, no submission is recorded. - Generate an API Token for the project (Settings → API).
The identifier you send must exactly match one of the registered ones. This validation is intentional: it prevents a typo from silently creating a new project.
Log a submission
| Method | Endpoint | Auth |
|---|---|---|
POST | /api/v1/diagnostic-submissions | API Token |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
project | string | Yes | Diagnostic identifier, matching the one registered under "Allowed projects". |
name | string | No | Name of the person who filled it in. |
email | string | No | Email of the person who filled it in. |
phone | string | No | Phone with country and area code (e.g. 5511999999999). |
result | object | No | Answers, scores and dimensions of the diagnostic. Free-form. |
whatsappStatus | string | No | success, failed or skipped. |
whatsappError | string | No | Error message when the delivery fails. |
activeCampaignStatus | string | No | success, failed or skipped. |
activeCampaignError | string | No | Error message when the integration fails. |
source | string | No | Lead source (campaign, page, ad). |
Send the status fields after attempting delivery, with the real outcome of each step. That is what lets you find failed deliveries later.
Example
curl --location 'https://backend.sendeasy.app/api/v1/diagnostic-submissions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--data '{
"project": "mydiagnostic",
"name": "Maria Souza",
"email": "maria@example.com",
"phone": "5511999999999",
"result": { "average": 7.5, "categories": { "process": 8, "people": 7 } },
"whatsappStatus": "success",
"activeCampaignStatus": "failed",
"activeCampaignError": "API timeout",
"source": "instagram-campaign"
}'
Response
{
"id": 42
}
Errors
| HTTP | error | What to do |
|---|---|---|
400 | PROJECT_REQUIRED | Send the project field. |
400 | NO_PROJECTS_CONFIGURED | No project registered yet: open "Allowed projects" on the screen and register the identifier. |
400 | PROJECT_NOT_ALLOWED | The identifier is not on the list. The response includes allowedProjects with the accepted values — compare them with what your form sends. |
401 | ERR_API_TOKEN_NOT_PROVIDED | Missing the Authorization: Bearer <api_token> header. |
401 | ERR_API_TOKEN_INVALID | Invalid or disabled token. |
Both project errors include the accepted list:
{
"error": "PROJECT_NOT_ALLOWED",
"allowedProjects": ["mydiagnostic"]
}
Best practices
- Log failures too. A submission with
whatsappStatus: "failed"is exactly what you want to see later. - Don't block the user. Call this API in the background: if logging fails, the lead should still see their result.
- Keep the token on the server. The API Token grants access to the project — never expose it in the browser.