# Create Wiki space

This interface is used to create a Wiki space

**Notice**：This API can not be accessed as app (tenant access token).

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/wiki/v2/spaces
HTTP Method | POST
Rate Limit | [10 per minute](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.**<br>Enable any scope from the list | Create and update wiki space(wiki:space:write_only)<br>View, edit, and manage Wiki(wiki:wiki)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Request body

Parameter | Type | Required | Description
---|---|---|---
name | string | No | Wiki space name<br>**Example value**: "Wiki Workspace"
description | string | No | Wiki space description<br>**Example value**: "Wiki Workspace Description"
open_sharing | string | No | Represents Wiki space sharing status<br>**Example value**: "open"<br>**Optional values are**:<br>- open：Open<br>- closed：Closed<br>**Data validation rules**:<br>- Length range: `0` ～ `99` characters

### Request body example
```json
{
    "name": "Knowledge space",
    "description": "Knowledge space description"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
space | space | Knowledge space
name | string | Wiki space name
description | string | Wiki space description
space_id | string | Wiki space id
space_type | string | Represents the Wiki space type (team space, or personal space)<br>**Optional values are**:<br>- team：Team space<br>- person：Personal space
visibility | string | Represents Wiki space visibility (public space, or private space)<br>**Optional values are**:<br>- public：Open space<br>- private：Private space
open_sharing | string | Represents Wiki space sharing status<br>**Optional values are**:<br>- open：Open<br>- closed：Closed

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "space": {
            "name": "Knowledge space",
            "description": "Knowledge space description",
            "space_id": "1565676577122621"
        }
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 131001 | RPC failed | Server error occurred, please try later, or take the x-tt-logid location in the header of the response and consult [oncall]((https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)).
400 | 131002 | param err | Usually, the parameter is incorrect, such as the data type does not match. Please check the **specific interface error information**. If the error is not clear, please consult [oncall]((https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)).
400 | 131003 | out of limit | Operational limits, such as number of nodes, were exceeded. See the table below.<br>- The total number of nodes in the original/target wiki space does not exceed 400,000.<br>- The original/target wiki space directory tree does not exceed 50 layers.<br>- The number of single-layer nodes under the destination parent node does not exceed 2000.<br>- The number of single mobile nodes (with child nodes) does not exceed 2000.
400 | 131004 | invalid user | Illegal user, please consult [oncall]((https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)).
400 | 131005 | not found | No relevant data was found, for example id does not exist. Reference for related error information:<br>- member not found: The user is not a member (admin) of the wiki space and cannot be deleted.<br>- identity not found: userid does not exist, cannot add/remove members.<br>- space not found: wiki space does not exist<br>- node not found: node does not exist<br>- document not found: document does not exist<br>Please consult [oncall]((https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)) when the error is unclear.
400 | 131006 | permission denied | Permission denied, please refer to the relevant error information:<br>- wiki space permission denied: wiki space permission authentication failed, you need to become a wiki space administrator (member).<br>- node permission denied: The document node permission authentication failed, the read operation needs to have the node view permission, and the write operation (create, move, etc.) needs to have the node container editing permission.<br>- no source parent node permission: Container editing permission of the original parent node is required.<br>- no destination parent node permission: Container editing permission on the destination parent node are required. If you move to wiki space, you need to become a wiki space administrator (member).<br>**Note**: When an application accesses or manipulates a document, in addition to applying for API permissions, it also needs to authorize reading, editing, or administrative permissions for specific document resources.<br>Please refer to the following steps:<br>1. **When encountering insufficient resource permissions**: See [How to authorize an application to access wiki space documentation resources](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/wiki-qa#a40ad4ca).<br>2. **You can also directly add an app as a wiki space administrator (member)**: See [How to add an app as a wiki space administrator (member) ](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/wiki-qa#b5da330b).<br>3. **If it cannot be solved or the error message is not clear**: Please consult [technical support](https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952).
400 | 131007 | internal err | Server internal error, take the x-tt-logid location in the header of the return response and consult [oncall]((https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)).

