Skip to main content
The KYA SDK is coming soon. The packages aren’t published yet, so the helpers named here won’t run until they are.
When a check fails, report.failure holds one VerificationFailure code and report.checks shows every check that ran. The code is the same string in TypeScript and Python. Only two failures are retryable. Both mean Baselayer couldn’t be reached from your side, not that anything is wrong with the credential. Every other failure is final: the same presentation will fail again.

Responding to the agent

Put the code in kya_error in the JSON body so the agent can tell what went wrong. The agent side of the SDK reads it from there. toOAuthError(failure) (failure.to_oauth_error() in Python) builds the whole answer for you. The agent side treats any 5xx as worth retrying and any 4xx as final. The oauthError helper in the SDK quickstart follows this table.

Your application creates the response

verify never returns these two. Your own route logic produces them before it calls verify.

Try again later

These are the only two 503 cases. Nothing is wrong with the credential. Your server couldn’t fetch one of Baselayer’s public files. You choose whether to fail open or closed. If you fail closed, return 503 so the agent tries again later. You can pass a Retry-After time in seconds as the second argument to toOAuthError (retry_after in Python).

Present a corrected or fresh credential

These are final for this presentation. The agent or its builder can often fix the input and present again.

Refuse and investigate

These point to a credential that can’t be trusted. Refuse, and log the failure with its checks.

Using the checks list

report.checks lists every check that ran with a name, whether it passed and a short detail. Log it with the failure. It shows exactly where a credential stopped, which helps when an agent builder asks why they were refused.

Next steps