# HTTP outcall cycles parameter

**URL:** <https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263>\
**Category:** Developers\
**Created:** [March 8, 2024, 8:24pm UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263 "2024-03-08T20:24:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [March 8, 2024, 8:24pm UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/1 "2024-03-08T20:24:51Z")

</div>

I just had a look at the IC portal and Rust documentation, but none seems to explicitly explain how the second parameter `cycle` of an `http_request` outcall works. By this, I mean that if I specify an oversized value, are all the cycles consumed, or only those effectively required for the call?

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [March 8, 2024, 10:04pm UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/2 "2024-03-08T22:04:58Z")

</div>

I **think** they are returned due to a test I did yesterday(same with ecdsa), but I seem to remember that maybe something was reserved if you put the expected return size very high. Perhaps it has to reserve some memory for the duration of the call? Basically putting this here because I have the same question and would love to see the code that calculates it.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 11, 2024, 8:31am UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/3 "2024-03-11T08:31:38Z")

</div>

Cost is explained here: [Paying for resources in cycles | Internet Computer](https://internetcomputer.org/docs/current/developer-docs/gas-cost#special-features)

> [@skilesare](#):
>
> Perhaps it has to reserve some memory for the duration of the call?

IIRC that’s it. The outcall has to reserve memory for the result and for some (probably consensus-related) reason can’t change it after the fact

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [March 11, 2024, 8:45am UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/4 "2024-03-11T08:45:12Z")

</div>

> [@Vivienne](#):
>
> The outcall has to reserve memory for the result and for some (probably consensus-related) reason can’t change it after the fact

So, to answer my original question, do you mean that providing an oversized value lead to having all the cycles being burned anyway?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 11, 2024, 8:46am UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/5 "2024-03-11T08:46:49Z")

</div>

Not all, but the possible maximum. There is a max value for response\_bytes that would be used

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [March 11, 2024, 10:29am UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/6 "2024-03-11T10:29:53Z")

</div>

> [@Vivienne](#):
>
> Not all, but the possible maximum.

That’s great!

Where’s that documented though? Maybe I missed it but, is that clearly explained in any HTTP outcall portal documentation or rust doc?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 11, 2024, 12:28pm UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/7 "2024-03-11T12:28:52Z")

</div>

[This page](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/advanced-features/https-outcalls/https-outcalls-how-to-use/#the-request) says the max is `2_000_000` bytes

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [March 11, 2024, 1:16pm UTC](https://forum.dfinity.org/t/http-outcall-cycles-parameter/28263/8 "2024-03-11T13:16:31Z")

</div>

So long story short, it’s not documented.
