Creates a service credential for a Resource Access Management (RAM) user in a specified cloud service.
Try it now
Test
RAM authorization
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| UserPrincipalName |
string |
No |
The logon name of the RAM user. If this parameter is left empty, a service credential is created for the current user by default. |
test@example.onaliyun.com |
| ServiceName |
string |
Yes |
The Alibaba Cloud service name. |
xxx.aliyuncs.com |
| ServiceCredentialName |
string |
Yes |
The service credential name. The name must be 1 to 128 characters in length and can contain letters, digits, periods (.), hyphens (-), and underscores (_). |
yourServiceCredentialName |
| CredentialAgeDays |
integer |
No |
The expiration time of the service credential, in days. Valid values: 1 to 36600. If this parameter is not specified, the service credential is permanently valid. |
30 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
81313F5E-3C85-478F-BCC9-E1B70E4556DB |
| ServiceCredential |
object |
The service credential information. |
|
| ServiceName |
string |
The Alibaba Cloud service name. |
xxx.aliyuncs.com |
| UserPrincipalName |
string |
The logon name of the RAM user. |
test@example.onaliyun.com |
| ServiceCredentialName |
string |
The service credential name. |
yourServiceCredentialName |
| ServiceCredentialId |
string |
The service credential ID. |
SC************* |
| CreateTime |
string |
The time when the service credential was created. |
2026-01-01T10:05:24Z |
| ExpirationTime |
string |
The expiration time of the service credential. This field is not returned for permanently valid service credentials. |
2026-02-01T10:05:24Z |
| Status |
string |
The status of the service credential. |
Active |
| ServiceCredentialSecret |
string |
The secret of the service credential. |
yourServiceCredentialSecret |
Examples
Success response
JSON format
{
"RequestId": "81313F5E-3C85-478F-BCC9-E1B70E4556DB",
"ServiceCredential": {
"ServiceName": "xxx.aliyuncs.com",
"UserPrincipalName": "test@example.onaliyun.com",
"ServiceCredentialName": "yourServiceCredentialName",
"ServiceCredentialId": "SC*************",
"CreateTime": "2026-01-01T10:05:24Z",
"ExpirationTime": "2026-02-01T10:05:24Z",
"Status": "Active",
"ServiceCredentialSecret": "yourServiceCredentialSecret"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.