# How to transfer ERC1155 tokens from a Smart Contract?

**URL:** <https://forum.openzeppelin.com/t/how-to-transfer-erc1155-tokens-from-a-smart-contract/33082>\
**Category:** Smart Contracts\
**Created:** [November 12, 2022, 2:13am UTC](https://forum.openzeppelin.com/t/how-to-transfer-erc1155-tokens-from-a-smart-contract/33082 "2022-11-12T02:13:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JJtheAndroid](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jjtheandroid/32/16927_2.png) [@JJtheAndroid](https://forum.openzeppelin.com/u/JJtheAndroid)\
**Post date:** [November 12, 2022, 2:13am UTC](https://forum.openzeppelin.com/t/how-to-transfer-erc1155-tokens-from-a-smart-contract/33082/1 "2022-11-12T02:13:07Z")

</div>

Hi, does anyoneknow how to transfer ERC1155 tokens from a smart contract? I keep getting the error "ERC1155: caller is not token owner or approved". Any help would be appreciated

---

<div class="post-metadata">

**Author:** ![CryptoWorld](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/cryptoworld/32/16709_2.png) [@CryptoWorld](https://forum.openzeppelin.com/u/CryptoWorld)\
**Post date:** [November 12, 2022, 10:27am UTC](https://forum.openzeppelin.com/t/how-to-transfer-erc1155-tokens-from-a-smart-contract/33082/2 "2022-11-12T10:27:37Z")

</div>

You're not providing alot of information to go on.  
ERC-1155 has a function called \* [`safeTransferFrom(from, to, id, amount, data)`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#ERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-) you can call which will transfer a token from one person to another.

However from address will have to be the owner of the token id, of he/she would have need to have called \* [`setApprovalForAll(operator, approved)`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#ERC1155-setApprovalForAll-address-bool-) to approve the msg sender to allow the transfer by the person calling the safeTransferFrom

---

<div class="post-metadata">

**Author:** ![mfer8023](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mfer8023/32/11458_2.png) [@mfer8023](https://forum.openzeppelin.com/u/mfer8023)\
**Post date:** [November 13, 2022, 5:14pm UTC](https://forum.openzeppelin.com/t/how-to-transfer-erc1155-tokens-from-a-smart-contract/33082/3 "2022-11-13T17:14:48Z")

</div>

agree with CryptoWorld...

let me add some points...

> ERC1155: caller is not token owner or approved...

it happens because you want to transfer the tokens on behalf owner's wallet address. but the owner hasn't approved your wallet address to be an operator.

what you need to do is let the owner of the address call `setApprovalForAll` :

setApprovalForAll is to let you as the contract owner/address to be an operator to transfer the tokens on behalf of the owners.

example:  
`operator (address)`  
contract owner/admin or contract address

`approved (bool)`  
true

that's it. hope it helps.
