MachinePortal API Documentation
    • Generate Token
      POST
    • Get KWH Data
      POST

      Generate Token

      POST
      /api/generate_token
      Generate a lifetime API token for authentication. The token will never expire unless the user changes their password.
      Important:
      Only one active token per user (old tokens are automatically deleted)
      Token is valid for lifetime (no expiry)
      Token will be invalidated if user changes password
      You can use either email or username in the request

      Request

      Header Params

      Body Params application/json

      Examples

      Responses

      🟢200
      application/json
      Body

      🟠400
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://prod.your-api-server.com/api/generate_token' \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "email": "string",
          "password": "string"
      }'
      Response Response Example
      200 - Success Response
      {
          "success": true,
          "message": "Token generated successfully.",
          "token": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2",
          "expires_at": null,
          "user": {
              "id": 1,
              "name": "Admin User",
              "email": "admin@admin.com"
          }
      }
      Modified at 2026-03-11 16:23:23
      Next
      Get KWH Data
      Built with