> For the complete documentation index, see [llms.txt](https://doorkeeper.gitbook.io/guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doorkeeper.gitbook.io/guides/grape/grape.md).

# Grape

## Grape integration

Doorkeeper provides helpers for the [Grape framework](https://github.com/ruby-grape/grape) >= 0.10. One of them is `doorkeeper_authorize!` that can be used in a similar way as an example above to protect your API with OAuth. Note that you have to use `require 'doorkeeper/grape/helpers'` and `helpers Doorkeeper::Grape::Helpers` in your Grape API class.

```ruby
require 'doorkeeper/grape/helpers'

module API
  module V1
    class Users < Grape::API
      helpers Doorkeeper::Grape::Helpers

      before do
        doorkeeper_authorize!
      end

      # For old versions of Grape:
      #   route_setting :scopes, ['user:email']
      #
      get :me, scopes: [:user, :read] do
        current_user.to_json
      end

      # ...
    end
  end
end
```

## Auto-documented API

[**Check out the sample app**](https://github.com/sethherr/grape-doorkeeper)

The sample app is a Rails 4 template with everything necessary to create an autodocumented, secured API in Grape with doorkeeper.

There is also a wiki page with details for [how to add this to an existing application](https://github.com/sethherr/grape-doorkeeper/wiki/Adding-to-an-existing-application).

* [**grape**](https://github.com/intridea/grape) a REST-like API micro-framework for Ruby. Makes building APIs easier and faster.
* **grape swagger** The [grape-swagger](https://github.com/tim-vandecasteele/grape-swagger) gem provides autogenerated swagger documentation (it's magical).
* **swagger ui rails** The [swagger-ui\_rails](https://github.com/d4be4st/swagger-ui_rails) gem provides asset pipeline assets for [swagger-ui](https://github.com/swagger-api/swagger-ui) - beautiful, interactive documentation.
* **wine\_bouncer** The [wine\_bouncer](https://github.com/antek-drzewiecki/wine_bouncer) gem protects grape with Doorkeeper, documents it in swagger, and permits scoping-based protection.
