# update\_operators

Implementation of FA2 interface method, more info about FA2 update\_operators you can read in the link below.

{% embed url="<https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md#update_operators>" %}
TZIP-12: FA2 - Multi-Asset Interface&#x20;
{% endembed %}

### Types

{% code title="yToken/fa2Types.ligo" %}

```pascaligo
type tokenId is nat

type operatorParam is [@layout:comb] record [
  owner                 : address;
  operator              : address;
  token_id              : tokenId;
]

type updateOperatorParam is
| Add_operator        of operatorParam // adds operator
| Remove_operator     of operatorParam // removes operator

type updateOperatorParams is list(updateOperatorParam)
```

{% endcode %}

<table><thead><tr><th width="179.33333333333331" align="center">Parameter</th><th align="center">Type</th><th>Description</th></tr></thead><tbody><tr><td align="center">owner</td><td align="center">address</td><td>account owner tokens</td></tr><tr><td align="center">to_</td><td align="center">address</td><td>account operator tokens</td></tr><tr><td align="center">token_id</td><td align="center">nat</td><td>token identifier</td></tr></tbody></table>

### Usage

{% tabs %}
{% tab title="🌮 Taquito" %}

```typescript
const tokenId = 0; // or new BigNumber(0) or "0"
const alice = "tz1..."
const bob = "tz2..."
const peter = "tz3..."
const yupana = await tezos.contract.at(yTokenAddress);
const operation = await yupana.methods.update_operators([
        {
          add_operator: {
            owner: alice,
            operator: peter,
            token_id: tokenId,
          },
        },
        {
          remove_operator: {
            owner: alice,
            operator: bob,
            token_id: tokenId,
          },
        }
      ]).send();
await operation.confirmation();
```

{% endtab %}

{% tab title="🐍   Pytezos" %}

```python
token_id = 0
alice = "tz1..."
bob = "tz2..."
peter = "tz3..."
yupana = ContractInterface.from_michelson(code) # or client.contract(contract_address)...
call = yupana.update_operators([{
      "add_operator": {
        "owner": alice,
        "operator": peter,
        "token_id": token_id,
      },
    },
    {
      "remove_operator": {
        "owner": alice,
        "operator": bob,
        "token_id": token_id,
      },
    }
  ])
opg = call.inject()

```

{% endtab %}
{% endtabs %}

### Errors

* `FA2_NOT_OWNER` - `sender` is not `owner` of account.
* `FA2_TOKEN_UNDEFINED` - token identifier is not assigned to any known tokens.
