CreateApiKey
Creates a custom API key.
Operation description
Applicable engines
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
rdsai:CreateApiKey |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
No |
The instance name. |
rds_copilot***_public_cn-*********6 |
| Quantity |
integer |
No |
The number of API keys to create. Default value: 1. |
1 |
| KeyName |
string |
No |
The name of the API key. |
api-***** |
| LimitType |
string |
No |
The quota limit type. Valid values:
Valid values:
|
fixed |
| LimitRate |
number |
No |
The quota limit percentage. |
0.2 |
| TokenQuota |
integer |
No |
The token quota for the current key. |
100000 |
| DailyTokenQuota |
integer |
No |
The daily token quota for the API key. |
1000000000 |
| RoleName |
string |
No |
||
| RoleArn |
string |
No |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
FE9C65D7-930F-57A5-A207-8C396329**** |
| Success |
boolean |
The request result. |
true |
| Message |
string |
The returned message. |
success |
| Data |
object |
The returned data. |
|
| CustomKeyList |
array<object> |
The list of custom API keys. |
|
|
object |
|||
| ApiKey |
string |
Api Key |
sk-rds-***** |
| KeyName |
string |
The name of the API key. |
api-***** |
| TokenQuota |
integer |
The token quota for the current key. |
100000 |
| DailyTokenQuota |
integer |
The daily token quota for the API key. |
0 |
| LimitType |
string |
The quota limit type. Valid values:
|
fixed |
| LimitRate |
number |
The quota limit percentage. |
0.2 |
| RoleArn |
string |
||
| BaseUrl |
string |
The URL for model invocation. |
http://xxx.yy/v1 |
| SystemApiKey |
string |
The system-generated key. |
sk-rds-xxx |
Examples
Success response
JSON format
{
"RequestId": "FE9C65D7-930F-57A5-A207-8C396329****",
"Success": true,
"Message": "success",
"Data": {
"CustomKeyList": [
{
"ApiKey": "sk-rds-*****",
"KeyName": "api-*****",
"TokenQuota": 100000,
"DailyTokenQuota": 0,
"LimitType": "fixed",
"LimitRate": 0.2,
"RoleArn": ""
}
],
"BaseUrl": "http://xxx.yy/v1",
"SystemApiKey": "sk-rds-xxx"
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidIpWhitelistError | Invalid IP address or CIDR in whitelist. | The IP address or CIDR block in the whitelist is invalid. |
| 400 | DomainNotReadyError | Domain is not ready yet, please try again later. | The domain name is not ready. |
| 400 | InstanceQuotaExceededError | Instance quota exceeded, cannot create new API key. | The instance quota is exhausted, and no new API keys can be created. |
| 400 | CustomKeyLimitExceededError | Custom key limit exceeded. | The maximum number of custom keys has been exceeded. |
| 400 | InstanceNotFoundError | No active instance found. | No active instance was found. |
| 400 | InvalidQuotaValueError | LimitType must be fixed or ratio. TokenQuota must be a positive integer and limitRate must be between 0.0 and 1.0. | The key quota parameter is invalid. |
| 400 | QuotaSumExceededError | Sum of custom key quotas exceeds instance total quota. | The total quota of custom keys exceeds the total quota of the instance. |
| 400 | MoPostpayRatioNotAllowedError | Ratio mode is not supported for POSTPAY instances. Use 'fixed' mode instead. | Pay-as-you-go instances do not support the proportional quota mode. |
| 400 | MoProLikeCustomKeyNotAllowed | Custom API keys are not supported for Pro or Enterprise instances. | Custom API keys are not supported for Pro or Enterprise instances. |
| 400 | InvalidQuantityError | Invalid quantity: must be an integer between 1 and 50. | The quantity must be an integer from 1 to 50. |
| 403 | InvalidUserOrder | There is no valid order for this UID. | There is no valid order for this UID |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.