Loading...
Profile Image

Profile Image

How to Authenticate and Use the ScaleGrowth API via cURL

How to Authenticate and Use the ScaleGrowth API via cURL

About

This guide explains how to authenticate and use the ScaleGrowth API using cURL. It walks through registering a client application, obtaining an access token, and making authorized API calls.



Content

πŸ” How to Authenticate and Use the ScaleGrowth API via cURL

This guide explains how to authenticate and use the ScaleGrowth API using cURL. It walks through registering a client application, obtaining an access token, and making authorized API calls


βš™οΈ Note: Every ScaleGrowth instance is hosted under a unique Platform Slug (your_p_slug). Replace your_p_slug in the URLs below with the actual slug of your instance (the part after /p/ in the URL paths of your ScaleGrowth Platform, like /p/your_p_slug/ ).



πŸ›  Step 1: Register an API Client Application


  1. Log in to your instance at:

https://your_p_slug.scalegrowth.ai/p/your_p_slug/login/

2. Navigate to:

Platform API β†’ API Client Applications

3. Click β€œRegister a New API Client Application”

4. On the form, select:

  • Client Type: Confidential
  • Authorization Grant Type: Client Credentials

5. White registering your Client app, save the client_id and client_secret – you will not be able to retrieve the secret again.


πŸ”‘ Step 2: Get an Access Token with cURL


Use the credentials you just saved in the following command:


curl -X POST "https://your_p_slug.scalegrowth.ai/api/o/token" \

-H "Content-Type: application/x-www-form-urlencoded" \

-d "grant_type=client_credentials" \

-d "client_id=YOUR_CLIENT_ID" \

-d "client_secret=YOUR_CLIENT_SECRET"


Example successful response:


{

"access_token": "D1TPmIwn64oSrBYNXQUu04RFLGaPGK",

"expires_in": 36000,

"token_type": "Bearer",

"scope": "openid email profile"

}



πŸͺͺ D1TPmIwn64oSrBYNXQUu04RFLGaPGK is your YOUR_ACCESS_TOKEN. Save it for the next step.



πŸ“‘ Step 3: Use the API with the Bearer Token


Now that you have the access token, use it to call any API endpoint by passing it as a Bearer token:


curl -X GET "https://your_p_slug.scalegrowth.ai/api/v1/custom_offers/4/" \

-H "Authorization: Bearer YOUR_ACCESS_TOKEN"


Example output:


{

"count": 1,

"next": null,

"previous": null,

"results": [

{

"sg_id": "674f49b5-39e7-4828-b64a-542bd5a57205",

"smart_field_7": "Test Contact – Example Contact Field",

"smart_field_13": "Test Contact – Second Contact Field"

}

]

}


πŸ“š Step 4: Explore the API


To discover all available endpoints and data models:

β†’ Navigate to Platform API β†’ API Documentation inside your ScaleGrowth admin interface.


⚠️ Final Note on White-Labeled Domains


If your platform uses a white-labeled custom domain, replace

https://your_p_slug.scalegrowth.ai

with your custom subdomain, e.g.,

https://app.yourdomain.com