LAPIS logo

LAPIS

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.

1 APIs 13 Features
APISpecificationLLMAI AgentsOpenAPIToken OptimizationStandards

APIs

LAPIS Specification

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], ...

Features

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.

Use Cases

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.

Integrations

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.

Semantic Vocabularies

Lapis Context

22 classes · 62 properties

JSON-LD

Resources

🌐
LAPIS Online Converter
Portal
🔗
Specification (English)
Documentation
🔗
Specification (Spanish)
Documentation
🚀
Getting Started
GettingStarted
👥
LAPIS Repository
GitHubRepository
📄
Changelog
ChangeLog
📜
License (CC BY 4.0)
TermsOfService
🔗
Code of Conduct
Compliance
🔗
Security Policy
Security
🔗
Contributing Guide
Contact
🔗
lapis CLI (lapis-spec on PyPI)
CLI
📦
lapis-spec Python Package
SDK
💬
LAPIS Visual Studio Code Extension
IDESupport
🔗
Browser-Based OpenAPI to LAPIS Converter
Sandbox
🔗
Issue Tracker
Issues
🔗
LAPIS Normative Vocabulary
Vocabulary
🔗
LAPIS Document JSON Schema
JSONSchema
🔗
LAPIS Document JSON Structure
JSONStructure
🔗
LAPIS JSON-LD Context
JSONLD
💻
Invoice Service LAPIS Example
Examples
💻
Meta Section Example
Examples
💻
Types Section Example
Examples
💻
Operations Section Example
Examples
💻
Webhooks Section Example
Examples
💻
Errors Section Example
Examples
💻
Limits Section Example
Examples
💻
Flows Section Example
Examples

Sources

apis.yml Raw ↑
aid: lapis
name: LAPIS
description: >-
  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.
type: Index
image: https://kinlane-productions.s3.amazonaws.com/apis-json/apis-json-logo.jpg
tags:
  - API
  - Specification
  - LLM
  - AI Agents
  - OpenAPI
  - Token Optimization
  - Standards
url: https://raw.githubusercontent.com/api-evangelist/lapis/refs/heads/main/apis.yml
created: '2026-05-06'
modified: '2026-05-06'
specificationVersion: '0.19'
apis:
  - aid: lapis:lapis-spec
    name: LAPIS Specification
    description: >-
      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.
    humanURL: https://github.com/cr0hn/LAPIS/blob/main/spec.en.md
    tags:
      - Specification
      - LLM
      - OpenAPI
      - Standards
    properties:
      - type: Documentation
        url: https://github.com/cr0hn/LAPIS/blob/main/spec.en.md
        title: LAPIS Specification (English)
      - type: Documentation
        url: https://github.com/cr0hn/LAPIS/blob/main/spec.es.md
        title: LAPIS Specification (Spanish)
      - type: APIReference
        url: https://github.com/cr0hn/LAPIS/blob/main/spec.en.md#16-formal-grammar-simplified-ebnf
        title: Formal EBNF Grammar
      - type: ChangeLog
        url: https://github.com/cr0hn/LAPIS/blob/main/CHANGELOG.md
        title: Changelog
      - type: GettingStarted
        url: https://github.com/cr0hn/LAPIS/blob/main/spec-example.en.md
        title: Walk-Through Example (English)
      - type: GettingStarted
        url: https://github.com/cr0hn/LAPIS/blob/main/spec-example.es.md
        title: Walk-Through Example (Spanish)
      - type: GitHubRepository
        url: https://github.com/cr0hn/LAPIS
        title: Canonical Specification Repository
      - type: Versioning
        url: https://github.com/cr0hn/LAPIS/releases
        title: Releases
      - type: Examples
        url: https://github.com/cr0hn/LAPIS/blob/main/examples/DigitalOcean-public.v2.lapis
        title: DigitalOcean Public API v2 (LAPIS)
      - type: Examples
        url: https://github.com/cr0hn/LAPIS/blob/main/examples/DigitalOcean-public.v2.yaml
        title: DigitalOcean Public API v2 (OpenAPI Source)
common:
  - type: Portal
    url: https://cr0hn.github.io/LAPIS/
    title: LAPIS Online Converter
  - type: Documentation
    url: https://github.com/cr0hn/LAPIS/blob/main/spec.en.md
    title: Specification (English)
  - type: Documentation
    url: https://github.com/cr0hn/LAPIS/blob/main/spec.es.md
    title: Specification (Spanish)
  - type: GettingStarted
    url: https://github.com/cr0hn/LAPIS#getting-started
    title: Getting Started
  - type: GitHubRepository
    url: https://github.com/cr0hn/LAPIS
    title: LAPIS Repository
  - type: ChangeLog
    url: https://github.com/cr0hn/LAPIS/blob/main/CHANGELOG.md
    title: Changelog
  - type: TermsOfService
    url: https://github.com/cr0hn/LAPIS/blob/main/LICENSE
    title: License (CC BY 4.0)
  - type: Compliance
    url: https://github.com/cr0hn/LAPIS/blob/main/CODE_OF_CONDUCT.md
    title: Code of Conduct
  - type: Security
    url: https://github.com/cr0hn/LAPIS/blob/main/SECURITY.md
    title: Security Policy
  - type: Contact
    url: https://github.com/cr0hn/LAPIS/blob/main/CONTRIBUTING.md
    title: Contributing Guide
  - type: CLI
    url: https://pypi.org/project/lapis-spec/
    title: lapis CLI (lapis-spec on PyPI)
  - type: SDK
    url: https://pypi.org/project/lapis-spec/
    title: lapis-spec Python Package
  - type: IDESupport
    url: https://github.com/cr0hn/LAPIS/tree/main/tools/ides/vscode
    title: LAPIS Visual Studio Code Extension
  - type: Sandbox
    url: https://cr0hn.github.io/LAPIS/
    title: Browser-Based OpenAPI to LAPIS Converter
  - type: Issues
    url: https://github.com/cr0hn/LAPIS/issues
    title: Issue Tracker
  - type: Vocabulary
    url: vocabulary/lapis-vocabulary.yml
    title: LAPIS Normative Vocabulary
  - type: JSONSchema
    url: json-schema/lapis-document-schema.json
    title: LAPIS Document JSON Schema
  - type: JSONStructure
    url: json-structure/lapis-document-structure.json
    title: LAPIS Document JSON Structure
  - type: JSONLD
    url: json-ld/lapis-context.jsonld
    title: LAPIS JSON-LD Context
  - type: Examples
    url: examples/lapis-invoice-service-example.lapis
    title: Invoice Service LAPIS Example
  - type: Examples
    url: examples/lapis-meta-section-example.lapis
    title: Meta Section Example
  - type: Examples
    url: examples/lapis-types-section-example.lapis
    title: Types Section Example
  - type: Examples
    url: examples/lapis-ops-section-example.lapis
    title: Operations Section Example
  - type: Examples
    url: examples/lapis-webhooks-section-example.lapis
    title: Webhooks Section Example
  - type: Examples
    url: examples/lapis-errors-section-example.lapis
    title: Errors Section Example
  - type: Examples
    url: examples/lapis-limits-section-example.lapis
    title: Limits Section Example
  - type: Examples
    url: examples/lapis-flows-section-example.lapis
    title: Flows Section Example
  - type: Features
    data:
      - name: Function-Signature Syntax for APIs
        description: >-
          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.
      - name: Seven-Section Document Model
        description: >-
          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.
      - name: Centralized Error Definitions
        description: >-
          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.
      - name: First-Class Webhook Triggers
        description: >-
          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.
      - name: Structured Rate Limits and Quotas
        description: >-
          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.
      - name: Multi-Step Workflow Flows
        description: >-
          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.
      - name: Field Versioning and Deprecation
        description: >-
          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.
      - name: Operation Modifiers
        description: >-
          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.
      - name: Inline Object Types
        description: >-
          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.
      - name: 70-80 Percent Token Reduction
        description: >-
          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.
      - name: Deterministic OpenAPI Conversion
        description: >-
          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.
      - name: Formal EBNF Grammar
        description: >-
          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.
      - name: Bilingual Specification
        description: >-
          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.
  - type: UseCases
    data:
      - name: Reducing LLM Context Cost
        description: >-
          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.
      - name: Powering AI Coding Assistants
        description: >-
          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.
      - name: Multi-Step API Agent Planning
        description: >-
          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.
      - name: Webhook-Aware Integrations
        description: >-
          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.
      - name: Plan-Aware Rate Limit Enforcement
        description: >-
          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.
      - name: Specification Linting and Validation
        description: >-
          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.
      - name: Cross-Provider API Comparison
        description: >-
          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.
      - name: Onboarding Documentation for Internal APIs
        description: >-
          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.
  - type: Integrations
    data:
      - name: OpenAPI 3.0 and 3.1
        description: >-
          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.
      - name: PyPI (lapis-spec)
        description: >-
          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.
      - name: Visual Studio Code
        description: >-
          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.
      - name: Web Browser Converter
        description: >-
          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.
      - name: MCP and Function Calling
        description: >-
          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.
      - name: Creative Commons Attribution 4.0
        description: >-
          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.
      - name: GitHub Pages
        description: >-
          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.
maintainers:
  - FN: Kin Lane
    email: [email protected]