Skip to content

Commit 02dcfac

Browse files
authored
Merge pull request #293 from makeplane/docs/create-project-with-template
docs: add create project with template API endpoint
2 parents ce1707d + c54516c commit 02dcfac

3 files changed

Lines changed: 183 additions & 0 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ export default extendConfig(
502502
items: [
503503
{ text: "Overview", link: "/api-reference/project/overview" },
504504
{ text: "Create Project", link: "/api-reference/project/add-project" },
505+
{
506+
text: "Create Project with Template",
507+
link: "/api-reference/project/create-project-with-template",
508+
},
505509
{ text: "List Projects", link: "/api-reference/project/list-projects" },
506510
{ text: "Get Project", link: "/api-reference/project/get-project-detail" },
507511
{ text: "Update Project", link: "/api-reference/project/update-project-detail" },
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
title: Create project with template
3+
description: Create a project from an existing project template via Plane API. HTTP request format, parameters, scopes, and example responses for create project with template.
4+
keywords: plane, plane api, rest api, api integration, project, create project with template, project template
5+
---
6+
7+
# Create project with template
8+
9+
<div class="api-endpoint-badge">
10+
<span class="method post">POST</span>
11+
<span class="path">/api/v1/workspaces/{workspace_slug}/projects/templates/use/</span>
12+
</div>
13+
14+
<div class="api-two-column">
15+
<div class="api-left">
16+
17+
Create a new project from an existing project template. The template's states, labels, estimates, modules, and work items are copied into the new project. Fields provided in the request body override the template defaults.
18+
19+
<div class="params-section">
20+
21+
### Path Parameters
22+
23+
<div class="params-list">
24+
25+
<ApiParam name="workspace_slug" type="string" :required="true">
26+
27+
The workspace_slug represents the unique workspace identifier for a workspace in Plane. It can be found in the URL. For example, in the URL `https://app.plane.so/my-team/projects/`, the workspace slug is `my-team`.
28+
29+
</ApiParam>
30+
31+
</div>
32+
</div>
33+
34+
<div class="params-section">
35+
36+
### Body Parameters
37+
38+
<div class="params-list">
39+
40+
<ApiParam name="template_id" type="string" :required="true">
41+
42+
The ID of the project template to instantiate. Must belong to the same workspace.
43+
44+
</ApiParam>
45+
46+
<ApiParam name="name" type="string" :required="false">
47+
48+
Name of the new project. Overrides the template default.
49+
50+
</ApiParam>
51+
52+
<ApiParam name="identifier" type="string" :required="false">
53+
54+
Short identifier for the project (e.g. `MAR`). Overrides the template default.
55+
56+
</ApiParam>
57+
58+
<ApiParam name="description" type="string" :required="false">
59+
60+
Description of the new project. Overrides the template default.
61+
62+
</ApiParam>
63+
64+
<ApiParam name="network" type="integer" :required="false">
65+
66+
Network visibility of the project. `0` for secret, `2` for public. Overrides the template default.
67+
68+
</ApiParam>
69+
70+
<ApiParam name="project_lead" type="string" :required="false">
71+
72+
User ID of the project lead. The lead is added as a project admin. Overrides the template default.
73+
74+
</ApiParam>
75+
76+
</div>
77+
</div>
78+
79+
<div class="params-section">
80+
81+
### Scopes
82+
83+
`write` or `projects:write`
84+
85+
</div>
86+
87+
</div>
88+
89+
<div class="api-right">
90+
91+
<CodePanel title="Create project with template" :languages="['cURL', 'Python', 'JavaScript']">
92+
<template #curl>
93+
94+
```bash
95+
curl -X POST \
96+
"https://api.plane.so/api/v1/workspaces/my-workspace/projects/templates/use/" \
97+
-H "X-API-Key: $PLANE_API_KEY" \
98+
# Or use -H "Authorization: Bearer $PLANE_OAUTH_TOKEN" \
99+
-H "Content-Type: application/json" \
100+
-d '{
101+
"template_id": "7a2d3972-80a5-4ac5-8bb5-03026671826a",
102+
"name": "Mobile App Revamp",
103+
"identifier": "MAR",
104+
"description": "Project created from the Agile Project Setup template",
105+
"network": 2,
106+
"project_lead": "0d8d8869-3ed1-4fb4-b5c4-ff672888f5e2"
107+
}'
108+
```
109+
110+
</template>
111+
<template #python>
112+
113+
```python
114+
import requests
115+
116+
response = requests.post(
117+
"https://api.plane.so/api/v1/workspaces/my-workspace/projects/templates/use/",
118+
headers={"X-API-Key": "your-api-key"},
119+
json={
120+
"template_id": "7a2d3972-80a5-4ac5-8bb5-03026671826a",
121+
"name": "Mobile App Revamp",
122+
"identifier": "MAR",
123+
"description": "Project created from the Agile Project Setup template",
124+
"network": 2,
125+
"project_lead": "0d8d8869-3ed1-4fb4-b5c4-ff672888f5e2"
126+
}
127+
)
128+
print(response.json())
129+
```
130+
131+
</template>
132+
<template #javascript>
133+
134+
```javascript
135+
const response = await fetch("https://api.plane.so/api/v1/workspaces/my-workspace/projects/templates/use/", {
136+
method: "POST",
137+
headers: {
138+
"X-API-Key": "your-api-key",
139+
"Content-Type": "application/json",
140+
},
141+
body: JSON.stringify({
142+
template_id: "7a2d3972-80a5-4ac5-8bb5-03026671826a",
143+
name: "Mobile App Revamp",
144+
identifier: "MAR",
145+
description: "Project created from the Agile Project Setup template",
146+
network: 2,
147+
project_lead: "0d8d8869-3ed1-4fb4-b5c4-ff672888f5e2",
148+
}),
149+
});
150+
const data = await response.json();
151+
```
152+
153+
</template>
154+
</CodePanel>
155+
156+
<ResponsePanel status="201">
157+
158+
```json
159+
{
160+
"id": "550e8400-e29b-41d4-a716-446655440000",
161+
"name": "Mobile App Revamp",
162+
"description": "Project created from the Agile Project Setup template",
163+
"identifier": "MAR",
164+
"network": 2,
165+
"project_lead": "0d8d8869-3ed1-4fb4-b5c4-ff672888f5e2",
166+
"created_at": "2024-01-01T00:00:00Z",
167+
"updated_at": "2024-01-01T00:00:00Z"
168+
}
169+
```
170+
171+
</ResponsePanel>
172+
173+
</div>
174+
175+
</div>

docs/api-reference/project/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ Projects organize your team's work within a workspace. Each project contains wor
131131

132132
Default state which will be used when the issues will be auto closed
133133

134+
- `template_id` _uuid_
135+
136+
UUID of the project template used to create this project.
137+
134138
</div>
135139
<div class="api-right">
136140

0 commit comments

Comments
 (0)