Find if an account has opted in to receive an asset

Is there a way to find out if an account has already opted in to receive an asset? Otherwise, we will need to maintain this information in our application to prevent sending 0 value transactions multiple times to opt in.

You can use the algod REST API or any SDK to do it.
Here is an example with the algoexplorer API endpoint:

$ curl -s | jq
  "amount": 200000,
  "amount-without-pending-rewards": 200000,
  "apps-local-state": [],
  "apps-total-schema": {
    "num-byte-slice": 0,
    "num-uint": 0
  "assets": [
      "amount": 15256789,
      "asset-id": 135464366,
      "is-frozen": false
  "created-apps": [],
  "created-assets": [],
  "pending-rewards": 0,
  "reward-base": 182866,
  "rewards": 0,
  "round": 13591552,
  "status": "Offline"

The list of assets the account is opted in is assets.