---
search:
  tags:
    - Files
    - POST
seo:
  description: >-
    Register the topic data one already-uploaded file carries, naming no…
    Reference for the POST /v1/files/id/{fs_node_id}/topics endpoint in the
    Roboto REST API.
sidebar:
  label: Declare file topics
  badge: POST
title: Declare file topics
type: openapi-operation
---
Register the topic data one already-uploaded file carries, naming no session.

Answers 200 once the request has been processed, even when the platform registered only some of its
declarations: the response carries one element per declared topic, in request order, holding either the
topic that declaration registered against or the error that refused it. A file that is not ``Available``,
or a listed representation naming a file that is not an ``Available`` file of the same org, answers 404;
a caller without edit access to the file or to a file a listed representation names, 401;
and a malformed request, 400. A request stating ``is_default_for_reads`` on a timeline source, true or false,
also answers 401 unless the caller has 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 of these is settled before the first declaration
is prepared, so a refused request registers nothing.

Each declaration's ``anchor_ns`` is an integer of nanoseconds since the Unix epoch, or any value
``roboto.time.to_epoch_nanoseconds`` reads: a float or numeric string is seconds, and an ISO 8601
string is that instant.

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

`POST /v1/files/id/{fs_node_id}/topics`

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

- `topics` (FileTopicDeclaration[], required)

Request body example:

```json
{
  "topics": [
    {
      "topic_name": "string",
      "topic_schema": {
        "name": null,
        "fields": [
          {
            "name": "",
            "path": [
              "string"
            ],
            "data_type": "string",
            "canonical_data_type": "unknown",
            "unit": null,
            "element_names": null
          }
        ]
      },
      "timeline_sources": [
        {
          "min_file_timestamp_ns": -9223372036854776000,
          "max_file_timestamp_ns": -9223372036854776000,
          "is_default_for_reads": true,
          "kind": "field",
          "field_path": [
            "string"
          ]
        }
      ],
      "data_range": null,
      "representations": [
        {
          "file_id": "string",
          "storage_format": "mcap",
          "content_format": null,
          "transformations": [
            "string"
          ],
          "field_path": null
        }
      ],
      "anchor_ns": null
    }
  ]
}
```

**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": {
    "responses": [
      {
        "data": null,
        "error": null
      }
    ]
  }
}
```
