> This page is for Paperwork API, version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.cloudraker.com/paperwork/v1/llms.txt

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

# Create an embed session

POST https://api.cloudraker.com/v1/embeds
Content-Type: application/json

Creates a session for an embedded view and returns its iframe `url`.

Call this from your backend with your API key. Put `url` in the `src` of an iframe on one of the `origins` pages. The URL carries a short-lived token in its fragment: treat it as a secret, and create a new session for each person and each visit.

A `review` session binds one extraction run (`exr_…`) with unit `per_document` and 1 to 20 of its documents. In `write` mode the person can edit and approve values. `webhook` then receives each save and approval.

A `transcript` or `document` session binds one ready `file`, in read mode. `transcript` needs a transcribed audio file. `document` needs a PDF, an office file with a preview, or an image.

The session ends at `expiresAt`: the earliest of now plus `ttl` and the run expiry. Call `DELETE /v1/embeds/{id}` to end it sooner.

Reference: https://docs.cloudraker.com/paperwork/api/embeds/create-embed-session

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a CreateEmbedBody.

- `origins` (list of string, required) — The exact origins of the pages that frame the view, such as `https://app.example.com`. No path, no wildcard, no trailing slash.
- `view` (enum, optional, default: review) — The embedded view. `review` shows the results of an extraction run. `transcript` shows an audio file with its speaker transcript. `document` shows a PDF, an office file preview or an image. `transcript` and `document` are read only.
  - Allowed values: `review`, `transcript`, `document`
- `run` (CreateEmbedBodyRun, optional) — The extraction run (`exr_…`) to review.
- `documents` (list of string, optional) — The file ids of the run to show, in this order. The default is every finished document of the run, in run order.
- `file` (CreateEmbedBodyFile, optional) — The file to show (`transcript` and `document` views).
- `space` (CreateEmbedBodySpace, optional) — The space of `file` (`transcript` and `document` views). The default is the files of `/v1/files`.
- `mode` (enum, optional, default: read) — `write` lets the person edit and approve the values.
  - Allowed values: `read`, `write`
- `user` (EmbedUser, optional) — The person who uses the embedded view, as your system knows them. It is stored as claimed and marked unverified. The email is never sent in a webhook or an audit event.
- `webhook` (CreateEmbedBodyWebhook, optional) — Where to deliver this run's events, given one of two ways. * `{ "url": "…" }` — a one-off https endpoint for this run only. * `{ "id": "whe_…" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too. Deliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`.
- `theme` (EmbedTheme, optional) — The look of the embedded view. The mode is fixed for the session.
- `locale` (enum, optional, default: en)
  - Allowed values: `en`, `fr-ca`
- `metadata` (map from string to any, optional) — Arbitrary JSON you attach to the run and get back on every read of it. Use it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized.
- `ttl` (integer, optional, default: 3600) — Session lifetime in seconds (60 to 28800). The session also ends when the run expires.

## Response

### 201

The session, with the iframe `url`.

- `object` ("embed_session", required)
- `id` (string, required)
- `view` (enum, required)
  - Allowed values: `review`, `transcript`, `document`
- `mode` (enum, required)
  - Allowed values: `read`, `write`
- `url` (string, required) — The iframe `src`. It carries the session token in its fragment: treat it as a secret.
- `documents` (list of string, required)
- `expiresAt` (string, required)
- `createdAt` (string, required)
- `run` (EmbedSessionRun, optional)
- `file` (EmbedSessionFile, optional)

## Errors

### 400 Bad Request Error

`invalid_request`: the body failed validation (theme, origins, webhook, ttl, or more than 20 documents).

- `any`

### 401 Unauthorized Error

Missing or invalid credential.

- `any`

### 403 Forbidden Error

The credential may not use the /v1 API.

- `any`

### 404 Not Found Error

`not_found`: unknown run, file or space.

- `any`

### 409 Conflict Error

`result_not_ready`: the run has not finished. `review_closed`: the review state is gone, or less than 60 seconds remain. `file_not_ready`: the file is not ready.

- `any`

### 410 Gone Error

`run_expired`: the run expired.

- `any`

### 422 Unprocessable Entity Error

`unsupported_run`: not a `per_document` extraction run. `unknown_document`: a `documents` id is not a finished document of the run. `unsupported_file`: the file type does not fit the view.

- `any`

### 429 Too Many Requests Error

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

- `code` (enum, required)
  - Allowed values: `rate_limited`
- `message` (string, required)
- `retryable` (boolean, required)
- `requestId` (string, required)
- `docUrl` (string, optional)

### 503 Service Unavailable Error

`embed_unconfigured`: embeds are not available right now.

- `any`

## Types

### CreateEmbedBodyRun

The extraction run (`exr_…`) to review.

- `id` (string, required)

### CreateEmbedBodyFile

The file to show (`transcript` and `document` views).

- `id` (string, required)

### CreateEmbedBodySpace

The space of `file` (`transcript` and `document` views). The default is the files of `/v1/files`.

- `id` (string, required)

### EmbedUser

The person who uses the embedded view, as your system knows them. It is stored as claimed and marked unverified. The email is never sent in a webhook or an audit event.

- `id` (string, required)
- `name` (string, required)
- `email` (string, optional)

### CreateEmbedBodyWebhook

Where to deliver this run's events, given one of two ways. * `{ "url": "…" }` — a one-off https endpoint for this run only. * `{ "id": "whe_…" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too. Deliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`.

- CreateEmbedBodyWebhook0
- CreateEmbedBodyWebhook1

### EmbedTheme

The look of the embedded view. The mode is fixed for the session.

- `mode` (enum, optional, default: light)
  - Allowed values: `light`, `dark`
- `colors` (map from string to string, optional) — Hex colors (`#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`) by theme key.
- `radius` (string, optional) — Corner radius in `px` or `rem`, at most `32px` or `2rem`.
- `font` (enum, optional)
  - Allowed values: `inter`, `system`

### EmbedSessionRun

- `id` (string, required)

### EmbedSessionFile

- `id` (string, required)

### CreateEmbedBodyWebhook0

- `url` (string, required)

### CreateEmbedBodyWebhook1

- `id` (string, required)

## Examples

**Request**

```json
{
  "origins": [
    "string"
  ]
}
```

**Response**

```json
{
  "object": "string",
  "id": "ems_01K6ZQB3C4D5E6F7G8H9J0K1M2",
  "view": "review",
  "mode": "read",
  "url": "string",
  "documents": [
    "string"
  ],
  "expiresAt": "string",
  "createdAt": "string",
  "run": {
    "id": "string"
  },
  "file": {
    "id": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/v1/embeds"

payload = { "origins": ["string"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.cloudraker.com/v1/embeds';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"origins":["string"]}'
};

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.cloudraker.com/v1/embeds"

	payload := strings.NewReader("{\n  \"origins\": [\n    \"string\"\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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.cloudraker.com/v1/embeds")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"origins\": [\n    \"string\"\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.cloudraker.com/v1/embeds")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"origins\": [\n    \"string\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cloudraker.com/v1/embeds', [
  'body' => '{
  "origins": [
    "string"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/v1/embeds");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"origins\": [\n    \"string\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["origins": ["string"]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/v1/embeds")! 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()
```