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. For providers, bindings and authentication rules, see 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
GET/v1/secret-connections
Lists the Secret Connections in a project. The response does not include provider authentication.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string (uuid) · query | No | The project whose Secret Connections to list. |
Response
| Field | Type | Description |
|---|---|---|
connections | object[] | The Secret Connections, each with the fields in Create a Secret Connection. |
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);
}from steel import Steel
client = Steel()
result = client.secret_connections.list()
for connection in result.connections:
print(connection.id, connection.name)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
}#[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 https://api.steel.dev/v1/secret-connections \
-H "steel-api-key: $STEEL_API_KEY"Create a Secret Connection
POST/v1/secret-connections
Creates a Secret Connection. The API accepts authentication when you create it but never returns it.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string · body | Yes | A name for the Secret Connection. |
provider | string · body | Yes | 1password or hashicorp_vault. |
auth | object · body | Yes | Write-only provider authentication. Send serviceAccountToken for 1Password, token for HashiCorp Vault token authentication, or roleId and secretId for AppRole. |
config | object · body | No | HashiCorp Vault settings. address is required when this object is present; namespace and caPem are optional. |
projectId | string (uuid) · body | No | The project to create the Secret Connection in. |
tokenBudget | object or null · body | No | The provider request budget. Set null for the default budget. |
The response is 201 with the Secret Connection:
Response
| 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. |
See 1Password and HashiCorp Vault.
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);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)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)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 -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"'" } }'Get a Secret Connection
GET/v1/secret-connections/{id}
Returns one Secret Connection without its provider authentication.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Secret Connection ID. |
projectId | string (uuid) · query | No | The Secret Connection's project. |
The response is the Secret Connection object, with the fields in Create a Secret Connection.
const connection = await client.secretConnections.retrieve(connectionId);
console.log(connection.provider, connection.enabled);connection = client.secret_connections.retrieve(connection_id)
print(connection.provider, connection.enabled)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)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 https://api.steel.dev/v1/secret-connections/$CONNECTION_ID \
-H "steel-api-key: $STEEL_API_KEY"Update a Secret Connection
PATCH/v1/secret-connections/{id}
Changes a Secret Connection. Send provider authentication to replace it; the API does not return that authentication.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Secret Connection ID. |
projectId | string (uuid) · query | No | The Secret Connection's project. |
The response is the Secret Connection object, with the fields in Create a Secret Connection.
When you replace authentication, Steel verifies that it can still reach what running sessions have bound. See connection_account_mismatch.
const connection = await client.secretConnections.update(connectionId, {
auth: { serviceAccountToken: process.env.OP_SERVICE_ACCOUNT_TOKEN! },
});
console.log(connection.updatedAt);connection = client.secret_connections.update(
connection_id,
auth={"service_account_token": os.environ["OP_SERVICE_ACCOUNT_TOKEN"]},
)
print(connection.updated_at)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)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 -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"'" } }'Delete a Secret Connection
DELETE/v1/secret-connections/{id}
Deletes a Secret Connection.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Secret Connection ID. |
projectId | string (uuid) · query | No | The Secret Connection's project. |
The response is 204 with no body.
await client.secretConnections.delete(connectionId);client.secret_connections.delete(connection_id)import "os"
connectionID := os.Getenv("CONNECTION_ID")
if err := client.SecretConnections.Delete(ctx, connectionID, steel.SecretConnectionDeleteParams{}); err != nil {
return err
}let connection_id = std::env::var("CONNECTION_ID")?;
client
.secret_connections()
.delete(
&connection_id,
steel_rs::SecretConnectionDeleteParams::default(),
)
.await?;curl -X DELETE https://api.steel.dev/v1/secret-connections/$CONNECTION_ID \
-H "steel-api-key: $STEEL_API_KEY"Test a Secret Connection
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.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Secret Connection ID. |
projectId | string (uuid) · query | No | The Secret Connection's project. |
The response is 204 with no body.
See Secret Connections.
await client.secretConnections.test(connectionId);client.secret_connections.test(connection_id)import "os"
connectionID := os.Getenv("CONNECTION_ID")
if err := client.SecretConnections.Test(ctx, connectionID, steel.SecretConnectionTestParams{}); err != nil {
return err
}let connection_id = std::env::var("CONNECTION_ID")?;
client
.secret_connections()
.test(
&connection_id,
steel_rs::SecretConnectionTestParams::default(),
)
.await?;curl -X POST https://api.steel.dev/v1/secret-connections/$CONNECTION_ID/test \
-H "steel-api-key: $STEEL_API_KEY"