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

# Push a capture batch

POST https://api.livingbrain.com/v1/brains/{brainId}/captures/batch
Content-Type: application/json

Push many captures in a single request. Each item is processed independently, so a malformed entry fails on its own without rejecting the whole batch.

Reference: https://docs.livingbrain.com/api-reference/captures/capture-batch

## Authentication

- `x-api-key` header (required) — Your Living Brain API key. Create one from the dashboard; keys are scoped to an organization and carry the role of the member they were issued to.

## Request

### Path parameters

- `brainId` (string, required) — Brain id

### Body (application/json)

This endpoint expects a BrainCaptureBatchReqDto.

- `items` (list of BrainCaptureReqDto, required) — Captures to ingest

## Response

### 201

- `ingested` (integer, required) — Number of sources ingested
- `sources` (list of BrainIngestSourceDto, required) — One ingest source per accepted item, in the order submitted.

## Errors

### 400 Bad Request Error

Validation failed (e.g. neither/both of `content` and `fetchUrl`)

- `statusCode` (integer, required) — HTTP status code
- `timestamp` (string, required) — ISO timestamp of the failure
- `path` (string, required) — Request path (query string stripped)
- `message` (string, required) — Human-readable error message
- `body` (ErrorResDtoBody, optional) — Original framework exception response when available, e.g. `{ statusCode, message, error }` with per-field validation messages

### 401 Unauthorized Error

Unauthorized

- `statusCode` (integer, required) — HTTP status code
- `timestamp` (string, required) — ISO timestamp of the failure
- `path` (string, required) — Request path (query string stripped)
- `message` (string, required) — Human-readable error message
- `body` (ErrorResDtoBody, optional) — Original framework exception response when available, e.g. `{ statusCode, message, error }` with per-field validation messages

### 404 Not Found Error

Brain or source not found

- `statusCode` (integer, required) — HTTP status code
- `timestamp` (string, required) — ISO timestamp of the failure
- `path` (string, required) — Request path (query string stripped)
- `message` (string, required) — Human-readable error message
- `body` (ErrorResDtoBody, optional) — Original framework exception response when available, e.g. `{ statusCode, message, error }` with per-field validation messages

### 429 Too Many Requests Error

Caller rate limit exceeded

- `statusCode` (integer, required) — HTTP status code
- `timestamp` (string, required) — ISO timestamp of the failure
- `path` (string, required) — Request path (query string stripped)
- `message` (string, required) — Human-readable error message
- `body` (ErrorResDtoBody, optional) — Original framework exception response when available, e.g. `{ statusCode, message, error }` with per-field validation messages

## Types

### BrainCaptureReqDto

- `kind` (enum, required) — Kind of raw input
  - Allowed values: `note`, `file`, `url`, `transcript`, `chat_turn`, `integration`
- `content` (string, optional) — Raw textual content of the capture
- `fetchUrl` (string, optional) — URL the service fetches and extracts instead of inlined content. Extraction is driven by `kind`: file -> parse PDF, Word, PPTX, HTML, or UTF-8 text; url -> scrape web page; transcript -> transcribe audio. Legacy .ppt and other unsupported binary formats are rejected. No cloud credentials needed.
- `mimeType` (string, optional) — MIME type hint for `fetchUrl` extraction (for example application/vnd.openxmlformats-officedocument.presentationml.presentation)
- `fileName` (string, optional) — Original filename hint for `fetchUrl` extraction, including its extension
- `label` (string, optional) — Short title / filename / URL for display
- `originRef` (string, optional, nullable) — Origin URL / external id, also used as the idempotency key for dedup
- `bucket` (enum, optional) — Bucket hint for the resulting page(s)
  - Allowed values: `inbox`, `notes`, `ideas`, `projects`
- `source` (BrainSourceDto, optional) — Opaque provenance

### BrainIngestSourceDto

- `id` (string, required) — Ingest source id
- `tenantId` (string, required) — Owning tenant id
- `subjectId` (string, required) — Owning subject id (host-defined)
- `brainId` (string, required) — Owning brain id
- `source` (BrainSourceDto, required, nullable) — Opaque provenance
- `kind` (enum, required) — Kind of raw input
  - Allowed values: `note`, `file`, `url`, `transcript`, `chat_turn`, `integration`
- `bucket` (enum, required) — Bucket hint for the resulting page(s)
  - Allowed values: `inbox`, `notes`, `ideas`, `projects`
- `label` (string, required) — Short display label
- `content` (string, required, nullable) — Extracted text; null for `fetchUrl` sources not yet extracted
- `originRef` (string, required, nullable) — Origin URL / external id, also the idempotency key for dedup
- `metadata` (BrainIngestSourceDtoMetadata, required, nullable) — Extraction hints (e.g. mimeType, fileName)
- `chunkUuids` (list of string, required) — Knowledge chunk uuids backing this source
- `status` (enum, required) — Compile pipeline status
  - Allowed values: `pending`, `compiling`, `completed`, `failed`
- `originalBytes` (integer, required, nullable) — Original file/note bytes counted toward account storage
- `lastError` (string, required, nullable) — Last compile error, if any
- `affectedPageIds` (list of string, required) — Ids of pages this source contributed to
- `attempts` (integer, required) — Compile attempts so far
- `compiledAt` (datetime, required, nullable) — When the compile completed
- `createdAt` (datetime, required) — ISO 8601 timestamp of when this record was created.
- `updatedAt` (datetime, required) — ISO 8601 timestamp of when this record was last modified.

### ErrorResDtoBody

Original framework exception response when available, e.g. `{ statusCode, message, error }` with per-field validation messages

### BrainSourceDto

- `channel` (string, required) — Provenance channel
- `ref` (string, optional, nullable) — Opaque host reference (e.g. agent id)
- `label` (string, optional, nullable) — Human-readable provenance label

### BrainIngestSourceDtoMetadata

Extraction hints (e.g. mimeType, fileName)

## Examples

**Request**

```json
{
  "items": [
    {
      "kind": "note",
      "content": "First note"
    },
    {
      "kind": "note",
      "content": "Second note"
    }
  ]
}
```

**Response**

```json
{
  "ingested": 1,
  "sources": [
    {
      "id": "string",
      "tenantId": "string",
      "subjectId": "string",
      "brainId": "string",
      "source": {
        "channel": "chat",
        "ref": "string",
        "label": "via Sales Agent"
      },
      "kind": "note",
      "bucket": "inbox",
      "label": "string",
      "content": "string",
      "originRef": "string",
      "metadata": {},
      "chunkUuids": [
        "string"
      ],
      "status": "pending",
      "originalBytes": 1,
      "lastError": "string",
      "affectedPageIds": [
        "string"
      ],
      "attempts": 1,
      "compiledAt": "2024-01-15T09:30:00Z",
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.livingbrain.com/v1/brains/brainId/captures/batch"

payload = { "items": [
        {
            "kind": "note",
            "content": "First note"
        },
        {
            "kind": "note",
            "content": "Second note"
        }
    ] }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.livingbrain.com/v1/brains/brainId/captures/batch';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"items":[{"kind":"note","content":"First note"},{"kind":"note","content":"Second note"}]}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.livingbrain.com/v1/brains/brainId/captures/batch"

	payload := strings.NewReader("{\n  \"items\": [\n    {\n      \"kind\": \"note\",\n      \"content\": \"First note\"\n    },\n    {\n      \"kind\": \"note\",\n      \"content\": \"Second note\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	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.livingbrain.com/v1/brains/brainId/captures/batch")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"items\": [\n    {\n      \"kind\": \"note\",\n      \"content\": \"First note\"\n    },\n    {\n      \"kind\": \"note\",\n      \"content\": \"Second note\"\n    }\n  ]\n}"

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.post("https://api.livingbrain.com/v1/brains/brainId/captures/batch")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"items\": [\n    {\n      \"kind\": \"note\",\n      \"content\": \"First note\"\n    },\n    {\n      \"kind\": \"note\",\n      \"content\": \"Second note\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.livingbrain.com/v1/brains/brainId/captures/batch', [
  'body' => '{
  "items": [
    {
      "kind": "note",
      "content": "First note"
    },
    {
      "kind": "note",
      "content": "Second note"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.livingbrain.com/v1/brains/brainId/captures/batch");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"items\": [\n    {\n      \"kind\": \"note\",\n      \"content\": \"First note\"\n    },\n    {\n      \"kind\": \"note\",\n      \"content\": \"Second note\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["items": [
    [
      "kind": "note",
      "content": "First note"
    ],
    [
      "kind": "note",
      "content": "Second note"
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.livingbrain.com/v1/brains/brainId/captures/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```