LAPIS (Lightweight API Specification for Intelligent Systems) is a compact, LLM-native API description format authored by Daniel Garcia (cr0hn). It is designed as the format you convert your OpenAPI specifications to when the consumer is a Large Language Model rather than a code generator or human reader. By replacing JSON/YAML structural overhead with a function-signature syntax, indentation-based sections, and centralized definitions for errors, webhooks, rate limits, and workflows, a typical LAPIS document carries the same semantic information as its OpenAPI source while consuming roughly 70-80 percent fewer tokens. LAPIS is not a runtime format and does not replace MCP, function calling, or OpenAPI itself - it is an intermediate representation optimized for AI agents that need to reason about an API inside a constrained context window.
URL: Visit APIs.json URL
Run: Capabilities Using Naftiko
- API, Specification, LLM, AI Agents, OpenAPI, Token Optimization, Standards
- Created: 2026-05-06
- Modified: 2026-05-06
The LAPIS specification defines a token-minimal, LLM-native format for describing HTTP APIs. A LAPIS document is organized into up to seven indentation-based sections - [meta], [types], [ops], [webhooks], [errors], [limits], and [flows] - each carrying a focused slice of the API contract. The format draws its syntax from function signatures rather than nested data structures, uses scalar types (str, int, float, bool, date, datetime, file, any) with array, map, optional, and default modifiers, and centralizes cross-cutting concerns like errors and rate limits so they are described once and applied globally. The current release is version 0.1.0 (status Draft) released 2026-02-16 under the Creative Commons Attribution 4.0 license, and the specification is published in both English and Spanish.
Human URL: https://github.com/cr0hn/LAPIS/blob/main/spec.en.md
- Specification, LLM, OpenAPI, Standards
- LAPIS Specification (English)
- LAPIS Specification (Spanish)
- Formal EBNF Grammar
- Changelog
- Walk-Through Example (English)
- Walk-Through Example (Spanish)
- Canonical Specification Repository
- Releases
- DigitalOcean Public API v2 (LAPIS)
- DigitalOcean Public API v2 (OpenAPI Source)
- LAPIS Online Converter
- Specification (English)
- Specification (Spanish)
- Getting Started
- LAPIS Repository
- Changelog
- License (CC BY 4.0)
- Code of Conduct
- Security Policy
- Contributing Guide
- lapis CLI (lapis-spec on PyPI)
- lapis-spec Python Package
- LAPIS Visual Studio Code Extension
- Browser-Based OpenAPI to LAPIS Converter
- Issue Tracker
| Name | Description |
|---|---|
| Function-Signature Syntax for APIs | LAPIS uses operation headers shaped like function signatures (operation_name METHOD /path), input parameters prefixed with > and outputs prefixed with <, so an LLM reads each endpoint as a callable rather than as a deeply nested JSON object. |
| Seven-Section Document Model | A LAPIS document is composed of up to seven sections in a fixed order - [meta], [types], [ops], [webhooks], [errors], [limits], and [flows] - with [meta] and [ops] required and the remainder optional based on what the API actually exposes. |
| Centralized Error Definitions | Errors are declared once in [errors] using HTTP code plus a snake_case identifier, optionally bound to specific operations via @ops:name1,name2, eliminating the per-operation duplication of 400/401/404/429 responses that bloats OpenAPI documents. |
| First-Class Webhook Triggers | The [webhooks] section captures both the payload shape and the trigger condition (lines prefixed with !) that fires the event, giving an LLM the why of an event rather than only the what that OpenAPI delivers. |
| Structured Rate Limits and Quotas | The [limits] section expresses rate limits, quotas, body size caps, batch size caps, and tiered plan blocks as first-class declarative fields with scope annotations like @key, @global, @ip, @user, and @op:operation_name. |
| Multi-Step Workflow Flows | The [flows] section describes how operations chain together using step1 -> step2 -> step3 notation, with branches (|), loops (*), waits (...(condition)), and inter-step data passing (op.field -> next_op(field)) so an agent learns canonical usage patterns alongside individual endpoints. |
| Field Versioning and Deprecation | Field-level @since:X.Y annotations let an LLM determine whether a given field exists at the API version declared in [meta], and @deprecated optionally followed by a quoted note marks fields and operations that should not be used by new integrations. |
| Operation Modifiers | Operations can carry +paginated, +deprecated, +idempotent, and +stream modifiers appended after the path, signaling pagination, retry safety, streaming response semantics, and deprecation status without verbose extension blocks. |
| Inline Object Types | Types used by only a single operation can be inlined directly in the parameter list using {field: type, field: type} or [{field: type}] notation, avoiding pollution of [types] with single-use schemas. |
| 70-80 Percent Token Reduction | For a representative mid-size API (11 operations, 8 types, 3 webhooks, 10 errors, limits, 4 flows), LAPIS measures roughly 1,500 tokens versus 6,500 for the equivalent OpenAPI YAML, a 0.23x ratio driven primarily by removing irrelevant metadata, repeated error definitions, and JSON/YAML key restatement. |
| Deterministic OpenAPI Conversion | Section 14 of the spec defines field-by-field rules for converting OpenAPI 3.x into LAPIS, covering info, servers, securitySchemes, components.schemas, paths, webhooks, x-rateLimit and x-quota extensions, and links, making the conversion fully automatable. |
| Formal EBNF Grammar | The specification ships a simplified EBNF grammar covering all seven sections, type expressions, modifiers, annotations, comments, and primitive lexical tokens, providing a normative reference for tool authors building parsers, linters, and highlighters. |
| Bilingual Specification | The LAPIS specification is published in parallel English (spec.en.md) and Spanish (spec.es.md) editions, with matching walk-through examples (spec-example.en.md and spec-example.es.md) that narrate a sample Invoice Service API in both languages. |
| Name | Description |
|---|---|
| Reducing LLM Context Cost | Engineering teams whose AI features pass an OpenAPI specification into prompts on every call convert the spec to LAPIS once and pass the smaller LAPIS document instead, reducing per-call token spend by roughly 70-80 percent on the API description portion of the context window. |
| Powering AI Coding Assistants | AI coding assistants that need to reason about a third-party API (generating client code, debugging a failing call, suggesting an endpoint) consume LAPIS as the API context layer, freeing more of the context window for the actual user prompt and conversation history. |
| Multi-Step API Agent Planning | AI agents executing multi-step API workflows (create customer, create invoice, send invoice, await payment webhook) load a LAPIS document with a populated [flows] section so the planner has canonical workflow templates rather than having to infer chaining from individual operation descriptions. |
| Webhook-Aware Integrations | Integration platforms that build webhook receivers use the [webhooks] section's trigger conditions (!) and headers (@header:X-Event-ID) to generate signature verification and event dispatch logic that knows when each event should fire and what identifying headers to expect. |
| Plan-Aware Rate Limit Enforcement | Client SDKs and gateway integrations consume the [limits] section to configure backoff, request-throttling, and quota tracking per plan tier (free, pro, enterprise) and per scope (@key, @user, @op:name) without reading provider documentation in prose. |
| Specification Linting and Validation | Tooling vendors and platform teams enforce LAPIS-conformant documents by validating against the EBNF grammar in spec section 16, catching missing required sections, invalid type expressions, and malformed annotations before the document is shipped to downstream consumers. |
| Cross-Provider API Comparison | Because LAPIS strips presentation overhead and centralizes errors, limits, and flows, two LAPIS documents from different providers can be diffed and compared more directly than two OpenAPI specifications. |
| Onboarding Documentation for Internal APIs | Platform teams generate LAPIS from internal OpenAPI sources to provide on-call engineers and product stakeholders a quickly readable, function-signature view of the company's services alongside the long-form OpenAPI documentation. |
| Name | Description |
|---|---|
| OpenAPI 3.0 and 3.1 | OpenAPI is the canonical source format for LAPIS. The lapis-spec Python tool ingests OpenAPI 3.0.x and 3.1.x in JSON or YAML, resolves $ref including circular references, flattens allOf/oneOf/anyOf, deduplicates inline versus named types, and emits a LAPIS document. |
| PyPI (lapis-spec) | The reference command-line converter is published to PyPI as lapis-spec and exposes a lapis console script. Installation is pip install lapis-spec or uv pip install lapis-spec, and the CLI accepts -i/--input, -o/--output, and --no-validate flags. |
| Visual Studio Code | The LAPIS Language extension (publisher lapis-spec, identifier lapis-lang) provides syntax highlighting for .lapis files, including section headers, scalar types, modifiers, IO markers, annotations, bracket matching, auto-closing pairs, and section folding. |
| Web Browser Converter | A static JavaScript single-page application at https://cr0hn.github.io/LAPIS/ runs the OpenAPI to LAPIS conversion entirely in the browser via converter.js, highlighter.js, and app.js, supporting drag-and-drop, paste, copy, and download of .lapis files. |
| MCP and Function Calling | LAPIS is positioned alongside (not as a replacement for) MCP and function calling. A LAPIS document is the context-layer description an LLM reads to understand an API; MCP servers and function-calling schemas remain the runtime invocation layer for actually executing operations. |
| Creative Commons Attribution 4.0 | The specification text is licensed under CC BY 4.0, allowing adaptation, distribution, and commercial use provided attribution is given. The reference tooling (lapis-spec Python package) is MIT licensed, and the VS Code extension is CC BY 4.0. |
| GitHub Pages | The browser-based converter is hosted on GitHub Pages from the cr0hn/LAPIS repository at https://cr0hn.github.io/LAPIS/, making it accessible without local installation or API keys. |
Machine-readable artifacts modeling the LAPIS specification.
- Invoice Service (Full Specification Example)
- Meta Section
- Types Section
- Operations Section
- Webhooks Section
- Errors Section
- Limits Section
- Flows Section
- LAPIS Vocabulary — Normative vocabulary of LAPIS v0.1.0 covering 7 sections, 8 scalar types, 4 operation modifiers, 10 annotations, 5 authentication types, 5 scopes, 4 rate-limit windows, 4 quota periods, 6 flow operators, and the full ecosystem of reference tooling (lapis-spec CLI, online converter, VS Code extension)
FN: Kin Lane
Email: kin@apievangelist.com