Skip to content

Make S3 Upload File Token

  • Endpoint Path: /api/fresns/common/v1/file/upload-token
  • Method: POST
  • Request: application/json

Headers Optional Parameter

KeyPublic Mode (Required)Private Mode (Required)
X-Fresns-Aidrequiredrequired
X-Fresns-Aid-Tokenrequiredrequired
X-Fresns-Uidrequiredrequired
X-Fresns-Uid-Tokenrequiredrequired

Body Params

KeyTypeRequiredDescription
usageTypeStringrequiredFile usage type
usageFsidStringrequiredUsage target fsid
archiveCodeStringoptionalelementType File Archive
typeStringrequiredChoose one from image, video, audio, document
nameStringrequiredFile Name
mimeStringrequiredFile Mime Type
extensionStringrequiredFile Extension Name
sizeNumberrequiredin Byte
shaStringoptionalFile SHA
shaTypeStringoptionalFile SHA Type
widthNumberoptionalImage-Only, in px
heightNumberoptionalImage-Only, in px
durationNumberoptionalAudio or Video-Only, in Seconds
warningStringoptionalFile Warning none, nudity, violence, sensitive
moreInfoObjectoptional

Request Description

usageTypeusageFsidarchiveCode
userAvatarUser uidOrUsername
userBannerUser uidOrUsername
userArchiveUser uidOrUsernameArchive code
conversationReceives the user uidOrUsername
postPost ID pid
commentComment ID comment
postDraftPost Draft ID did
postDraftArchivePost Draft ID didArchive code
commentDraftComment Draft ID did
commentDraftArchiveComment Draft ID didArchive code

Return

json
{
    "code": 0,
    "message": "ok",
    "data": {
        "fid": "String / File ID",
        "type": "presignedUrl",
        "method": "String / Method",
        "url": "String / Upload Endpoint URL",
        "headers": "Object / Headers",
        "activeMinutes": "Number / Active Minutes",
        "expiration": "String / Expiration Datetime Y-m-d H:i:s" // UTC+0
    }
}

Released under the Apache-2.0 License