Create API keys and webhooks for other systems
Issue scoped API keys for the Cohort REST API, send event webhooks to tools like Zapier, and set who is emailed about website leads.
The written steps below are complete. Producing the video? Use the video script tab — it follows these steps one for one.
The Developer page connects Cohort to your website, Zapier or your own systems. API keys let another system read or write data through the Cohort API at /api/v1; each key only gets the scopes you pick. Webhooks push events, such as a new prospect or a paid invoice, to a web address as they happen, signed so the receiver can trust them.
By the end you can
- Create an API key with only the scopes it needs
- Set up a webhook endpoint for chosen events
- Set website lead notification recipients
Before you start
- An Owner or Admin login
- The address of the system that will receive webhooks, if you use them
Step by step
- 1
Open Developer settings
/settingsIn Settings, click Open Developer settings.
You should see: A page titled Developer with API keys, Website integration, Webhooks and Recent webhook deliveries.
- 2
Name a new key and pick scopes
/settings/developerIn API keys, type a Name (for example Marketing website) and click each scope it needs under Scopes (pick at least one), such as read:programs.
You should see: The chosen scopes are highlighted.
- 3
Create the key
/settings/developerClick Create key.
You should see: New key created with the full key and Copy it now — it won't be shown again.
- 4
Copy and store the key
/settings/developerCopy the key into your other system's settings, then click Dismiss.
You should see: The key appears in the list with its start, scopes and never used.
- 5
Create a webhook endpoint
/settings/developerIn Webhooks, type a Name and URL (https), click the events under Events to subscribe to (leave empty for all), and click Create endpoint.
You should see: Endpoint created with Signing secret (store securely on your receiver):.
- 6
Store the signing secret
/settings/developerCopy the signing secret into your receiving system, then click Dismiss.
You should see: The endpoint is listed as active with its events.
- 7
Set lead notification emails
/settings/developerIn Website integration, type one email per line in Notification recipients and click Save.
You should see: Saved. These people are emailed for every lead, trial or enrolment submitted from your website.
- 8
Check deliveries
/settings/developerLook at Recent webhook deliveries.
You should see: The last 25 events sent, each marked succeeded or failed.
Tips
- Send the key in the X-API-Key header. The API quickstart card at the bottom shows sample requests.
- Never put an API key in public website code. Keep it on a server.
- Click Revoke to switch a key off. Anything using it starts getting a 401 error.
- Use Disable to pause a webhook without deleting it, and Enable to turn it back on.
- Each webhook is signed with an X-Cohort-Signature header your receiver can check with the signing secret.
Troubleshooting
- It says Pick at least one scope — keys with no scopes can't read or write any data.
- Click at least one scope before creating the key.
- It says Name and URL are required.
- Give the webhook a name and a full https address.
- It says Webhook URL must start with http:// or https://.
- Type the full address, including https://.
- A webhook shows consecutive failures.
- The receiving system isn't answering. Check its address and that it's running, then watch Recent webhook deliveries.
- I lost an API key.
- Keys are only shown once. Revoke the old key and create a new one.
Shot list for recording this lesson — about 2:26 long. Record in a sample college with made-up students only, and follow the recording standards.
- 0:00Title card
- Show
- Title Create API keys and webhooks for other systems over the Cohort logo, then the first screen (/settings) with sample data.
- Say
- Issue scoped API keys for the Cohort REST API, send event webhooks to tools like Zapier, and set who is emailed about website leads. By the end you'll be able to create an API key with only the scopes it needs, set up a webhook endpoint for chosen events, set website lead notification recipients.
- Cut
- When the narration ends.
- 0:26Step 1: Open Developer settings
- Show
- Screen /settings. Do: In Settings, click Open Developer settings.
- Say
- In Settings, click Open Developer settings. A page titled Developer with API keys, Website integration, Webhooks and Recent webhook deliveries.
- Cut
- Hold on the result until it is clearly visible: A page titled Developer with API keys, Website integration, Webhooks and Recent webhook deliveries.
- 0:38Step 2: Name a new key and pick scopes
- Show
- Screen /settings/developer. Do: In API keys, type a Name (for example Marketing website) and click each scope it needs under Scopes (pick at least one), such as read:programs.
- Say
- In API keys, type a Name (for example Marketing website) and click each scope it needs under Scopes (pick at least one), such as read:programs. The chosen scopes are highlighted.
- Cut
- Hold on the result until it is clearly visible: The chosen scopes are highlighted.
- 0:54Step 3: Create the key
- Show
- Screen /settings/developer. Do: Click Create key.
- Say
- Click Create key. New key created with the full key and Copy it now — it won't be shown again.
- Cut
- Hold on the result until it is clearly visible: New key created with the full key and Copy it now — it won't be shown again.
- 1:06Step 4: Copy and store the key
- Show
- Screen /settings/developer. Do: Copy the key into your other system's settings, then click Dismiss.
- Say
- Copy the key into your other system's settings, then click Dismiss. The key appears in the list with its start, scopes and never used.
- Cut
- Hold on the result until it is clearly visible: The key appears in the list with its start, scopes and never used.
- 1:20Step 5: Create a webhook endpoint
- Show
- Screen /settings/developer. Do: In Webhooks, type a Name and URL (https), click the events under Events to subscribe to (leave empty for all), and click Create endpoint.
- Say
- In Webhooks, type a Name and URL (https), click the events under Events to subscribe to (leave empty for all), and click Create endpoint. Endpoint created with Signing secret (store securely on your receiver):.
- Cut
- Hold on the result until it is clearly visible: Endpoint created with Signing secret (store securely on your receiver):.
- 1:38Step 6: Store the signing secret
- Show
- Screen /settings/developer. Do: Copy the signing secret into your receiving system, then click Dismiss.
- Say
- Copy the signing secret into your receiving system, then click Dismiss. The endpoint is listed as active with its events.
- Cut
- Hold on the result until it is clearly visible: The endpoint is listed as active with its events.
- 1:50Step 7: Set lead notification emails
- Show
- Screen /settings/developer. Do: In Website integration, type one email per line in Notification recipients and click Save.
- Say
- In Website integration, type one email per line in Notification recipients and click Save. Saved. These people are emailed for every lead, trial or enrolment submitted from your website.
- Cut
- Hold on the result until it is clearly visible: Saved. These people are emailed for every lead, trial or enrolment submitted from your website.
- 2:06Step 8: Check deliveries
- Show
- Screen /settings/developer. Do: Look at Recent webhook deliveries.
- Say
- Look at Recent webhook deliveries. The last 25 events sent, each marked succeeded or failed.
- Cut
- Hold on the result until it is clearly visible: The last 25 events sent, each marked succeeded or failed.
- 2:16Outro
- Show
- End card: mycohort.org/help/api-keys-and-webhooks and Start your free 30-day trial — mycohort.org.
- Say
- That's it. The written steps for this lesson are on mycohort.org/help/api-keys-and-webhooks. To try it on your own college, start your free 30-day trial at mycohort.org.
- Cut
- Hold the end card for 5 seconds.
YouTube chapters: use each shot's time and title. First line of the description: mycohort.org/help/api-keys-and-webhooks
Related lessons
Turn on Interac e-Transfer details for students, connect your own Stripe account for card payments, and choose automatic receipts.
Upload or paste a CSV from your old system, map its columns to Cohort fields, preview five rows and import them all at once.
Connect your Moodle site with a web services token, match Moodle courses to Cohort course codes, test the link and pull grades in.