Skip to content

Apply a delta batch to a branch (OCC)

POST
/v1/branches/{branch_id}/deltas
curl --request POST \
--url https://api.hydrate.sh/v1/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/deltas \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "deltas": [ { "node": { "data": { "aliases": [ "example" ], "config": [ { "contract_name": null, "description": "", "external": false, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "", "type": "" } ], "constraints": [ "example" ], "description": "", "documentation_url": null, "external_kind": null, "inputs": [ { "contract_name": null, "description": "", "external": false, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "", "type": "" } ], "is_external": false, "is_test_node": false, "kind": null, "language": null, "name": "", "outputs": [ { "contract_name": null, "description": "", "external": false, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "", "type": "" } ], "parent_id": null, "path_prefix": null, "protocol": null, "source_decisions": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "status": "idle", "user_kind": null, "verifications": [ { "author": "user", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "text": "example", "type": null } ] }, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "kind": "behavior", "parent_id": null }, "type": "add_node" } ], "expected_version": 1, "positions": { "additionalProperty": { "x": 1, "y": 1 } } }'

Apply an ordered batch of structural changes to a branch under optimistic concurrency. Pass the version from the branch read as expected_version; a 409 with current_version is returned if the branch moved underneath you. Pair with the Idempotency-Key header for at-most-once apply across retries.

branch_id
required
Branch Id

The branch to apply to.

string format: uuid

The branch to apply to.

Media typeapplication/json
V1DeltasBody

Request body for POST /v1/branches/{bid}/deltas.

object
deltas
Deltas

Ordered list of delta operations to apply. Each must carry a type field in the closed write-surface vocabulary (add_node / delete_node / update_node_data / reparent_node / add_edge / delete_edge / flatten_boundary). Empty list returns 200 with applied: false and no version bump.

Array
One of: discriminator: type
AddNodeDelta

Insert a node.

object
node
required
Node

A behavior or boundary node.

object
data
NodeData

A node’s data payload; its shape varies by kind and whether the node is external.

On update, key-presence semantics apply: a field present with a null value is set to null, while an omitted field is left unchanged. All fields are optional at the type level — cross-field rules (e.g. behavior nodes reject user_kind; external nodes require external_kind) are enforced server-side, so a partial update is not blocked by “missing required field” errors that don’t apply to it.

object
aliases
Aliases
Array<string>
<= 50 items
config
Config
Array<object>
Port

An input, output, or config port on a node.

object
contract_name
Any of:
string
<= 500 characters
description
Description
string
""
external
External
boolean
id
required
Id
string format: uuid
name
Name
string
""
type
Type
string
""
constraints
Constraints
Array<string>
description
Description
string
""
documentation_url
Any of:
string
external_kind
Any of:
string
inputs
Inputs
Array<object>
Port

An input, output, or config port on a node.

object
contract_name
Any of:
string
<= 500 characters
description
Description
string
""
external
External
boolean
id
required
Id
string format: uuid
name
Name
string
""
type
Type
string
""
is_external
Is External
boolean
is_test_node
Is Test Node
boolean
kind
Any of:
string
Allowed values: behavior boundary state io interface
language
Any of:
string
name
Name
string
""
outputs
Outputs
Array<object>
Port

An input, output, or config port on a node.

object
contract_name
Any of:
string
<= 500 characters
description
Description
string
""
external
External
boolean
id
required
Id
string format: uuid
name
Name
string
""
type
Type
string
""
parent_id
Any of:
string format: uuid
path_prefix
Any of:
string
protocol
Any of:
string
source_decisions
Source Decisions
Array<string>
status
Status
string
default: idle
user_kind
Any of:
string
verifications
Verifications
Array<object>
Verification

A test specification attached to a behavior node.

object
author
required
Author
string
Allowed values: user agent
id
required
Id
string format: uuid
text
required
Text
string
type
Any of:
string
id
required
Id
string format: uuid
kind
required
Kind
string
Allowed values: behavior boundary state io interface
parent_id
Any of:
string format: uuid
type
required
Type
string
Allowed value: add_node
expected_version
required
Expected Version

The branch.version the client believes is current. If it doesn’t match the server’s view at commit time, the route 409s with the actual current_version in the detail.

integer
positions
Any of:
object
key
additional properties
V1NodePosition

A single explicit pin coordinate on the /v1/ write surface.

object
x
required
X
number
y
required
Y
number

Successful Response

Media typeapplication/json
DeltaApplyResponse
object
applied
required
Applied
boolean
branch
required
BranchRef
object
id
required
Id
string format: uuid
version
required
Version
integer
delta_count
required
Delta Count
integer
positions_applied
Any of:
integer
project_id
required
Project Id
string format: uuid
version
required
Version
string
Example
{
"positions_applied": null
}

No credentials, malformed credentials, or revoked credentials. The envelope is leak-parity (same shape across all 401 paths) so an attacker cannot distinguish revoked vs. unknown via the body.

Media typeapplication/json
object
detail
required
string
Example
{
"detail": "unauthenticated"
}

Credentials are valid but lack the scope required for this route, or the principal lacks membership in the target project.

Media typeapplication/json
object
detail
object
code
string
message
string
Examplegenerated
{
"detail": {
"code": "example",
"message": "example"
}
}

Branch/project not found or not accessible, OR a delta targets a node that doesn’t exist.

Media typeapplication/json
object
detail
required
One of:
object
code
required
string
message
required
string
Example
{
"detail": {
"error": "not_found"
}
}

OCC version conflict, or the branch is not active.

Media typeapplication/json
object
detail
required
One of:
VersionConflictBody
object
current_version
required
Current Version
integer
error
required
Error
string
Allowed value: version_conflict
Example
{
"detail": {
"error": "version_conflict"
}
}

Request body failed validation, OR a delta is malformed / unknown / not an object.

Media typeapplication/json
One of:
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example
{
"detail": {
"error": "malformed_delta_field",
"recovery_hint": "regenerate_uuid"
}
}

Per-bucket rate limit exceeded. The response carries Retry-After and the standard X-RateLimit-* headers (Limit / Remaining / Reset).

Media typeapplication/json
object
detail
string
Example
{
"detail": "rate_limited"
}
Retry-After
integer
X-RateLimit-Limit
integer
X-RateLimit-Remaining
integer
X-RateLimit-Reset
integer