Skip to content
Download Beeper

Upload an asset

client.Assets.Upload(ctx, body) (*AssetUploadResponse, error)
POST/v1/assets/upload

Upload a file to a temporary location using multipart/form-data. Returns an uploadID that can be referenced when sending messages with attachments.

ParametersExpand Collapse
body AssetUploadParams
File param.Field[Reader]

The file to upload (max 500 MB).

FileName param.Field[string]optional

Original filename. Defaults to the uploaded file name if omitted

MimeType param.Field[string]optional

MIME type. Auto-detected from magic bytes if omitted

ReturnsExpand Collapse
type AssetUploadResponse struct{…}
Duration float64optional

Duration in seconds (audio/videos)

Error stringoptional

Error message if upload failed

FileName stringoptional

Resolved filename

FileSize float64optional

File size in bytes

Height float64optional

Height in pixels (images/videos)

MimeType stringoptional

Detected or provided MIME type

SrcURL stringoptional

Local file URL (file://) for the uploaded asset

UploadID stringoptional

Unique upload ID for this asset

Width float64optional

Width in pixels (images/videos)

Upload an asset

package main

import (
  "bytes"
  "context"
  "fmt"
  "io"

  "github.com/beeper/desktop-api-go"
)

func main() {
  client := beeperdesktopapi.NewClient(

  )
  response, err := client.Assets.Upload(context.TODO(), beeperdesktopapi.AssetUploadParams{
    File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Width)
}
{
  "duration": 0,
  "error": "error",
  "fileName": "fileName",
  "fileSize": 0,
  "height": 0,
  "mimeType": "mimeType",
  "srcURL": "srcURL",
  "uploadID": "uploadID",
  "width": 0
}
Returns Examples
{
  "duration": 0,
  "error": "error",
  "fileName": "fileName",
  "fileSize": 0,
  "height": 0,
  "mimeType": "mimeType",
  "srcURL": "srcURL",
  "uploadID": "uploadID",
  "width": 0
}