> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vertracloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Stack Connection Code

> Returns ready-to-use code that connects an application of a stack to its databases and Blob folders, with the real variable names.

Returns code snippets in the language of the application, using the variable names the platform injected. Needs the `stacks:read` scope when called with an API key.

**stack\_id** `string` *required*

The stack ID.

**app\_id** `string` *required*

The application of the stack to connect.

**language** `string`

The language of the code. Default: the language of the application.

**workspace\_id** `string`

The workspace the stack belongs to. Required for a workspace member acting on a stack they do not own.

### Response

**response** `object`

**Toggle object**

**app\_id** `string`

The application ID.

**language** `string`

The language of the application.

**snippets** `object[]`

One item per connection. Each has `language`, `driver` (the client library the code uses), `database_type` (`null` for a Blob folder), `blob` (`true` for an S3-compatible Blob client), `title`, `code` and `env_vars` (the names of the variables the code reads).

For more on connecting, see [Connect a database](https://docs.vertracloud.app/guides/connect-database.md).

### Errors

| Status | Code | When |
| - | - | - |
| 404 | `STACK_NOT_FOUND` | The stack does not exist or belongs to another account. |
| 404 | `STACK_MEMBER_NOT_FOUND` | The application is not a member of the stack. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.