Consumers

Create a new Consumer

Changed on

Create a new Consumer

post/{workspace}/consumers

Request

  • Base URL
    http://localhost:8001
  • Auth
    API key in header Kong-Admin-Token

Path parameters

workspace, string required
Example:team-payments

The name of the workspace

Request body

Consumer required

The Consumer object represents a consumer - or a user - of a Service. You can either rely on Kong as the primary datastore, or you can map the consumer list with your database to keep consistency between Kong and your existing primary datastore.

created_at, integer nullable

Unix epoch when the resource was created.

custom_id, string nullable

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.

id, string nullable

A string representing a UUID (universally unique identifier).

tags, string[] nullable

An optional set of strings associated with the Consumer for grouping and filtering.

updated_at, integer nullable

Unix epoch when the resource was last updated.

username, string nullable

The unique username of the Consumer. You must send either this field or custom_id with the request.

Example request

{
  "custom_id": "4200",
  "id": "8a388226-80e8-4027-a486-25e4f7db5d21",
  "tags": [
    "silver-tier"
  ],
  "username": "bob-the-builder"
}

Response

Successfully created Consumer

Consumer required

The Consumer object represents a consumer - or a user - of a Service. You can either rely on Kong as the primary datastore, or you can map the consumer list with your database to keep consistency between Kong and your existing primary datastore.

created_at, integer nullable

Unix epoch when the resource was created.

custom_id, string nullable

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.

id, string nullable

A string representing a UUID (universally unique identifier).

tags, string[] nullable

An optional set of strings associated with the Consumer for grouping and filtering.

updated_at, integer nullable

Unix epoch when the resource was last updated.

username, string nullable

The unique username of the Consumer. You must send either this field or custom_id with the request.

Example response

{
  "custom_id": "4200",
  "id": "8a388226-80e8-4027-a486-25e4f7db5d21",
  "tags": [
    "silver-tier"
  ],
  "username": "bob-the-builder"
}

Changes