Vaults
A Vault is a named group of credentials in a project. Vaults are optional. Use one to keep a set of logins together, such as one customer's accounts, and to give a session access to exactly that set.
A credential in a Vault does not fill by namespace and origin. A session uses it only through a binding to the Vault or to the item.
Before you begin
- A Steel API key in the
STEEL_API_KEYenvironment variable, for the API, SDK and CLI steps. See API keys. - For the SDK tabs,
clientisnew Steel()in TypeScript andSteel()in Python. - For the CLI tabs, the Steel CLI, which uses the same key.
- With an organization key, add your project's ID as
projectIdto each request (project_idin Python,--project-idin the CLI). See Choose a scope.
Create a Vault
A Vault name has 1 to 63 lowercase letters, digits, dots, underscores or hyphens, and starts with a letter or a digit. The name is unique in its project. The description is optional.
In the dashboard:
- Open Credentials in the sidebar, then the Vaults tab.
- Click New Vault.
- Type a Vault name and, if you want one, a Description.
- Click Create Vault.
With the API, an SDK or the CLI:
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" }'const vault = await client.vaults.create({
name: "acme-prod",
description: "Logins for the Acme account",
});
console.log(vault.id);vault = client.vaults.create(
name="acme-prod",
description="Logins for the Acme account",
)
print(vault.id)steel vaults create acme-prod --description "Logins for the Acme account"The response has the Vault's id, name, description, projectId, createdAt and updatedAt. Keep the id: you need it to add credentials. In the dashboard, the copy icon beside a Vault's name copies its ID.
Add a credential to a Vault
You can create a credential in a Vault, or move one in. A move keeps the credential's ID and its stored values.
In the dashboard:
- To create one, click Open Vault on the Vault's row, then New credential.
- To move one, open the All credentials tab, open the credential's menu, and click Move credential. Choose the Vault, or Unassigned to take it out.
With the API, set vaultId when you create the credential. The SDKs and the CLI cannot put a credential in a Vault yet, so these two requests are cURL only.
curl -X POST https://api.steel.dev/v1/secrets \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "credential",
"vaultId": "'"$VAULT_ID"'",
"name": "billing",
"origin": "https://app.example.com",
"value": { "username": "'"$SITE_USERNAME"'", "password": "'"$SITE_PASSWORD"'" }
}'To move a credential, send its new vaultId. Send null to take it out of its Vault.
curl -X PATCH https://api.steel.dev/v1/secrets/$CREDENTIAL_ID \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "vaultId": "'"$VAULT_ID"'" }'To list a Vault's credentials, call GET /v1/secrets?kind=credential&vaultId=$VAULT_ID.
Item names are unique in a Vault. A credential with no name takes its origin as its name, so two credentials for one origin in the same Vault each need a name of their own.
Give a session access to a Vault
A binding names what a session can use. You write it as a reference:
| Reference | The session can use |
|---|---|
steel:// | Every credential in the Vault, and each one that you add later |
steel:// | One credential. The binding follows it if you move it to another Vault |
<vault> and <item> are a name or an ID. Percent-encode a character that is not a letter, a digit, -, ., _ or ~. For example, write a space as %20 and a / as %2F. An item's name is the Label that the dashboard shows.
In the dashboard:
- Open Sessions, and click Start session.
- Under Credential access, choose Choose what this session can use.
- Under Binding type, choose Steel Vault, then choose the Vault.
- Click Start session.
The dashboard binds one whole Vault. To bind one item, choose Individual credential instead. To bind several Vaults or items, use the API.
With the API or an SDK, pass the references in credentials.bindings when you create the session:
curl -X POST https://api.steel.dev/v1/sessions \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "credentials": { "bindings": ["steel://vaults/acme-prod"] } }'const session = await client.sessions.create({
credentials: { bindings: ["steel://vaults/acme-prod"] },
});session = client.sessions.create(
credentials={"bindings": ["steel://vaults/acme-prod"]},
)The session fills only what its bindings cover. Each credential still fills only on its own origin and its additional allowed origins. To change the bindings while the session runs, see Change what a running session can use.
Rename or delete a Vault
A rename keeps the Vault's ID and its items. A binding that a session already holds keeps working, because Steel stores the binding by ID. A reference that you write later must use the new name.
You can delete only an empty Vault. Move or delete its credentials first. Deleting a Vault never deletes credentials.
In the dashboard, open the Vault's menu on the Vaults tab and click Rename Vault or Delete Vault. The dashboard changes the name only. To change the description, use the API.
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", "description": "Production logins for Acme" }'await client.vaults.update(vaultId, {
name: "acme-production",
description: "Production logins for Acme",
});client.vaults.update(
vault_id,
name="acme-production",
description="Production logins for Acme",
)steel vaults update $VAULT_ID \
--name acme-production \
--description "Production logins for Acme"curl -X DELETE https://api.steel.dev/v1/vaults/$VAULT_ID \
-H "steel-api-key: $STEEL_API_KEY"await client.vaults.delete(vaultId);client.vaults.delete(vault_id)steel vaults delete $VAULT_IDA successful delete returns 204 with no body.
Check that it worked
List the session's bindings:
curl https://api.steel.dev/v1/sessions/$SESSION_ID/credentials \
-H "steel-api-key: $STEEL_API_KEY"const access = await client.sessions.credentials.list(session.id);
console.log(access.lookup, access.bindings);access = client.sessions.credentials.list(session.id)
print(access.lookup, access.bindings)steel sessions credentials list $SESSION_IDA session with only a whole-Vault binding returns:
{
"credentialsEnabled": true,
"lookup": "explicit",
"bindings": ["steel://vaults/<vault-id>"],
"credentials": []
}bindings has the Vault. credentials lists only the credentials that you bound one by one, so it is empty here, and the session can still fill from the Vault. To see what the Vault holds now, call GET /v1/secrets?kind=credential&vaultId=$VAULT_ID.
Then open a sign-in page of one of the Vault's credentials in the session. Steel fills the form.
Troubleshooting
vault_item_name_taken
Cause: The Vault already has an item with this name. The request fails with 409 and the message An item named <name> already exists in this vault.
Fix: Give the credential another name, then create or move it again.
Verify: The request returns the credential with the Vault's ID in vaultId.
Vault contains live items
Cause: You tried to delete a Vault that still holds credentials. The request fails with 409.
Fix: Move each credential to another Vault or to Unassigned, or delete it. Then delete the Vault.
Verify: The delete returns 204.
A credential stopped filling after you moved it into a Vault
Cause: The session matches by namespace and origin, and that match skips credentials in a Vault.
Fix: Start the session with a binding to the Vault or to the item. Or move the credential back to Unassigned.
Verify: GET /v1/sessions/$SESSION_ID/credentials has the Vault's reference in bindings, or the item in credentials. Then open the sign-in page in the session. Steel fills the form.