> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endprompt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How Endprompt Works

> Understand the core concepts behind Endprompt

Before diving deeper, let's understand the key concepts that make Endprompt work.

## Core Concepts

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/endprompt/images/architecture-diagram.png" alt="Endprompt Architecture" />
</Frame>

### Endpoints

An **Endpoint** is a stable API URL that your application calls. Think of it as the "contract" between your code and the LLM.

```
https://yourcompany.api.endprompt.ai/api/v1/summarize
                                    └──────────────┘
                                     Your endpoint path
```

Endpoints define:

* **Path** — The URL path (e.g., `/api/v1/summarize`)
* **Input Schema** — What data the endpoint accepts
* **Output Schema** — What data the endpoint returns
* **Default Prompt** — Which prompt to use when called

<Tip>
  Your integration code always calls the same endpoint URL. You can change prompts, models, and configurations without touching your application code.
</Tip>

### Prompts

A **Prompt** is the actual instruction sent to the LLM. Prompts are attached to endpoints and can be versioned independently.

```liquid theme={null}
You are a helpful assistant. Please summarize the following text:

{{ inputs.text }}

Return your response as JSON with a "summary" field.
```

Key features of prompts:

* **Liquid Templating** — Use `{{ inputs.fieldName }}` to inject request data
* **Model Selection** — Choose which LLM to use (GPT-4, Claude, etc.)
* **Settings** — Configure temperature, max tokens, and other parameters
* **Versioning** — Every save creates a new version you can rollback to

### Prompt Status Lifecycle

Prompts follow a status workflow:

```mermaid theme={null}
graph LR
    A[Draft] --> B[Live]
    B --> C[Archived]
    B --> A
```

| Status       | Description                                              |
| ------------ | -------------------------------------------------------- |
| **Draft**    | Work in progress. Can be tested but not used as default. |
| **Live**     | Production-ready. Can be set as endpoint default.        |
| **Archived** | Deprecated. Hidden from lists but preserved for history. |

### Input & Output Schemas

Schemas define the structure of data flowing in and out of your endpoint.

**Input Schema Example:**

```json theme={null}
{
  "text": {
    "type": "string",
    "required": true,
    "description": "The text to summarize"
  },
  "max_length": {
    "type": "integer",
    "required": false,
    "default": 100
  }
}
```

**Output Schema Example:**

```json theme={null}
{
  "summary": {
    "type": "string",
    "description": "The summarized text"
  },
  "word_count": {
    "type": "integer",
    "description": "Number of words in summary"
  }
}
```

<Note>
  Input validation happens automatically. If a request doesn't match your schema, it's rejected with a clear error message before reaching the LLM.
</Note>

## Request Flow

Here's what happens when you call an Endprompt endpoint:

<Steps>
  <Step title="Request Received">
    Your application sends a POST request with JSON data to your endpoint URL.
  </Step>

  <Step title="Authentication">
    Endprompt validates your API key from the `x-api-key` header.
  </Step>

  <Step title="Input Validation">
    The request body is validated against the endpoint's input schema.
  </Step>

  <Step title="Prompt Resolution">
    The default prompt (or specified prompt) is loaded.
  </Step>

  <Step title="Template Rendering">
    Liquid template is rendered with your input data, creating the final prompt text.
  </Step>

  <Step title="LLM Execution">
    The rendered prompt is sent to the configured LLM (OpenAI, Anthropic, etc.).
  </Step>

  <Step title="Response Parsing">
    The LLM response is parsed and validated against the output schema.
  </Step>

  <Step title="Logging">
    The entire execution is logged for observability.
  </Step>

  <Step title="Response Returned">
    The validated JSON response is returned to your application.
  </Step>
</Steps>

## Multi-Tenancy

Each Endprompt account is a **tenant** with its own:

* Subdomain (e.g., `yourcompany.api.endprompt.ai`)
* Endpoints, prompts, and configurations
* API keys
* Team members
* Usage quotas

<Info>
  All your data is completely isolated from other tenants. Your prompts, logs, and API keys are never visible to others.
</Info>

## What Makes This Different?

<CardGroup cols={2}>
  <Card title="Stable Contracts" icon="handshake">
    Your application code calls the same URL forever. Iterate on prompts without deployments.
  </Card>

  <Card title="Type Safety" icon="shield-check">
    Schema validation catches errors before they reach the LLM—and before they reach your users.
  </Card>

  <Card title="Version Control" icon="code-branch">
    Every prompt change is versioned. Test new versions, rollback bad ones, compare performance.
  </Card>

  <Card title="Observability" icon="magnifying-glass">
    See every request, response, latency, and cost. Replay requests to debug issues.
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Dashboard Overview" icon="gauge" href="/getting-started/dashboard">
    Learn to navigate the Endprompt dashboard
  </Card>

  <Card title="Create an Endpoint" icon="plug" href="/endpoints/create-endpoint">
    Build your first production endpoint
  </Card>
</CardGroup>
