---
search:
  tags:
    - Sessions
    - POST
seo:
  description: >-
    Anchor all of this session's data to wall-clock time. Reference for the POST
    /v1/sessions/id/{session_id}/unix-offset endpoint in the Roboto REST API.
sidebar:
  label: Set unix offset
  badge: POST
title: Set unix offset
type: openapi-operation
---
Anchor all of this session's data to wall-clock time.

Every partition inside the slice this session holds of each of its files takes
``unix_epoch_offset_ns`` as the wall-clock instant of its stored time 0, and the session's
aggregate bounds are recomputed from the moved data. Data that has never been anchored carries an
offset of 0, so its stored timestamps already read as nanoseconds since the Unix epoch. Last writer
wins: whatever anchor the data carried before is overwritten. The offset is a time after the Unix
epoch: an integer of nanoseconds since the epoch, or any time ``roboto.time.to_epoch_nanoseconds``
reads, so a float or numeric string is seconds and an ISO 8601 string is that instant. Returning a
session to an offset of 0 is the DELETE on this path. Setting the anchor the data already carries
changes nothing and succeeds.

The write reaches this session's data and no further. Where several sessions share one file, the
slices this session does not hold keep their own anchors; the slices it does hold are shared
rather than copied, so every other session over that data reads the anchor written here. The time
range the session declares over a file is stored in anchored time and moves with its data, but only
when every partition that range covers carries one offset before the write and one after; a range
whose data disagrees on where it started has no single distance to move by, and stays where it is.

Returns the session with its recomputed bounds.

Four cases yield a 400: an offset that is not a time strictly between the Unix epoch and 2**63 ns,
a session with no topic data, a session whose data already carries several distinct anchors
(anchor one file or one topic at a time instead), and an anchor that would move the session's data,
or a time range declared over it, before the Unix epoch or past the largest storable instant (2**63 - 1 ns).
A concurrent writer adding data to the session yields a 409; retry the request.

### Access control
 - Restricted tokens need the API scope `api.everything_else`

`POST /v1/sessions/id/{session_id}/unix-offset`
