Register an edge type
curl --request POST \
--url https://api.example.com/edges/types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"label": "<string>",
"description": "<string>",
"source_type_constraints": [
"<string>"
],
"target_type_constraints": [
"<string>"
],
"property_schema": {}
}
'import requests
url = "https://api.example.com/edges/types"
payload = {
"id": "<string>",
"label": "<string>",
"description": "<string>",
"source_type_constraints": ["<string>"],
"target_type_constraints": ["<string>"],
"property_schema": {}
}
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({
id: '<string>',
label: '<string>',
description: '<string>',
source_type_constraints: ['<string>'],
target_type_constraints: ['<string>'],
property_schema: {}
})
};
fetch('https://api.example.com/edges/types', 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/types",
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([
'id' => '<string>',
'label' => '<string>',
'description' => '<string>',
'source_type_constraints' => [
'<string>'
],
'target_type_constraints' => [
'<string>'
],
'property_schema' => [
]
]),
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/types"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\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/types")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/edges/types")
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 \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\n}"
response = http.request(request)
puts response.read_body{
"edge_type": {
"id": "<string>",
"cardinality": "one-to-one",
"source_type_constraints": [
"<string>"
],
"target_type_constraints": [
"<string>"
],
"cascade_on_delete": "cascade",
"property_schema": {},
"label": "<string>",
"description": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "conflict",
"message": "<string>",
"details": {}
}
}EdgeTypes
Register an edge type
Registers a custom edge type. Carries cardinality (one-to-one / one-to-many / many-to-one / many-to-many), cascade_on_delete (cascade / orphan / block), source and target type constraints, and an optional property_schema. Core edge type names (about, parent-of, in-thread, attached-to, references, authored-by, derived-from, supersedes) are reserved and collide with 409 conflict.
Admin-only. Custom edge types do not inherit — they’re flat. See Edges — custom edge types.
POST
/
edges
/
types
Register an edge type
curl --request POST \
--url https://api.example.com/edges/types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"label": "<string>",
"description": "<string>",
"source_type_constraints": [
"<string>"
],
"target_type_constraints": [
"<string>"
],
"property_schema": {}
}
'import requests
url = "https://api.example.com/edges/types"
payload = {
"id": "<string>",
"label": "<string>",
"description": "<string>",
"source_type_constraints": ["<string>"],
"target_type_constraints": ["<string>"],
"property_schema": {}
}
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({
id: '<string>',
label: '<string>',
description: '<string>',
source_type_constraints: ['<string>'],
target_type_constraints: ['<string>'],
property_schema: {}
})
};
fetch('https://api.example.com/edges/types', 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/types",
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([
'id' => '<string>',
'label' => '<string>',
'description' => '<string>',
'source_type_constraints' => [
'<string>'
],
'target_type_constraints' => [
'<string>'
],
'property_schema' => [
]
]),
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/types"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\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/types")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/edges/types")
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 \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"description\": \"<string>\",\n \"source_type_constraints\": [\n \"<string>\"\n ],\n \"target_type_constraints\": [\n \"<string>\"\n ],\n \"property_schema\": {}\n}"
response = http.request(request)
puts response.read_body{
"edge_type": {
"id": "<string>",
"cardinality": "one-to-one",
"source_type_constraints": [
"<string>"
],
"target_type_constraints": [
"<string>"
],
"cascade_on_delete": "cascade",
"property_schema": {},
"label": "<string>",
"description": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "conflict",
"message": "<string>",
"details": {}
}
}Authorizations
Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)
Body
application/json
Minimum string length:
1Available options:
one-to-one, one-to-many, many-to-one, many-to-many Available options:
cascade, orphan, block Show child attributes
Show child attributes
Response
Edge type registered
Show child attributes
Show child attributes