---
site: steel.dev
collection: docs
canonical_url: https://steel.dev/docs/reference/api/secret-connections
markdown_url: https://steel.dev/docs/reference/api/secret-connections.md
content_signal: ai-input=yes, ai-train=yes, search=yes
title: Secret Connections API
description: Create, list, get, update, delete and test Secret Connections with the Steel API.
summary: Create, list, get, update, delete and test Secret Connections with the Steel API.
type: reference
prerequisites: []
related:
  - https://steel.dev/docs/reference/api/credentials.md
  - https://steel.dev/docs/reference/api/vaults.md
  - https://steel.dev/docs/reference/api/files.md
  - https://steel.dev/docs/reference/api/extensions.md
  - https://steel.dev/docs/reference/api/projects.md
agent_setup: https://setup.steel.dev/install.md
docs_index: https://steel.dev/docs/sitemap.md
---

# Secret Connections API

A Secret Connection gives a project access to 1Password or HashiCorp Vault (KV version 2). These endpoints create, list, get, update, delete and test Secret Connections. For the base URL and authentication, see [API conventions](https://steel.dev/docs/reference/api). For providers, bindings and authentication rules, see [Secret Connections](https://steel.dev/docs/logins/secret-connections).

The first example is a complete program. The later examples use its `client`, and the ID of a Secret Connection in `CONNECTION_ID` (cURL), `connectionId` (TypeScript), `connection_id` (Python and Rust) or `connectionID` (Go).

## Endpoints

### List Secret Connections

```http
GET /v1/secret-connections
```

Lists the Secret Connections in a project. The response does not include provider authentication.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `projectId` | query | string (uuid) | no | | The project whose Secret Connections to list. |

| Field | Type | Description |
| - | - | - |
| `connections` | object\[] | The Secret Connections, each with the fields in [Create a Secret Connection](https://steel.dev/docs/reference/api/secret-connections#create-a-secret-connection). |

**TypeScript**

```ts file=list-secret-connections.mts
import Steel from "steel-sdk";

const client = new Steel();
const result = await client.secretConnections.list();

for (const connection of result.connections) {
  console.log(connection.id, connection.name);
}
```

**Python**

```python file=list_secret_connections.py
from steel import Steel

client = Steel()
result = client.secret_connections.list()

for connection in result.connections:
    print(connection.id, connection.name)
```

**Go**

```go file=main.go
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/steel-dev/sdk/go"
)

func main() {
	if err := run(context.Background()); err != nil {
		log.Fatal(err)
	}
}

func run(ctx context.Context) error {
	client := steel.NewClient()
	result, err := client.SecretConnections.List(ctx, steel.SecretConnectionListParams{})
	if err != nil {
		return err
	}

	for _, connection := range result.Connections {
		fmt.Println(connection.ID, connection.Name)
	}
	return nil
}
```

**Rust**

```rust file=src/main.rs
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = steel_rs::Client::new();
    let result = client
        .secret_connections()
        .list(steel_rs::SecretConnectionListParams::default())
        .await?;

    for connection in result.connections {
        println!("{} {}", connection.id, connection.name);
    }
    Ok(())
}
```

**cURL**

```sh
curl https://api.steel.dev/v1/secret-connections \
  -H "steel-api-key: $STEEL_API_KEY"
```

### Create a Secret Connection

```http
POST /v1/secret-connections
```

Creates a Secret Connection. The API accepts authentication when you create it but never returns it.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `name` | body | string | yes | | A name for the Secret Connection. |
| `provider` | body | string | yes | | `1password` or `hashicorp_vault`. |
| `auth` | body | object | yes | | Write-only provider authentication. Send `serviceAccountToken` for 1Password, `token` for HashiCorp Vault token authentication, or `roleId` and `secretId` for AppRole. |
| `config` | body | object | no | | HashiCorp Vault settings. `address` is required when this object is present; `namespace` and `caPem` are optional. |
| `projectId` | body | string (uuid) | no | | The project to create the Secret Connection in. |
| `tokenBudget` | body | object or null | no | | The provider request budget. Set `null` for the default budget. |

The response is `201` with the Secret Connection:

| Field | Type | Description |
| - | - | - |
| `id` | string (uuid) | The Secret Connection ID. |
| `name` | string | The Secret Connection name. |
| `provider` | string | `1password` or `hashicorp_vault`. |
| `enabled` | boolean | Whether Steel can make later reads from the provider. |
| `tokenBudget` | object or null | The provider request budget, or `null` for the default budget. |
| `vaultFingerprint` | string | A diagnostic fingerprint of accessible 1Password vault IDs, or of the HashiCorp Vault endpoint and namespace. It does not prove account or server identity. |
| `version` | integer | The Secret Connection version. |
| `createdAt` | string (date-time) | When the Secret Connection was created. |
| `updatedAt` | string (date-time) | When the Secret Connection last changed. |

**TypeScript**

```ts
const connection = await client.secretConnections.create({
  name: "team-1password",
  provider: "1password",
  auth: { serviceAccountToken: process.env.OP_SERVICE_ACCOUNT_TOKEN! },
});
console.log(connection.id, connection.name);
```

**Python**

```python
import os

connection = client.secret_connections.create(
    name="team-1password",
    provider="1password",
    auth={"service_account_token": os.environ["OP_SERVICE_ACCOUNT_TOKEN"]},
)
print(connection.id, connection.name)
```

**Go**

```go
import "os"

connection, err := client.SecretConnections.New(ctx, steel.SecretConnectionNewParams{
	Name:     steel.F("team-1password"),
	Provider: steel.F(steel.SecretConnectionNewParamsProvider1password),
	Auth: steel.F(steel.SecretConnectionNewParamsAuth{
		ServiceAccountToken: steel.F(os.Getenv("OP_SERVICE_ACCOUNT_TOKEN")),
	}),
})
if err != nil {
	return err
}
fmt.Println(connection.ID, connection.Name)
```

**Rust**

```rust
let connection = client
    .secret_connections()
    .create(steel_rs::SecretConnectionCreateParams::new(
        "team-1password".to_owned(),
        steel_rs::SecretConnectionCreateParamsProvider::V1password,
        steel_rs::SecretConnectionCreateParamsAuth {
            service_account_token: Some(std::env::var("OP_SERVICE_ACCOUNT_TOKEN")?),
            ..Default::default()
        },
    ))
    .await?;
println!("{} {}", connection.id, connection.name);
```

**cURL**

```sh
curl -X POST https://api.steel.dev/v1/secret-connections \
  -H "steel-api-key: $STEEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "team-1password", "provider": "1password", "auth": { "serviceAccountToken": "'"$OP_SERVICE_ACCOUNT_TOKEN"'" } }'
```

See [1Password](https://steel.dev/docs/integrations/1password) and [HashiCorp Vault](https://steel.dev/docs/integrations/hashicorp-vault).

### Get a Secret Connection

```http
GET /v1/secret-connections/{id}
```

Returns one Secret Connection without its provider authentication.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `id` | path | string (uuid) | yes | | The Secret Connection ID. |
| `projectId` | query | string (uuid) | no | | The Secret Connection's project. |

The response is the Secret Connection object, with the fields in [Create a Secret Connection](https://steel.dev/docs/reference/api/secret-connections#create-a-secret-connection).

**TypeScript**

```ts
const connection = await client.secretConnections.retrieve(connectionId);
console.log(connection.provider, connection.enabled);
```

**Python**

```python
connection = client.secret_connections.retrieve(connection_id)
print(connection.provider, connection.enabled)
```

**Go**

```go
import "os"

connectionID := os.Getenv("CONNECTION_ID")
connection, err := client.SecretConnections.Get(ctx, connectionID, steel.SecretConnectionGetParams{})
if err != nil {
	return err
}
fmt.Println(connection.Provider, connection.Enabled)
```

**Rust**

```rust
let connection_id = std::env::var("CONNECTION_ID")?;
let connection = client
    .secret_connections()
    .retrieve(
        &connection_id,
        steel_rs::SecretConnectionRetrieveParams::default(),
    )
    .await?;
println!("{} {}", connection.provider, connection.enabled);
```

**cURL**

```sh
curl https://api.steel.dev/v1/secret-connections/$CONNECTION_ID \
  -H "steel-api-key: $STEEL_API_KEY"
```

### Update a Secret Connection

```http
PATCH /v1/secret-connections/{id}
```

Changes a Secret Connection. Send provider authentication to replace it; the API does not return that authentication.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `id` | path | string (uuid) | yes | | The Secret Connection ID. |
| `projectId` | query | string (uuid) | no | | The Secret Connection's project. |

The response is the Secret Connection object, with the fields in [Create a Secret Connection](https://steel.dev/docs/reference/api/secret-connections#create-a-secret-connection).

**TypeScript**

```ts
const connection = await client.secretConnections.update(connectionId, {
  auth: { serviceAccountToken: process.env.OP_SERVICE_ACCOUNT_TOKEN! },
});
console.log(connection.updatedAt);
```

**Python**

```python
connection = client.secret_connections.update(
    connection_id,
    auth={"service_account_token": os.environ["OP_SERVICE_ACCOUNT_TOKEN"]},
)
print(connection.updated_at)
```

**Go**

```go
import "os"

connectionID := os.Getenv("CONNECTION_ID")
connection, err := client.SecretConnections.Update(ctx, connectionID, steel.SecretConnectionUpdateParams{
	Auth: steel.F(steel.SecretConnectionUpdateParamsAuth{
		ServiceAccountToken: steel.F(os.Getenv("OP_SERVICE_ACCOUNT_TOKEN")),
	}),
})
if err != nil {
	return err
}
fmt.Println(connection.UpdatedAt)
```

**Rust**

```rust
let connection_id = std::env::var("CONNECTION_ID")?;
let connection = client
    .secret_connections()
    .update(
        &connection_id,
        steel_rs::SecretConnectionUpdateParams {
            auth: Some(steel_rs::SecretConnectionUpdateParamsAuth {
                service_account_token: Some(std::env::var("OP_SERVICE_ACCOUNT_TOKEN")?),
                ..Default::default()
            }),
            ..Default::default()
        },
    )
    .await?;
println!("{}", connection.updated_at);
```

**cURL**

```sh
curl -X PATCH https://api.steel.dev/v1/secret-connections/$CONNECTION_ID \
  -H "steel-api-key: $STEEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "auth": { "serviceAccountToken": "'"$OP_SERVICE_ACCOUNT_TOKEN"'" } }'
```

When you replace authentication, Steel verifies that it can still reach what running sessions have bound. See [`connection_account_mismatch`](https://steel.dev/docs/logins/secret-connections#connection-account-mismatch).

### Delete a Secret Connection

```http
DELETE /v1/secret-connections/{id}
```

Deletes a Secret Connection.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `id` | path | string (uuid) | yes | | The Secret Connection ID. |
| `projectId` | query | string (uuid) | no | | The Secret Connection's project. |

The response is `204` with no body.

**TypeScript**

```ts
await client.secretConnections.delete(connectionId);
```

**Python**

```python
client.secret_connections.delete(connection_id)
```

**Go**

```go
import "os"

connectionID := os.Getenv("CONNECTION_ID")
if err := client.SecretConnections.Delete(ctx, connectionID, steel.SecretConnectionDeleteParams{}); err != nil {
	return err
}
```

**Rust**

```rust
let connection_id = std::env::var("CONNECTION_ID")?;
client
    .secret_connections()
    .delete(
        &connection_id,
        steel_rs::SecretConnectionDeleteParams::default(),
    )
    .await?;
```

**cURL**

```sh
curl -X DELETE https://api.steel.dev/v1/secret-connections/$CONNECTION_ID \
  -H "steel-api-key: $STEEL_API_KEY"
```

### Test a Secret Connection

```http
POST /v1/secret-connections/{id}/test
```

Checks whether Steel can authenticate with the provider. It does not change the Secret Connection or verify that a binding can fill a login.

| Name | In | Type | Required | Default | Description |
| - | - | - | - | - | - |
| `id` | path | string (uuid) | yes | | The Secret Connection ID. |
| `projectId` | query | string (uuid) | no | | The Secret Connection's project. |

The response is `204` with no body.

**TypeScript**

```ts
await client.secretConnections.test(connectionId);
```

**Python**

```python
client.secret_connections.test(connection_id)
```

**Go**

```go
import "os"

connectionID := os.Getenv("CONNECTION_ID")
if err := client.SecretConnections.Test(ctx, connectionID, steel.SecretConnectionTestParams{}); err != nil {
	return err
}
```

**Rust**

```rust
let connection_id = std::env::var("CONNECTION_ID")?;
client
    .secret_connections()
    .test(
        &connection_id,
        steel_rs::SecretConnectionTestParams::default(),
    )
    .await?;
```

**cURL**

```sh
curl -X POST https://api.steel.dev/v1/secret-connections/$CONNECTION_ID/test \
  -H "steel-api-key: $STEEL_API_KEY"
```

See [Secret Connections](https://steel.dev/docs/logins/secret-connections).
