---
title: "Create tenant"
method: PUT
path: "/api/v1/obtenants"
tags: ["OBTenant"]
---

# Create tenant

`PUT /api/v1/obtenants`

Create an obtenant in a specific namespace, passwords should be encrypted by AES

## Request body

- ParamCreateOBTenantParam
  - `charset` string
  - `connectWhiteList` string
  - `deletionProtection` boolean
  - `enableSqlAnalyzer` boolean
  - `name` string, required
  - `namespace` string, required
  - `obcluster` string, required
  - `parameters` CommonKVPair[]
    - `key` string, required
    - `value` string, required
  - `pools` ParamResourcePoolSpec[], required
    - `priority` integer
    - `type` string — Enum: Full, Readonly, Columnstore
    - `zone` string, required
  - `rootCredential` string
  - `rootPassword` string
  - `scenario` string, required — Enum: express_oltp, express_oltp, olap, kv, htap, express_oltp_perf
  - `secretNamespace` string
  - `source` ParamTenantSourceSpec
    - `restore` ParamRestoreSourceSpec
      - `appId` string
      - `archiveSource` string, required
      - `bakDataSource` string, required
      - `bakEncryptionPassword` string
      - `bakEncryptionSecret` string
      - `ossAccessId` string
      - `ossAccessKey` string
      - `ossAccessSecret` string
      - `region` string
      - `type` 'NFS' | 'OSS' | 'COS' | 'S3' | 'S3_COMPATIBLE', required
      - `until` ParamRestoreUntilConfig
        - `timestamp` string
        - `unlimited` boolean
    - `tenant` string
  - `tenantName` string, required
  - `tenantRole` string — Enum: Primary, Standby
  - `unitConfig` ParamUnitConfig, required
    - `cpuCount` string, required
    - `iopsWeight` integer
    - `logDiskSize` string
    - `maxIops` integer
    - `memorySize` string, required
    - `minIops` integer
  - `unitNum` integer, required
  - `variables` CommonKVPair[]
    - `key` string, required
    - `value` string, required

## Response `200`

OK

- object
  - `data` ResponseOBTenantDetail, required
    - `annotations` CommonKVPair[]
      - `key` string, required
      - `value` string, required
    - `charset` string, required — Charset of the tenant
    - `clusterResourceName` string, required — Name of the cluster belonging to
    - `createTime` string, required — Creation time of the tenant
    - `deletionProtection` boolean, required — Whether the tenant is protected from deletion
    - `locality` string, required — Locality of the tenant units
    - `name` string, required — Name of the resource
    - `namespace` string, required — Namespace of the resource
    - `primaryTenant` string
    - `primaryZone` string, required — Primary zone of the tenant
    - `restoreSource` ResponseRestoreSource
      - `archiveSource` string, required
      - `bakDataSource` string, required
      - `bakEncryptionSecret` string
      - `ossAccessSecret` string
      - `type` string, required — Enum: OSS, NFS
      - `until` string
    - `rootCredential` string
    - `scenario` string
    - `sqlAnalyzerEnabled` boolean — Whether the sql analyzer is enabled
    - `standbyROCredential` string
    - `status` string, required — Status of the tenant
    - `tenantName` string, required — Name of the tenant in the database
    - `tenantRole` string, required — Enum: Primary, Standby
    - `topology` ResponseOBTenantReplica[] — Topology of the tenant
      - `iopsWeight` integer, required
      - `logDiskSize` integer, required
      - `maxCPU` integer, required
      - `maxIops` integer, required
      - `memorySize` integer, required
      - `minCPU` integer, required
      - `minIops` integer, required
      - `priority` integer, required
      - `type` string, required — Enum: Readonly, Full
      - `zone` string, required
    - `uid` string, required — Unique identifier of the resource
    - `unitNumber` integer, required — Number of units in every zone
    - `version` string
  - `message` string, required
  - `successful` boolean, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `500` — Internal Server Error

## Changes

> 28 revisions in range; 1 could not be searched.

- **2024-03-14** `649de0f2e535` — 2 info
  - api tag `OBTenant` added
  - api tag `Obtenant` removed
- **2024-02-27** `643ae3c8d824` — 2 info
  - api tag `Obtenant` added
  - api tag `OBTenant` removed

[Change history](https://skmtc.dev/oceanbase/apis/oceanbase-dashboard-api/changes/api/v1/obtenants/put.md)

---

[API](https://skmtc.dev/oceanbase/apis/oceanbase-dashboard-api.md) · [All operations](https://skmtc.dev/oceanbase/apis/oceanbase-dashboard-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/oceanbase/oceanbase-dashboard-api/revisions/fa579fa6f72d/schema)
