API method

Add an API method to a page.

We are depreciating the API method block

We’re working on some major improvements to how teams can document APIs in GitBook. As a result, we’ve decided to deprecate the API method block. Read our recent announcement to find out more about the reasons behind this change.

From Monday 13 February, you will no longer be able to add API method blocks to your content in GitBook.

On Monday 4 March, we’ll automatically transition all pre-existing API method blocks to regular text blocks. Read our announcement to find out more.

An API method block is used to manually document an HTTP API endpoint.

Example of API method block

Get a user

GET https://api.example.com/v1/user

Use this method to get information about a user.

Path Parameters

NameTypeDescription

id

String

ID of the user to lookup

{
  "id": "eoziwgldfkj18239J30kd1Dj",
  "email": "user@example.com",
  "firstName": "Happy",
  "lastName": "User"
}

Related:

pageOpenAPI methods

Representation in Markdown

# API

{% swagger method="get" path="" baseUrl="" summary="" %}
{% swagger-description %}

{% endswagger-description %}
{% endswagger %}

Last updated