Consumer Groups Reference

    The endpoint works together with the . To use consumer groups for rate limiting, configure the plugin with the enforce_consumer_groups and consumer_groups parameters, then use the /consumer_groups endpoint to manage the groups.

    For more information and examples of setting up and managing consumer groups, see the Consumer Groups examples.

    Endpoint

    /consumer_groups

    Response

    1. {
    2. "data": [
    3. {
    4. "created_at": 1557522650,
    5. "id": "42b022c1-eb3c-4512-badc-1aee8c0f50b5",
    6. "name": "my_group"
    7. },
    8. {
    9. "created_at": 1637706162,
    10. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    11. "name": "my_group2"
    12. }
    13. ],
    14. "next": null
    15. }

    List a specific consumer group

    Endpoint

    /consumer_groups/{GROUP_NAME|GROUP_ID}

    Response

    1. HTTP/1.1 200 OK
    1. {
    2. "consumer_group": {
    3. "created_at": 1638917780,
    4. "id": "be4bcfca-b1df-4fac-83cc-5cf6774bf48e",
    5. "name": "JL"
    6. }
    7. }

    Endpoint

    /consumer_groups/{GROUP_NAME|GROUP_ID}/consumers

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group.

    Response

    1. HTTP/1.1 200 OK
    1. {
    2. "consumers": [
    3. {
    4. "id": "288f2bfc-04e2-4ec3-b6f3-40408dff5417",
    5. "type": 0,
    6. "username": "BarryAllen",
    7. "username_lower": "barryallen"
    8. },
    9. {
    10. "created_at": 1638915577,
    11. "id": "8089a0e6-1d31-4e00-bf51-5b902899b4cb",
    12. "type": 0,
    13. "username": "DianaPrince",
    14. "username_lower": "dianaprince"
    15. }
    16. ]

    List consumer groups for a consumer

    View all consumer groups that a consumer is assigned to.

    Endpoint

    /consumers/{CONSUMER_NAME|CONSUMER_ID}/consumer_groups

    AttributeDescription
    USERNAME|CONSUMER_ID
    required
    The name or UUID of the consumer.

    Response

    1. HTTP/1.1 200 OK

    Create a consumer group

    /consumer_groups

    Request body

    AttributeDescription
    name
    required
    A unique name for the consumer group you want to create.

    Response

    1. HTTP 201 Created
    1. {
    2. "created_at": 1557522650,
    3. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    4. "name": "JL",
    5. }

    Endpoint

    /consumer_groups/{GROUP_NAME}

    AttributeDescription
    GROUP_NAME
    required
    A unique name for the consumer group you want to create.

    Response

    1. HTTP 201 Created
    1. {
    2. "created_at": 1557522650,
    3. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    4. "name": "JL",
    5. }

    Add a consumer to a specific consumer group.

    If you add a consumer to multiple groups:

    • If all groups are allowed by the Rate Limiting Advanced plugin, only the first group’s settings will apply.
    • Otherwise, whichever group is specified in the Rate Limiting Advanced plugin will be active.

    Consumers endpoint

    /consumers/{CONSUMER_NAME|CONSUMER_ID}/consumer_groups

    Request body

    AttributeDescription
    group
    required
    The name or ID of the group to add the consumer to.

    Response

    1. HTTP 201 Created
    1. {
    2. "consumer": {
    3. "created_at": 1638918560,
    4. "custom_id": null,
    5. "id": "288f2bfc-04e2-4ec3-b6f3-40408dff5417",
    6. "tags": null,
    7. "type": 0,
    8. "username": "BarryAllen",
    9. "username_lower": "barryallen"
    10. },
    11. {
    12. "created_at": 1638918476,
    13. "id": "e2c3f16e-22c7-4ef4-b6e4-ab25c522b339",
    14. "name": "JL"
    15. }
    16. ]
    17. }

    Consumer groups endpoint

    /consumer_groups/{GROUP_NAME|GROUP_ID}/consumers

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group.

    Request body

    AttributeDescription
    consumer
    required
    The name or ID of the consumer to add to this group.

    Response

    1. {
    2. "consumer_group": {
    3. "created_at": 1638915521,
    4. "id": "8a4bba3c-7f82-45f0-8121-ed4d2847c4a4",
    5. "name": "JL"
    6. },
    7. "consumers": [
    8. "created_at": 1638915577,
    9. "id": "8089a0e6-1d31-4e00-bf51-5b902899b4cb",
    10. "type": 0,
    11. "username": "DianaPrince",
    12. "username_lower": "dianaprince"
    13. }
    14. ]
    15. }

    Delete a consumer group

    Endpoint

    /consumer_groups/{GROUP_NAME|GROUP_ID}

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group to delete.

    Response

    1. HTTP/1.1 204 No Content

    Endpoint

    /consumers/{CONSUMER_NAME|CONSUMER_ID}/consumer_groups

    Response

    1. HTTP/1.1 204 No Content

    Remove a consumer from a consumer group

    Consumer endpoint

    /consumers/{CONSUMER_NAME|CONSUMER_ID}/consumer_groups/{GROUP_NAME|GROUP_ID}

    AttributeDescription
    CONSUMER_NAME|CONSUMER_ID
    required
    The name or UUID of the consumer to remove.
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group to remove the consumer from.

    Response

    1. HTTP/1.1 204 No Content

    Consumer groups endpoint

    /consumer_groups/{GROUP_NAME|GROUP_ID}/consumers/{CONSUMER_NAME|CONSUMER_ID}

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group to remove the consumer from.
    CONSUMER_NAME|CONSUMER_ID
    required
    The name or UUID of the consumer to remove.

    Response

    1. HTTP/1.1 204 No Content

    /consumer_groups/{GROUP_NAME|GROUP_ID}/consumers

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group to remove all consumers from.

    Response

    1. HTTP/1.1 204 No Content

    Configure rate limiting for a consumer group

    Define custom rate limiting settings for a consumer group. This endpoint overrides the settings of the Rate Limiting Advanced plugin.

    /consumer_groups/{GROUP_NAME|GROUP_ID}/overrides/plugins/rate-limiting-advanced

    AttributeDescription
    GROUP_NAME|GROUP_ID
    required
    The name or UUID of the consumer group to configure.

    Response

    1. {
    2. "config": {
    3. "limit": [
    4. 10
    5. ],
    6. "retry_after_jitter_max": 0,
    7. "window_size": [
    8. 10
    9. ],
    10. "window_type": "sliding"
    11. },
    12. "group": "test-group",
    13. }