CreateProjects
client.projects.bulkCreate(ProjectBulkCreateParams { projects } body, RequestOptionsoptions?): ProjectBulkCreateResponse { createdProjects, failedProjects }
POST/gitpod.v1.ProjectService/CreateProjects
Creates multiple projects in a single request.
Use this method to:
- Onboard multiple repositories at once
- Import a batch of projects during initial setup
Returns successfully created projects and details about any failures. Each project in the request is processed independently — partial success is possible.
Examples
-
Create multiple projects:
Creates several projects in one request.
projects: - name: "Frontend" initializer: specs: - git: remoteUri: "https://github.com/org/frontend" - name: "Backend" initializer: specs: - git: remoteUri: "https://github.com/org/backend"
CreateProjects
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
const response = await client.projects.bulkCreate({
projects: [
{
initializer: { specs: [{ git: { remoteUri: 'https://github.com/org/frontend' } }] },
name: 'Frontend',
},
{
initializer: { specs: [{ git: { remoteUri: 'https://github.com/org/backend' } }] },
name: 'Backend',
},
],
});
console.log(response.createdProjects);{
"createdProjects": [
{
"environmentClass": {
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"localRunner": true,
"order": 0
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"automationsFilePath": "automationsFilePath",
"desiredPhase": "PROJECT_PHASE_UNSPECIFIED",
"devcontainerFilePath": "devcontainerFilePath",
"environmentClasses": [
{
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"localRunner": true,
"order": 0
}
],
"initializer": {
"specs": [
{
"contextUrl": {
"url": "https://example.com"
},
"git": {
"checkoutLocation": "checkoutLocation",
"cloneTarget": "cloneTarget",
"remoteUri": "remoteUri",
"targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
"upstreamRemoteUri": "upstreamRemoteUri"
}
}
]
},
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"name": "x",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"updatedAt": "2019-12-27T18:11:19.117Z"
},
"prebuildConfiguration": {
"enabled": true,
"enableJetbrainsWarmup": true,
"environmentClassIds": [
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
],
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"timeout": "+9125115.360s",
"trigger": {
"dailySchedule": {
"hourUtc": 23
}
}
},
"recommendedEditors": {
"editors": {
"foo": {
"versions": [
"string"
]
}
}
},
"technicalDescription": "technicalDescription",
"usedBy": {
"subjects": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
}
],
"totalSubjects": 0
}
}
],
"failedProjects": [
{
"error": "error",
"index": 0,
"name": "name"
}
]
}Returns Examples
{
"createdProjects": [
{
"environmentClass": {
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"localRunner": true,
"order": 0
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"automationsFilePath": "automationsFilePath",
"desiredPhase": "PROJECT_PHASE_UNSPECIFIED",
"devcontainerFilePath": "devcontainerFilePath",
"environmentClasses": [
{
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"localRunner": true,
"order": 0
}
],
"initializer": {
"specs": [
{
"contextUrl": {
"url": "https://example.com"
},
"git": {
"checkoutLocation": "checkoutLocation",
"cloneTarget": "cloneTarget",
"remoteUri": "remoteUri",
"targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
"upstreamRemoteUri": "upstreamRemoteUri"
}
}
]
},
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"name": "x",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"updatedAt": "2019-12-27T18:11:19.117Z"
},
"prebuildConfiguration": {
"enabled": true,
"enableJetbrainsWarmup": true,
"environmentClassIds": [
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
],
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"timeout": "+9125115.360s",
"trigger": {
"dailySchedule": {
"hourUtc": 23
}
}
},
"recommendedEditors": {
"editors": {
"foo": {
"versions": [
"string"
]
}
}
},
"technicalDescription": "technicalDescription",
"usedBy": {
"subjects": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
}
],
"totalSubjects": 0
}
}
],
"failedProjects": [
{
"error": "error",
"index": 0,
"name": "name"
}
]
}