# Obtain temporary identity credentials for the role played - AssumeRole

## Overview

Obtain temporary identity credentials for the role played






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `AssumeRole`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RoleUrn** | string | The URN of the IAM role to be assumed. |**Yes**|
| **RoleSessionName** | string | Role session name. The format allows 1-64 characters composed of letters, numbers, underscores (_), hyphens (-), and English periods (.). |**Yes**|
| **DurationSeconds** | int | Token validity period, unit: seconds. The minimum value is 900, and the maximum value is limited by the maximum session time configured for the role. |No|
| **Policy** | string | An additional permission policy added for the STS Token, further limiting the permissions of the STS Token. |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **Credentials** | [*Credentials*](#credentials) | Access Token. |No|

#### Data Model


#### Credentials

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **SecurityToken** | string | Security Token. |**Yes**|
| **AccessKeyId** | string | Key ID. |**Yes**|
| **AccessKeySecret** | string | Secret Key. |**Yes**|
| **Expiration** | string | Token expiration time (UTC time). |**Yes**|

## Example

### Request Example
    
```
https://api.scloudsg.com/?Action=AssumeRole
&RoleUrn=FwesBQjA
&RoleSessionName=jFbSZIhm
&DurationSeconds=1
&Policy=BhQicCmh
```

### Response Example
    
```json
{
  "Action": "AssumeRoleResponse",
  "Credentials": {},
  "RetCode": 0
}
```





