# Scopes

For this guide let's create two scopes: `read` and `write`. Applications authorized with the `read` scope will be able to read public data from our API. The `write` scope will let applications change data in our API.

Go to doorkeeper's initializer and add:

{% code title="config/initializers/doorkeeper.rb" %}

```ruby
Doorkeeper.configure do
  default_scopes :read
  optional_scopes :write
    
  enforce_configured_scopes
end
```

{% endcode %}

The last line with `enforce_configured_scopes` ensures applications to be able to ask only for configured scopes defined in `default_scopes` and `optional_scopes`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doorkeeper.gitbook.io/guides/ruby-on-rails/scopes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
