Skip to main content

Authentication (API access token)

All API requests must be authenticated using an API key. Without a valid key, every request will return a 401 Unauthorized error.

Your API key

Each account has a unique API key. To retrieve yours, log in and visit the API page.

Keep your key private. Treat it like a password. Do not include it in client-side code, public repositories, or log files.

Passing your key

Include your API key as an access_token query parameter on every request. How you append it depends on whether other parameters are already present in the URL.

Query string syntax: Use ? to begin the query string when access_token is the only parameter. Use & to chain it when other parameters come first.

Document requests

access_token is the only parameter, so the query string begins with ?.

https://service.betterregulation.com/api/document/38001?access_token=[your-api-key]

Search requests

Other parameters come first, so access_token is appended with &.

https://service.betterregulation.com/api/v1/search?title=article&access_token=[your-api-key]

Authentication errors

If your key is missing, malformed, or invalid, the API will return a 401 Unauthorized response. See the Error Handling page for details on the error response format.

Generating a new key

You can generate a replacement key at any time from the API page.

Your previous key is invalidated immediately. Update any existing integrations before generating a new key to avoid service interruption.