# How to recognize different events in CircleCI

**URL:** <https://discuss.circleci.com/t/how-to-recognize-different-events-in-circleci/38087>\
**Category:** Build Environment\
**Created:** [November 11, 2020, 10:21am UTC](https://discuss.circleci.com/t/how-to-recognize-different-events-in-circleci/38087 "2020-11-11T10:21:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![nbialostosky](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nbialostosky/32/24962_2.png) [@nbialostosky](https://discuss.circleci.com/u/nbialostosky)\
**Post date:** [November 11, 2020, 8:12pm UTC](https://discuss.circleci.com/t/how-to-recognize-different-events-in-circleci/38087/4 "2020-11-11T20:12:51Z")

</div>

You’re welcome and happy to hear it!

As for the API side of things, we have some examples of utilizing the API in bash scripts here:

> [@Example bash script using Insights to get credits used for a workflow](https://discuss.circleci.com/t/example-bash-script-using-insights-to-get-credits-used-for-a-workflow/36933):
>
> Hi There! Recently the Support team created a script for easily getting the total number of credits used on a workflow. This was created since the [insights endpoint for workflow](https://circleci.com/docs/api/v2/?shell#get-recent-runs-of-a-workflow) credits is scoped per branch, which means you need to do an API call per branch to get this information. This script will likely need to be modified to be used for your purposes, but should be a good starting point! A few notes/caveats: It will only look at branches from the last 100 builds The credit data that is r…

And here:

> [@Example bash script to get job artifacts from pipeline](https://discuss.circleci.com/t/example-bash-script-to-get-job-artifacts-from-pipeline/36795):
>
> Hi There! Recently the Support team created a script for easily getting artifacts from a pipeline. This was created since the artifacts are associated with the jobs in the pipeline, it requires finding the jobs and returning the results. This script will likely need to be modified to be used for your purposes, but should be a good starting point! A few notes/caveats: It is not setup for pagination, so if you have a lot of jobs associated with your workflows you may need to update to account…

And here:

> [@Example bash script to identify who triggered a workflow](https://discuss.circleci.com/t/example-bash-script-to-identify-who-triggered-a-workflow/37876):
>
> Hello Everyone! Recently the Support team created a script for determining who triggered a workflow by using our v2 API. Feel free to mix up the script how ever you best see fit! Note: We’re making us of jq which makes using JSON in scripts possible Also, if you have an environment variable set with your CIRCLE\_API\_TOKEN, feel free to delete the variable declaration line from the script! #!/bin/bash -e # This script will return the user who started a workflow # Can be called with "sh name\_o…

We also have a thing called CircleCI Academy that has a “General Developer” course that includes information on utilizing the API, you can signup and access here:

> **[CircleCI Academy](https://accounts.skilljar.com/accounts/signup/?access_code=public-2020&d=1wy16a3le6rt2&next=%2Fauth%2Fendpoint%2Flogin%2Fresult%3Faccess_code%3Dpublic-2020%26next%3D%252F%253Faccess_code%253Dpublic-2020%26d%3D1wy16a3le6rt2&t=7mpxo290p1l3)**

Hope that helps!

---

_[View the full topic](https://discuss.circleci.com/t/how-to-recognize-different-events-in-circleci/38087)._
