# Get all variables from a context using the API

**URL:** <https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549>\
**Category:** Deployments\
**Tags:** api, contexts\
**Created:** [July 25, 2019, 9:38pm UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549 "2019-07-25T21:38:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![santiagomoneta](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/santiagomoneta/32/22855_2.png) [@santiagomoneta](https://discuss.circleci.com/u/santiagomoneta)\
**Post date:** [July 25, 2019, 9:38pm UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/1 "2019-07-25T21:38:13Z")

</div>

Hello community, im trying to do some automations and at some point I need to use the CircleCI API to see all the variables on my context and then add as needed. Looking at the documentation I see it talks about environment variables on a specific project but does not mention anything about context variables… can anyone share some light, a pointer or an example I can use to remove this blocker?

thanks!

---

<div class="post-metadata">

**Author:** ![liene](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/liene/32/14373_2.png) [@liene](https://discuss.circleci.com/u/liene)\
**Post date:** [July 26, 2019, 11:09pm UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/2 "2019-07-26T23:09:52Z")

</div>

Hey Santiago! Welcome to Discuss. 🙂

You’re right that there’s currently no way to use variables from Contexts via the API, but you’re not alone in wanting this functionality. We’ve got [at least](https://ideas.circleci.com/ideas/CCI-I-545) a [couple posts on our Ideas board](https://ideas.circleci.com/ideas/CCI-I-1088) about this very feature, and I’d encourage you to add your vote(s), since we draw from the Ideas page when prioritizing future work.

There might be something you can try here in Discuss, in the meantime ([here’s one such post](https://discuss.circleci.com/t/how-to-see-full-value-of-environment-variables-via-circle-ci-apis/29910/5)).

---

<div class="post-metadata">

**Author:** ![rkinwar](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rkinwar/32/25108_2.png) [@rkinwar](https://discuss.circleci.com/u/rkinwar)\
**Post date:** [August 26, 2020, 9:13pm UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/3 "2020-08-26T21:13:11Z")

</div>

Has this feature been added to the API yet?

---

<div class="post-metadata">

**Author:** ![yannCI](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/yannci/32/24866_2.png) [@yannCI](https://discuss.circleci.com/u/yannCI)\
**Post date:** [September 19, 2020, 1:05am UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/4 "2020-09-19T01:05:28Z")

</div>

@santiagomoneta, @rkinwar,

Just to let you know [Context-related API endpoints](https://circleci.com/docs/api/v2/#tag/Context) are now available.

_Note that this is still in **preview** _.

---

<div class="post-metadata">

**Author:** ![YJina](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/yjina/32/31286_2.png) [@YJina](https://discuss.circleci.com/u/YJina)\
**Post date:** [October 4, 2022, 8:40am UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/5 "2022-10-04T08:40:25Z")

</div>

At the moment, the [context endpoint](https://circleci.com/docs/api/v2/index.html#operation/listEnvironmentVariablesFromContext) allows you list all variables but it doesn’t allow you to see the last four character of the variable values. Is there any plan for this being added in the near future ?

---

<div class="post-metadata">

**Author:** ![nipun45](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nipun45/32/35554_2.png) [@nipun45](https://discuss.circleci.com/u/nipun45)\
**Post date:** [August 29, 2024, 7:23am UTC](https://discuss.circleci.com/t/get-all-variables-from-a-context-using-the-api/31549/6 "2024-08-29T07:23:47Z")

</div>

Is there a way to get last 4 characters of context variable values from api ?  
We can get it for project environment variables but need same for context as well.  
It would be risky to update the variable without checking its current value.
