Edges

Create an edge

Creates an edge between two existing items. After any from_version precondition passes, repeating an id you already created returns the stored edge with acknowledged: true and writes nothing.

POST
/edges

Authorization

bearerAuth
headerAuthorizationBearer <token>

Authenticate with an API key (marfa_k1_…) or an OAuth access token (marfa_at_…).

Query parameters

from_version?integer

The version you read of the item the edge points from. If it differs, the edge is not changed. Leave it out to use that item as it is.

Range1 <= value

Header parameters

Idempotency-Key?string

A unique key that makes the request safe to retry. If you send the same request with the same key again, Marfa returns the first response and doesn't write again. A key belongs to the credential that sends it.

Lengthlength <= 255
X-Marfa-Instance-Id?string

The ID of the instance you expect, as GET / returns it. If another instance answers at this address, Marfa returns 409 instance_changed and doesn't write. Leave it out to send the request to whichever instance answers.

Match^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

Request body

application/json
  1. body
id?string

A UUIDv7 you choose for the edge. Leave it out and Marfa creates one.

from_id*string

The ID of the item the edge starts from.

to_id*string

The ID of the item the edge points to.

edge_type*string

The identifier of the edge type, such as parent-of.

properties?

The edge's properties. Leave it out for none. A whole number whose digits a 64-bit float doesn't keep is refused: send it as a string.

Response body

About errors

Returns the stored edge with acknowledged: true after any from_version precondition passes. id repeats a create you made with the same from item, to item and edge type, so Marfa wrote nothing and sent no event.

application/json
  1. response

A repeated create's answer: the stored edge.

edge*

The stored edge.

acknowledged*boolean

Always true: Marfa wrote nothing.

Returns the new edge.

application/json
  1. response

One edge.

edge*

The edge.

  • missing_required_field: from_id, to_id or edge_type is missing.
  • invalid_id: from_id, to_id or id isn't a valid ID.
  • validation_error, invalid_properties: a field is invalid or undeclared, or a property breaks its schema.
  • edge_constraint_violation, edge_cycle: the edge exists (details.constraint is duplicate), breaks its type's rules or closes a cycle.
application/json
  1. response

An error response.

error*

What went wrong.

unauthorized: the request has no credential, or its credential is not valid. For a key that has expired, details.expired_at says when it expired.

application/json
  1. response

An error response.

error*

What went wrong.

  • edge_type_not_permitted: you don't have write on the edge type. details.grant names the missing grant.
  • type_not_permitted: you can read the type of the item the edge points from but don't have write on it, or your credential reaches no type. details.grant names the missing grant.
application/json
  1. response

An error response.

error*

What went wrong.

  • item_not_found: the item from_id or to_id names doesn't exist, or its type is one you can't read.
  • edge_type_not_found: the edge type doesn't exist.
application/json
  1. response

An error response.

error*

What went wrong.

request_timeout: the request body didn't arrive whole within 180 seconds. Nothing changed, and Marfa closed the connection. Send the request again. A body larger than about 21 MiB can't arrive in that time over a 1 Mbit/s link, so send it in smaller requests.

application/json
  1. response

An error response.

error*

What went wrong.

  • version_conflict: from_version differs; current is the item the edge points from now.
  • id_reused: id belongs to a different edge. details.differs lists the differing ends or type; an unreadable edge supplies only details.existing_id.
application/json
  1. response

A failed precondition on the item: the error and the item now.

error*

What went wrong.

current*

The item as it stands now.

contract_mismatch: X-Marfa-Contract names another contract version than this instance speaks, or is not a whole number. Nothing was done.

application/json
  1. response

An error response.

error*

What went wrong.

request_too_large: the request body is larger than this instance accepts.

application/json
  1. response

An error response.

error*

What went wrong.

  • idempotency_contract_changed: the first response was made under another contract version, so Marfa can't replay it. The write isn't repeated.
  • idempotency_key_reused: the key was first used for a different request. Nothing is written.
  • idempotency_result_not_retained: the first response was too large to keep, so Marfa can't replay it. The write isn't repeated.
application/json
  1. response

An error response.

error*

What went wrong.

rate_limited: you sent too many requests. Wait for the number of seconds in Retry-After, then try again.

application/json
  1. response

An error response.

error*

What went wrong.

internal_error: Marfa failed in a way it didn't expect, and the request may not have completed. Read what you changed before you repeat a write.

application/json
  1. response

An error response.

error*

What went wrong.

write_contention: the database was busy, and Marfa couldn't complete the request in time. Nothing changed. Try the request again. While a restore runs, details.reason is restore_running.

application/json
  1. response

An error response.

error*

What went wrong.

insufficient_storage: the disk that holds the instance's data has no room for the request, or the request would leave less free than the instance keeps in reserve. Nothing changed, unless details.write_outcome is unknown, which means the write may have landed: read what you changed before you repeat it. Free space on the disk, then try the request again.

application/json
  1. response

An error response.

error*

What went wrong.

curl -X POST 'http://localhost:8600/edges' \  -H 'Content-Type: application/json' \  -d '{  "from_id": "string",  "to_id": "string",  "edge_type": "string"}'
About errors
{  "edge": {    "id": "01a1011e-1222-7633-b194-950271e759ed",    "from_id": "01a1011a-4902-76cf-a4a9-88e99c038c8d",    "to_id": "01a1011c-2f86-76b6-9594-050c109f4957",    "edge_type": "acme.deal-contact",    "version": 1,    "created_at": "2026-10-03T09:41:50.646Z",    "updated_at": "2026-10-03T09:41:50.646Z",    "properties": {}  },  "acknowledged": true}