Authentication

Learn how to generate an access token using your API Key and Secret Key and authenticate requests to protected API endpoints.

Carrier Network AI Public API uses token-based authentication.

To access protected API endpoints, you must first generate an access token using your API Key and Secret Key.

Authentication Flow

The authentication process follows these steps:

  1. Obtain your API Key and Secret Key.
  2. Generate an access token using the Generate Auth Token API.
  3. Receive the access token in the API response.
  4. Include the access token as a Bearer token when making requests to protected API endpoints.

Generate Access Token

Use the following endpoint to generate an access token:

POST /public-api/v1/auth/token

Request

Send your API Key and Secret Key in the request body.

{
  "apiKey": "YOUR_API_KEY",
  "secretKey": "YOUR_SECRET_KEY"
}

Successful Response

If your API Key and Secret Key are valid, the API returns an access token.

{
  "success": true,
  "message": "Access token generated successfully.",
  "data": {
    "accessToken": "YOUR_ACCESS_TOKEN"
  }
}

Using the Access Token

For protected API endpoints, include the generated access token in the Authorization header.

Authorization: Bearer YOUR_ACCESS_TOKEN

Example

curl --request GET \
  --url https://api.carriernetwork.ai/public-api/v1... \
  --header "Authorization: Bearer YOUR_ACCESS_TOKEN"

Replace /public-api/v1... with the endpoint you want to call.

Token Expiration

The generated access token is valid for 24 hours.

After the token expires, generate a new access token using your API Key and Secret Key.

Security

Keep your API Key, Secret Key, and Access Token secure.

Do not:

  • Share your API Key or Secret Key publicly.
  • Commit your credentials to public repositories.
  • Expose your Secret Key in client-side applications.
  • Include real credentials in documentation examples.

Use placeholder values such as YOUR_API_KEY, YOUR_SECRET_KEY, and YOUR_ACCESS_TOKEN when sharing examples.

For information about API errors and authentication failures, see Errors & Status Codes.


Did this page help you?