> ## Documentation Index
> Fetch the complete documentation index at: https://docs.closient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TRMNL display poll

> Called by TRMNL firmware on every refresh cycle to decide what to paint. The server returns an ``image_url`` pointing to the device's next PNG plus a ``refresh_rate`` telling firmware when to poll again.

Phase 1 always returns the current ``image_url`` — image generation is synchronous and per-request. A future phase will switch to S3-backed pre-rendered images so many devices can share a single render.

**Auth:** ``Access-Token`` header (the opaque per-device token issued by ``/api/setup/``).

* ``200`` — image ready.
* ``401`` — missing, unknown, or disabled ``Access-Token``.



## OpenAPI

````yaml /openapi/openapi-byos.json get /byos/api/display
openapi: 3.1.0
info:
  title: BYOS API
  version: 1.0.0
  description: >
    Closient's TRMNL-compatible **Bring Your Own Server** endpoints. Powers
    e-ink analytics displays — devices poll ``/api/setup/`` on first boot, then
    ``/api/display`` on a schedule to fetch the image they should paint. The
    wire protocol matches TRMNL's BYOS contract verbatim so off-the-shelf
    reTerminal firmware works without modification.


    ## Authentication


    All endpoints require an API key passed via the `X-API-Key` HTTP header,
    unless otherwise noted.


    ```

    X-API-Key: csb_<body>_<checksum>

    ```


    Generate API keys in **Settings > API Keys** in your dashboard, or via the
    Account API.

    Session-based (cookie) authentication is also accepted for browser-based
    access.


    ## Rate Limits


    | Tier        | Requests / minute | Requests / day |

    |-------------|-------------------|----------------|

    | Default     | 300               | 10,000         |

    | Custom      | Contact us        | Contact us     |


    Rate-limit headers are included on every response so callers can
    self-throttle without

    hitting our 429s ("informed governor"):


    - `RateLimit-Policy` — every active window, e.g. `300;w=60, 10000;w=86400`

    - `RateLimit-Limit` — quota for the **most-restrictive** currently-active
    window

    - `RateLimit-Remaining` — requests left in that window

    - `RateLimit-Reset` — seconds until that window resets (relative; clock-skew
    safe)


    Legacy `X-RateLimit-*` aliases are also emitted for back-compat.
    `X-RateLimit-Reset`

    keeps the absolute Unix-timestamp shape to avoid breaking existing
    consumers.


    When rate-limited, you receive `429 Too Many Requests` with a
    `retry_after_seconds` field

    in the error envelope and a `Retry-After` header.


    ## Pagination


    List endpoints return paginated results in this envelope:


    ```json

    {
      "data": [...],
      "pagination": {
        "page": 1,
        "page_size": 25,
        "total_count": 342,
        "total_pages": 14,
        "has_next": true,
        "has_previous": false
      }
    }

    ```


    Use `?page=2&page_size=50` query parameters. Maximum page size is 100.


    ## Error Responses


    All errors conform to [RFC 9457 Problem
    Details](https://www.rfc-editor.org/rfc/rfc9457)

    with `Content-Type: application/problem+json`:


    ```json

    {
      "type": "https://closient.com/docs/errors/not_found",
      "title": "Not Found",
      "status": 404,
      "detail": "The requested resource was not found.",
      "error_code": "not_found",
      "retryable": false,
      "timestamp": "2026-03-31T12:00:00+00:00"
    }

    ```


    Common error codes: `unauthorized` (401), `forbidden` (403), `not_found`
    (404),

    `validation_error` (422), `rate_limited` (429), `internal_error` (500).
  termsOfService: https://www.closient.com/terms/
servers:
  - url: https://www.closient.com
security: []
externalDocs:
  description: Closient Documentation
  url: https://docs.closient.com
paths:
  /byos/api/display:
    get:
      tags:
        - byos-trmnl
      summary: TRMNL display poll
      description: >-
        Called by TRMNL firmware on every refresh cycle to decide what to paint.
        The server returns an ``image_url`` pointing to the device's next PNG
        plus a ``refresh_rate`` telling firmware when to poll again.


        Phase 1 always returns the current ``image_url`` — image generation is
        synchronous and per-request. A future phase will switch to S3-backed
        pre-rendered images so many devices can share a single render.


        **Auth:** ``Access-Token`` header (the opaque per-device token issued by
        ``/api/setup/``).


        * ``200`` — image ready.

        * ``401`` — missing, unknown, or disabled ``Access-Token``.
      operationId: apps_boards_api_trmnl_trmnl_display
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DisplayOut'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorOut'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                additionalProperties: true
                title: Response
                type: object
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorOut'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorOut'
        '405':
          description: Method Not Allowed
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorOut'
        '429':
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorOut'
      security:
        - TRMNLDeviceAuth: []
components:
  schemas:
    DisplayOut:
      description: |-
        Response to ``GET /api/display``.

        Tells the device what to draw next, how long to wait before checking
        again, and (optionally) whether to take firmware action.
      examples:
        - device_status: claimed
          filename: closient-A1B2C3-3f9a2c1d8e.png
          firmware_url: ''
          image_url: https://www.closient.com/byos/devices/A1B2C3/image.png
          refresh_rate: 900
          reset_firmware: false
          status: 0
          update_firmware: false
      properties:
        status:
          default: 0
          description: >-
            TRMNL display status code. ``0`` means "image ready"; non-zero
            values are reserved for future TRMNL extensions.
          title: Status
          type: integer
        image_url:
          description: >-
            Absolute URL the device should fetch and paint. Currently a Django
            view that streams the rendered 2-bit PNG.
          title: Image Url
          type: string
        filename:
          description: >-
            Suggested filename for the device's local cache (the device de-dupes
            by this name).
          title: Filename
          type: string
        refresh_rate:
          description: >-
            Seconds the device should wait before polling ``/api/display``
            again. Bounded to [60s, 24h].
          maximum: 86400
          minimum: 60
          title: Refresh Rate
          type: integer
        reset_firmware:
          default: false
          description: >-
            Whether the device should reset to first-boot state on next reboot.
            Unused in Phase 1.
          title: Reset Firmware
          type: boolean
        update_firmware:
          default: false
          description: >-
            Whether the device should fetch new firmware. Unused in Phase 1 —
            Closient does not host firmware images.
          title: Update Firmware
          type: boolean
        firmware_url:
          default: ''
          description: >-
            URL of new firmware to fetch when ``update_firmware`` is true. Empty
            in Phase 1.
          title: Firmware Url
          type: string
        device_status:
          $ref: '#/components/schemas/BYOSDeviceStatusEnum'
          description: >-
            Closient-side lifecycle state of this device. Non-standard extension
            to the TRMNL response — TRMNL firmware ignores it; dashboards
            consume it for status badges.
      required:
        - image_url
        - filename
        - refresh_rate
        - device_status
      title: DisplayOut
      type: object
    ErrorOut:
      title: ErrorOut
      type: object
      description: RFC 9457 Problem Details error body.
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        error_code:
          type: string
        retryable:
          type: boolean
        timestamp:
          type: string
          format: date-time
      required:
        - type
        - title
        - status
        - detail
      examples:
        - type: https://closient.com/docs/errors/not_found
          title: Not Found
          status: 404
          detail: The requested resource was not found.
          error_code: not_found
          retryable: false
          timestamp: '2026-03-31T12:00:00+00:00'
    BYOSDeviceStatusEnum:
      description: |-
        Lifecycle state of a :class:`apps.boards.models.BYOSDevice`.

        State machine:

        * ``unclaimed`` — device has called ``/api/setup/`` but is not yet
          linked to a Closient :class:`Organization`. Renders the BYOS
          fallback "register me" image.
        * ``claimed`` — device is linked to an organization and renders the
          org-typed dashboard.
        * ``disabled`` — device is administratively disabled and rejected at
          auth time. Used to retire lost/stolen panels without deleting the
          row (so historical logs survive).
      enum:
        - unclaimed
        - claimed
        - disabled
      title: BYOSDeviceStatusEnum
      type: string
  securitySchemes:
    TRMNLDeviceAuth:
      type: apiKey
      in: header
      name: Access-Token

````