Skip to main content
The input schema defines what data your endpoint accepts. When a request comes in, Endprompt validates it against your schema before processing—rejecting invalid requests with clear error messages.

Why Define Input Schema?

Automatic Validation

Invalid requests are rejected before hitting the LLM, saving costs

Clear Documentation

Your OpenAPI docs are auto-generated from your schema

Type Safety

Ensure prompts receive data in the expected format

Default Values

Provide sensible defaults for optional fields

Adding Input Fields

Navigate to your endpoint’s Input Schema tab and click Add Field.

Field Configuration

PropertyRequiredDescription
NameYesField identifier used in templates ({{ inputs.name }})
TypeYesData type (see types below)
RequiredNoWhether the field must be provided
DefaultNoValue to use if field is not provided
DescriptionNoHelp text shown in docs and test forms

Field Types

Text values of any length.
{
  "name": "query",
  "type": "string",
  "required": true,
  "description": "The search query"
}
Validation options:
  • minLength — Minimum character count
  • maxLength — Maximum character count
  • pattern — Regex pattern to match
  • enum — List of allowed values

Validation Rules

Add validation rules to ensure data quality:

String Validation

{
  "name": "email",
  "type": "string",
  "required": true,
  "minLength": 5,
  "maxLength": 254,
  "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
}

Enum (Allowed Values)

{
  "name": "tone",
  "type": "string",
  "required": true,
  "enum": ["formal", "casual", "friendly", "professional"]
}
Use enums when you have a fixed set of valid options. They generate dropdowns in the test form and are documented in OpenAPI.

Number Ranges

{
  "name": "confidence_threshold",
  "type": "number",
  "required": false,
  "default": 0.8,
  "minimum": 0,
  "maximum": 1
}

Array Limits

{
  "name": "categories",
  "type": "array",
  "items": { "type": "string" },
  "minItems": 1,
  "maxItems": 10
}

Using Inputs in Prompts

Once defined, access input fields in your prompts using Liquid syntax:
Summarize the following {{ inputs.content_type }} content:

{{ inputs.text }}

{% if inputs.include_keywords %}
Also extract the top {{ inputs.keyword_count | default: 5 }} keywords.
{% endif %}

Keep the summary under {{ inputs.max_words | default: 100 }} words.
Use the | default: filter to provide fallback values for optional fields.

JSON Schema Preview

The Input Schema tab shows a live JSON Schema preview:
{
  "type": "object",
  "required": ["text"],
  "properties": {
    "text": {
      "type": "string",
      "description": "The content to summarize",
      "minLength": 10,
      "maxLength": 50000
    },
    "max_words": {
      "type": "integer",
      "description": "Maximum words in summary",
      "default": 100,
      "minimum": 10,
      "maximum": 1000
    },
    "format": {
      "type": "string",
      "description": "Output format",
      "enum": ["paragraph", "bullets", "numbered"],
      "default": "paragraph"
    }
  }
}
This schema is used for:
  • Request validation
  • OpenAPI documentation
  • Test form generation

Best Practices

Field names should be clear and self-documenting.customer_feedback
cf
Descriptions appear in docs and help users understand what to provide.
Optional fields should have reasonable defaults so users don’t need to specify everything.
Use minLength, maxLength, and patterns to catch bad data before it reaches the LLM.
Avoid deeply nested objects. Flat schemas are easier to understand and template.

Example: Complete Input Schema

Here’s a full example for a content moderation endpoint:
FieldTypeRequiredDefaultDescription
contentstringYesThe content to moderate
content_typestringYesType: text, image_url, or html
categoriesarrayNoallCategories to check
thresholdnumberNo0.7Confidence threshold (0-1)
include_explanationbooleanNofalseInclude reasoning

Next Steps