---
search:
  tags:
    - Devices
    - POST
seo:
  description: >-
    Create many sessions on this device, each with its files, topics,… Reference
    for the POST /v1/devices/id/{device_id}/sessions endpoint in the Roboto REST
    API.
sidebar:
  label: Create device sessions
  badge: POST
title: Create device sessions
type: openapi-operation
---
Create many sessions on this device, each with its files, topics, and schemas, in one call.

Answers 200 once the batch has been processed, even when the platform refused some of its declarations:
the response carries one element per declared session, in request order, holding either the session that
declaration created or the error that refused it. Every declaration's refusal is decided before anything is
written, and the others are written together in one transaction, so a failure the platform did not
anticipate, such as the request's deadline, writes none of them. A malformed batch answers 400.
A device not registered in this org answers 404, and so does a file an entry declares, or a file a listed
representation names, that is not an ``Available`` file of the org. All three are settled before the first
declaration is written, so the request creates no session. When a session a declaration reuses is deleted
before the request commits, the request answers 404 and writes nothing.

Each ``anchor_ns`` in the body is read as ``roboto.time.to_epoch_nanoseconds`` reads a time: an integer is
nanoseconds since the Unix epoch, a float or numeric string is seconds, and an ISO 8601 string is that
instant. An anchor at or before the epoch makes the batch malformed.

Declaring topics on a file or anchoring it writes to that file and so requires edit access to it; an anchor
stated on a session applies to every file that session names. Naming a file in a listed representation writes
nothing to that file and takes the access that declaring topics on it does, because a read of the topic opens
that file. Stating ``is_default_for_reads`` on a timeline source, true or false, additionally requires topic edit
access in the org: which source a schema's reads fall back to is a property of the org's topics, not of any one
file. Each denial answers 401 before any session is prepared.

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

`POST /v1/devices/id/{device_id}/sessions`
