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_valid never changes once a message is signed.
  • Is the signer still trusted? status and key_status are 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

HeaderRequiredDescription
Content-TypeYesMust 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"
}
FieldTypeRequiredDescription
signedMessagestringOne of these twoA whole 4QUAYS SIGNED MESSAGE block. Email quote prefixes (>) and re-wrapped lines are tolerated.
signaturestringOne of these twoA detached compact JWS (signature.jws from /sign)
contentstringNoThe signed content. Only needed for a legacy v1 detached signature; v2 signatures carry the content in the signed payload.
expectedAudiencestringNoRequire 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
}
FieldTypeDescription
validbooleanSignature valid, not expired, audience OK and signer active
signature_validbooleanThe signature math alone
statusactive | revoked | unknownThe signer's liveness at check time
key_statusactive | rotated | revoked | unknownThe signing key's lifecycle. rotated is normal for older messages and still verifies.
quantum_safebooleantrue for ML-DSA signatures
reasonsstring[]Why the message did not fully pass (empty when valid)
block_version1 | 2 | nullSigned-message format version
contentstring | nullThe verified content. For v2 it is decoded from the signed payload. Show this, not the text that was pasted.
signerobject | nullThe signing principal: { "type": "agent" | "service", "id", "name" }
agentobject | null{ "id", "name" }, set only when an agent signed. Kept for existing callers; prefer signer.
orgobject | nullThe signer's organization { "id", "name" }
algorithmstring | nullJOSE algorithm (ML-DSA-44, ML-DSA-65, ML-DSA-87, ES256, PS256)
kidstring | nullSigning key fingerprint
modestring | null"service-held"
signed_atstring | nullISO 8601 signing time
expires_atstring | nullISO 8601 expiry
audiencestring | nullThe audience embedded in the signature

Reasons

ReasonMeaning
malformedThe input is not a 4Quays signed message or JWS
unknown_signerNo 4Quays key matches the kid
signature_invalidThe signature does not match the content
digest_mismatchv1 only: the in-band content was changed, often by email reflow
payload_undecodablev2 only: the signed payload is not valid UTF-8
expiredPast expires_at
audience_mismatchThe audience differs from expectedAudience
revokedThe signer (agent or service) has been revoked
key_revokedThe signing key has been revoked

Error Responses

StatusCodeMeaning
400INVALID_REQUESTNeither signedMessage nor signature was sent, or the input is over 512 KB
429RATE_LIMITEDMore than 60 requests a minute from one IP. Honor Retry-After.
500INTERNAL_ERRORVerification 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);
}