About the Authorization API

API Version: 1.9

The Authorization API allows you to authorize your API calls. It is required that you retrieve a valid access token for all calls to the account APIs. Public APIs do not require authorization.

In order to use API endpoints that require authroization, you need client credentials. If you do not already have client credentials, sign into your account and generate them.

The diagram below shows the authorization flow for the account APIs:Diagram of NetworkCalc API authorization flow

To authorize your API requests, send a POST to the /auth/token endpoint with your client_id and client_secret in the body, along with a grant_type of client_credentials. You will receive an access_token back that should be used in the Authorization header as a bearer token. View the endpoints below for examples.

Endpoints

POST
https://networkcalc.com/api/auth/token

Get an access token

. Get an access token to use in API calls that require authorization.

Request Headers

Content-Type
(Required) application/json

Request Body

{
  "client_id": "[string] The client ID for the authorization.",
  "client_secret": "[string] The client secret for the authorization.",
  "grant_type": "[string] The type of authorization. Should be 'client_credentials'."
}

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
INVALID_CREDENTIALS - The credentials supplied are not valid.
401
REVOKED_CREDENTIALS - The credentials supplied have been reboked and can no longer be used.
401
INVALID_GRANT_TYPE - The grant_type supplied is invalid. Should be client_credentials.
401
INVALID_GRANT - The access token supplied is invalid or another error occured.

Response Formats

AuthTokenResponse

{
  "status": "[string] The status of the request.",
  "token": {
    "access_token": "[string] A bearer token to be used in the header of subsequent API calls.",
    "token_type": "[string] The type of token, for example 'bearer'.",
    "expires_in": "[number] The time (in seconds) until the token expires and a new token is required."
  }
}