Extensions
Beta
Load a Chrome extension, such as a crypto wallet or a tool that your team built, into your sessions. Upload it once, and Steel stores it for your organization. Then load it into any session by its ID.
Before you begin
Put your Steel API key in the STEEL_API_KEY environment variable. Then install the Steel SDK.
npm install steel-sdkpython3 -m venv .venv
source .venv/bin/activate
pip install steel-sdkgo mod init upload-extension
go get github.com/steel-dev/sdk/gocargo new upload-extension
cd upload-extension
cargo add steel-rs
cargo add tokio --features macros,rt-multi-threadUpload an extension
Call client.extensions.upload with one of these sources:
url: the extension's Chrome Web Store URL. Copy it from the extension's page.file: a packaged extension file of at most 500 MB. The package needs amanifest.jsonfile with the extension's name and version.
This program uploads an extension from the Chrome Web Store and prints its ID.
import Steel from "steel-sdk";
const client = new Steel();
const extension = await client.extensions.upload({
url: "https://chromewebstore.google.com/detail/github-isometric-contribu/mjoedlfflcchnleknnceiplgaeoegien",
});
console.log(extension.id, extension.name);from steel import Steel
client = Steel()
extension = client.extensions.upload(
url="https://chromewebstore.google.com/detail/github-isometric-contribu/mjoedlfflcchnleknnceiplgaeoegien",
)
print(extension.id, extension.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()
extension, err := client.Extensions.Upload(ctx, steel.ExtensionUploadParams{
URL: steel.F("https://chromewebstore.google.com/detail/github-isometric-contribu/mjoedlfflcchnleknnceiplgaeoegien"),
})
if err != nil {
return err
}
fmt.Println(extension.ID, extension.Name)
return nil
}#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = steel_rs::Client::new();
let extension = client
.extensions()
.upload(steel_rs::ExtensionUploadParams {
url: Some("https://chromewebstore.google.com/detail/github-isometric-contribu/mjoedlfflcchnleknnceiplgaeoegien".to_owned()),
..Default::default()
})
.await?;
println!("{} {}", extension.id, extension.name);
Ok(())
}Run the program:
npx tsx upload-extension.mtspython upload_extension.pygo run .cargo runThe program prints the extension's ID and name. Keep the ID, because you load the extension by it. The ID is the Chrome extension ID, and Steel makes the name from the part of the URL before the ID.
mjoedlfflcchnleknnceiplgaeoegien Github_Isometric_ContribuTo upload a file, pass it in file with its name. Steel checks that the name ends in .zip or .crx. In TypeScript, createReadStream sends the name of the file that it reads. In Python, pass a tuple of the name and bytes. In Go, a file that os.Open returns sends its name. In Rust, steel_rs::Upload::open keeps the name of the file that it reads. Steel takes the extension's name from its manifest.json.
import { createReadStream } from "node:fs";
const extension = await client.extensions.upload({
file: createReadStream("extension.zip"),
});from pathlib import Path
extension = client.extensions.upload(
file=("extension.zip", Path("extension.zip").read_bytes()),
)import (
"io"
"os"
)
file, err := os.Open("extension.zip")
if err != nil {
return err
}
defer file.Close()
extension, err := client.Extensions.Upload(ctx, steel.ExtensionUploadParams{
File: steel.F[io.Reader](file),
})
if err != nil {
return err
}let extension = client
.extensions()
.upload(steel_rs::ExtensionUploadParams {
file: Some(steel_rs::Upload::open("extension.zip").await?),
..Default::default()
})
.await?;You can upload each extension only once. To change it, update it.
Load extensions in a session
Pass the extensions' IDs in extensionIds when you create the session. Steel installs them when the session starts.
const session = await client.sessions.create({
extensionIds: [extension.id],
});session = client.sessions.create(
extension_ids=[extension.id],
)session, err := client.Sessions.New(ctx, steel.SessionNewParams{
ExtensionIDs: steel.F([]string{extension.ID}),
})
if err != nil {
return err
}let session = client
.sessions()
.create(steel_rs::SessionCreateParams {
extension_ids: Some(vec![extension.id.clone()]),
..Default::default()
})
.await?;To load all of your organization's extensions, pass ["all_ext"].
const session = await client.sessions.create({ extensionIds: ["all_ext"] });session = client.sessions.create(extension_ids=["all_ext"])session, err := client.Sessions.New(ctx, steel.SessionNewParams{
ExtensionIDs: steel.F([]string{"all_ext"}),
})
if err != nil {
return err
}let session = client
.sessions()
.create(steel_rs::SessionCreateParams {
extension_ids: Some(vec!["all_ext".to_owned()]),
..Default::default()
})
.await?;A profile saves the extensionIds of the session that created it.
Update or delete an extension
To replace an extension with a new version, call client.extensions.update with its ID and a new url or file. The ID stays the same, so your extensionIds stay the same.
await client.extensions.update(extension.id, {
file: createReadStream("extension-v2.zip"),
});client.extensions.update(
extension.id,
file=("extension-v2.zip", Path("extension-v2.zip").read_bytes()),
)import (
"io"
"os"
)
v2, err := os.Open("extension-v2.zip")
if err != nil {
return err
}
defer v2.Close()
if _, err := client.Extensions.Update(ctx, extension.ID, steel.ExtensionUpdateParams{
File: steel.F[io.Reader](v2),
}); err != nil {
return err
}client
.extensions()
.update(
&extension.id,
steel_rs::ExtensionUpdateParams {
file: Some(steel_rs::Upload::open("extension-v2.zip").await?),
..Default::default()
},
)
.await?;To see your extensions, call client.extensions.list. It returns extensions, each with its id, name, createdAt and updatedAt, and count, the number of extensions.
To remove one extension, call client.extensions.delete with its ID. To remove all of your organization's extensions, call deleteAll in TypeScript, delete_all in Python and Rust, or DeleteAll in Go.
await client.extensions.delete(extension.id);client.extensions.delete(extension.id)if _, err := client.Extensions.Delete(ctx, extension.ID); err != nil {
return err
}client.extensions().delete(&extension.id).await?;Check that it worked
Call client.extensions.list. It returns the extension with the id and name that the upload printed. Then start a session with that ID in extensionIds, open a page that the extension acts on, and watch the page in the live view. The page shows what the extension adds or changes.
Troubleshooting
Extension already exists in your organization
{
"error": "Bad Request",
"message": "Extension already exists in your organization. Use the update endpoint for that extension id, or upload a different extension.",
"retryable": false,
"linkToDocs": "https://docs.steel.dev/overview/extensions-api/overview"
}Cause: You uploaded an extension that your organization already has.
Fix: Find its ID with client.extensions.list, and call client.extensions.update with that ID to change it.
Verify: The update returns the extension with a new updatedAt.
Extension file must be a .zip archive or .crx file
{
"error": "Bad Request",
"message": "Extension file must be a .zip archive or .crx file. Upload a packaged Chrome extension in one of those formats.",
"retryable": false,
"linkToDocs": "https://docs.steel.dev/overview/extensions-api/overview"
}Cause: The uploaded file has no name, or its name does not end in .zip or .crx. A file that you pass as raw bytes, without a name, fails this way.
Fix: Pass the file with its name, as the examples in Upload an extension do.
Verify: The upload returns the extension's id.
Extension was not found in your organization
{
"error": "Not Found",
"message": "Extension 'mjoedlfflcchnleknnceiplgaeoegien' was not found in your organization. Check the extension id, or list your extensions to confirm it exists.",
"retryable": false,
"linkToDocs": "https://docs.steel.dev/overview/extensions-api/overview"
}Cause: An ID in extensionIds, or in an update or a delete, does not match any of your organization's extensions. Steel creates no session in that case.
Fix: Copy the ID from client.extensions.list, or pass ["all_ext"].
Verify: The session starts, and the response has a session id.
Next steps
- Extensions API: Download a stored extension as a ZIP file, or call the endpoints over HTTP.