POST /verify
API reference for the verify endpoint - check a 4Quays signed message, its signer and its liveness
The /verify endpoint checks a 4Quays signed message and returns a verdict. It works for messages signed by agents and by services. No API key is needed, so anyone who receives a signed message can verify it.
The verdict keeps two questions separate:
- Is the math valid?
signature_validnever changes once a message is signed. - Is the signer still trusted?
statusandkey_statusare read live, so a revoked signer shows up on the next check.
A message is valid only when both hold, it has not expired, and the audience matches (if you asked for one).
Endpoint
POST /api/v1/verify
Request
Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | Must be application/json |
No authentication is required. The endpoint allows cross-origin requests from any origin (CORS *).
Body
Send the whole signed message:
{
"signedMessage": "-----BEGIN 4QUAYS SIGNED MESSAGE-----\nVersion: 4QSB/2\n...\n-----END 4QUAYS SIGNED MESSAGE-----",
"expectedAudience": "payments.example.com"
}
Or send a detached signature:
{
"signature": "eyJhbGciOiJNTC1EU0EtNjUi...",
"content": "Only needed for a legacy v1 signature"
}
| Field | Type | Required | Description |
|---|---|---|---|
signedMessage | string | One of these two | A whole 4QUAYS SIGNED MESSAGE block. Email quote prefixes (>) and re-wrapped lines are tolerated. |
signature | string | One of these two | A detached compact JWS (signature.jws from /sign) |
content | string | No | The signed content. Only needed for a legacy v1 detached signature; v2 signatures carry the content in the signed payload. |
expectedAudience | string | No | Require the signature's audience to equal this value. A mismatch adds audience_mismatch. Max 512 characters. |
Input is limited to 512 KB.
Example Request
curl -X POST https://api.4quays.com/api/v1/verify \
-H "Content-Type: application/json" \
-d "{\"signedMessage\": $(jq -Rs . < message.4qs)}"
Response
Success (200 OK)
The endpoint returns 200 with a verdict even when the signature does not verify. Read valid and reasons; do not rely on the HTTP status.
{
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"valid": true,
"signature_valid": true,
"status": "active",
"key_status": "active",
"quantum_safe": true,
"reasons": [],
"block_version": 2,
"content": "Approve payment of CAD 5,000 to ACME Ltd.",
"signer": { "type": "service", "id": "3b1d...", "name": "Payments API" },
"agent": null,
"org": { "id": "8c0a...", "name": "Acme Corp" },
"algorithm": "ML-DSA-65",
"kid": "9f2c4e...",
"mode": "service-held",
"signed_at": "2026-11-24T15:04:05.000Z",
"expires_at": "2026-11-24T16:04:05.000Z",
"audience": null
}
| Field | Type | Description |
|---|---|---|
valid | boolean | Signature valid, not expired, audience OK and signer active |
signature_valid | boolean | The signature math alone |
status | active | revoked | unknown | The signer's liveness at check time |
key_status | active | rotated | revoked | unknown | The signing key's lifecycle. rotated is normal for older messages and still verifies. |
quantum_safe | boolean | true for ML-DSA signatures |
reasons | string[] | Why the message did not fully pass (empty when valid) |
block_version | 1 | 2 | null | Signed-message format version |
content | string | null | The verified content. For v2 it is decoded from the signed payload. Show this, not the text that was pasted. |
signer | object | null | The signing principal: { "type": "agent" | "service", "id", "name" } |
agent | object | null | { "id", "name" }, set only when an agent signed. Kept for existing callers; prefer signer. |
org | object | null | The signer's organization { "id", "name" } |
algorithm | string | null | JOSE algorithm (ML-DSA-44, ML-DSA-65, ML-DSA-87, ES256, PS256) |
kid | string | null | Signing key fingerprint |
mode | string | null | "service-held" |
signed_at | string | null | ISO 8601 signing time |
expires_at | string | null | ISO 8601 expiry |
audience | string | null | The audience embedded in the signature |
Reasons
| Reason | Meaning |
|---|---|
malformed | The input is not a 4Quays signed message or JWS |
unknown_signer | No 4Quays key matches the kid |
signature_invalid | The signature does not match the content |
digest_mismatch | v1 only: the in-band content was changed, often by email reflow |
payload_undecodable | v2 only: the signed payload is not valid UTF-8 |
expired | Past expires_at |
audience_mismatch | The audience differs from expectedAudience |
revoked | The signer (agent or service) has been revoked |
key_revoked | The signing key has been revoked |
Error Responses
| Status | Code | Meaning |
|---|---|---|
| 400 | INVALID_REQUEST | Neither signedMessage nor signature was sent, or the input is over 512 KB |
| 429 | RATE_LIMITED | More than 60 requests a minute from one IP. Honor Retry-After. |
| 500 | INTERNAL_ERROR | Verification failed |
Public keys (JWKS)
Every agent and service signing key is published at:
GET /.well-known/jwks/<kid>
The response is a JWK Set ({ "keys": [...] }) with the public key for that kid. ML-DSA keys use the AKP key type with the raw public key in pub. Revoked keys are not served. Responses can be cached for 5 minutes.
Verify locally
@4quays/verify checks the signature on your own machine against the JWKS key, with no call to 4Quays for the verdict. It checks the math and expiry and returns the signer ({ type, id }) from the signed header. Liveness, names and organization come only from /api/v1/verify.
import { verifyLocal } from '@4quays/verify';
const result = await verifyLocal(signedMessage, {
origin: 'https://api.4quays.com',
// ML-DSA needs a post-quantum library in your runtime:
mldsaVerify: ({ alg, publicKey, message, signature }) =>
myPqc.verify(alg, message, signature, publicKey),
});
if (result.valid) {
console.log(result.signer, result.content);
}
ES256 and PS256 verify with Node's built-in crypto. Without an mldsaVerify function, ML-DSA messages return pqc_lib_required; they never pass silently.
SDK
import { FourQ } from '@4quays/sdk';
const fourq = new FourQ({ endpoint: process.env.FOURQ_ENDPOINT });
const verdict = await fourq.verify(signedMessage);
if (verdict.valid && verdict.status === 'active') {
console.log(`${verdict.signer?.type} ${verdict.signer?.name} signed:`, verdict.content);
}
Related
- POST /sign: sign as an agent or service
- Error Codes: full error reference