> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Ask for a judgment (hosted DecisionProvider)

POST https://api.runtype.com/v1/runtime/judgments
Content-Type: application/json

The runtime-family judgment contract consumed by `@runtypelabs/runtime`’s HostedDecisionProvider, so a self-hosted runtime on platform or hybrid keys judges through Runtype with a Self-hosted Runtime key (`RUNTIME:EXECUTE`). Answers like `builtin:decision_judge`: with `questionSetId` the published question set supplies the questions (configured mode, and `questions` is refused); without it the call supplies `questions` (ad hoc mode). Billed and recorded like a decision tool call. Requires an Enterprise plan: ineligible accounts receive 403 (code `BYOC_PLAN_REQUIRED`).

Reference: https://docs.runtype.com/api-reference/runtype-api/decision-models/ask-for-a-judgment-hosted-decision-provider

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Body (application/json)

This endpoint expects a RuntimeJudgmentRequest.

- `state` (RuntimeJudgmentRequestState, required) — The text, JSON object or JSON array to judge. Never echoed in errors or logs.
- `executionId` (string, optional) — The self-hosted execution asking, recorded on the judgment telemetry.
- `model` (string, optional) — Decision model id. In configured mode it outranks the question set version model.
- `questionSetId` (string, optional) — A question set owned by the caller; its published version supplies the questions.
- `questions` (map from string to any, optional) — Ad hoc questions keyed by question id, each `{ type: "boolean" | "choice" | "score", instructions, criteria }`. Refused with `JUDGMENT_CONFIGURED_QUESTIONS_REJECTED` when `questionSetId` is set.
- `version` (integer, optional) — Published question set version to use; omit for the current version. Without `questionSetId` the call is refused with 400 `JUDGMENT_VERSION_WITHOUT_QUESTION_SET`.

## Response

### 200

The answers and the judgment metadata

- `answers` (map from string to any, required) — One answer per question id, exactly as the decision model returned it.
- `judgment` (RuntimeJudgmentMetadata, required)

## Errors

### 400 Bad Request Error

Invalid state, questions or configuration (see `code`)

- `error` (string, required)
- `details` (map from string to any, optional)
- `code` (string, optional) — Stable code for a caller-fixable failure, e.g. JUDGMENT_QUESTIONS_INVALID, JUDGMENT_CONFIGURED_QUESTIONS_REJECTED or QUESTION_SET_UNRESOLVED.

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 402 Payment Required Error

Monthly spend limit exceeded

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 403 Forbidden Error

Not an API key, the key lacks an execute permission, or the account is not on an Enterprise plan (code `BYOC_PLAN_REQUIRED`)

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 404 Not Found Error

The question set is missing, unpublished or not owned by the caller (code `QUESTION_SET_UNRESOLVED`)

- `error` (string, required)
- `details` (map from string to any, optional)
- `code` (string, optional) — Stable code for a caller-fixable failure, e.g. JUDGMENT_QUESTIONS_INVALID, JUDGMENT_CONFIGURED_QUESTIONS_REJECTED or QUESTION_SET_UNRESOLVED.

### 422 Unprocessable Entity Error

The decision model is not served or no credential can pay for it (see `code`)

- `error` (string, required)
- `details` (map from string to any, optional)
- `code` (string, optional) — Stable code for a caller-fixable failure, e.g. JUDGMENT_QUESTIONS_INVALID, JUDGMENT_CONFIGURED_QUESTIONS_REJECTED or QUESTION_SET_UNRESOLVED.

### 429 Too Many Requests Error

Daily execution limit or rate limit exceeded

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 500 Internal Server Error

Judgment failed

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

## Types

### RuntimeJudgmentRequestState

The text, JSON object or JSON array to judge. Never echoed in errors or logs.

### RuntimeJudgmentMetadata

- `calibrationId` (string, required, nullable)
- `keySource` (enum, required)
  - Allowed values: `user`, `platform`
- `provider` (string, required)
- `requestedModel` (string, required)
- `resolvedModelId` (string, required, nullable)
- `route` (string, required)
- `usage` (RuntimeJudgmentMetadataUsage, required)
- `estimatedCostUsd` (double, optional) — Provider rates, before margin.
- `questionSetId` (string, optional)
- `questionSetVersion` (integer, optional)

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### RuntimeJudgmentMetadataUsage

- `inputTokens` (double, required)
- `outputTokens` (double, required)
- `reported` (boolean, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "answers": {},
  "judgment": {
    "calibrationId": "calib-9f8e7d6c5b4a3",
    "keySource": "user",
    "provider": "openai",
    "requestedModel": "decision-model-v2",
    "resolvedModelId": "decision-model-v2.1",
    "route": "standard",
    "usage": {
      "inputTokens": 125,
      "outputTokens": 30,
      "reported": true
    },
    "estimatedCostUsd": 0.023,
    "questionSetId": "qs-12345abcde",
    "questionSetVersion": 3
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/runtime/judgments"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/runtime/judgments';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/runtime/judgments"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/runtime/judgments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/runtime/judgments")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/runtime/judgments', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/runtime/judgments");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/runtime/judgments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```