curl --request POST \
--url https://api.example.com/edges/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"edge_type": "<string>",
"id": "<string>",
"properties": {}
}
],
"atomic": true,
"emit_events": true
}
'import requests
url = "https://api.example.com/edges/bulk"
payload = {
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"edge_type": "<string>",
"id": "<string>",
"properties": {}
}
],
"atomic": True,
"emit_events": 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({
edges: [
{
source_id: '<string>',
target_id: '<string>',
edge_type: '<string>',
id: '<string>',
properties: {}
}
],
atomic: true,
emit_events: true
})
};
fetch('https://api.example.com/edges/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/edges/bulk",
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([
'edges' => [
[
'source_id' => '<string>',
'target_id' => '<string>',
'edge_type' => '<string>',
'id' => '<string>',
'properties' => [
]
]
],
'atomic' => true,
'emit_events' => 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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/edges/bulk"
payload := strings.NewReader("{\n \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/edges/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/edges/bulk")
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 \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\n}"
response = http.request(request)
puts response.read_body{
"counts": {
"created": 123,
"updated": 123,
"skipped": 123,
"errored": 123
},
"results": [
{
"index": 123,
"outcome": "created",
"id": "<string>",
"reason": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
]
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}Bulk upsert edges
Creates or upserts up to 5000 edges in one call. Sibling to POST /items/bulk for the graph half of tenant migrations — items created in an earlier bulk call exist on the server; a second pass through this endpoint wires them together without having to hold source and target in the same payload.
Modes: upsert (default) matches existing rows on (source_id, target_id, edge_type) and replaces properties in place; create_only surfaces matching rows as skipped with reason duplicate_edge. Atomic by default — any failure rolls back the batch. Set atomic: false to run per-edge with per-edge outcomes. emit_events: true fires an edge.created webhook per newly-created edge; updated outcomes emit nothing.
Admin-only. See Bulk operations for outcome shape and event semantics.
curl --request POST \
--url https://api.example.com/edges/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"edge_type": "<string>",
"id": "<string>",
"properties": {}
}
],
"atomic": true,
"emit_events": true
}
'import requests
url = "https://api.example.com/edges/bulk"
payload = {
"edges": [
{
"source_id": "<string>",
"target_id": "<string>",
"edge_type": "<string>",
"id": "<string>",
"properties": {}
}
],
"atomic": True,
"emit_events": 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({
edges: [
{
source_id: '<string>',
target_id: '<string>',
edge_type: '<string>',
id: '<string>',
properties: {}
}
],
atomic: true,
emit_events: true
})
};
fetch('https://api.example.com/edges/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/edges/bulk",
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([
'edges' => [
[
'source_id' => '<string>',
'target_id' => '<string>',
'edge_type' => '<string>',
'id' => '<string>',
'properties' => [
]
]
],
'atomic' => true,
'emit_events' => 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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/edges/bulk"
payload := strings.NewReader("{\n \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/edges/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/edges/bulk")
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 \"edges\": [\n {\n \"source_id\": \"<string>\",\n \"target_id\": \"<string>\",\n \"edge_type\": \"<string>\",\n \"id\": \"<string>\",\n \"properties\": {}\n }\n ],\n \"atomic\": true,\n \"emit_events\": true\n}"
response = http.request(request)
puts response.read_body{
"counts": {
"created": 123,
"updated": 123,
"skipped": 123,
"errored": 123
},
"results": [
{
"index": 123,
"outcome": "created",
"id": "<string>",
"reason": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
]
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}Authorizations
Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)