Skip to content

What is AsyncAPI? A minimal 3.0 document, linted and rendered

Last checked and updated

AsyncAPI is a specification for describing message-driven APIs in a YAML or JSON file. Where an OpenAPI document lists the requests a server answers, an AsyncAPI document lists the channels an application uses, the messages that travel on them, and the operations the application performs: it sends to a channel or receives from one. The current major version is 3 (3.0.0, and 3.1.0 since January 2026); 2.x documents can still be linted and rendered, and the migration page shows the changes.

Events, not requests

The two specifications say what they describe in their first lines. OpenAPI 3.1.1: "a standard, programming language-agnostic interface description for HTTP APIs". AsyncAPI 3.0.0: "a project used to describe message-driven APIs in a machine-readable format. It's protocol-agnostic, so you can use it for APIs that work over any protocol (e.g., AMQP, MQTT, WebSockets, Kafka, STOMP, HTTP, Mercure, etc)."

OpenAPIAsyncAPI 3.0
DescribesHTTP requests and their responsesMessages sent to and received from channels
Main unitA path and a method: GET /orders/{id}A channel (orders.created) and an operation on it
Who actsA client calls; the server answersThe application sends (action: send) or receives (action: receive)
Where it runsAn HTTP serverA broker or any server: AMQP, MQTT, Kafka, WebSocket...
Payload schemasSchema ObjectSchema Object, or another format (Avro, ...) through a Multi Format Schema Object

An AsyncAPI document describes one application from its own side. The specification is explicit that the other side is not the mirror image: "It's NOT RECOMMENDED to derive a receiver AsyncAPI document from a sender one or vice versa."

A minimal AsyncAPI 3.0 document

An order service that sends one event:

asyncapi: 3.0.0
info:
  title: Orders events
  version: 1.0.0
channels:
  orderCreated:
    address: orders.created
    messages:
      orderCreated:
        payload:
          type: object
          properties:
            orderId:
              type: string
            total:
              type: number
operations:
  publishOrderCreated:
    action: send
    channel:
      $ref: '#/channels/orderCreated'

Three parts do the work. channels.orderCreated is the channel: its key is an identifier inside the document, and address is the name on the broker. messages lists what may travel on it, here one message with a JSON payload. operations.publishOrderCreated says that this application sends to that channel; channel must be a $ref to it. The only required fields in the root object are asyncapi and info, and info needs title and version. Channels, operations and messages builds the structure up part by part.

What a linter says about it

The document is valid, so a linter reports no errors, only advice:

$ apigit lint asyncapi.yaml
asyncapi.yaml
  1:1    warn   asyncapi-servers                  AsyncAPI object must have non-empty "servers" object.
  1:11   info   asyncapi-latest-version           The latest version is not used. You should update to the "3.1.0" version.  (asyncapi)
  2:6    warn   asyncapi-3-tags                   AsyncAPI document must have non-empty "tags" array.  (info)
  2:6    warn   asyncapi-info-contact             Info object must have "contact" object.  (info)
  2:6    warn   asyncapi-info-description         Info "description" must be present and non-empty string.  (info)
  2:6    warn   asyncapi-info-license             Info object must have "license" object.  (info)
  18:23  warn   asyncapi-3-operation-description  Operation "description" must be present and non-empty string.  (operations.publishOrderCreated)

7 problems (0 errors, 6 warnings, 1 info, 0 hints)

The exit code is 0: by default only errors fail the run. The warnings come from Spectral's AsyncAPI rules, which ask for what a reader of the documentation needs (a description, a contact, a server to connect to) rather than what the specification requires. With a description, a contact, a license, a tag, a server and an operation description added, one finding is left:

$ apigit lint asyncapi.yaml
asyncapi.yaml
  1:11  info   asyncapi-latest-version  The latest version is not used. You should update to the "3.1.0" version.  (asyncapi)

1 problem (0 errors, 0 warnings, 1 info, 0 hints)

and with asyncapi: 3.1.0 the same file prints No problems found. Lint an AsyncAPI file has every rule with its fix.

How it renders

Rendered as documentation (here with apigit preview, which uses the viewer of APIGit's published pages), the complete version of the file shows the title, version and description; the contact, the license and the server broker.example.com:5672; then the channel orders.created with "Accepts the following message:", the orderCreated payload as a table of fields with a generated sample ({"orderId": "string", "total": 0}), and the operation publishOrderCreated under Send, with its description. Publish AsyncAPI documentation shows the commands.

Where to go next

Sources

Related pages

  • AsyncAPI linter: every finding apigit lint reports, with its fix

    apigit lint checks AsyncAPI 2.x and 3.x files offline with Spectral's AsyncAPI rules. The findings it printed on real documents, what each rule asks for, how to fix it, how to change the rule set, and the version string that stops every rule.

  • AsyncAPI 2 to 3 migration: the same API in 2.6 and 3.0, side by side

    One small event API written in AsyncAPI 2.6 and in 3.0: publish and subscribe become operations with action send or receive, the channel key becomes an id with an address, messages move under the channel, servers split url into host and pathname. With the linter's output for each version and for a 2.6 file that only had its version changed.

  • AsyncAPI channels, operations and messages: the 3.0 structure, step by step

    In AsyncAPI 3.0 a channel is an address with the messages on it, an operation says whether the application sends to or receives from a channel, and messages live under the channel. Each part built up in a working document, with the linter's message when it is missing or wrong, and four mistakes the linter does not catch.

  • AsyncAPI documentation: render it locally, then publish it from Git

    An AsyncAPI file becomes a documentation page with its servers, channels, messages and operations. How to see it on your machine with apigit preview before committing, what the page shows, and how to publish a version from a commit in the browser or with apigit doc publish.

Try it with your own API

Create a free workspace, add an OpenAPI file, and publish its documentation and a mock server from the same repository.

Free for individuals. No credit card.

$ npm install -g @apigit/cli$ apigit auth login$ apigit doc publish