Upload an asset (base64)
$client->assets->uploadBase64(string content, ?string fileName, ?string mimeType): AssetUploadBase64Response
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.
Parameters
content: string
Base64-encoded file content (max ~500MB decoded)
fileName?:optional string
Original filename. Generated if omitted
mimeType?:optional string
MIME type. Auto-detected from magic bytes if omitted
Returns
Upload an asset (base64)
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client();
$response = $client->assets->uploadBase64(
content: 'x', fileName: 'fileName', mimeType: 'mimeType'
);
var_dump($response);{
"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
}