# Create

Launch stage: GA

`POST /api/2.0/accounts/{account_id}/servicePrincipals/{service_principal}/credentials/secrets`

Create a secret for the given service principal.

API scopes: authentication

## Path parameters

- `account_id` (string, optional)
  The account ID.
- `service_principal` (string, optional)
  The service principal ID.

## Request body

- `lifetime` (string, optional)
  The lifetime of the secret in seconds. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s).
  Example: `31536000s`

## Returns

- `id` (string, optional)
  ID of the secret
  Example: `09094e3230c893775eac3a9e7d912a8ad08ffd7e592feec9afd51958cb662110`
- `secret` (string, optional)
  Secret Value
  Example: `x8ipcf0482bcaah6b3dfcb3fb217461f8b83`
- `secret_hash` (string, optional)
  Secret Hash
- `create_time` (string, optional)
  UTC time when the secret was created
  Example: `2023-01-01T19:30:41.000Z`
- `update_time` (string, optional)
  UTC time when the secret was updated
  Example: `2023-01-01T19:30:41.000Z`
- `status` (string, optional)
  Status of the secret
  Example: `ACTIVE`
- `expire_time` (string, optional)
  UTC time when the secret will expire. If the field is not present, the secret does not expire.
  Example: `2024-01-01T19:30:41.000Z`

## Request

```json
{
  "lifetime": "31536000s"
}
```

## Response

```json
{
  "id": "09094e3230c893775eac3a9e7d912a8ad08ffd7e592feec9afd51958cb662110",
  "secret": "x8ipcf0482bcaah6b3dfcb3fb217461f8b83",
  "secret_hash": "string",
  "create_time": "2023-01-01T19:30:41.000Z",
  "update_time": "2023-01-01T19:30:41.000Z",
  "status": "ACTIVE",
  "expire_time": "2024-01-01T19:30:41.000Z"
}
```

