Skip to content
Download Beeper

Upload an asset (base64)

client.Assets.UploadBase64(ctx, body) (*AssetUploadBase64Response, error)
POST/v1/assets/upload/base64

Upload a file using a JSON body with base64-encoded content. Returns an uploadID that can be referenced when sending messages with attachments. Alternative to the multipart upload endpoint.

ParametersExpand Collapse
body AssetUploadBase64Params
Content param.Field[string]

Base64-encoded file content (max ~500MB decoded)

minLength1
maxLength750000000
FileName param.Field[string]Optional

Original filename. Generated if omitted

MimeType param.Field[string]Optional

MIME type. Auto-detected from magic bytes if omitted

ReturnsExpand Collapse
type AssetUploadBase64Response 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 (base64)

package main

import (
  "context"
  "fmt"

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

func main() {
  client := beeperdesktopapi.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Assets.UploadBase64(context.TODO(), beeperdesktopapi.AssetUploadBase64Params{
    Content: "x",
  })
  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
}