All requests to the EnergyPrint JSON API are authenticated via JSON Web Token as an Authorization
request header.
Request a Token
POST /auth/login
Request:
{
"email": "morpheus@energyprint.com",
"password": "f0llowthewh1ter@bbit"
}
Key | Data Type | Example Value |
---|---|---|
email (required) |
String | "morpheus@energyprint.com" |
password (required) |
String | "f0||owthewh1ter@bbit" |
Response:
{
"message": "Welcome, morpheus@energyprint.com!",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wYW55X2lkIjoxMSwicGVyc29uX2lkIjo1NzM3LCJ1c2VyX2txkjjo1NjkwLCJlbWFpbCI6Im1pY2hhZWwuaGFybXNAZW5lcmd5cHJpbnQuY29tIiwibmFtZSI6Im1pY2hhZWwuaGFybXNAZW5lcmd5cHJpbnQuY29tIiwiaWF0IjoxNjQzNzMxODY4LCJleHAiOjE2NDQzMzY2Njh9.n1D9TauOqEJLoQ0KKlDzBNXeQfQdkDWyH9RE8WtSv-s"
}
Key | Data Type | Example Value |
---|---|---|
message |
String | "Welcome, morpheus@energyprint.com!" |
token |
JWT | "eyJhbGciOiJIUzI1j..." |
Request Data
Using the returned token as a request header, Authorization
, you’re ready to start requesting data.
Tokens do not expire, but can be manually revoked.
Revoking Tokens
For your security, you can, at any time, revoke your company’s outstanding API tokens. This is important if you’ve made changes to your development team, or if you think a token may have been compromised. An authenticated request to
POST /auth/revoke
will revoke all your company’s existing API tokens, including the one used to make the request. You will have to request a new token before using the API again.