# Consumer Restriction Configuration

The `consumer-restriction` plugin controls access by consumer, route, service, or APISIX consumer group; API7 Gateway does not support consumer-group matching.<!-- --> <!-- -->Configuration covers plugin parameters.

## Parameters[​](#parameters "Direct link to Parameters")

See plugin [common configurations](https://docs.api7.ai/apisix/reference/plugin-common-configurations.md) for configuration options available to all plugins.

* type

  string

  default: `consumer_name`

  valid value:

  `consumer_name`, `consumer_group_id`, `service_id`, or `route_id`

  ***

  Key type to restrict by.

  `consumer_group_id` is usable in APISIX. API7 Gateway inherits the schema value but does not assign group IDs; selecting it causes requests to return HTTP 401.

* whitelist

  array\[string]

  ***

  List of objects to whitelist.

  Configure at least one of `whitelist`, `blacklist`, and `allowed_by_methods`.

  When combined, a matching `blacklist` entry rejects first. A matching `whitelist` entry then allows the request without evaluating `allowed_by_methods`. A value absent from the whitelist remains rejected even if `allowed_by_methods` would allow its method.

* blacklist

  array\[string]

  ***

  List of objects to blacklist.

  Configure at least one of `whitelist`, `blacklist`, and `allowed_by_methods`.

  A matching blacklist entry always rejects the request, including when the same value is also whitelisted.

* allowed\_by\_methods

  array\[object]

  ***

  List of key-value pairs of consumer name and their corresponding HTTP methods allowed.

  Configure at least one of `whitelist`, `blacklist`, and `allowed_by_methods`.

  Method restrictions are evaluated only for values that are not whitelisted. If a value has no entry in this list, this field does not restrict its methods.

  * user

    string

    ***

    Consumer username.

  * methods

    array\[string]

    valid value:

    Any combination of the `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS`, `CONNECT`, `TRACE`, `PURGE` methods

    ***

    List of allowed HTTP methods for the consumer.

* rejected\_code

  integer

  default: `403`

  valid value:

  greater than or equal to 200

  ***

  HTTP status code to return when the request is rejected.

* rejected\_msg

  string

  ***

  Error message to return when the request is rejected.
