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

# Fetch entity state history from InfluxDB

> Returns time-ordered state changes for one or more entities in a time range.



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi get /v1/history
openapi: 3.1.0
info:
  title: Unicontrol API
  description: Welcome
  version: 1.0.0
servers:
  - url: http://0.0.0.0:3000
    description: Local Server
  - url: https://portal.test.flexhome.casa
    description: Development
  - url: https://portal.unicontrol.me
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/history:
    get:
      tags:
        - History
      summary: Fetch entity state history from InfluxDB
      description: >-
        Returns time-ordered state changes for one or more entities in a time
        range.
      operationId: getV1History
      parameters:
        - in: query
          name: start
          required: true
          schema:
            type: string
            format: date-time
          description: ISO 8601 start time
        - in: query
          name: end
          required: true
          schema:
            type: string
            format: date-time
          description: ISO 8601 end time
        - in: query
          name: entity_id
          required: true
          schema:
            type: string
          description: Comma-separated entity_ids
      responses:
        '200':
          description: History points grouped by entity_id
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                      state:
                        type: string
        '400':
          description: Dados inválidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: validation error
        '401':
          description: Não autenticado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: unauthorized
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````