# Create a new data point

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /import/data_points/{customerId}:
    post:
      summary: Create a new data point
      deprecated: false
      description: >
        This endpoint enables clients to add new data points in custom data
        series to Enectiva. Each data point is sent in a separate HTTP request.
        There's no recommended frequency of data points sent because it depends
        on the time series, but too frequent requests might lead to rate
        limiting (429).


        The data points should be sent in chronological order. Data points with
        time before the latest data point in any given series will be accepted,
        but might not be used by Enectiva.


        Each data point must satisfy validation rules:


        - `time`, `value` and `import_id` are required


        - `time` must conform to format defined in RFC3339, the time will be
        truncated to whole seconds


        - `value` has to be a floating point number; we recommend sending only
        reasonable number of digits after the decimal point


        - `import_id` is limited to 255 characters, it is case-sensitive, must
        not contain spaces


        - `sender` is a case-sensitive string limited to 255 characters used for
        debugging and verification


        - `suit` is an optional string identifying the series of readings, if
        not provided `default` will be used, must not contain spaces


        - data point must be in the past


        For testing integration of a new client, we recommend using dummy series
        IDs (e.g. `test`).


        An attempt to insert an identical data point (the same `import_id`,
        `suit`, `time` and `value`) will result in 409 status code.
      operationId: Create a new data point
      tags:
        - Data points to Enectiva
        - Data points to Enectiva
      parameters:
        - name: customerId
          in: path
          description: >-
            UUID of the customer, available in the token management section in
            Enectiva
          required: true
          example: '{{customerId}}'
          schema:
            type: string
        - name: Accept
          in: header
          description: e.g. application/vnd.api+json
          required: true
          example: application/vnd.api+json
          schema:
            type: string
        - name: Content-Type
          in: header
          description: e.g. application/vnd.api+json
          required: true
          example: application/vnd.api+json
          schema:
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    type:
                      type: string
                    attributes:
                      type: object
                      properties:
                        time:
                          type: string
                        value:
                          type: number
                        import_id:
                          type: string
                        sender:
                          type: string
                        suit:
                          type: string
                      required:
                        - time
                        - value
                        - import_id
                        - sender
                        - suit
                      x-apidog-orders:
                        - time
                        - value
                        - import_id
                        - sender
                        - suit
                  required:
                    - type
                    - attributes
                  x-apidog-orders:
                    - type
                    - attributes
              required:
                - data
              x-apidog-orders:
                - data
            example:
              data:
                type: data_points
                attributes:
                  time: '2016-01-07T05:23:41+01:00'
                  value: 550011.34
                  import_id: temp_01
                  sender: test_script_01
                  suit: default
      responses:
        '201':
          description: Created
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      attributes:
                        type: object
                        properties:
                          customer_uuid:
                            type: string
                          import_id:
                            type: string
                          sender:
                            type: string
                          suit:
                            type: string
                          time:
                            type: string
                          value:
                            type: number
                        required:
                          - customer_uuid
                          - import_id
                          - sender
                          - suit
                          - time
                          - value
                        x-apidog-orders:
                          - customer_uuid
                          - import_id
                          - sender
                          - suit
                          - time
                          - value
                      id:
                        type: integer
                      type:
                        type: string
                    required:
                      - attributes
                      - id
                      - type
                    x-apidog-orders:
                      - attributes
                      - id
                      - type
                required:
                  - data
                x-apidog-orders:
                  - data
              example:
                data:
                  attributes:
                    customer_uuid: 11e7e767-6f74-4994-b607-158ff7f7445e
                    import_id: temp_01
                    sender: test_script_01
                    suit: default
                    time: '2016-01-07T05:23:41+01:00'
                    value: 550011.34
                  id: 1
                  type: data_points
          headers: {}
          x-apidog-name: Created
        '400':
          description: Bad Request
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - detail
                        - status
                        - title
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Missing series ID
                    status: '400'
                    title: Invalid data
          headers: {}
          x-apidog-name: Bad Request
        '401':
          description: Unauthorized
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - detail
                        - status
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Access token is invalid.
                    status: '401'
                    title: Unauthorized
          headers: {}
          x-apidog-name: Unauthorized
        '406':
          description: Not Acceptable
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - detail
                        - status
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Accept HTTP header must be "application/vnd.api+json".
                    status: '406'
                    title: Not acceptable
          headers: {}
          x-apidog-name: Not Acceptable
        '409':
          description: Conflict
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - detail
                        - status
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: A record with the same ID already exists.
                    status: '409'
                    title: Conflict
          headers: {}
          x-apidog-name: Conflict
        '415':
          description: Unsupported Media Type
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - detail
                        - status
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Content-Type header must be "application/vnd.api+json".
                    status: '415'
                    title: Unsupported Media Type
          headers: {}
          x-apidog-name: Unsupported Media Type
        '429':
          description: Too Many Requests
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - detail
                        - status
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: You have exceeded the number of allowed requests.
                    status: '429'
                    title: Too Many Requests
          headers: {}
          x-apidog-name: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - status
                        - detail
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Something went wrong
                    status: '500'
                    title: Internal Server Error
          headers: {}
          x-apidog-name: Server Error
      security:
        - Access  or  Import token: []
          x-apidog:
            schemeGroups:
              - id: u1s7AhEp5a9NUvBVCjo3r
                schemeIds:
                  - Access  or  Import token
            required: true
            use:
              id: u1s7AhEp5a9NUvBVCjo3r
            scopes:
              u1s7AhEp5a9NUvBVCjo3r: {}
      x-apidog-folder: Data points to Enectiva
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1003855/apis/api-19188097-run
components:
  schemas: {}
  securitySchemes:
    Access token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Import token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Login token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Access  or  Import token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
servers:
  - url: https://api.enectiva.cz
    description: https://api.enectiva.cz
security: []

```
