## Get Credential Secret by Name

`client.Credentials.DecryptByName(ctx, credentialName) (*CredentialSecret, error)`

**post** `/v5/credentials/name/{credential_name}/secret`

Retrieve the plaintext payload of a credential by its name.

### Parameters

- `credentialName string`

### Returns

- `type CredentialSecret struct{…}`

  - `Result string`

  - `Object string`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  credentialSecret, err := client.Credentials.DecryptByName(context.TODO(), "credential_name")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", credentialSecret.Result)
}
```

#### Response

```json
{
  "result": "result",
  "object": "object"
}
```
