I try to swap some tokens and receive BUSD. When I enter the amount 100_000 for my token, API returns the normal price. But it doesnt work when I increase this amount more then 1_000_000. All liquidity is in the Pancake swap pools and it's more then 80 billions for the pair MYTOKEN - BUSD In this case I get an error:

  "code": 105,
  "reason": "Error",
  "values": {
    "message": "Pancake: K"

The question is: what the problem??

  • Solidity contract you wrote?! Sep 10, 2021 at 10:53
  • no, I didn't write anything. On PancakeSwap this amount calculates as normal, but not through 0x API
    – user81512
    Sep 10, 2021 at 11:01
  • PancakeSwap support team is happy to help. Sep 10, 2021 at 11:41
  • my message above: 'it's ok on PancakeSwap'. The problem from API. If I'm wrong, can you clarify in which place?
    – user81512
    Sep 10, 2021 at 11:48
  • which Api :) ? can you add more information or screenshot, maybe it will make it easier to find the problem for someone
    – Majd TL
    Sep 10, 2021 at 13:27

2 Answers 2


The Pancake: K error is from PancakeSwap, not from the 0x API.

I was unable to reproduce your error with any of the tokens available to swap on the BSC 0x API endpoint. Do you have the exact query parameters of your API call available?

  • thanks for your reply: working request problem
    – user81512
    Sep 10, 2021 at 14:39
  • 1
    Thanks for providing your exact API call for further troubleshooting :) It looks like the token you are trying to sell has a transfer fee, which the 0x API does not support. You provided a value for takerAddress which helped the API to discover the issue and return an error. If you hadn't included the takerAddress parameter the API would have returned a quote, but it would most definitely had reverted with the same error if you had tried to submit the transaction.
    – Megan
    Sep 13, 2021 at 15:59
  • you're right about reverted tx, but there is no reason as for usual user. I can see the problem inside this transaction, in the fee method. So it's only this kind of contract problem or you can do something with it?
    – user81512
    Sep 14, 2021 at 8:59
  • To make sure I understand your question, are you asking if it's possible to work around this issue in order to trade this token via 0x? If so, unfortunately it is not as we do not support this and you would have to trade through PancakeSwap directly. Hope this helps!
    – Megan
    Sep 16, 2021 at 12:43

0x API does not support tokens with transfer fees, that is most likely the issue with the call

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.