tencent cloud

CreateStorageCredentials
Last updated: 2025-10-30 22:08:09
CreateStorageCredentials
Last updated: 2025-10-30 22:08:09

1. API Description

Domain name for API request: vod.intl.tencentcloudapi.com.

The API is used to generate access credentials for VOD professional applications, such as generating credentials for client uploads.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateStorageCredentials.
Version Yes String Common Params. The value used for this API: 2024-07-18.
Region No String Common Params. This parameter is not required.
SubAppId Yes Integer The ID of VOD Professional Application.
Policy Yes String The policy string serialized by URL Encode is used as the input parameter Policy. The server will URL Decode the Policy value and grant temporary access credentials according to the parsed policy. Please pass in parameters according to the specification.
Note:
1.The policy syntax refers to Cloud Access Management.
2.The policy cannot contain the principal element.
3.The policy actions include:
  • name/vod:ListObjects;
  • name/vod:ListObjectsV2;
  • name/vod:HeadObject;
  • name/vod:PutObject;
  • name/vod:ListParts;
  • name/vod:PostObject;
  • name/vod:CreateMultipartUpload;
  • name/vod:UploadPart;
  • name/vod:CompleteMultipartUpload;
  • name/vod:AbortMultipartUpload;
  • name/vod:ListMultipartUploads;
  • name/vod:CopyObject;
  • name/vod:RestoreObject;
  • name/vod:DeleteObjects;
  • name/vod:DeleteObject;
  • name/vod:UploadPartCopy.
  • 4.The resource format of the policy is qcs::vod:[region]:uid/[AppID]:prefix//[SubAppId]/[BucketId]/[Path], where AppID, SubAppId, BucketId and Path need to be filled in as required.
    DurationSeconds No Integer Specifies the validity period of credentials in seconds. The default value is 1800 seconds and the maximum value is 129600 seconds.

    3. Output Parameters

    Parameter Name Type Description
    Credentials Credentials Credentials.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Apply for credentials to upload a single file.

    Apply for credentials to upload a single file.

    Input Example

    {
      "SubAppId": 220209,
      "DurationSeconds": 7200,
      "Policy": "%7B%22statement%22%3A%5B%7B%22action%22%3A%5B%22name%2Fvod%3AInitiateMultipartUpload%22%2C%22name%2Fvod%3AListMultipartUploads%22%2C%22name%2Fvod%3AListParts%22%2C%22name%2Fvod%3AUploadPart%22%2C%22name%2Fvod%3ACompleteMultipartUpload%22%5D%2C%22effect%22%3A%22allow%22%2C%22resource%22%3A%5B%22qcs%3A%3Avod%3Aap-beijing%3Auid%2F251197738%3Aprefix%2F%2F220209%2Fa%2F001.png%22%5D%7D%5D%2C%22version%22%3A%222.0%22%7D"
    }

    Output Example

    {
        "Response": {
            "Credentials": {
                "SessionToken": "***********************************",
                "AccessKeyId": "***********************************",
                "SecretAccessKey": "***********************************",
                "Expiration": "2024-08-20T13:55:53Z"
            },
            "RequestId": "59a5e07e-4147-4d2e-a808-dca76ac5b3fd"
        }
    }

    Example2 Apply for credentials to upload multiple files

    Apply for credentials to upload multiple files.

    Input Example

    {
      "SubAppId": 220209,
      "DurationSeconds": 7200,
      "Policy": "%7B%22statement%22%3A%5B%7B%22action%22%3A%5B%22name%2Fvod%3AInitiateMultipartUpload%22%2C%22name%2Fvod%3AListMultipartUploads%22%2C%22name%2Fvod%3AListParts%22%2C%22name%2Fvod%3AUploadPart%22%2C%22name%2Fvod%3ACompleteMultipartUpload%22%5D%2C%22effect%22%3A%22allow%22%2C%22resource%22%3A%5B%22qcs%3A%3Avod%3Aap-beijing%3Auid%2F251197738%3Aprefix%2F%2F220209%2Fa%2F1024x1024.png%22%2C%22qcs%3A%3Avod%3Aap-beijing%3Auid%2F251197738%3Aprefix%2F%2F220209%2Fa%2Fb%2Fc%2F1042x1042.png%22%2C%22qcs%3A%3Avod%3Aap-beijing%3Auid%2F251197738%3Aprefix%2F%2F220209%2Fpath%2F2060.gif_wh300.gif%22%5D%7D%5D%2C%22version%22%3A%222.0%22%7D"
    }

    Output Example

    {
        "Response": {
            "Credentials": {
                "SessionToken": "***********************************",
                "AccessKeyId": "***********************************",
                "SecretAccessKey": "***********************************",
                "Expiration": "2024-08-20T13:55:53Z"
            },
            "RequestId": "59a5e07e-4147-4d2e-a808-dca76ac5b3fd"
        }
    }

    Example3 Apply for credentials to get all objects with a specified object key prefix in the bucket.

    Apply for credentials to get all objects with a specified object key prefix in the bucket.

    Input Example

    {
      "SubAppId": 220209,
      "DurationSeconds": 7200,
      "Policy": "%7B%22statement%22%3A%5B%7B%22action%22%3A%5B%22name%2Fvod%3AGetBucket%22%5D%2C%22effect%22%3A%22allow%22%2C%22resource%22%3A%5B%22qcs%3A%3Avod%3Aap-beijing%3Auid%2F251197738%3Aprefix%2F%2F220209%2F98gw6e1b4hds0zh%2F%22%5D%7D%5D%2C%22version%22%3A%222.0%22%7D"
    }

    Output Example

    {
        "Response": {
            "Credentials": {
                "SessionToken": "***********************************",
                "AccessKeyId": "***********************************",
                "SecretAccessKey": "***********************************",
                "Expiration": "2024-08-20T13:55:53Z"
            },
            "RequestId": "59a5e07e-4147-4d2e-a808-dca76ac5b3fd"
        }
    }

    Example4 Apply for credentials to automatically upload files nearby.

    Apply for credentials to automatically upload files nearby.

    Input Example

    {
      "SubAppId": 220209,
      "DurationSeconds": 7200,
      "Policy": "%7B%22statement%22%3A%5B%7B%22action%22%3A%5B%22name%2Fvod%3AInitiateMultipartUpload%22%2C%22name%2Fvod%3AListMultipartUploads%22%2C%22name%2Fvod%3AListParts%22%2C%22name%2Fvod%3AUploadPart%22%2C%22name%2Fvod%3ACompleteMultipartUpload%22%5D%2C%22effect%22%3A%22allow%22%2C%22resource%22%3A%5B%22qcs%3A%3Avod%3Aauto%3Auid%2F251197738%3Aprefix%2F%2F220209%2Fauto%2F001.png%22%5D%7D%5D%2C%22version%22%3A%222.0%22%7D"
    }

    Output Example

    {
        "Response": {
            "Credentials": {
                "SessionToken": "***********************************",
                "AccessKeyId": "***********************************",
                "SecretAccessKey": "***********************************",
                "Expiration": "2024-08-20T13:55:53Z"
            },
            "RequestId": "59a5e07e-4147-4d2e-a808-dca76ac5b3fd"
        }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

    Was this page helpful?
    You can also Contact Sales or Submit a Ticket for help.
    Yes
    No

    Feedback