Getting Started
Getting your long lived token
To get started with the API, you will need to create an API key:
- Click the Settings icon on the upper right of any page when logged in to Crunchy Bridge.
- Click “Create”.
Your Application ID
and Application Secret
are long lived and allow you to get a short lived token which you can then use to connect to the Crunchy Bridge API.
Each user can create an API key to authenticate across teams where they are a member.
To delete a key, click the Delete icon for the key. Once you confirm the removal of the key, it is deleted permanently.
If you had generated a short-lived token but deleted the key while the token is valid, calls made using the token will still work, unless a /logout
operation is performed.
Getting an API bearer token
Once you’ve set up your long lived Application ID
and Application Secret
, you can then connect to the API to get a bearer token which allows you to perform operations against your resources.
We recommend storing your Application ID
and Application Secret
in environment variables.
To get a token, submit a POST request to the token
endpoint on https://api.crunchybridge.com
:
curl -v
-d "grant_type=client_credential"
-d "client_id=$APPLICATION_ID"
-d "client_secret=$APPLICATION_SECRET"
-X POST "https://api.crunchybridge.com/token";
This will return:
{
"token_type":"bearer",
"expires_in":3600,
"access_token":"pkcym5d6qfe3hikavzgtqww35m"
}
You will want to save your access_token
this is what you will use when making other calls against the API. Your access_token
is valid for 1 hour.
Querying the Crunchy Bridge API
Once you have your access token from above you can now begin to issue calls against the API. All API calls are issued against https://api.crunchybridge.com
.
We’ll begin by listing all of our teams:
curl --request GET "https://api.crunchybridge.com/teams"
--header "Accept: application/json"
--header "Authorization: Bearer a22rpvk7jjdqfci6rjbrl24x5m";
This will provide a list of all your teams:
{
"teams": [
{
"id": "lkpufdheyrdm7j6n77rs3rqswy",
"is_personal": true,
"roles": [],
"created_at": "2020-08-26T21:10:39.719444Z",
"updated_at": "2020-08-26T21:10:39.719444Z"
},
{
"id": "esodoj4ugvcatginlvjrjt4tzu",
"team_name": "demo",
"is_personal": false,
"roles": [
1,
2
],
"created_at": "2020-09-16T16:46:46.151828Z",
"updated_at": "2020-09-16T16:46:46.151828Z"
}
]
}
From here you can dig into each of the various endpoints in the following sections.