Skip to main content

Authentication

Before You Begin​

Make sure you have your clientId and clientSecret. You'll need them to request your OAuth2 token. If you're missing either value, reach out to support.

How Authentication Works​

Every API call must include a valid OAuth2 Bearer token. The first step in getting that token is to build a Basic auth header using your client credentials.


Step 1 — Build Your Basic Auth Token​

  1. Create a string in the format:

    clientId:clientSecret
  2. Base64-encode that string.

Example source string:

0000000000000000000000:111111111111111111111111111

Encoded result:

MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDoxMTExMTExMTExMTExMTExMTExMTExMTExMTE=

You can use any Base64 encoder (CLI tools, libraries, or online utilities).


Step 2 — Get a Bearer Token​

Now that you have your Base64-encoded Basic token, you can use it to request an OAuth2 Bearer token.

Send a POST request to:

https://pwrapi.generac.com/v1/auth

Sample Request:

POST /v1/auth HTTP/1.1
Host: pwrapi.generac.com
Accept: application/json
Authorization: Basic <your-base64-token>

No body payload is required for this request.


Expected Response

A successful response will return an OAuth2 Bearer token along with metadata such as expiration and the company context associated with your credentials.

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"created_at": "2025-12-01T23:31:19.142+00:00",
"companies": [
{
"companyId": "xxxxxxxx-0000-0000-0000-xxxxxxxxxxxx"
}
]
}

You will use the value in access_token as the Authorization: Bearer <token> header for all subsequent API requests.


Step 3 — Handle Token Expiry​

The Bearer token is valid for 3600 seconds ("expires_in": 3600 in the response).

When the token expires, simply call the same endpoint again:

POST /v1/auth

This will issue a new Bearer token using the same Basic authentication header. You can repeat this flow as needed.