--- title: "임시 자격 증명 역할 전환" slug: "switch-role" tags: ["Secure Token Service"] updated: 2026-09-17T09:16:38Z published: 2026-09-17T09:16:38Z canonical: "api.ncloud-docs.com/switch-role" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # 임시 자격 증명 역할 전환 Classic/VPC 환경에서 이용 가능합니다. switchRole 정책을 부여하여 역할을 전환한 임시 자격 증명을 생성합니다. 참고 역할 전환과 switchRole 정책에 대한 자세한 설명은 Sub Account 사용 가이드의 [정책 및 역할 관리](https://guide.ncloud-docs.com/docs/subaccount-policy-role)를 참조해 주십시오. ## 요청 요청 형식을 설명합니다. 요청 형식은 다음과 같습니다. | 메서드 | URI | | --- | --- | | POST | /api/v1/switch-role | ### 요청 헤더 Secure Token Service API에서 공통으로 사용하는 헤더에 대한 정보는 [Secure Token Service 요청 헤더](/docs/management-sts#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94)를 참조해 주십시오. ### 요청 바디 요청 바디에 대한 설명은 다음과 같습니다. | 필드 | 타입 | 필수 여부 | 설명 | | --- | --- | --- | --- | | `roleNrn` | String | Required | 전환하려는 역할의 NRN | | `durationSec` | Integer | Optional | Access Key 유효 시간(초) - 600~43200 (기본값: 3600) | | `serialNumber` | String | Optional | 시리얼 번호 - OTP 디바이스 NRN \| MFA 시리얼 번호 | | `tokenCode` | Integer | Optional | OTP 인증 번호 | ### 요청 예시 요청 예시는 다음과 같습니다. ``` curl --location --request POST 'https://sts.apigw.ntruss.com/api/v1/switch-role' \ --header 'x-ncp-apigw-timestamp: {Timestamp}' \ --header 'x-ncp-iam-access-key: {Access Key}' \ --header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \ --header 'Content-Type: application/json' \ --data '{ "roleNrn": "nrn:PUB:IAM::*****:Role/******************" }' ``` ## 응답 응답 형식을 설명합니다. ### 응답 바디 응답 바디에 대한 설명은 다음과 같습니다. | 필드 | 타입 | 필수 여부 | 설명 | | --- | --- | --- | --- | | `switchedRole` | String | - | 전환된 역할의 NRN | | `credentials` | Object | - | 역할 전환 결과 | | `credentials.accessKey` | String | - | Access Key | | `credentials.keySecret` | String | - | Secret Key | | `credentials.createTime` | String | - | 생성 일자 - ISO 8601 형식 | | `credentials.expireTime` | String | - | 만료 일자 - ISO 8601 형식 | | `credentials.useMfa` | Boolean | - | MFA 인증 여부 - `true` \| `false` - `true`: 인증 - `false`: 인증 안 함 | ### 응답 상태 코드 Secure Token Service API에서 공통으로 사용하는 응답 상태 코드에 대한 정보는 [Secure Token Service 응답 상태 코드](/docs/management-sts#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C)를 참조해 주십시오. ### 응답 예시 응답 예시는 다음과 같습니다. ``` { "switchedRole": "nrn:PUB:IAM::*****:Role/******************", "credentials": { "accessKey": "ncp_iam_***************", "keySecret": "ncp_iam_**********************", "createTime": "2024-10-10T16:58:28Z", "expireTime": "2024-10-10T17:58:28Z", "useMfa": false } } ```