Skip to main content

TypeAlias.ProblemDetails

type ProblemDetails = {
detail: string;
instance?: string;
status?: number;
title?: string;
type: string;
};

RFC 7807 Problem Details for HTTP APIs.

A machine-readable format for specifying errors in HTTP API responses. Standardizes error responses across the Keyban API with consistent structure.

All fields except detail are optional but recommended for clarity. The detail field contains the primary human-readable error message.

Type Declaration

NameTypeDescription
detailstringHuman-readable explanation specific to this occurrence of the problem. This is the primary error message shown to users.
instance?stringURI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
status?numberHTTP status code generated by the origin server for this occurrence. Convenient way to make problem details self-contained.
title?stringShort, human-readable summary of the problem type. SHOULD NOT change from occurrence to occurrence of the problem.
typestringURI reference that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation. Defaults to "about:blank" for generic problems.

See

Example

// Parsing error responses from the API
const response = await fetch('/v1/llm/chat/completions', {
method: 'POST',
body: JSON.stringify({ model: 'gemini-2.5-flash-lite', messages: [] })
});

if (!response.ok) {
const error: ProblemDetails = await response.json();
console.error(error.detail); // "Invalid request: The 'messages' field must contain at least one message."
console.log(error.status); // 400
console.log(error.title); // "Bad Request"
}