Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

Skip to main content

Get a project access token

Learn how to get project access tokens.

Prerequisites

You have a Swan project and you have access to your Dashboard.

Step 1: Get your credentials

  1. Go to Dashboard > Developers > API.
  2. Locate your client ID.
  3. Locate your client secret, or generate a new secret if needed.

Keep this page open; you'll need these values for the next step.

Image of Dashboard API page focused on credentials

Step 2: Request your access token

Send a cURL request with your client ID and secret (lines 2-3) to get your project access token.

Request project access token
curl -v -X POST <https://oauth.swan.io/oauth2/token> \\
-d "client_id=$YOUR_CLIENT_ID" \\
-d "client_secret=$YOUR_CLIENT_SECRET" \\
-d "grant_type=client_credentials"

Step 3: Get your access token

Assuming the credentials provided were correct, you'll receive a response with a project access token.

The example response explains that you're receiving a bearer token, which is a cryptic string, and that the token provides project-level access for one hour.

Response
{
"access_token": "$YOUR_PROJECT_ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3600,
"scope": ""
}
Troubleshooting

If your request returns an error, your client secret might be invalid. Generate a new secret on your Dashboard, then try again.