Skip to content

Purpose Mismatch

URI: https://docs.ankatech.co/errors/purpose-mismatch
HTTP Status: 422 Unprocessable Entity

When you see this

The key's purpose does not match the purpose required by the requested operation or context.

Common Causes

  • Using an ENCRYPT_DECRYPT key where a SIGN_VERIFY key is required (or vice versa).
  • Binding a key to a context that demands a different purpose.
  • A request whose declared purpose conflicts with the key's stored purpose.

Response Example

{
  "type": "https://docs.ankatech.co/errors/purpose-mismatch",
  "title": "Purpose Mismatch",
  "status": 422,
  "detail": "Key purpose 'ENCRYPT_DECRYPT' does not match the required purpose 'SIGN_VERIFY' for this operation.",
  "instance": "/api/v3/admin/keys/my-mlkem-key/operations",
  "correlationId": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": 1730000000
}

Content-Type: application/problem+json — the response follows RFC 7807 Problem Details.

How to Resolve

  1. Select a key whose purpose matches the operation's required purpose.
  2. Confirm the key's purpose via its metadata before use.
  3. Re-submit using a correctly-purposed key.

For full schema definitions, examples, and interactive testing, see the Developer Hub Reference.