Vaults API
A Vault is a named group of credentials in a project. These endpoints create, list, get, update and delete Vaults. For the base URL and authentication, see API conventions. For Vault names, items and bindings, see Vaults.
The first example is a complete program. The later examples use its client, and the ID of a Vault in VAULT_ID (cURL), vaultId (TypeScript), vault_id (Python and Rust) or vaultID (Go).
Endpoints
List Vaults
GET/v1/vaults
Lists the Vaults in a project.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string (uuid) · query | No | The project whose Vaults to list. |
Response
| Field | Type | Description |
|---|---|---|
vaults | object[] | The Vaults, each with the fields in Create a Vault. |
import Steel from "steel-sdk";
const client = new Steel();
const result = await client.vaults.list();
for (const vault of result.vaults) {
console.log(vault.id, vault.name);
}from steel import Steel
client = Steel()
result = client.vaults.list()
for vault in result.vaults:
print(vault.id, vault.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.Vaults.List(ctx, steel.VaultListParams{})
if err != nil {
return err
}
for _, vault := range result.Vaults {
fmt.Println(vault.ID, vault.Name)
}
return nil
}#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = steel_rs::Client::new();
let result = client
.vaults()
.list(steel_rs::VaultListParams::default())
.await?;
for vault in result.vaults {
println!("{} {}", vault.id, vault.name);
}
Ok(())
}curl https://api.steel.dev/v1/vaults \
-H "steel-api-key: $STEEL_API_KEY"Create a Vault
POST/v1/vaults
Creates a Vault.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string · body | Yes | The Vault name. It has 1 to 63 lowercase letters, digits, dots, underscores or hyphens, and starts with a letter or digit. |
description | string or null · body | No | A description of the Vault. |
projectId | string (uuid) · body | No | The project to create the Vault in. |
The response is 201 with the Vault:
Response
| Field | Type | Description |
|---|---|---|
id | string (uuid) | The Vault ID. |
name | string | The Vault name. |
description | string or null | The Vault description. |
projectId | string (uuid) | The project that owns the Vault. |
createdAt | string (date-time) | When the Vault was created. |
updatedAt | string (date-time) | When the Vault last changed. |
const vault = await client.vaults.create({
name: "acme-prod",
description: "Logins for the Acme account",
});
console.log(vault.id, vault.name);vault = client.vaults.create(
name="acme-prod",
description="Logins for the Acme account",
)
print(vault.id, vault.name)vault, err := client.Vaults.New(ctx, steel.VaultNewParams{
Name: steel.F("acme-prod"),
Description: steel.F("Logins for the Acme account"),
})
if err != nil {
return err
}
fmt.Println(vault.ID, vault.Name)let vault = client
.vaults()
.create(steel_rs::VaultCreateParams {
description: Some("Logins for the Acme account".to_owned()),
..steel_rs::VaultCreateParams::new("acme-prod".to_owned())
})
.await?;
println!("{} {}", vault.id, vault.name);curl -X POST https://api.steel.dev/v1/vaults \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "acme-prod", "description": "Logins for the Acme account" }'Get a Vault
GET/v1/vaults/{id}
Returns one Vault.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Vault ID. |
projectId | string (uuid) · query | No | The Vault's project. |
The response is the Vault object, with the fields in Create a Vault.
const vault = await client.vaults.retrieve(vaultId);
console.log(vault.name);vault = client.vaults.retrieve(vault_id)
print(vault.name)import "os"
vaultID := os.Getenv("VAULT_ID")
vault, err := client.Vaults.Get(ctx, vaultID, steel.VaultGetParams{})
if err != nil {
return err
}
fmt.Println(vault.Name)let vault_id = std::env::var("VAULT_ID")?;
let vault = client
.vaults()
.retrieve(&vault_id, steel_rs::VaultRetrieveParams::default())
.await?;
println!("{}", vault.name);curl https://api.steel.dev/v1/vaults/$VAULT_ID \
-H "steel-api-key: $STEEL_API_KEY"Update a Vault
PATCH/v1/vaults/{id}
Changes a Vault's name or description.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Vault ID. |
projectId | string (uuid) · query | No | The Vault's project. |
The response is the Vault object, with the fields in Create a Vault.
const vault = await client.vaults.update(vaultId, {
name: "acme-production",
});
console.log(vault.updatedAt);vault = client.vaults.update(vault_id, name="acme-production")
print(vault.updated_at)import "os"
vaultID := os.Getenv("VAULT_ID")
vault, err := client.Vaults.Update(ctx, vaultID, steel.VaultUpdateParams{
Name: steel.F("acme-production"),
})
if err != nil {
return err
}
fmt.Println(vault.UpdatedAt)let vault_id = std::env::var("VAULT_ID")?;
let vault = client
.vaults()
.update(
&vault_id,
steel_rs::VaultUpdateParams {
name: Some("acme-production".to_owned()),
..Default::default()
},
)
.await?;
println!("{}", vault.updated_at);curl -X PATCH https://api.steel.dev/v1/vaults/$VAULT_ID \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "acme-production" }'Delete a Vault
DELETE/v1/vaults/{id}
Deletes an empty Vault. Delete or move its items first; a Vault that has items returns 409.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) · path | Yes | The Vault ID. |
projectId | string (uuid) · query | No | The Vault's project. |
The response is 204 with no body.
See Vaults.
await client.vaults.delete(vaultId);client.vaults.delete(vault_id)import "os"
vaultID := os.Getenv("VAULT_ID")
if err := client.Vaults.Delete(ctx, vaultID, steel.VaultDeleteParams{}); err != nil {
return err
}let vault_id = std::env::var("VAULT_ID")?;
client
.vaults()
.delete(&vault_id, steel_rs::VaultDeleteParams::default())
.await?;curl -X DELETE https://api.steel.dev/v1/vaults/$VAULT_ID \
-H "steel-api-key: $STEEL_API_KEY"