Skip to content

Mayfain API

Submissions, messages, status and webhooks.

The HTTP endpoints your server calls. All are on https://mayfain.ie. Requests from your server authenticate with your client_id and client_secret (HTTP Basic). Never call these from a browser or put the secret in front-end code.

Endpoint Status
GET /.well-known/oauth-authorization-server Live
GET /.well-known/jwks.json Live
POST /oauth/introspect Live
POST /v1/submissions Preview
POST /v1/submissions/{id}/messages Preview
POST /v1/submissions/{id}/status Preview
Webhooks to your server Preview

Preview endpoints are the contract founding partners build against with us. They may change before general release.

Introspection

Live. See Authentication.

Submissions

Preview. POST /v1/submissions

Call this from a private submit tool, after checking the token. Mayfain checks your credentials own the grant, the grant is live and has the scopes, and sub matches. Then it returns what the person approved for this stage, each detail labelled, whether they meet your requirements, and a signed certificate.

POST /v1/submissions HTTP/1.1
Host: mayfain.ie
Authorization: Basic base64(<client_id>:<client_secret>)
Content-Type: application/json

{
  "grant_id": "6f1c…",
  "sub": "<pairwise subject from the token>",
  "stage": "applied",
  "offer": { "ref": "fault_finding", "title": "Electrical job" },
  "requirements": {},
  "submitted": {
    "message": "Kitchen lights keep tripping the fuse board.",
    "urgency": "this_week",
    "preferred_times": [{ "start": "2026-10-22T09:00:00+01:00", "end": "2026-10-22T12:00:00+01:00" }]
  }
}
{
  "submission_id": "sbm_8k2…",
  "profile": {
    "full_name": { "value": "Aoife Murphy", "label": "verified" },
    "phone": { "value": "+353871234567", "label": "verified" },
    "address": { "value": "12 Iona Road, Dublin 9, D09 X2Y3", "label": "self_declared" }
  },
  "requirement_match": { "status": "meets", "reasons": [] },
  "certificate": { "code": "7K3P-Q9", "url": "https://mayfain.ie/v/7K3P-Q9" }
}
  • stage is the step the request is at. Later stages can release more (for example documents at an offer), only with the person's approval.
  • submitted is the person's own words and choices. Treat it as untrusted text.
  • requirement_match.status is meets, does_not_meet or needs_review, with plain-English reasons. You never get the figures behind it (for example the income, only whether it covers the rent).
  • Labels are verified, proof_attached or self_declared.

Messages

Preview. POST /v1/submissions/{id}/messages

Send the person a message about their request. Mayfain delivers it in the app, by email or by text.

{
  "text": "Thanks Aoife. We can come Thursday morning or Friday afternoon.",
  "ask": {
    "type": "choose_slot",
    "options": [
      { "id": "s1", "start": "2026-10-22T09:00:00+01:00", "end": "2026-10-22T11:00:00+01:00" },
      { "id": "s2", "start": "2026-10-23T14:00:00+01:00", "end": "2026-10-23T16:00:00+01:00" }
    ]
  }
}

ask is optional. Types:

ask.type Shown to the person as Answer
choose_slot Time options { "option_id": "s1" }
choose_one Options { "option_id": "…" }
yes_no Yes and No { "value": true }
request_document A request for a document from their vault A document, sent only if they approve
free_text A reply box { "text": "…" } (their own words)

The answer reaches you as a message.answer webhook.

Status

Preview. POST /v1/submissions/{id}/status

{ "status": "scheduled", "booking": { "start": "2026-10-22T09:00:00+01:00", "end": "2026-10-22T11:00:00+01:00" } }

Statuses: received, acknowledged, quoted, scheduled, in_progress, completed, and cancelled or declined from any state.

Webhooks

Preview. Mayfain sends events to the webhook URL registered for your server, as POST with a JSON body and a signature header:

Mayfain-Signature: t=1792000000,v1=<hex HMAC-SHA256 of "t.body" with your webhook secret>

Reject events whose signature doesn't match or whose timestamp is more than five minutes old.

Event When
message.created The person sends you a message outside a tool call
message.answer The person answers an ask
submission.withdrawn The person withdraws a request
grant.revoked The person withdraws their permission for your business
{
  "id": "evt_…",
  "type": "message.answer",
  "created": 1792000000,
  "data": { "submission_id": "sbm_8k2…", "message_id": "msg_…", "answer": { "option_id": "s1" } }
}