Help Center/ CodeArts Repo/ API Reference (Ally Region)/ APIs/ Project (V2)/ Creating a Project and Repository
Updated on 2026-01-08 GMT+08:00

Creating a Project and Repository

Description

This API is used to create a project first, then create a repository in the project.

URI

POST /v2/projects/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.

project_name

Yes

String

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

repo_name

Yes

String

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

Minimum length: 2

Maximum length: 128

type

No

String

Project type, scrum

visibility_level

No

Integer

Repository visibility: *Private: Only repository members can read, write and access the repository. The value is 0. *Public: 1. Read-only for project members: Only project members can read, view and search for repositories of a project or a repository group. The value is 10. 2. Read-only for tenant members: Only tenant members can read, view and search for repositories of a project or a repository group. The value is 10. 3. Read-only for all visitors: All visitors can read, view and search for repositories of a project or a repository group. The value is 20.

external_project_info

No

ExternalKeyMessage object

Third-party service information

Table 3 ExternalKeyMessage

Parameter

Mandatory

Type

Description

external_key_message

No

String

Key information stored by third parties in CodeArts Repo

external_service

No

String

External service name

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Response error

result

ProjectRepository object

Response result

status

String

Response status

Table 5 Error

Parameter

Type

Description

code

String

Error codes

message

String

Error message

Table 6 ProjectRepository

Parameter

Type

Description

projectUuid

String

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

Minimum length: 32

Maximum length: 32

repositoryUuid

String

Repository UUID

Minimum length: 32

Maximum length: 32

Request Examples

POST https://{endpoint}/v2/projects/repositories

{
  "project_name" : "testworld",
  "repo_name" : "demotest1",
  "import_members" : "0",
  "visibility_level" : "20",
  "type" : "normal"
}

Response Examples

Status code: 200

Request succeeded

{
  "result" : {
    "repositoryUuid" : "02637c34ba954ab5bd37ff9537fe05b4",
    "projectUuid" : "1aeda7a6070d4119b7d8b45e5641599b"
  },
  "status" : "success"
}

Status Codes

Status Codes

Description

200

Request succeeded

Error Codes

See Error Codes.