Skip to content

Store the session's work so far, which becomes its diff (own session token only)

POST
/v1/sessions/{session_id}/snapshots
curl --request POST \
--url http://127.0.0.1:8080/v1/sessions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/snapshots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "base_commit": "example", "numstat": [ { "path": "example", "added": 1, "deleted": 1, "binary": true } ], "symbols": [ { "kind": "func", "name": "example", "normalized": "example", "path": "example", "lang": "example", "signature": "example", "doc": "example" } ], "patch": "example", "patch_truncated": true }'

A snapshot is cumulative against the session’s base commit. The patch and each symbol’s signature and doc pass the secret scan, and a hit sets redacted. The symbols are matched against the other active sessions’ latest snapshots and current plans, and both sessions of each overlap get an overlap_symbol or symbol_near_duplicate notice. A symbol whose doc comment is close to the doc of another session’s snapshotted symbol of the same kind is a near duplicate too, whatever the names (ADR-0017). A repeat folds into the unacked notice. A session sends at most 30 snapshots a minute.

session_id
required
string format: uuid
Media typeapplication/json
object
base_commit
required
string
/^([0-9a-f]{40}|[0-9a-f]{64})$/
numstat
Array<object>
<= 5000 items
object
path
required

Canonical repository path, once per snapshot.

string
added
required
integer
deleted
required
integer
binary

A binary file has added and deleted 0.

boolean
symbols
Array<object>
<= 1000 items
object
kind
required
string
Allowed values: func type component route table migration
name
required

Bytes, on one line, with no outer spaces.

string
>= 1 characters <= 200 characters
normalized

Ignored on input; the coordinator recomputes it.

string
path
required

Canonical repository path.

string
lang
required
string
signature

One line, at most 200 characters.

string
doc

One line, at most 300 characters.

string
patch

A unified diff, at most 524288 bytes.

string
patch_truncated

The sender cut the patch to fit.

boolean

Stored.

Media typeapplication/json
object
snapshot_id
required
string format: uuid
created_at
required
string format: date-time
redacted
required
boolean
overlaps
required
Array<object>
<= 100 items
object
kind
required
string
Allowed values: overlap_symbol symbol_near_duplicate
session_id
required
string format: uuid
user_handle
required
string
symbol
required
object
kind
required
string
Allowed values: func type component route table migration
name
required
string
path
required

Empty for a symbol from a plan.

string
other
required
object
kind
required
string
Allowed values: func type component route table migration
name
required
string
path
required

Empty for a symbol from a plan.

string
source
required
string
Allowed values: plan snapshot
similarity
required
number
<= 1
doc_similarity

Set on a symbol_near_duplicate whose doc comments matched: the cosine of the two doc texts, rounded to three places. similarity is still the names’ similarity, which may be low (ADR-0017).

number
<= 1
digest

Up to three of the session’s most urgent undelivered notices, one line each, after a “Zentri notices:” header. A last line says how many more wait. Showing a notice here marks it delivered but not acked. Absent when nothing is undelivered or the caller is not the session’s own token.

string

Example

{
"overlaps": [
{
"kind": "overlap_symbol",
"symbol": {
"kind": "func"
},
"other": {
"kind": "func",
"source": "plan"
}
}
]
}

The request is malformed.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

No valid bearer token.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The token may not do this.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

No such resource in the caller’s org.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The request clashes with current state.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The request is well formed but breaks a rule or a limit.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

A rate limit or quota stopped the request. Retry-After gives seconds to wait.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}
Retry-After
integer