curl --request POST \
--url https://api.example.com/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"properties": {},
"id": "<string>",
"state": "<string>",
"timestamp": "<string>",
"source": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"tags": [
"<string>"
],
"edges": {}
}
'import requests
url = "https://api.example.com/items"
payload = {
"type": "<string>",
"properties": {},
"id": "<string>",
"state": "<string>",
"timestamp": "<string>",
"source": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"tags": ["<string>"],
"edges": {}
}
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({
type: '<string>',
properties: {},
id: '<string>',
state: '<string>',
timestamp: '<string>',
source: '<string>',
source_id: '<string>',
device: '<string>',
capture_latitude: 123,
capture_longitude: 123,
tags: ['<string>'],
edges: {}
})
};
fetch('https://api.example.com/items', 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/items",
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([
'type' => '<string>',
'properties' => [
],
'id' => '<string>',
'state' => '<string>',
'timestamp' => '<string>',
'source' => '<string>',
'source_id' => '<string>',
'device' => '<string>',
'capture_latitude' => 123,
'capture_longitude' => 123,
'tags' => [
'<string>'
],
'edges' => [
]
]),
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/items"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\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/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/items")
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 \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"type": "<string>",
"properties": {},
"state": "active",
"version": 123,
"schema_version": 123,
"source": "<string>",
"timestamp": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"tier": "library",
"tenant_id": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"edges": {},
"extensions": {}
},
"metadata": {
"item_id": "<string>",
"tags": [
"<string>"
],
"extensions": {}
}
}{
"item": {
"id": "<string>",
"type": "<string>",
"properties": {},
"state": "active",
"version": 123,
"schema_version": 123,
"source": "<string>",
"timestamp": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"tier": "library",
"tenant_id": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"edges": {},
"extensions": {}
},
"metadata": {
"item_id": "<string>",
"tags": [
"<string>"
],
"extensions": {}
}
}{
"error": {
"code": "validation_error",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "forbidden",
"message": "<string>",
"details": {}
}
}Create an item
Creates an item against its type schema and persists it. The server stamps id, created_at, version, and source (from the caller’s credential — not forgeable). Type-schema validation runs before any write.
If source_id is supplied and an existing non-trashed item in the tenant already has the same (source, source_id) pair, the call short-circuits to update — properties shallow-merge, tags replace if provided, edges replace per-type if provided. The HTTP status flips from 201 to 200; the response body is the updated item either way. See Items — natural-key upsert for the wider semantics.
An edges block on the request body creates the item and its outbound edges in one transaction; either the whole write succeeds or nothing persists. See Edges — atomic item + edges write.
curl --request POST \
--url https://api.example.com/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"properties": {},
"id": "<string>",
"state": "<string>",
"timestamp": "<string>",
"source": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"tags": [
"<string>"
],
"edges": {}
}
'import requests
url = "https://api.example.com/items"
payload = {
"type": "<string>",
"properties": {},
"id": "<string>",
"state": "<string>",
"timestamp": "<string>",
"source": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"tags": ["<string>"],
"edges": {}
}
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({
type: '<string>',
properties: {},
id: '<string>',
state: '<string>',
timestamp: '<string>',
source: '<string>',
source_id: '<string>',
device: '<string>',
capture_latitude: 123,
capture_longitude: 123,
tags: ['<string>'],
edges: {}
})
};
fetch('https://api.example.com/items', 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/items",
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([
'type' => '<string>',
'properties' => [
],
'id' => '<string>',
'state' => '<string>',
'timestamp' => '<string>',
'source' => '<string>',
'source_id' => '<string>',
'device' => '<string>',
'capture_latitude' => 123,
'capture_longitude' => 123,
'tags' => [
'<string>'
],
'edges' => [
]
]),
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/items"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\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/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/items")
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 \"type\": \"<string>\",\n \"properties\": {},\n \"id\": \"<string>\",\n \"state\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"source\": \"<string>\",\n \"source_id\": \"<string>\",\n \"device\": \"<string>\",\n \"capture_latitude\": 123,\n \"capture_longitude\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"edges\": {}\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": "<string>",
"type": "<string>",
"properties": {},
"state": "active",
"version": 123,
"schema_version": 123,
"source": "<string>",
"timestamp": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"tier": "library",
"tenant_id": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"edges": {},
"extensions": {}
},
"metadata": {
"item_id": "<string>",
"tags": [
"<string>"
],
"extensions": {}
}
}{
"item": {
"id": "<string>",
"type": "<string>",
"properties": {},
"state": "active",
"version": 123,
"schema_version": 123,
"source": "<string>",
"timestamp": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"tier": "library",
"tenant_id": "<string>",
"source_id": "<string>",
"device": "<string>",
"capture_latitude": 123,
"capture_longitude": 123,
"edges": {},
"extensions": {}
},
"metadata": {
"item_id": "<string>",
"tags": [
"<string>"
],
"extensions": {}
}
}{
"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_...)
Body
Response
Item updated via natural-key upsert. Returned when both source (stamped from the credential) and request source_id resolve a non-trashed item in the caller's tenant — the request is treated as an idempotent re-sync of the upstream entry.