llms.txt

Actions

Actions are bound to elements via the on field. Buttons use on.press to trigger an action when tapped.

"my-button": {
  "type": "button",
  "props": { "label": "Go" },
  "on": {
    "press": {
      "action": "submit",
      "params": { "target": "https://my-snap.com/" }
    }
  }
}
#ActionDescription
1submitPOST to server, get next page
2open_urlOpen URL in browser
3open_mini_appLaunch mini app
4view_castNavigate to a cast
5view_profileNavigate to a profile
6compose_castOpen cast composer
7view_tokenView token in wallet
8send_tokenOpen send token flow
9swap_tokenOpen swap token flow

submit

POST to the snap server with a signed payload containing the user's FID, all collected field input values, and a timestamp. The server returns the next snap page.

This is the primary interaction mechanism — how snaps navigate between pages. It is the only action that triggers a server round-trip.

ParamTypeRequiredDescription
targetstringYesURL to POST to (HTTPS, or http://localhost for dev)
{
  "type": "button",
  "props": { "label": "Submit", "variant": "primary" },
  "on": {
    "press": {
      "action": "submit",
      "params": { "target": "https://my-snap.com/api/vote" }
    }
  }
}

See Buttons — Input Data in POST Requests for the full payload shape.


open_url

Open a URL in the system browser. No server round-trip. No input collection.

ParamTypeRequiredDescription
targetstringYesURL to open
{
  "type": "button",
  "props": { "label": "Learn More", "icon": "external-link" },
  "on": {
    "press": {
      "action": "open_url",
      "params": { "target": "https://docs.farcaster.xyz/snap" }
    }
  }
}

open_mini_app

Open a URL as an in-app Farcaster mini app.

ParamTypeRequiredDescription
targetstringYesMini app URL
{
  "type": "button",
  "props": { "label": "Open App", "icon": "arrow-right" },
  "on": {
    "press": {
      "action": "open_mini_app",
      "params": { "target": "https://my-miniapp.com" }
    }
  }
}

view_cast

Navigate to a cast by its hash.

ParamTypeRequiredDescription
hashstringYesCast hash (e.g. "0xabc123...")
{
  "type": "button",
  "props": { "label": "View Cast" },
  "on": {
    "press": {
      "action": "view_cast",
      "params": { "hash": "0x0000000000000000000000000000000000000001" }
    }
  }
}

view_profile

Navigate to a Farcaster user's profile.

ParamTypeRequiredDescription
fidnumberYesFarcaster user ID
{
  "type": "button",
  "props": { "label": "View Profile", "icon": "user" },
  "on": {
    "press": {
      "action": "view_profile",
      "params": { "fid": 3 }
    }
  }
}

compose_cast

Open the cast composer with optional pre-filled content.

ParamTypeRequiredDescription
textstringNoPre-filled cast text
channelKeystringNoTarget channel key
embedsstring[]NoURLs to embed in the cast
{
  "type": "button",
  "props": { "label": "Share", "icon": "share" },
  "on": {
    "press": {
      "action": "compose_cast",
      "params": {
        "text": "Check out this snap!",
        "embeds": ["https://my-snap.com"]
      }
    }
  }
}

view_token

View a token in the wallet. The token is identified by a CAIP-19 asset identifier.

ParamTypeRequiredDescription
tokenstringYesCAIP-19 token identifier
{
  "type": "button",
  "props": { "label": "View Token", "icon": "wallet" },
  "on": {
    "press": {
      "action": "view_token",
      "params": { "token": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }
    }
  }
}

send_token

Open the send flow for a token.

ParamTypeRequiredDescription
tokenstringYesCAIP-19 token identifier
amountstringNoPre-filled amount
recipientFidnumberNoRecipient identified by FID
recipientAddressstringNoRecipient identified by address
{
  "type": "button",
  "props": { "label": "Send USDC", "icon": "coins" },
  "on": {
    "press": {
      "action": "send_token",
      "params": {
        "token": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "amount": "10.00",
        "recipientFid": 3
      }
    }
  }
}

swap_token

Open the swap flow between two tokens.

ParamTypeRequiredDescription
sellTokenstringNoCAIP-19 identifier for the token to sell
buyTokenstringNoCAIP-19 identifier for the token to buy
{
  "type": "button",
  "props": { "label": "Swap to USDC", "icon": "refresh-cw" },
  "on": {
    "press": {
      "action": "swap_token",
      "params": {
        "sellToken": "eip155:8453/slip44:60",
        "buyToken": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
      }
    }
  }
}