--- title: "Generate Random Secret" slug: "secretmanager-generate-random-secret" updated: 2026-09-17T10:25:43Z published: 2026-09-17T10:25:43Z canonical: "api.ncloud-docs.com/secretmanager-generate-random-secret" --- > ## 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. # Generate Random Secret Available in VPC Generate a random string that can be used as a secret value. The random string can be generated by adding conditions such as whether it contains English letters, numbers, special characters, or spaces, and can be specified as the secret value for the Pending stage in [Update Pending Stage](/docs/en/secretmanager-update-pending-stage) after it is generated. For more information on how to automatically populate the secret rotation target value and register it as a Pending stage, see [Add Pending Stage](/secretmanager-add-pending-stage). ## Request This section describes the request format. The method and URI are as follows: | Method | URI | | --- | --- | | POST | /action/v1/secrets/{secretId}/jobs/{jobToken}/generate-random-secret | ### Request headers For information about the headers common to all Secret Manager APIs, see [Secret Manager request headers](/docs/en/secretmanager-api-overview#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94). ### Request path parameters You can use the following path parameters with your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `secretId` | String | Required | Secret ID - See [Get Secret List](/docs/en/secretmanager-getsecretlist) or [Get Secret Logs](/docs/en/secretmanager-getsecretlogs). - Automatically injected into the application that fired the trigger, visible as an environment variable. - See [Secret rotation action example code](https://guide.ncloud-docs.com/docs/en/secretmanager-rotate-action#%EC%8B%9C%ED%81%AC%EB%A6%BF-%EA%B5%90%EC%B2%B4-%EC%95%A1%EC%85%98-%EC%98%88%EC%A0%9C-%EC%BD%94%EB%93%9C). | | `jobToken` | String | Required | Job token - See [Get Secret Logs](/docs/en/secretmanager-getsecretlogs). - Automatically injected into the application that fired the trigger, visible as an environment variable - See [Secret rotation action example code](https://guide.ncloud-docs.com/docs/en/secretmanager-rotate-action#%EC%8B%9C%ED%81%AC%EB%A6%BF-%EA%B5%90%EC%B2%B4-%EC%95%A1%EC%85%98-%EC%98%88%EC%A0%9C-%EC%BD%94%EB%93%9C). | ### Request body You can include the following data in the body of your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `length` | Integer | Required | Random string length (character) - 5-32 (default: 12) | | `excludeCharacters` | String | Optional | Excluded characters - If there are multiple, concatenate them into a single string with no separator. | | `excludeNumbers` | Boolean | Optional | Whether to exclude numbers - `true` \| `false` (default) - `true`: Exclude - `false`: Not exclude | | `excludePunctuation` | Boolean | Optional | Whether to exclude special characters - `true` \| `false` (default) - `true`: Exclude - `false`: Not exclude | | `excludeUppercase` | Boolean | Optional | Whether to exclude uppercase letters - `true` \| `false` (default) - `true`: Exclude - `false`: Not exclude | | `excludeLowercase` | Boolean | Optional | Whether to exclude lowercase letters - `true` \| `false` (default) - `true`: Exclude - `false`: Not exclude | | `includeSpace` | Boolean | Optional | Whether to include spaces - `true` (default) \| `false` - `true`: Include - `false`: Not include | | `requireEachIncludedType` | Boolean | Optional | Whether to include all character types (uppercase, lowercase, numbers, special characters, and spaces) that you haven't excluded - `true` (default) \| `false` - `true`: Include all - `false`: Not include all | ### Request example The request example is as follows: ``` curl --location --request POST 'https://secretmanager.apigw.ntruss.com/action/v1/secrets/{secretId}/jobs/{jobToken}/generate-random-secret' \ --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-raw '{ "length": 5, "excludeCharacters": "", "excludeNumbers": false, "excludePunctuation": false, "excludeUppercase": false, "excludeLowercase": false, "includeSpace": false, "requireEachIncludedType": true }' ``` ## Response This section describes the response format. ### Response body The response body includes the following data: | Field | Type | Required | Description | | --- | --- | --- | --- | | `randomString` | String | - | Random string | ### Response status codes For information about the HTTP status codes common to all Secret Manager APIs, see [Secret Manager response status codes](/docs/en/secretmanager-api-overview#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C). ### Response example The response example is as follows: ``` { "randomString": "2!?xY" } ```