tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Creating a Quota

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 14:27:58

Description

Create quota.
Note:
Required permission: admin. For details about permissions, see Generate Access Token API.
When a file that is about to exceed the quota is uploaded in a Tenant Space with configured quotas, the QuotaLimitReached error code will be returned.
The remaining space in the Tenant Space is not updated in real-time. When the system load is high, there may be significant update delays, which could lead to unexpectedly exceeding the quota. If the automatic deletion option for exceeding the quota is configured, it may further result in old files being deleted.

Request

Request Example

POST /api/v1/quota/{LibraryId}?access_token={AccessToken}&user_id={UserId}
Request Parameters:
Request parameters.
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library in the media hosting console. See Create Media Library
String
Yes
AccessToken
Access token. For Public Read Media Library or tenant space, this parameter is not specified, otherwise you must specify this parameter. See Generate Access Token
String
No
UserId
User identity recognition. When the access token corresponds to admin permission and the user identity recognition during token application is empty, it is used to temporarily specify user identity. For details, see Generate Access Token API.
String
No

Request Body

application/json, specify tenant space (only for multi-tenant space media library) and quota value.
Request body example:
{
"spaces": [ "space111", "space222" ],
"capacity": "1099511627776",
"removeWhenExceed": true,
"removeAfterDays": 30,
"removeNewest": false
}
Request body field description:
Request parameters.
Description
Type
Required or Not
spaces
For multi-tenant space media libraries, specify the tenant space covered by the quota to control multiple tenant space quotas at the same time. Empty arrays are not supported. For single-tenant spaces, this field cannot be specified.
Array
No
capacity
The specific value of the quota, in bytes (Byte), can be specified in digital form or string form. To avoid precision loss from large numbers, it is advisable to specify this field in string form.
String
No
removeWhenExceed
When set to false, the quota is only used to determine whether there is sufficient space for uploading, and no deletion cleanup operation will be performed for space that has already exceeded the limit.
When set to true, creating a quota will check the current storage capacity. If the capacity has exceeded the limit, files will start being deleted after the removeAfterDays number of days is reached to ensure storage remains under the quota. The earliest files are deleted by default. If removeNewest is set to true, the latest files will be deleted. Required parameter.
Boolean
No
removeAfterDays
The number of days to wait before performing file deletion when the stored amount exceeds the limit
Int
Yes
removeNewest
Whether to start deleting from the latest file, default to false (start from the oldest file)
Boolean
No

Response

Response code

Creation succeeded, return HTTP 201 Created.

Response Body

application/json
Response body example:
{ "quotaId": 1 }
Response body field description:
Response Parameters
Description
Type
quotaId
Quota ID, used for follow-up queries of detailed information, modifying quota values, or deleting quota.
Int

Error Codes

This request operation has no special error messages. For common error messages, see Error Codes.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan