Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
253 changes: 199 additions & 54 deletions docs/.vitepress/config.mts

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions docs/api-reference/assets/create-user-asset-upload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
title: Create user asset upload
description: Create user asset upload via Plane API. HTTP request format, parameters, scopes, and example responses for create user asset upload.
keywords: plane, plane api, rest api, api integration, assets, create user asset upload
---

# Create user asset upload

<div class="api-endpoint-badge">
<span class="method post">POST</span>
<span class="path">/api/v1/assets/user-assets/</span>
</div>

<div class="api-two-column">
<div class="api-left">

Generate presigned URL for user asset upload

<div class="params-section">

### Body Parameters

<div class="params-list">

<ApiParam name="name" type="string" :required="true">

Original filename of the asset

</ApiParam>

<ApiParam name="type" type="string" :required="false">

MIME type of the file

- `image/jpeg` - JPEG
- `image/png` - PNG
- `image/webp` - WebP
- `image/jpg` - JPG
- `image/gif` - GIF

</ApiParam>

<ApiParam name="size" type="integer" :required="true">

File size in bytes

</ApiParam>

<ApiParam name="entity_type" type="string" :required="true">

Type of user asset

- `USER_AVATAR` - User Avatar
- `USER_COVER` - User Cover

</ApiParam>

</div>
</div>

<div class="params-section">

### Scopes

`assets:write`

</div>

</div>

<div class="api-right">

<CodePanel title="Create user asset upload" :languages="['cURL', 'Python', 'JavaScript']">
<template #curl>

```bash
curl -X POST \
"https://api.plane.so/api/v1/assets/user-assets/" \
-H "X-API-Key: $PLANE_API_KEY" \
# Or use -H "Authorization: Bearer $PLANE_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Example Name",
"type": "image/jpeg",
"size": 1024000,
"entity_type": "USER_AVATAR"
}'
```

</template>
<template #python>

```python
import requests

response = requests.post(
"https://api.plane.so/api/v1/assets/user-assets/",
headers={"X-API-Key": "your-api-key"},
json={
"name": "Example Name",
"type": "image/jpeg",
"size": 1024000,
"entity_type": "USER_AVATAR"
}
)
print(response.json())
```

</template>
<template #javascript>

```javascript
const response = await fetch("https://api.plane.so/api/v1/assets/user-assets/", {
method: "POST",
headers: {
"X-API-Key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Example Name",
type: "image/jpeg",
size: 1024000,
entity_type: "USER_AVATAR",
}),
});
const data = await response.json();
```

</template>
</CodePanel>

<ResponsePanel status="200">

```json
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"asset_url": "/api/assets/v2/static/550e8400-e29b-41d4-a716-446655440000/",
"upload_data": {
"url": "https://uploads.example.com/plane-bucket",
"fields": {
"Content-Type": "image/png",
"key": "user-assets/550e8400-e29b-41d4-a716-446655440000/profile-image.png",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "example/20240101/us-east-1/s3/aws4_request",
"x-amz-date": "20240101T000000Z",
"policy": "example-policy",
"x-amz-signature": "example-signature"
}
}
}
```

</ResponsePanel>

</div>

</div>
181 changes: 181 additions & 0 deletions docs/api-reference/assets/create-workspace-asset-upload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
title: Create workspace asset upload
description: Create workspace asset upload via Plane API. HTTP request format, parameters, scopes, and example responses for create workspace asset upload.
keywords: plane, plane api, rest api, api integration, assets, create workspace asset upload
---

# Create workspace asset upload

<div class="api-endpoint-badge">
<span class="method post">POST</span>
<span class="path">/api/v1/workspaces/{slug}/assets/</span>
</div>

<div class="api-two-column">
<div class="api-left">

Generate presigned URL for generic asset upload

<div class="params-section">

### Path Parameters

<div class="params-list">

<ApiParam name="slug" type="string" :required="true">

Workspace slug

</ApiParam>

</div>
</div>

<div class="params-section">

### Body Parameters

<div class="params-list">

<ApiParam name="name" type="string" :required="true">

Original filename of the asset

</ApiParam>

<ApiParam name="type" type="string" :required="false">

MIME type of the file

</ApiParam>

<ApiParam name="size" type="integer" :required="true">

File size in bytes

</ApiParam>

<ApiParam name="project_id" type="string" :required="false">

UUID of the project to associate with the asset

</ApiParam>

<ApiParam name="external_id" type="string" :required="false">

External identifier for the asset (for integration tracking)

</ApiParam>

<ApiParam name="external_source" type="string" :required="false">

External source system (for integration tracking)

</ApiParam>

</div>
</div>

<div class="params-section">

### Scopes

`assets:write`

</div>

</div>

<div class="api-right">

<CodePanel title="Create workspace asset upload" :languages="['cURL', 'Python', 'JavaScript']">
<template #curl>

```bash
curl -X POST \
"https://api.plane.so/api/v1/workspaces/my-workspace/assets/" \
-H "X-API-Key: $PLANE_API_KEY" \
# Or use -H "Authorization: Bearer $PLANE_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Example Name",
"type": "image/jpeg",
"size": 1024000,
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"external_id": "550e8400-e29b-41d4-a716-446655440000",
"external_source": "github"
}'
```

</template>
<template #python>

```python
import requests

response = requests.post(
"https://api.plane.so/api/v1/workspaces/my-workspace/assets/",
headers={"X-API-Key": "your-api-key"},
json={
"name": "Example Name",
"type": "image/jpeg",
"size": 1024000,
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"external_id": "550e8400-e29b-41d4-a716-446655440000",
"external_source": "github"
}
)
print(response.json())
```

</template>
<template #javascript>

```javascript
const response = await fetch("https://api.plane.so/api/v1/workspaces/my-workspace/assets/", {
method: "POST",
headers: {
"X-API-Key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Example Name",
type: "image/jpeg",
size: 1024000,
project_id: "550e8400-e29b-41d4-a716-446655440000",
external_id: "550e8400-e29b-41d4-a716-446655440000",
external_source: "github",
}),
});
const data = await response.json();
```

</template>
</CodePanel>

<ResponsePanel status="200">

```json
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"asset_url": "/api/assets/v2/workspaces/my-workspace/projects/None/issues/None/attachments/550e8400-e29b-41d4-a716-446655440000/",
"upload_data": {
"url": "https://uploads.example.com/plane-bucket",
"fields": {
"Content-Type": "image/png",
"key": "workspace-assets/550e8400-e29b-41d4-a716-446655440000/workspace-image.png",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "example/20240101/us-east-1/s3/aws4_request",
"x-amz-date": "20240101T000000Z",
"policy": "example-policy",
"x-amz-signature": "example-signature"
}
}
}
```

</ResponsePanel>

</div>

</div>
Loading
Loading