---
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`

**Request body** (`application/json`, required)

- `unix_epoch_offset_ns` (integer, required)

Request body example:

```json
{
  "unix_epoch_offset_ns": 0
}
```

**Responses**

- `200` — OK
- `400` — A conversation with Roboto's AI is longer than the AI model can read at once. The conversation's messages and tool results, together with the AI's instructions, exceed the model's context window. The exception does not carry the token count or the model's limit.
- `401` — The caller's token is expired or malformed.
- `403` — The request would take the user or organization past a limit on a resource, such as AI credits.
- `404` — The request names an API route Roboto does not serve.
- `409` — The request conflicts with an existing resource, such as by giving a name another resource already has.
- `410` — The resource the request names is missing or has expired.
- `500` — Roboto reported an error that this release of the SDK cannot match to a specific exception class. Reported for an element of a :py:class:\`\~roboto.http.BatchResponse\` whose error names a code this release defines no class for, or that arrived without a code, without a message, or as text that is not an error envelope at all. It carries whatever code and message Roboto sent, so a caller handling the failure still learns what went wrong; when no message could be read, the message is the error's raw text. :py:meth:\`\~roboto.domain.devices.Device.create\_session\` raises it, and :py:meth:\`\~roboto.domain.devices.Device.create\_sessions\` lists it in the batch's :py:attr:\`\~roboto.http.BatchResponse.failed\`. The error envelope carries no status code, so \`\`http\_status\_code\`\` reports the 500 inherited from \`\`RobotoDomainException\`\` rather than the status the failure had.
- `501` — The request asks for an operation this deployment of Roboto does not provide.
- `503` — Roboto could not accept the request, such as under heavy load. Retrying later may succeed.
- `504` — Roboto ran out of time while processing the request. Retrying may succeed.
- `507` — The response to the request is larger than Roboto can send. Retrying the same request fails the same way; request less data at a time.

Response example, 200:

```json
{
  "data": {
    "completed_at": null,
    "completed_by": null,
    "completes_at": null,
    "completion_policy": null,
    "created": null,
    "created_by": "string",
    "custom_fields": {},
    "description": null,
    "ingested_at": null,
    "ingestion_count": 0,
    "max_timestamp_ns": null,
    "metadata": {},
    "min_timestamp_ns": null,
    "modified": null,
    "modified_by": "string",
    "name": null,
    "org_id": "string",
    "session_id": "string",
    "status": "in_progress",
    "tags": [
      "string"
    ]
  }
}
```
