# External API Call

**URL:** <https://community.cloudcannon.com/t/external-api-call/229>\
**Category:** General\
**Created:** [May 14, 2025, 4:22am UTC](https://community.cloudcannon.com/t/external-api-call/229 "2025-05-14T04:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fat\_Dev](https://community.cloudcannon.com/user_avatar/community.cloudcannon.com/fat_dev/32/333_2.png) [@Fat\_Dev](https://community.cloudcannon.com/u/Fat_Dev)\
**Post date:** [May 14, 2025, 4:22am UTC](https://community.cloudcannon.com/t/external-api-call/229/1 "2025-05-14T04:22:27Z")

</div>

Is it possible to do an external api call within cloudcannon and save the data within cloudcannon?

---

<div class="post-metadata">

**Author:** ![michaelroper](https://community.cloudcannon.com/user_avatar/community.cloudcannon.com/michaelroper/32/287_2.png) [@michaelroper](https://community.cloudcannon.com/u/michaelroper)\
**Post date:** [May 15, 2025, 4:15am UTC](https://community.cloudcannon.com/t/external-api-call/229/2 "2025-05-15T04:15:55Z")

</div>

I don’t think you can do it within the CloudCannon UI itself, but you can do things like fetch data as part of the [`prebuild` script/build hook](https://cloudcannon.com/documentation/articles/extending-your-build-process-with-hooks/#prebuild). I’m guessing if you do download any data into your site folder as part of that prebuild process, CloudCannon will then have that data available to save back to your git repo as a change?

---

<div class="post-metadata">

**Author:** ![bglw](https://community.cloudcannon.com/user_avatar/community.cloudcannon.com/bglw/32/40_2.png) [@bglw](https://community.cloudcannon.com/u/bglw)\
**Post date:** [May 16, 2025, 1:10am UTC](https://community.cloudcannon.com/t/external-api-call/229/3 "2025-05-16T01:10:52Z")

</div>

Yep! Within the build environment you’re free to fetch any data you want.

CloudCannon won’t save anything from your build process back to your git repo _by default_, but this is something you can configure using the [SYNC\_PATHS environment variable.](https://cloudcannon.com/documentation/articles/saving-files-from-your-build-back-to-your-source/)

That documentation page mentions configuring it with a fixed environment variable, but this can also be set from within the build environment. For example, your `prebuild` script can download data, and then export the `SYNC_PATHS` environment variable to include the modified path. At the end of your build, CloudCannon will then commit those files back to your source repository if modified.
