Updated on 2026-01-08 GMT+08:00

Creating a Repository

Description

This API is used to create a repository on a specified project with the specified name. Input parameters: repository name, template ID, whether to import project members, and home project

URI

POST /v1/repositories

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

import_members

No

Integer

Whether to import project members. 0: No. 1: Yes.

name

Yes

String

Repo name. Start with a letter and use only letters, digits, hyphens (-), and underscores (_).

project_uuid

Yes

String

Project ID. For details, see Obtaining a Project ID.

Minimum length: 32

Maximum length: 32

template_id

No

String

Template ID

visibility_level

No

Integer

Repository status. 0: private; 20: public and read-only.

import_url

No

String

Base64-encoded HTTP address of the template repository

description

No

String

Repository description

gitignore_id

No

String

.gitignore file generated based on the programming language

license_id

No

Integer

License ID

enable_readme

No

Integer

Whether to generate a README file

caller

No

String

Caller

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Response error

result

Repository object

Response result

status

String

Response status

Table 4 Error

Parameter

Type

Description

code

String

Error codes

message

String

Error message

Table 5 Repository

Parameter

Type

Description

repository_uuid

String

Repo UUID

Minimum length: 32

Maximum length: 32

Request Examples

POST https://{endpoint}/v1/repositories

{
	"project_uuid": "4838955a48e2492bbe44b31bc4c272f6", 
	"name": "demotest1", 
	"import_members": "0", 
	"visibility_level": "20", 
 }

Response Examples

Status code: 200

Request succeeded

{
  "result" : {
    "repository_uuid" : "d161fd00d9194816a455cb3c1d6a783e"
  },
  "status" : "success"
}

Status Codes

Status Codes

Description

200

Request succeeded

Error Codes

See Error Codes.