Skip to main content

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:

FieldTypeRequiredRules
namestringYesTrimmed; 2 to 120 characters
emailstringYesValid email; trimmed; lower-cased; max 320
organizationstringNoTrimmed; max 180; empty string allowed
subjectstringYesTrimmed; 5 to 180
messagestringYesTrimmed; 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:

HTTPCodeMeaning
403REQUEST_REJECTEDOrigin missing or not allowed, or body is not JSON (lib RequestValidationError).
422VALIDATION_ERRORField validation failed; fields lists paths (unknown fields appear under request).
429RATE_LIMITEDFive or more inquiries from the same email in the last 15 minutes.
500INTERNAL_ERRORDatabase insert failed.

Side effects:

  • Inserts a contact_inquiries row with status PENDING.
  • 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.