Skip to content

REST API Route Reference

[!NOTE] Automated Documentation This document is automatically generated from the FastAPI route definitions via pipe.api.openapi. Any route, parameter, or docstring changes in src/pipe/api/routes.py are immediately reflected here.

API Version: 0.1.0 | OpenAPI Version: 3.1.0
Raw Schemas: openapi.json · openapi.yaml · Interactive Docs: /docs · /redoc


Endpoints Overview

Method Path Summary Tags
GET /echo Echo ops
GET /echo/stream Echo Stream ops
POST /legal/detect Legal Detect legal
GET /legal/ops Legal Ops legal
POST /llm Llm llm
POST /stt Stt llm

POST /legal/detect — Legal Detect

Run one atomic legal op over text for a given jurisdiction.

op is one of the names from GET /legal/ops; jurisdiction is a hierarchical code like us, us/ny, in/mh (optionally with facets appended later). Returns the detections found.

Parameters

Name In Type Required Default Description
text query string ✓ —
jurisdiction query string — us
op query string — detect_pii

Responses

Status Code Description Schema / Returns
200 Successful Response object
422 Validation Error HTTPValidationError

Example Request

curl -X POST "http://localhost:8787/legal/detect" \
  -H "Content-Type: application/json"
import httpx

response = httpx.post("http://localhost:8787/legal/detect")
print(response.json())

List the available atomic legal operations and rule categories.

Responses

Status Code Description Schema / Returns
200 Successful Response object

Example Request

curl -X GET "http://localhost:8787/legal/ops"
import httpx

response = httpx.get("http://localhost:8787/legal/ops")
print(response.json())

LLM & Speech-to-Text (llm)

POST /llm — Llm

Test route: send a prompt to OpenRouter and return the completion.

Reads the key from $OPENROUTER_API_KEY (injected in the deployment). Returns a 4xx-shaped JSON error rather than a 500 when the LLM stack or key is unavailable, so it’s safe to probe.

Parameters

Name In Type Required Default Description
prompt query string ✓ —
model query string — openai/gpt-4o-mini
max_tokens query integer — 256

Responses

Status Code Description Schema / Returns
200 Successful Response object
422 Validation Error HTTPValidationError

Example Request

curl -X POST "http://localhost:8787/llm" \
  -H "Content-Type: application/json"
import httpx

response = httpx.post("http://localhost:8787/llm")
print(response.json())

POST /stt — Stt

Transcribe an uploaded audio file to text (audio bytes in, text out).

Accepts a multipart file upload; the audio format is inferred from the filename extension (falls back to wav). Reads the key from $OPENROUTER_API_KEY. Errors map like /llm (503 missing key, 502 upstream).

Parameters

Name In Type Required Default Description
model query string — openai/whisper-large-v3
language query string | null — —

Request Body

  • Content-Type: multipart/form-data

Responses

Status Code Description Schema / Returns
200 Successful Response object
422 Validation Error HTTPValidationError

Example Request

curl -X POST "http://localhost:8787/stt" \
  -F "file=@audio.wav"
import httpx

with open("audio.wav", "rb") as f:
    response = httpx.post("http://localhost:8787/stt", files={"file": f})
print(response.json())

Core Operations (ops)

GET /echo — Echo

Echo atomic op: returns the input unchanged (data in, data out).

Parameters

Name In Type Required Default Description
data query string — ``

Responses

Status Code Description Schema / Returns
200 Successful Response object
422 Validation Error HTTPValidationError

Example Request

curl -X GET "http://localhost:8787/echo"
import httpx

response = httpx.get("http://localhost:8787/echo")
print(response.json())

GET /echo/stream — Echo Stream

Streaming echo: sends the input back incrementally as a data stream.

Parameters

Name In Type Required Default Description
data query string — ``
chunk_size query integer — 16

Responses

Status Code Description Schema / Returns
200 Successful Response any
422 Validation Error HTTPValidationError

Example Request

curl -X GET "http://localhost:8787/echo/stream?chunk_size=16"
import httpx

response = httpx.get("http://localhost:8787/echo/stream")
print(response.json())