Convert Figma logo to code with AI

apiaryio logoapi-blueprint

API Blueprint

8,642
2,138
8,642
66

Top Related Projects

The OpenAPI Specification Repository

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

RAML Specification

4,104

The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.

Quick Overview

API Blueprint is a powerful high-level API description language for web APIs. It allows you to design, prototype, document, and test APIs using a simple and expressive Markdown-like syntax. API Blueprint is designed to be human-readable and machine-processable, making it an excellent tool for both developers and non-technical stakeholders.

Pros

  • Easy to learn and use due to its Markdown-like syntax
  • Supports a wide range of tools and integrations for API design, documentation, and testing
  • Enables clear communication between API providers and consumers
  • Facilitates rapid prototyping and iterative API development

Cons

  • Limited support for complex API structures compared to some other specifications
  • May require additional tooling for full functionality
  • Less widespread adoption compared to alternatives like OpenAPI (Swagger)
  • Some users report occasional inconsistencies in parsing and interpretation

Code Examples

# GET /message
+ Response 200 (text/plain)

        Hello World!

This example defines a simple GET endpoint that returns "Hello World!" as plain text.

# Group Notes
## Note [/notes/{id}]
+ Parameters
    + id: 1 (number, required) - Unique identifier for a note

### Retrieve a Note [GET]
+ Response 200 (application/json)
    + Attributes
        + id: 1 (number, required)
        + title: My Note (string, required)
        + content: This is the content of my note. (string, required)

This example defines a group of endpoints related to Notes, including a GET endpoint to retrieve a specific note by ID.

# Data Structures
## User (object)
+ id: 1 (number, required)
+ username: johndoe (string, required)
+ email: john@example.com (string, required)
+ created_at: `2023-04-15T12:00:00Z` (string, required)

This example defines a reusable data structure for a User object.

Getting Started

  1. Install Drafter, the reference implementation parser:

    npm install -g drafter
    
  2. Create a new API Blueprint file (e.g., api.apib) and add your API description:

    # My API
    ## GET /hello
    + Response 200 (text/plain)
            Hello, API Blueprint!
    
  3. Parse the API Blueprint file:

    drafter api.apib
    

This will output the parsed API description in JSON format, which can be used with various tools for documentation, testing, and more.

Competitor Comparisons

The OpenAPI Specification Repository

Pros of OpenAPI-Specification

  • More widely adopted and supported by a larger ecosystem of tools
  • Offers more detailed and structured specification for complex APIs
  • Better support for machine-readable formats (JSON, YAML)

Cons of OpenAPI-Specification

  • Steeper learning curve due to more complex structure
  • Can be more verbose, especially for simpler APIs
  • Less human-readable in its raw form compared to API Blueprint

Code Comparison

API Blueprint:

# GET /users/{id}
+ Response 200 (application/json)
    {
        "id": 1,
        "name": "John Doe"
    }

OpenAPI-Specification:

paths:
  /users/{id}:
    get:
      responses:
        '200':
          content:
            application/json:    
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string

Key Differences

  • API Blueprint uses a Markdown-like syntax, making it more human-readable
  • OpenAPI-Specification provides more detailed schema definitions
  • API Blueprint is more concise for simple APIs, while OpenAPI-Specification offers more flexibility for complex APIs
  • OpenAPI-Specification has better tooling support and integration with popular API development platforms

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

Pros of swagger-core

  • More widely adopted and supported in the industry
  • Extensive tooling ecosystem for code generation and documentation
  • Better integration with Java-based projects

Cons of swagger-core

  • Steeper learning curve for beginners
  • More verbose syntax compared to API Blueprint
  • Less human-readable format

Code Comparison

API Blueprint:

# GET /users/{id}
+ Response 200 (application/json)
    {
        "id": 1,
        "name": "John Doe"
    }

Swagger-core:

/users/{id}:
  get:
    responses:
      '200':
        description: Successful response
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                name:
                  type: string

Key Differences

  • API Blueprint uses Markdown-like syntax, making it more readable for non-technical users
  • Swagger-core uses YAML or JSON, which is more machine-friendly but less human-readable
  • API Blueprint focuses on simplicity and readability, while Swagger-core offers more detailed specifications
  • Swagger-core provides better support for complex API structures and validation

Use Cases

  • API Blueprint: Ideal for rapid prototyping and documentation-first approach
  • Swagger-core: Better suited for large-scale, complex API projects with extensive tooling requirements

RAML Specification

Pros of RAML-spec

  • More extensive tooling ecosystem, including code generators and validators
  • Supports inheritance and reusability through traits and resource types
  • Better suited for large, complex API designs with many endpoints

Cons of RAML-spec

  • Steeper learning curve due to more complex syntax and features
  • Less human-readable compared to API Blueprint's Markdown-based format
  • Requires more verbose documentation for simple APIs

Code Comparison

RAML-spec:

#%RAML 1.0
title: Example API
/users:
  get:
    responses:
      200:
        body:
          application/json:
            type: User[]

API Blueprint:

# GET /users

+ Response 200 (application/json)
    + Attributes (array[User])

Both RAML-spec and API Blueprint are popular API description formats, each with its own strengths. RAML-spec offers more advanced features and is better suited for complex APIs, while API Blueprint provides a simpler, more human-readable format. The choice between the two depends on the specific needs of the project, team expertise, and the complexity of the API being designed.

4,104

The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.

Pros of AsyncAPI Spec

  • Specifically designed for event-driven and asynchronous APIs
  • Supports multiple protocols (e.g., AMQP, MQTT, Kafka)
  • Active community and ongoing development

Cons of AsyncAPI Spec

  • Less mature compared to API Blueprint
  • Fewer tools and integrations available
  • Steeper learning curve for developers new to async APIs

Code Comparison

API Blueprint:

# GET /users
+ Response 200 (application/json)
    [
        {
            "id": 1,
            "name": "John Doe"
        }
    ]

AsyncAPI Spec:

channels:
  user/signedup:
    subscribe:
      message:
        payload:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string

The API Blueprint example shows a simple REST API endpoint, while the AsyncAPI Spec example demonstrates an event-driven approach for user sign-ups. AsyncAPI Spec focuses on describing message payloads and channels, making it more suitable for asynchronous communication patterns.

Both specifications aim to improve API documentation and design, but they cater to different API paradigms. API Blueprint is well-established for REST APIs, while AsyncAPI Spec addresses the growing need for standardizing event-driven architectures.

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.

Pros of Spectral

  • More flexible and customizable linting rules
  • Supports multiple API description formats (OpenAPI, AsyncAPI, JSON Schema)
  • Active development and community support

Cons of Spectral

  • Steeper learning curve for custom rulesets
  • Primarily focused on linting, less emphasis on documentation generation

Code Comparison

API Blueprint:

# GET /users/{id}
+ Parameters
    + id: 1 (number, required) - User ID
+ Response 200 (application/json)
    + Attributes
        + name: John Doe (string)
        + email: john@example.com (string)

Spectral (OpenAPI):

/users/{id}:
  get:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    responses:
      '200':
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                email:
                  type: string

Summary

Spectral offers more flexibility and supports multiple API description formats, making it suitable for diverse projects. However, it has a steeper learning curve for custom rulesets. API Blueprint, on the other hand, provides a simpler syntax for API documentation but is more limited in scope. The choice between the two depends on project requirements and team expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

logo

API Blueprint

API Design for Humans

A powerful high-level API design language for web APIs.

API Blueprint is simple and accessible to everybody involved in the API design lifecycle. Its syntax is concise yet expressive.

With API Blueprint you can quickly prototype and model APIs to be created or describe already deployed mission-critical APIs. From a car to the largest Content Distribution Network (CDN) in the world.

The API Blueprint is built to encourage dialogue and collaboration between project stakeholders, developers and customers at any point in the API lifecycle. At the same time, the API Blueprint tools provide the support to achieve the goals be it API development, governance or delivery.

API Blueprint Lifecycle

Open Source

API Blueprint is completely open sourced under the MIT license. Any contribution is highly appreciated.

At home on GitHub

API Blueprint language is recognized by GitHub. You can search for API Blueprint or use the apib language identifier for syntax highlighting.

Getting started

All it takes to describe an endpoint of your API is to write:

# GET /message
+ Response 200 (text/plain)

        Hello World!

in your favorite plain text editor.

With this blueprint you can already get a mock, documentation and test for your API before you even start coding.

To learn more about the API Blueprint syntax jump directly to the API Blueprint Tutorial or take a look at some examples.

Media Type

The media type for API Blueprint is text/vnd.apiblueprint.

Learn more

Future

The plans for API Blueprint are completely tracked on GitHub – see the API Blueprint Roadmap.

Developers

Building tools for API Blueprint is possible thanks to its machine-friendly face provided by API Blueprint parser.

If you are interested in building tools for API Blueprint check out the Developing tools for API Blueprint.

Contribute

Feel free report problems or propose new ideas using the API Blueprint GitHub issues.

We use an RFC process for proposing any substantial changes to the API Blueprint language, specification and/or parsers.

If you would like to propose a change, please consult our RFC process.

Get in Touch

License

MIT License. See the LICENSE file.