> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.scrapybara.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.scrapybara.com/_mcp/server.

# Get notebook by ID

GET https://api.scrapybara.com/v1/instance/{instance_id}/notebook/{notebook_id}

Reference: https://docs.scrapybara.com/api-reference/notebook/get

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Request

### Path parameters

- `instance_id` (string, required)
- `notebook_id` (string, required)

## Response

### 200

Successful Response

- `id` (string, required)
- `name` (string, required)
- `kernel_name` (string, required)
- `cells` (list of NotebookCell, required)
- `metadata` (map from string to any, optional)

## Errors

### 422 Notebook Get Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### NotebookCell

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `code`, `markdown`, `raw`
- `content` (string, required)
- `metadata` (map from string to any, optional)
- `outputs` (list of map from string to any, optional)
- `execution_count` (integer, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**Response**

```json
{
  "id": "id",
  "name": "name",
  "kernel_name": "kernel_name",
  "cells": [
    {
      "id": "id",
      "type": "code",
      "content": "content",
      "metadata": {
        "key": "value"
      },
      "outputs": [
        {
          "key": "value"
        }
      ],
      "execution_count": 1
    }
  ],
  "metadata": {
    "key": "value"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id"

headers = {"x-api-key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.scrapybara.com/v1/instance/instance_id/notebook/notebook_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```