The StackPath Developer Portal

Integrate our platform directly into your products and dynamically protect your edge.

Get Started    API Reference

Authenticating the StackPath API



This article assumes you have a StackPath account. Review our Introduction to the StackPath API to get started.

Once you sign up and configure your first , then continue by creating the OAuth credentials you'll need to properly authenticate each request made to the API.

Generating your API credentials

To generate your API credentials, perform the following:

  1. Navigate to the API Management page in your StackPath control portal.
  2. Click or tap Generate Credentials.
  3. Record the Client Secret and Client ID in a secure location for later use.


Client Secret

You will only be shown your Client Secret once, so make sure you record it in a secure location. If you miss it, you will have to create a new set of API credentials.

Receiving your access token

An access token is required to make requests to the API. To create an access token, make a POST API request with the minimal properties of Content-Type, Client ID, Client Secret, and Grant Type.

For example, to generate an access_token in the , execute the following curl command substituting your recorded Client ID with client_id and Client Secret with client_secret:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your_client_id",
    "client_secret": "your_client_secret",
    "grant_type": "client_credentials"


Grant Type

The grant_type value should always be "client_credentials".

On success, this request will return a JSON object in response:

  "access_token": "this_is_your_token_and_its_around_900_characters",
  "token_type": "bearer",
  "expires_in": 3600

What do these keys represent? Let us review:

  • access_token -- an access token string as issued by the authorization server
  • token_type -- denotes the type of token returned, often merely the string "bearer"
  • expires_in -- the granted duration of time (in seconds) the access token works


Access Token

The access_token is the value you will use when making requests to the StackPath API. This string is used in subsequent API calls until it's expired.


If you are getting errors, first make sure the appropriate elements of the curl command were substituted. Secondly, ensure the characters aren't formatted versions of single-quotes or double-quotes; a common formatting issue faced when moving between text editors.

If you're still stuck, contact our 24/7 support team for immediate assistance. They're here to help!

Updated about a year ago

Authenticating the StackPath API

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.