11.2 Public contact form
POST /api/v1/contact
- Purpose. Records a public enquiry and notifies staff.
- Authentication. None. Requires a valid mutation
Origin(see Section 2.6). - Role. None.
- Headers.
Content-Type: application/json,Origin.
Request body:
| Field | Type | Required | Rules |
|---|---|---|---|
name | string | Yes | Trimmed; 2 to 120 characters |
email | string | Yes | Valid email; trimmed; lower-cased; max 320 |
organization | string | No | Trimmed; max 180; empty string allowed |
subject | string | Yes | Trimmed; 5 to 180 |
message | string | Yes | Trimmed; 20 to 5,000 |
Unknown fields are rejected (.strict()).
curl -s -X POST https://dffms.org/api/v1/contact \
-H 'Content-Type: application/json' \
-H 'Origin: https://dffms.org' \
-d '{
"name": "Ada Example",
"email": "ada@demo.dffms.org",
"organization": "Demo Agro Cooperative",
"subject": "Question about input financing",
"message": "We would like to know the eligibility criteria for the smallholder input window."
}'
Response (201):
{
"data": {
"id": "0190f2c4-6b3e-7a1d-8c2f-000000000101",
"status": "submitted",
"message": "Your inquiry has been submitted and recorded successfully."
},
"error": null,
"requestId": "<request-id>"
}
Errors:
| HTTP | Code | Meaning |
|---|---|---|
| 403 | REQUEST_REJECTED | Origin missing or not allowed, or body is not JSON (lib RequestValidationError). |
| 422 | VALIDATION_ERROR | Field validation failed; fields lists paths (unknown fields appear under request). |
| 429 | RATE_LIMITED | Five or more inquiries from the same email in the last 15 minutes. |
| 500 | INTERNAL_ERROR | Database insert failed. |
Side effects:
- Inserts a
contact_inquiriesrow with statusPENDING. - Queues an in-app notification, a push notification and an email to Platform Super Administrators, with an action link to
/admin/inquiries/{id}. Failures here are swallowed; the inquiry is still recorded. - Sends an email to the DFFMS support mailbox and an acknowledgement email to the submitter. Email failures do not affect the result.
- No audit event is written by this route.