---
# @generated by sylphx-gen 0.1.0 from contracts@e145cc7cf1bc9605f2b27439e5e17ed76a1a2fd7e7021906a013f7565e4a0cd5. Do not edit.
title: "Connect a database"
description: "`data.databases.connect` (POST /v1/{name}:connect): Returns how to connect to the database: its endpoint and its own engine credentials."
type: reference
product: database
summary: "Returns how to connect to the database: its endpoint and its own engine credentials."
updated: 2026-09-28
nav: false
---

Returns how to connect to the database: its endpoint and its own engine credentials. The credentials are not API keys and are returned only here.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/databases/database:connect`
- **Scope** `data:write`
- **Effect** `read` — nothing is written.
- **Collection** [databases](/docs/api/databases)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | The name of the database. Required. |
| `profile` | `ConnectionProfile` | POOLED (default) or DIRECT. One of `pooled`, `direct`. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `connection_info` | `ConnectionInfo` | How to connect. |

### ConnectionInfo

| Field | Type | What it is |
| --- | --- | --- |
| `host` | `string` | The endpoint host, `{ref}.sylphx.net`. |
| `port` | `int32` | The TLS port: 5432 Postgres, 6379 Valkey, 8108 search, 443 objects. |
| `username` | `string` | The engine user. |
| `password` | `string` | The engine password. Never returned again. |
| `database` | `string` | The Postgres database name; empty for other kinds. |
| `uri` | `string` | A driver URL embedding the credentials. Never returned again. |
| `direct_uri` | `string` | Postgres only: the direct URL for migrations, `pg_dump`, `LISTEN`/`NOTIFY`, session `SET`, and logical replication. Never returned again. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/databases/database:connect" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**TypeScript**

```ts
const response = await sylphx.data.databases.connect({ name: 'orgs/acme/projects/shop/envs/production/databases/database' })
```

**Rust**

```rust
let mut req = sylphx::data::ConnectDatabaseRequest::default();
req.name = "orgs/acme/projects/shop/envs/production/databases/database".to_string();
let response = sx.data().databases().connect(req).await?;
```

**CLI**

```bash
sylphx data databases connect orgs/acme/projects/shop/envs/production/databases/database
```

**MCP**

```json
{ "method_id": "data.databases.connect", "args": {"name":"orgs/acme/projects/shop/envs/production/databases/database"} }
```
