Skip to content

Latest commit

 

History

History
157 lines (116 loc) · 3.09 KB

File metadata and controls

157 lines (116 loc) · 3.09 KB
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

POST /api/v1/assets/user-assets/

Generate presigned URL for user asset upload

Body Parameters

Original filename of the asset

MIME type of the file

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

File size in bytes

Type of user asset

  • USER_AVATAR - User Avatar
  • USER_COVER - User Cover

Scopes

assets:write

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"
}'
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())
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();
{
  "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"
    }
  }
}