---
title: "Update a Consumer"
url: "https://nov18-dev.movespot.fyi/apis/konnect-runtime-groups-configuration-0/versions/af18902c-58f1-49d7-8ec2-9987b4e0d1bd/operations/upsert-consumer"
---

> Full API specification: https://nov18-dev.movespot.fyi/apis/konnect-runtime-groups-configuration-0/versions/af18902c-58f1-49d7-8ec2-9987b4e0d1bd.md

# Update a Consumer

`PUT` `/runtime-groups/{runtimeGroupId}/core-entities/consumers/{consumer_id}`

Operation ID: `upsert-consumer`

Create or Update Consumer using ID or username. The consumer will be identified via the username or id attribute.If the consumer with the specified ID or username cannot be found, the endpoint will return a 404. When the username or id attribute has the structure of a UUID, the Consumer being inserted/replaced will be identified by its id. Otherwise it will be identified by its username. When creating a new Consumer without specifying id (neither in the URL nor in the body), then it will be auto-generated. Notice that specifying a username in the URL and a different one in the request body is not allowed.

## Path parameters

- `consumer_id` (string, required) - The unique identifier or the username of the Consumer to retrieve.
- `runtimeGroupId` (string, required) - The ID of your runtime group. This variable is available in the Konnect manager

## Request body

Content types: `application/json`

## Responses

- `200` - The consumer object response body
- `400` - Bad Request
- `404` - Not Found

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Konnect Runtime Groups Configuration
  version: 0.0.1
servers:
  - url: https://us.api.konghq.com/v2
    description: United-States Production region
  - url: https://eu.api.konghq.com/v2
    description: Europe Production region
  - url: https://au.api.konghq.com/v2
    description: Australia Production region
  - url: https://me.api.konghq.com/v2
    description: Middle-East Production region
  - url: https://in.api.konghq.com/v2
    description: India Production region
  - url: https://sg.api.konghq.com/v2
    description: Singapore Production region
paths:
  /runtime-groups/{runtimeGroupId}/core-entities/consumers/{consumer_id}:
    parameters:
      - $ref: "#/components/parameters/consumer_id"
      - $ref: "#/components/parameters/runtimeGroupId"
    put:
      operationId: upsert-consumer
      summary: Update a Consumer
      description: >-
        Create or Update Consumer using ID or username. The consumer will be
        identified via the username or id attribute.If the consumer with the
        specified ID or username cannot be found, the endpoint will return a
        404.


        When the username or id attribute has the structure of a UUID, the
        Consumer being inserted/replaced will be identified by its id. Otherwise
        it will be identified by its username.


        When creating a new Consumer without specifying id (neither in the URL
        nor in the body), then it will be auto-generated.


        Notice that specifying a username in the URL and a different one in the
        request body is not allowed.
      requestBody:
        $ref: "#/components/requestBodies/consumer-request"
      responses:
        "200":
          $ref: "#/components/responses/consumer-response-data"
        "400":
          description: Bad Request
        "404":
          description: Not Found
      tags:
        - Consumers
security:
  - konnectAccessToken: []
  - personalAccessToken: []
components:
  parameters:
    consumer_id:
      name: consumer_id
      in: path
      schema:
        type: string
        example: e94215b0-9198-42ce-bf0b-98afff31b2a7
      description: The unique identifier or the username of the Consumer to retrieve.
      required: true
    runtimeGroupId:
      name: runtimeGroupId
      in: path
      required: true
      schema:
        type: string
        example: 9524ec7d-36d9-465d-a8c5-83a3c9390458
      description: The ID of your runtime group. This variable is available in the
        Konnect manager
  requestBodies:
    consumer-request:
      content:
        application/json:
          schema:
            type: object
            properties:
              username:
                description: >
                  The unique username of the Consumer. You must send either this
                  field or custom_id with the request.
                type: string
              custom_id:
                description: >
                  Field for storing an existing unique ID for the Consumer -
                  useful for mapping Kong with users in your existing database.
                  You must send either this field or username with the request.
                type: string
              tags:
                description: >
                  An optional set of strings associated with the Consumer for
                  grouping and filtering.
                type: array
                items:
                  type: string
            required:
              - username
              - custom_id
            x-examples:
              Example 1:
                id: ec1a1f6f-2aa4-4e58-93ff-b56368f19b27
                created_at: 1422386534
                username: my-username
                custom_id: my-custom-id
                tags:
                  - user-level
                  - low-priority
      description: Consumer request body
  responses:
    consumer-response-data:
      description: The consumer object response body
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      description: The unique identifier or the name attribute of the consumer.
                      type: string
                      example: a4407883-c166-43fd-80ca-3ca035b0cdb7
                    created_at:
                      description: Unix epoch when the resource was created.
                      type: integer
                      example: 1422386534
                    username:
                      description: The unique username of the consumer. You must send either this
                        field or` custom_i`d with the request.
                      type: string
                      example: my-username
                    custom_id:
                      description: Field for storing an existing unique ID for the Consumer - useful
                        for mapping Kong with users in your existing database.
                      type: string
                      example: my-custom-id
                    updated_at:
                      description: Unix epoch when the resource was created.
                      type: string
                      example: "1422386534"
                    tags:
                      description: >
                        An optional set of strings associated with the Consumer
                        for grouping and filtering.
                      type: array
                      items:
                        type: string
                        example: admin
              next:
                description: Pagination information
                type: string
                example: http://localhost:8001/consumers?offset=6378122c-a0a1-438d-a5c6-efabae9fb969
            x-examples:
              Example 1:
                data:
                  - id: a4407883-c166-43fd-80ca-3ca035b0cdb7
                    created_at: 1422386534
                    username: my-username
                    custom_id: my-custom-id
                    tags:
                      - user-level
                      - low-priority
                  - id: 01c23299-839c-49a5-a6d5-8864c09184af
                    created_at: 1422386534
                    username: my-username
                    custom_id: my-custom-id
                    tags:
                      - admin
                      - high-priority
                      - critical
                next: http://localhost:8001/consumers?offset=6378122c-a0a1-438d-a5c6-efabae9fb969
  securitySchemes:
    konnectAccessToken:
      type: http
      scheme: bearer
      description: >-
        The Konnect access token is meant to be used by the Konnect dashboard
        and the decK CLI to

        authenticate with.
    personalAccessToken:
      type: http
      scheme: bearer
      description: The personal access token is meant to be used as an alternative to
        basic-auth when accessing Konnect via APIs. You can generate a Personal
        Access Token (PAT) from the personal access token page in the Konnect
        dashboard.
```
