# Generate Database Credential

Launch stage: Public Preview

`POST /api/2.0/database/credentials`

Generates a credential that can be used to access database instances.

API scopes: postgres

## Request body

- `request_id` (string, optional)
- `instance_names` (array of string, optional)
  Instances to request a credential for. At least one of instance_names or claims must be specified.
- `claims` (array of object, optional)
  A set of UC permissions to add to the credential. We verify that the caller has the necessary
   permissions in UC and include a reference in the token. Postgres uses that token to give the 
   connecting user additional grants to the Postgres resources that correspond to the UC resources.
   The UC resources need to be something that have a Postgres counterpart. For example, a synced table or
   a table in a UC database catalog.
  - `permission_set` (string, optional)
    Possible values: `PERMISSION_SET_UNSPECIFIED`, `READ_ONLY`
  - `resources` (array of object, optional)
    - `unspecified_resource_name` (string, required)
    - `table_name` (string, required)

## Returns

- `token` (string, optional)
- `expiration_time` (string, optional)

## Response

```json
{
  "token": "string",
  "expiration_time": "string"
}
```

