{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "Limits": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attachments_per_turn": {
          "const": 4
        },
        "image_bytes": {
          "const": 8388608
        },
        "image_longest_side": {
          "const": 6000
        },
        "image_pixels": {
          "const": 36000000
        },
        "text_bytes": {
          "const": 65536
        },
        "upload_lifetime_seconds": {
          "const": 2592000
        },
        "upload_body_bytes": {
          "const": 11201196
        },
        "assembled_image_bytes": {
          "const": 33554432
        },
        "retained_uploads_per_learner": {
          "const": 32
        },
        "learner_storage_bytes": {
          "const": 67108864
        },
        "workspace_storage_bytes": {
          "const": 268435456
        },
        "uploads_per_learner_day": {
          "const": 100
        }
      },
      "required": [
        "attachments_per_turn",
        "image_bytes",
        "image_longest_side",
        "image_pixels",
        "text_bytes",
        "upload_lifetime_seconds",
        "upload_body_bytes",
        "assembled_image_bytes",
        "retained_uploads_per_learner",
        "learner_storage_bytes",
        "workspace_storage_bytes",
        "uploads_per_learner_day"
      ]
    },
    "Catalog": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.catalog.v1"
        },
        "interface_version": {
          "const": "2026-12-01"
        },
        "postures": {
          "type": "array",
          "items": {
            "enum": [
              "guided",
              "feedback",
              "explain"
            ]
          },
          "maxItems": 3,
          "minItems": 3,
          "uniqueItems": true
        },
        "requested_support": {
          "type": "array",
          "items": {
            "enum": [
              "auto",
              "hint",
              "framework",
              "example",
              "coaching"
            ]
          },
          "maxItems": 5,
          "minItems": 5,
          "uniqueItems": true
        },
        "media_types": {
          "type": "array",
          "items": {
            "enum": [
              "image/png",
              "image/jpeg",
              "image/webp",
              "text/plain",
              "text/markdown"
            ]
          },
          "maxItems": 5,
          "minItems": 5,
          "uniqueItems": true
        },
        "limits": {
          "$ref": "#/$defs/Limits"
        },
        "write_policy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "profile": {
              "type": "boolean"
            },
            "long_term": {
              "type": "boolean"
            }
          },
          "required": [
            "profile",
            "long_term"
          ]
        },
        "release_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "rate_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "content_release": {
          "type": "string",
          "maxLength": 100
        },
        "mode": {
          "enum": [
            "test",
            "live"
          ]
        },
        "price": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "amount_micro_usd": {
              "type": "integer",
              "minimum": 0
            },
            "currency": {
              "const": "USD"
            },
            "unit": {
              "const": "governed_turn"
            }
          },
          "required": [
            "amount_micro_usd",
            "currency",
            "unit"
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "interface_version",
        "postures",
        "requested_support",
        "media_types",
        "limits",
        "write_policy",
        "release_id",
        "rate_id",
        "content_release",
        "mode",
        "price"
      ]
    },
    "Task": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "enum": [
            "homework",
            "practice",
            "exam_prep",
            "open"
          ]
        },
        "subject": {
          "type": "string",
          "maxLength": 120
        },
        "assignment": {
          "type": "string",
          "maxLength": 2000
        }
      },
      "required": [
        "kind"
      ]
    },
    "LearnerPreferences": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "preferred_name": {
          "type": "string",
          "maxLength": 80
        },
        "grade_band": {
          "enum": [
            "primary",
            "middle",
            "9-10",
            "11-12",
            "higher_education",
            "adult",
            "unspecified"
          ]
        },
        "language": {
          "enum": [
            "en"
          ]
        },
        "reading_level": {
          "enum": [
            "on_grade",
            "simplified",
            "unspecified"
          ]
        },
        "support_needs": {
          "enum": [
            "none",
            "step_by_step",
            "plain_language",
            "unspecified"
          ]
        }
      },
      "required": []
    },
    "Setup": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "task": {
          "$ref": "#/$defs/Task"
        },
        "learner": {
          "anyOf": [
            {
              "$ref": "#/$defs/LearnerPreferences"
            },
            {
              "type": "null"
            }
          ]
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 80
            },
            {
              "type": "null"
            }
          ]
        },
        "team_dialog": {
          "type": "boolean"
        }
      },
      "required": [
        "task"
      ]
    },
    "CreateSession": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "setup": {
          "$ref": "#/$defs/Setup"
        }
      },
      "required": [
        "setup"
      ]
    },
    "Upload": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "media_type": {
          "enum": [
            "image/png",
            "image/jpeg",
            "image/webp",
            "text/plain",
            "text/markdown"
          ]
        },
        "data": {
          "type": "string",
          "minLength": 4,
          "maxLength": 11184812
        },
        "filename": {
          "type": "string",
          "maxLength": 160
        },
        "session_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "media_type",
        "data"
      ]
    },
    "Attachment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attachment_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "media_type": {
          "enum": [
            "image/png",
            "image/jpeg",
            "image/webp",
            "text/plain",
            "text/markdown"
          ]
        },
        "bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 8388608
        },
        "created_at": {
          "type": "string",
          "minLength": 20,
          "maxLength": 35
        },
        "expires_at": {
          "type": "string",
          "minLength": 20,
          "maxLength": 35
        },
        "status": {
          "enum": [
            "pending",
            "available",
            "linked",
            "rejected",
            "expired",
            "deleted"
          ]
        },
        "session_id": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "attachment_id",
        "media_type",
        "bytes",
        "created_at",
        "expires_at",
        "status",
        "session_id"
      ]
    },
    "Source": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "session_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "committed_at": {
          "type": "string",
          "minLength": 20,
          "maxLength": 35
        }
      },
      "required": [
        "session_id",
        "request_id",
        "committed_at"
      ]
    },
    "Signal": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "concept": {
          "type": "string",
          "maxLength": 160
        },
        "evidence": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 240
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      },
      "required": [
        "concept",
        "evidence",
        "source"
      ]
    },
    "State": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.state.v1"
        },
        "session_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "enum": [
            "available",
            "unavailable"
          ]
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/$defs/Source"
            },
            {
              "type": "null"
            }
          ]
        },
        "posture": {
          "anyOf": [
            {
              "enum": [
                "guided",
                "feedback",
                "explain"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "effective_support": {
          "anyOf": [
            {
              "enum": [
                "baseline",
                "hints",
                "frameworks",
                "parallel_examples",
                "coaching"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "progress": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 400
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_signals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Signal"
          },
          "maxItems": 32
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "session_id",
        "status",
        "source",
        "posture",
        "effective_support",
        "progress",
        "observed_signals"
      ]
    },
    "Summary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.summary.v1"
        },
        "session_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "enum": [
            "available",
            "unavailable"
          ]
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/$defs/Source"
            },
            {
              "type": "null"
            }
          ]
        },
        "text": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 32000
            },
            {
              "type": "null"
            }
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "session_id",
        "status",
        "source",
        "text"
      ]
    },
    "SupportObservation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "support": {
          "enum": [
            "baseline",
            "hints",
            "frameworks",
            "parallel_examples",
            "coaching"
          ]
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      },
      "required": [
        "support",
        "source"
      ]
    },
    "Profile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.profile.v1"
        },
        "user_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "seeded_preferences": {
          "anyOf": [
            {
              "$ref": "#/$defs/LearnerPreferences"
            },
            {
              "type": "null"
            }
          ]
        },
        "seed_source": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "session_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "created_at": {
                  "type": "string",
                  "minLength": 20,
                  "maxLength": 35
                }
              },
              "required": [
                "session_id",
                "created_at"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "observed_signals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Signal"
          },
          "maxItems": 32
        },
        "support_history": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SupportObservation"
          },
          "maxItems": 32
        },
        "last_observed_at": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 20,
              "maxLength": 35
            },
            {
              "type": "null"
            }
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "user_id",
        "seeded_preferences",
        "seed_source",
        "observed_signals",
        "support_history",
        "last_observed_at"
      ]
    },
    "Session": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.session.v1"
        },
        "session_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "setup": {
          "$ref": "#/$defs/Setup"
        },
        "status": {
          "enum": [
            "prepared",
            "active",
            "closed",
            "discarded"
          ]
        },
        "created_at": {
          "type": "string",
          "minLength": 20,
          "maxLength": 35
        },
        "content_release": {
          "type": "string",
          "maxLength": 100
        },
        "release_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "rate_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "limits": {
          "$ref": "#/$defs/Limits"
        },
        "state": {
          "$ref": "#/$defs/State"
        },
        "summary": {
          "$ref": "#/$defs/Summary"
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "session_id",
        "setup",
        "status",
        "created_at",
        "content_release",
        "release_id",
        "rate_id",
        "limits",
        "state",
        "summary"
      ]
    },
    "SessionList": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.sessions.v1"
        },
        "sessions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Session"
          },
          "maxItems": 100
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1024
            },
            {
              "type": "null"
            }
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "sessions",
        "next_cursor"
      ]
    },
    "Export": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "fl.quest.export.v1"
        },
        "sessions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Session"
          },
          "maxItems": 100
        },
        "profile": {
          "$ref": "#/$defs/Profile"
        },
        "attachments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Attachment"
          },
          "maxItems": 32
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1024
            },
            {
              "type": "null"
            }
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "schema",
        "sessions",
        "profile",
        "attachments",
        "next_cursor"
      ]
    },
    "AttachmentDelete": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attachment_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "enum": [
            "deleted"
          ]
        },
        "request_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "attachment_id",
        "status"
      ]
    }
  },
  "$id": "https://developers.foreverlearning.ai/schemas/quest-v1.json",
  "title": "Quest developer API"
}
