---
title: "Create a consumer"
method: POST
path: "/apiops/projects/{projectName}/consumers"
tags: ["Consumer"]
---

# Create a consumer

`POST /apiops/projects/{projectName}/consumers`

## Request

- Base URL: `http://167.86.118.166:32080`
- URL: `http://167.86.118.166:32080/apiops/projects/{projectName}/consumers`
- Auth: none declared
- TypeScript: <https://skmtc.dev/apinizer/apis/apinizer-management-apis/docs/apiops/projects/:projectName/consumers/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a consumer in the project and deploys it (201 + Location). username and password are required; the consumer key is assigned by the installation and returned in the result. organizationCode files the consumer under an organization of the project. A taken username is 409 duplicateName. The password is stored encrypted and never returned.

## Path parameters

- `projectName` string, required

## Request body

- ApiOpsConsumerWriteDTO
  - `consumerKey` string
  - `username` string
  - `password` string
  - `fullName` string
  - `email` string
  - `description` string
  - `enabled` boolean
  - `ipList` string[]
  - `expireDate` string, date-time
  - `roleNameList` string[]
  - `metadata` CredentialMetadataDTO[]
    - `key` string
    - `value` string
    - `secret` boolean
    - `includeInJwt` boolean
    - `includeInTokenResponse` boolean
    - `jwtClaimName` string
  - `trafficLogDisabled` boolean
  - `organizationCode` string

## Response `200`

OK

- ApiOpsMutationResponseApiOpsResponseConsumer
  - `status` 'SUCCESS' | 'FAILURE'
  - `resourceVersion` integer
  - `runtimeDeployment` ApiOpsRuntimeDeploymentDTO
    - `state` 'IN_SYNC' | 'DEGRADED'
    - `environments` Environment[]
      - `name` string
      - `acknowledged` boolean
      - `detail` string
  - `result` ApiOpsResponseConsumer
    - `consumerKey` string
    - `username` string
    - `fullName` string
    - `email` string
    - `description` string
    - `enabled` boolean
    - `organizationCode` string
    - `expireDate` string, date-time
    - `trafficLogDisabled` boolean
    - `ipList` string[]
    - `roleNames` string[]
    - `metadata` CredentialMetadataDTO[]
      - `key` string
      - `value` string
      - `secret` boolean
      - `includeInJwt` boolean
      - `includeInTokenResponse` boolean
      - `jwtClaimName` string

---

[API](https://skmtc.dev/apinizer/apis/apinizer-management-apis.md) - [All operations](https://skmtc.dev/apinizer/apis/apinizer-management-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/apinizer/apis/apinizer-management-apis/revisions/e083046b24cd?raw)
