curl --request POST \
--url https://app.withrealm.com/api/external/alpha/documents/{data_source_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"id": "doc_42",
"title": "Getting started with Realm",
"content": "# Getting started\n\nWelcome to Realm.",
"contentType": "markdown",
"url": "https://docs.example.com/getting-started",
"meta": {
"category": "guide"
},
"readAccess": [
"alice@example.com"
],
"verified": true
}
]
}
'import requests
url = "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}"
payload = { "documents": [
{
"id": "doc_42",
"title": "Getting started with Realm",
"content": "# Getting started
Welcome to Realm.",
"contentType": "markdown",
"url": "https://docs.example.com/getting-started",
"meta": { "category": "guide" },
"readAccess": ["alice@example.com"],
"verified": True
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents: [
{
id: 'doc_42',
title: 'Getting started with Realm',
content: '# Getting started\n\nWelcome to Realm.',
contentType: 'markdown',
url: 'https://docs.example.com/getting-started',
meta: {category: 'guide'},
readAccess: ['alice@example.com'],
verified: true
}
]
})
};
fetch('https://app.withrealm.com/api/external/alpha/documents/{data_source_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"id\": \"doc_42\",\n \"title\": \"Getting started with Realm\",\n \"content\": \"# Getting started\\n\\nWelcome to Realm.\",\n \"contentType\": \"markdown\",\n \"url\": \"https://docs.example.com/getting-started\",\n \"meta\": {\n \"category\": \"guide\"\n },\n \"readAccess\": [\n \"alice@example.com\"\n ],\n \"verified\": true\n }\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(string(body))
}require 'uri'
require 'net/http'
url = URI("https://app.withrealm.com/api/external/alpha/documents/{data_source_id}")
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 \"documents\": [\n {\n \"id\": \"doc_42\",\n \"title\": \"Getting started with Realm\",\n \"content\": \"# Getting started\\n\\nWelcome to Realm.\",\n \"contentType\": \"markdown\",\n \"url\": \"https://docs.example.com/getting-started\",\n \"meta\": {\n \"category\": \"guide\"\n },\n \"readAccess\": [\n \"alice@example.com\"\n ],\n \"verified\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents' => [
[
'id' => 'doc_42',
'title' => 'Getting started with Realm',
'content' => '# Getting started
Welcome to Realm.',
'contentType' => 'markdown',
'url' => 'https://docs.example.com/getting-started',
'meta' => [
'category' => 'guide'
],
'readAccess' => [
'alice@example.com'
],
'verified' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"results": [
{
"id": "doc_42",
"success": true
}
]
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Upsert documents
Create or update one or more documents. This endpoint requires a Data Source ID. To get started:
- Go to the Connectors page
- Create a new API Connector
- Copy the data source ID from the connector details page
- Use this ID in the path parameter
Alternatively, you can use the /connectors endpoint to programmatically fetch available API connectors.
The writes will be queued and processed in the background.
Send a maximum of 100 documents per request.
Rate Limits
600 requests per minute.
curl --request POST \
--url https://app.withrealm.com/api/external/alpha/documents/{data_source_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"id": "doc_42",
"title": "Getting started with Realm",
"content": "# Getting started\n\nWelcome to Realm.",
"contentType": "markdown",
"url": "https://docs.example.com/getting-started",
"meta": {
"category": "guide"
},
"readAccess": [
"alice@example.com"
],
"verified": true
}
]
}
'import requests
url = "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}"
payload = { "documents": [
{
"id": "doc_42",
"title": "Getting started with Realm",
"content": "# Getting started
Welcome to Realm.",
"contentType": "markdown",
"url": "https://docs.example.com/getting-started",
"meta": { "category": "guide" },
"readAccess": ["alice@example.com"],
"verified": True
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents: [
{
id: 'doc_42',
title: 'Getting started with Realm',
content: '# Getting started\n\nWelcome to Realm.',
contentType: 'markdown',
url: 'https://docs.example.com/getting-started',
meta: {category: 'guide'},
readAccess: ['alice@example.com'],
verified: true
}
]
})
};
fetch('https://app.withrealm.com/api/external/alpha/documents/{data_source_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"id\": \"doc_42\",\n \"title\": \"Getting started with Realm\",\n \"content\": \"# Getting started\\n\\nWelcome to Realm.\",\n \"contentType\": \"markdown\",\n \"url\": \"https://docs.example.com/getting-started\",\n \"meta\": {\n \"category\": \"guide\"\n },\n \"readAccess\": [\n \"alice@example.com\"\n ],\n \"verified\": true\n }\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(string(body))
}require 'uri'
require 'net/http'
url = URI("https://app.withrealm.com/api/external/alpha/documents/{data_source_id}")
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 \"documents\": [\n {\n \"id\": \"doc_42\",\n \"title\": \"Getting started with Realm\",\n \"content\": \"# Getting started\\n\\nWelcome to Realm.\",\n \"contentType\": \"markdown\",\n \"url\": \"https://docs.example.com/getting-started\",\n \"meta\": {\n \"category\": \"guide\"\n },\n \"readAccess\": [\n \"alice@example.com\"\n ],\n \"verified\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.withrealm.com/api/external/alpha/documents/{data_source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents' => [
[
'id' => 'doc_42',
'title' => 'Getting started with Realm',
'content' => '# Getting started
Welcome to Realm.',
'contentType' => 'markdown',
'url' => 'https://docs.example.com/getting-started',
'meta' => [
'category' => 'guide'
],
'readAccess' => [
'alice@example.com'
],
'verified' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"results": [
{
"id": "doc_42",
"success": true
}
]
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the custom API data source.
Body
Hide child attributes
Hide child attributes
markdown, text, html Optional unique identifier for the document. We enforce uniqueness in our end. If not provided, a UUID will be generated automatically and returned in the response. Must be alphanumeric and can include underscores and hyphens. The order of the documents in the response is the same as the order of the documents in the request, so you can match any generated IDs.
^[a-zA-Z0-9_-]+$UTC timestamp in ISO 8601 format (e.g. '2024-03-20T10:00:00Z')
UTC timestamp in ISO 8601 format (e.g. '2024-03-20T10:00:00Z')
Email addresses of the users that have read access to the document. If not provided, the document can be seen by anyone in Realm. Cannot be an empty array — omit the field instead.
1When true, marks this document as verified for this upsert. Send true on every upsert while the source system still treats it as authoritative; omitting it or sending false stops asserting source verification.

