KeelsonDocs
    Judge Mode

    API reference Mandates

    Compile a mandate from a shopping request

    POST/v1/mandates/compile

    Two models compile the request independently; fields they disagree on or the request leaves unstated come back ambiguous, and a third model checks the rendered card against the request. Limited to 10 requests a minute per user.

    Headers

    Content-Typeapplication/jsonRequired
    idempotency-keystringRequired
    keelson-devicestring
    The app's opaque device id, recorded as risk_data.device_fp. Required.
    Idempotency-KeystringRequired
    1 to 255 characters. A retry with the same key returns the first answer.

    Request body

    application/json

    promptstringRequired
    The shopping request in natural language, at most 2000 UTF-16 code units.
    credentialIdstring
    The passkey that will sign the mandate; defaults to the most recent one.
    modestring
    Whether the user is present at checkout (immediate) or not (autonomous).One of immediateautonomous

    Responses

    • 200The draft mandate and its card
    • 401Not signed in
    • 403The passkey is not the user's
    • 409The user has no passkey to sign with
    • 422The prompt is too long (prompt-too-long), the device id is missing (device-required), the compilations conflict (compile-conflict), the request leaves out a value a mandate needs (compile-needs-input) or cannot become a mandate (compile-unresolved); fields names what to ask the user
    • 429Too many compilations
    • 502The models failed to compile the request
    • 503Inputs a mandate needs are not available yet (compile-unavailable; missing names them), or the rate limit store is unreachable

    200 response

    mandateDraftobjectRequired
    The compiled keelson.mandate.1 payload, unsigned; its commitment is zero.
    cardobjectRequired
    ambiguousarray of stringRequired
    Card fields the compilations disagreed on or the request left unstated, shown gray for the user to settle. Pass them to prepareSigning so the card the user signs shows them gray too.
    checkobjectRequired
    The round trip of the card against the request. Only ok means it was checked.