Hootsuite Rest API Authentication API
Follow the steps below to make an authenticated API request. # 1. Request client credentials ### Step 1: Create your OAuth 2.0 app Follow [these steps](https://developer.hootsuite.com/docs/getting-started-with-the-rest-api) to set up your app and retrieve your client credentials (`client_id` and `client_secret`): ### Step 2: Retrieve the appId of your newly created app 1. Go to your [Hootsuite Developer Apps](https://hootsuite.com/developers/my-apps) dashboard. 2. Select `edit` for your newly created app. 3. You can find the appId in the `appId` parameter of the browser URL. Ex: `https://hootsuite.com/developers/my-apps/app-directory/app/edit?appId=XXXXXX` ### Step 3: Retrieve the organization ID of your Hootsuite organization 1. Sign in into your [Hootsuite account](https://hootsuite.com). 2. Select `My profile > Manage accounts and teams`. 3. Select `Teams` for your organization. 5. You can find the organization ID in the id query parameter in your browser's address bar. ``` https://hootsuite.com/dashboard#/organizations/teams/?id= ``` ### Step 4: Request to link your organization to your app 1. Add a member to your org that is not a paying member 2. Make sure they have at least admin permission level 3. Send an email to the Development Support Team to link your organization to your app: - To: `dev.support@hootsuite.com` - Include: - the `appId` you retrieved in *Step 2* - the `organization ID` you retrieved in *Step 3* - the `member ID` of the non-paying admin member 4. Wait for the Development Support Team to link your app to your organization. # 2. Generate an access token When the developer app is correctly set up, you can use your `client_id` and `client_secret` to retrieve an `access_token` to make authorized API requests. When the `access_token` expires, use the [/oauth2/token](#operation/oauthToken) to generate a new token. This endpoint requires that you pass in your client credentials (`client_id` and `client_secret`) using the HTTP Basic authentication scheme as described in the [OAuth 2.0 specification](https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1). Including your client credentials in the request-body is not supported. When the `access_token` expires, the API returns a 401 unauthorized. The client can automate this by generating a new access token and replaying the failed request with the fresh access token, as described in the following section. # 3. Include the access token as a bearer token Authorization header Add the bearer token in the Authorization header ```text Authorization: Bearer ``` Example request with token ```shell $ curl -X GET https://platform.hootsuite.com/inbox/v1/reporting/metrics/agent-availability \ -H 'Authorization: Bearer oZy8FDUHEiZ0mh0j4rUwOT9t5yHouTzBDsn-x_GROB0.rz-pMQzh-1F6VIGwnJZMBwH3SRwDfEHE4CRi-AClpcg' ```