The Get Upload Policy API provides the necessary authentication parameters and destination details required for the Upload API. While our AI services can fetch files from your own servers, using our optimized Storage service ensures faster, more stable downloads for large or slow-loading files.
Note on Storage: This service is provided free of charge to support AI processing. Uploaded files are intended for temporary use and are guaranteed to be available for at least one day.
data object to authorize your direct upload to the cloud storage bucket.Enum: application/json
Bearer authentication token. Example: Bearer {{APIKey}}.
The upload scenario which determines the storage strategy. Currently supported: Dream-CN (utilizes Alibaba Cloud OSS). Future regions/providers may be added.
Returns 0 for success, or a specific error code.
Returns "success" or a descriptive error message.
The Access Key ID used for authentication. Maps directly to the OSSAccessKeyId field in the Upload API request.
The Base64 encoded upload policy defining constraints like expiration and file size.
The digital signature verifying the request.
The full object key (directory path + filename) where the file will be stored. Maps directly to the key field in the Upload API request.
The endpoint URL of the Object Storage Service (OSS) server.
The duration (in seconds) for which this policy remains valid.
The encoded callback configuration for the server.
The unique request identifier.
curl -X POST 'https://api.newportai.com/api/file/v1/get_policy' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
"scene": "Dream-CN"
}'{
"code": 0,
"message": "success",
"data": {
"OSSAccessKeyId": "LTAI5tF1QzxoHGvEcziVACyc",
"policy": "eyJ0leHBpcmF0aW9uIjoiMjAyNC0xMS0xOVQwODo0NDo0OC42MzZaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsNTM2ODcwOTEyMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ0bXBcL2RyZWFtXC8yMDI0LTExLTE5XC81MzY5MjA3ODIwOTg5MDAyXC8iXV19",
"signature": "G2TzrhlybemHbfFakysY4j2EI2I=",
"key": "tmp/dream/2024-11-19/5369207820989002/f6915012-8e3a-4fb1-a1e6-64c3f4fd4797",
"host": "https://dreamapi-oss.oss-cn-hongkong.aliyuncs.com",
"expire": "1732005888",
"callback": "eyJ0jYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9uZXdwb3J0YWkuY29tL3ByZS1haWdjLXByaW50LTJiL2ZpbGUvdjEvY2FsbGJhY2siLCJjYWxsYmFja0JvZHkiOiJ7XCJmaWxlbmFtZVwiOiR7b2JqZWN0fSxcInNpemVcIjoke3NpemV9LFwibWltZVR5cFwiOiR7bWltZVR5cGV9LFwiaGVpZ2h0XCI6JHtpbWFnZUluZm8uaGVpZ2h0fSxcIndpZHRoXCI6JHtpbWFnZUluZm8ud2lkdGh9LFwiYnVja2V0XCI6JHtidWNrZXR9LFwiZXRhZ1wiOiR7ZXRhZ30sXCJmb3JtYXRcIjoke2ltYWdlSW5mby5mb3JtYXR9LFwiY29udGVudE1kNVwiOiR7Y29udGVudE1kNX0sXCJjbGllbnRJcFwiOiR7Y2xpZW50SXB9LFwicmVxSWRcIjoke3JlcUlkfSxcIm9wZXJhdGlvblwiOiR7b3BlcmF0aW9ufSxcImJpeklkXCI6XCJmNjkxNTAxMi04ZTNhLTRmYjEtYTFlNi02NGMzZjRmZDQ3OTdcIn0ifQ==",
"reqId": "f6915012-8e3a-4fb1-a1e6-64c3f4fd4797"
}
}