Skip to content

Commit e1f1d96

Browse files
authored
Fix codesnippet in docs for API Key (#699)
# Description Updates code snippet for current SDK version https://e2b-web-git-fix-docs-api-key.e2b-preview.dev/docs
1 parent 93db2ed commit e1f1d96

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

apps/web/src/app/(docs)/docs/quickstart/api-key/page.mdx renamed to apps/web/src/app/(docs)/docs/api-key/page.mdx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,11 @@ To use the API key, you can either:
1212
import { Sandbox } from '@e2b/code-interpreter'
1313

1414
const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' })
15-
await sandbox.notebook.execCell('x = 1')
16-
17-
const execution = await sandbox.notebook.execCell('x+=1; x')
18-
console.log(execution.text) // outputs 2
19-
20-
await sandbox.close()
2115
```
2216
```python {{ language: 'python' }}
23-
from e2b_code_interpreter import CodeInterpreter
17+
from e2b_code_interpreter import Sandbox
2418

25-
with CodeInterpreter(api_key="YOUR_API_KEY") as code_interpreter:
26-
sandbox.notebook.exec_cell("x = 1")
27-
execution = sandbox.notebook.exec_cell("x+=1; x")
28-
print(execution.text) # outputs 2
19+
sbx = Sandbox(api_key="YOUR_API_KEY")
2920
```
3021
</CodeGroup>
3122

apps/web/src/components/Navigation/routes.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Braces, CheckCircle, Home, MessagesSquare } from 'lucide-react'
1+
import { Braces, CheckCircle, Home, KeyRound, MessagesSquare } from 'lucide-react'
22
import sdkRefRoutesJson from './sdkRefRoutes.json'
33

44
enum Tag {
@@ -58,12 +58,13 @@ export const docRoutes: NavGroup[] = [
5858
title: 'Install custom packages',
5959
href: '/docs/quickstart/install-custom-packages',
6060
},
61-
{
62-
title: 'API Key',
63-
href: '/docs/quickstart/api-key',
64-
},
6561
],
6662
},
63+
{
64+
title: 'API Key',
65+
href: '/docs/api-key',
66+
icon: <KeyRound size={16} />,
67+
},
6768
{
6869
title: 'Cookbook',
6970
href: 'https://github.com/e2b-dev/e2b-cookbook',

0 commit comments

Comments
 (0)