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/" }
}
}
}
| # | Action | Description |
|---|---|---|
| 1 | submit | POST to server, get next page |
| 2 | open_url | Open URL in browser |
| 3 | open_mini_app | Launch mini app |
| 4 | view_cast | Navigate to a cast |
| 5 | view_profile | Navigate to a profile |
| 6 | compose_cast | Open cast composer |
| 7 | view_token | View token in wallet |
| 8 | send_token | Open send token flow |
| 9 | swap_token | Open 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.
| Param | Type | Required | Description |
|---|---|---|---|
target | string | Yes | URL 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.
| Param | Type | Required | Description |
|---|---|---|---|
target | string | Yes | URL 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.
| Param | Type | Required | Description |
|---|---|---|---|
target | string | Yes | Mini 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.
| Param | Type | Required | Description |
|---|---|---|---|
hash | string | Yes | Cast 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.
| Param | Type | Required | Description |
|---|---|---|---|
fid | number | Yes | Farcaster 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.
| Param | Type | Required | Description |
|---|---|---|---|
text | string | No | Pre-filled cast text |
channelKey | string | No | Target channel key |
embeds | string[] | No | URLs 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.
| Param | Type | Required | Description |
|---|---|---|---|
token | string | Yes | CAIP-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.
| Param | Type | Required | Description |
|---|---|---|---|
token | string | Yes | CAIP-19 token identifier |
amount | string | No | Pre-filled amount |
recipientFid | number | No | Recipient identified by FID |
recipientAddress | string | No | Recipient 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.
| Param | Type | Required | Description |
|---|---|---|---|
sellToken | string | No | CAIP-19 identifier for the token to sell |
buyToken | string | No | CAIP-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"
}
}
}
}