tencent cloud

APIs

Common Request Headers

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-05-19 15:45:24

Description

This document introduces the common Request headers used when APIs are used. The headers mentioned here will not be described again in subsequent specific API documentation.

Request Header List

Header Name
Description
Type
Required
Authorization
Signature information that carries authentication credentials for verifying request legitimacy.
This header is optional for publicly readable objects and is also not required if authentication information is passed via request parameters. For details, see the Request Signature document.
string
Yes,
This header is optional for publicly readable objects or if authentication information is passed via request parameters.
Content-Length
HTTP request content length (in bytes) as defined in RFC 2616.
integer
For PUT and POST requests (excluding PUT Object requests that specify the Transfer-Encoding header), it is strongly recommended to include this header.
This header cannot be specified for GET, HEAD, DELETE, and OPTIONS requests.
Content-Type
HTTP request content type (MIME) as defined in RFC 2616, for example, application/xml or image/jpeg.
string
For PUT and POST requests that have a request body, this header is required.
This header cannot be specified for GET, HEAD, DELETE, and OPTIONS requests.
Content-MD5
Base64-encoded form of the 16-byte (128-bit) binary MD5 hash value of the request body content as defined in RFC 1864. It is used for integrity checks to verify whether the request body has changed during transmission. The final value length should be 24 characters. Ensure that you use the correct methods and parameters when writing code, for example, ZzD3iDJdrMAAb00lgLLeig==.
string
For PUT and POST requests that have a request body (excluding POST Object), this header is required.
This header cannot be specified for GET, HEAD, DELETE, and OPTIONS requests.
Date
Current time in GMT format as defined in RFC 1123, for example, Wed, 29 May 2019 04:10:12 GMT.
string
No
Host
The host of the request, in the format <BucketName-APPID>.cos.<Region>.myqcloud.com.
string
Yes
x-cos-security-token
The security token field that must be passed when temporary security credentials are used. For details, see the Temporary Security Credentials documentation.
string
No,
This header is required when a temporary key is used and authentication information is carried via Authorization.

Special Headers for SSE

For APIs supporting server-side encryption (SSE), the following request headers apply to different encryption methods. See API-specific documents to determine whether SSE is applicable. Whether these headers are required only applies to scenarios using SSE. If the request is for an API that does not support SSE or does not use SSE, these headers do not need to be included. For details, see Server-side Encryption Overview.

SSE-COS

Header Name
Description
Type
Required
x-cos-server-side-encryption
Server-side encryption algorithm, specified as AES256 or SM4 when SSE-COS is used.
AES256 indicates the use of SSE-COS mode, where the encryption algorithm is AES256.
SM4 indicates the use of SSE-COS mode, where the encryption algorithm is SM4.
string
If this header is included when you upload or copy objects (including simple upload/copy and multipart upload/copy), SSE-COS encryption is used. If this header is not included, encryption is performed according to the bucket encryption configuration. This header cannot be specified when you download objects.

SSE-KMS

Header Name
Description
Type
Required
x-cos-server-side-encryption
SSE algorithm, which is set to cos/kms when SSE-KMS is used.
string
If this header is carried during object upload or copying (including simple upload/copy and multipart upload/copy), SSE-KMS is used. If this header is not carried, encryption is performed based on the bucket encryption configuration. This header should not be specified when objects are downloaded.
x-cos-server-side-encryption-cos-kms-algorithm
Specifies the KMS encryption algorithm when x-cos-server-side-encryption is set to cos/kms. Supported values: AES256, SM4. Uses AES256 by default if not specified.
string
No
x-cos-server-side-encryption-cos-kms-key-id
CMK of the KMS when x-cos-server-side-encryption is set to cos/kms. If it is not specified, the CMK created by COS by default is used. For details, see SSE-KMS Encryption.
string
No
x-cos-server-side-encryption-context
Encryption context when x-cos-server-side-encryption is set to cos/kms. The value is the Base64-encoded key-value pair of the encryption context in JSON format,
for example, eyJhIjoiYXNkZmEiLCJiIjoiMTIzMzIxIn0=.
string
No

SSE-C

Header Name
Description
Type
Required
x-cos-server-side-encryption-customer-algorithm
Encryption algorithm for SSE-C mode, currently supporting AES256 and SM4 (newly added).
string
Yes
x-cos-server-side-encryption-customer-key
Base64-encoded SSE key,
for example, MDEyMzQ1Njc4OUFCQ0RFRjAxMjM0NTY3ODlBQkNERUY=.
string
Yes
x-cos-server-side-encryption-customer-key-MD5
Base64-encoded MD5 hash value of the SSE key,
for example, U5L61r7jcwdNvT7frmUG8g==.
string
Yes


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan