Get an Avatar Upload Credential

Gets the upload credential for uploading an avatar file. Upload the avatar file to the returned uploadUrl with the returned form fields first, and then pass the returned resourceId to the avatar setting APIs.

Request URL

POST {base_url}/uc-user/api/v1/users/avatar/upload-credential

Request parameters

Headers
Parameter Required Type Description
Authorization Yes String The access token used for authentication.

Format: Bearer {access_token}.

Body parameters
Parameter Required Type Description
fileName Yes String The original name of the avatar file, including the file name extension.

Response parameters

Parameter Type Description
requestId String The unique ID of the request, which can be used to quickly locate the request.
code String The HTTP status code of the request.
  • 200: Request succeeded.
  • Non-200 value: Request failed.
message String The status message of the request.
detailMessage String The detailed error information.

When the request is successful, this parameter returns empty.

result Object<Upload_Credential> The upload credential of the avatar file.
Upload_Credential
Parameter Type Description
resourceId String The resource ID of the avatar file.
uploadUrl String The URL that the upload request is sent to.
httpMethod String The HTTP method of the upload request. The value is POST.
formFields Object The form fields of the upload request. The key is the form field name (such as key, Content-Type, x-amz-algorithm, x-amz-credential, x-amz-date, policy, and x-amz-signature), and the value is the corresponding form field value.
expiresIn Integer The validity period of the credential, in seconds.

Example

Request example

POST /uc-user/api/v1/users/avatar/upload-credential HTTP/1.1
Host: api.cn.novoone.com
Authorization: Bearer eyJraWQiOiJjbi0wLWtleS0xIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJtdDEwMDBAbWFpbHN0YXIudG9wIiwiYXBwX2tleSI6Im9icWJUSWd1ZkJ5d3ZCNmF0VURmVDZpeDJvUlhUb0wzIiwiZ3JhbnRfdHlwZSI6Im9wZW5hcGkiLCJjbGllbnRfZXh0Ijp7ImRlc2NyaXB0aW9uIjoi56ys5LiJ5pa55ZCI5L2c5LyZ5Ly05bqU55SoIiwicGFydG5lciI6IuekuuS-i-WQiOS9nOS8meS8tCJ9LCJjbGllbnRfdHlwZSI6Im9wZW5hcGkiLCJleHAiOjE3OTIwNzU4MzksImlhdCI6MTc5MjA1NDIzOSwianRpIjoiNmIxNTdhMTItOTc3Mi00ZTQ3LWIzNDEtZGMzMzhlMzcwYWFkIiwiY2xpZW50X2lkIjoibm92by1vcGVuLXBsYXRmb3JtIiwidXNlcl9leHQiOnsicm9sZUlkcyI6WzNdLCJzdHlwZSI6IkFETUlOIiwidGVuYW50Q29kZSI6bnVsbCwidHlwZSI6IlBfQUNDT1VOVCIsInVzZXJJZCI6MjA4NTMxNTk0ODg0OTgyNzg0MiwiZW1haWwiOiJtdDEwMDBAbWFpbHN0YXIudG9wIiwidXNlcm5hbWUiOiJtdDEwMDBAbWFpbHN0YXIudG9wIiwidWNJZCI6MjA4NTMxNTk0ODI4Nzc5MTEwNn19.bayAAcd25Y7rW9a0eWF0uHP6IBJHaiG5PfnclIIB-JOHY-WVQM_zGlBe8EinHuvzpvDnF9VtPtW_5VN_RvYCmRFjxRtHU8ygl-ktznZpqtMZSAmXeBnJJkhCzPeM6eS7mF29dk5l016E2PUiDgXqsG5ZS-e_r1SCaNHdqLik60AQDoyiKVT7hDTSaXaVqD2NmDdjm3S2-hClC8VB0NdnPot0qd-Kv6CrVDnZ5TuMdAQ0cm_qG81PLxB4To4kwqyi_G2LBcYiqoFfZXK6BMJo2_N4xP7bEvcZ5HT1Qy2s1yW42jk5kkvjfhUFfrvZcswoFuuLuw870ngG_ahD95xV7A
Content-Type: application/json
{
  "fileName": "aitdoc-b2.png"
}

Response example

HTTP/1.1 200 OK
{
  "result": {
    "resourceId": "2110654582913515522",
    "uploadUrl": "https://tst-client-hosted-0-business-992382618242-ap-east-1-an.s3.ap-east-1.amazonaws.com",
    "httpMethod": "POST",
    "formFields": {
      "key": "public/platform/_GLOBAL/user_avatar/1792054241283/aitdoc-b2.png",
      "Content-Type": "image/png",
      "x-amz-algorithm": "AWS4-HMAC-SHA256",
      "x-amz-credential": "AKIA6ODU5BKBMSDIXP4N/20261015/ap-east-1/s3/aws4_request",
      "x-amz-date": "20261015T085041Z",
      "policy": "eyJleHBpcmF0aW9uIjoiMjAyNi0xMC0xNVQwOTowNTo0MVoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJ0c3QtY2xpZW50LWhvc3RlZC0wLWJ1c2luZXNzLTk5MjM4MjYxODI0Mi1hcC1lYXN0LTEtYW4ifSx7ImtleSI6InB1YmxpYy9wbGF0Zm9ybS9fR0xPQkFML3VzZXJfYXZhdGFyLzE3OTIwNTQyNDEyODMvYWl0ZG9jLWIyLnBuZyJ9LHsiQ29udGVudC1UeXBlIjoiaW1hZ2UvcG5nIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCwxMDQ4NTc2XSx7IngtYW16LWFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IngtYW16LWNyZWRlbnRpYWwiOiJBS0lBNk9EVTVCS0JNU0RJWFA0Ti8yMDI2MTAxNS9hcC1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJ4LWFtei1kYXRlIjoiMjAyNjEwMTVUMDg1MDQxWiJ9XX0=",
      "x-amz-signature": "12659c7a4a274bced4560e945bf10ad9e6e720e1cdcfc6853876f1f90de6615d"
    },
    "expiresIn": 900
  },
  "requestId": "205d0f60c1337d051ededdb89f85b3d8",
  "code": "200",
  "message": "SUCCESS"
}