GET
Request
Action clients first make an HTTP GET
JSON request to the Action URL. The request should be made with an Accept-Encoding
header.
Response
The Action URL should respond with an HTTP OK
JSON response with the body payload below, or with an HTTP error
.
The client must handle HTTP client errors, server errors, and redirect responses.
The endpoint should respond with a Content-Encoding header for HTTP compression.
The client should not cache the response except as instructed by HTTP caching response headers.
The client should then display the response body information, like icon, title, description, and labels.
GET Response Body
A successful GET response with status HTTP OK
should conform to the following payload:
icon
- Must be an absolute HTTP or HTTPS URL of an image describing the action. Supported image formats are SVG, PNG, or WebP image. If none of the above, the client ust reject it as malformed.title
- A UTF-8 string for the title of the action.description
- A UTF-8 string providing a brief description of the action.label
- AUTF-8 string to be displayed on the button used to execute the action. Labels should not exceed 5 word phrases and should start with a verb, to emphasize the action to be taken. For example, "Mint NFT", "Vote Yes", or "Stake 1 SOL".disabled
- An optionalboolean
value. If present, all buttons associated with the action should be disabled. This optional value isfalse
y, in that its absence is equivalent to enabled=true. Examples ofdisabled
in use could include an NFT collection that has minted out, or a governance proposal whose voting period as ended.error
- An optional error indication for non-fatal errors, intended to be human readable and presented to the end-user. If set, it should not prevent the client from interpreting the action or displaying it to the user. For example, the error can be used together withdisabled
to display a reason like business constraints, authorization, the state, or an error of external resource.
links.actions
- An optional array of addtional actions related to this action. Each linked action is given only a label, to be rendered on a button, and an associated Action URL athref
. No additional icons, titles, or descriptions are provided. For example, a governance vote action endpoint may return three options for the user: "Vote Yes", "Vote No", and "Abstain from Vote".If no
links.actions
is provided, the client should render a single button using the rootlabel
string and make the POST request to the same action URL endpoint as the initial GET request.If any
links.actions
are provided, the client should only render buttons and input fields based on the items listed in thelinks.actions
field. The client should not render a button for the contents of the rootlabel
.
Note that ActionParameter
represents a second action type, one with a multiple input types, as well as an extended version of ActionParameter
called ActionParameterSelectable
which are expanded on in Action Types.
Note that the complete ActionParameter
interface is not supported by Blinks clients, and we're working on bringing client support as soon as possible. As of now, the fields in ActionParameter
that are supported are name
, label
and required
. ActionParameterSelectable
is not currently supported as well.
For more information on how actions are linked to create multi-action experiences, see Multi-Actions.
Examples
Example GET Response
The following example response provides a single "root" action that is expected to be presented to the user a single button with a label of "Buy WIF":
The following example response provides 3 related action links that allow the user to click one of 3 buttons to buy WIF:
Example GET Response with Parameters
The following examples response demonstrate how to accept text input from the user (via parameters
) and include that input in the final POST
request endpoint (via the href
field within a LinkedAction
):
The following example response provides the user with 3 linked actions to buy WIF: a button labeled "$10", another button labeled "$100", a third button labeled "$1,000" and a text input field that allows the user to enter a specific "amount" value that will be sent to the Action API:
The following example response provides a single input field for the user to enter an amount
which is sent with the POST request (either as a query parameter or a subpath can be used):
Note that the aspect ratio of the url-to-image is generally flexible and the only limitation is that the max height of the image must be equal to the max width of the blink container. The recommended size for 1:1 aspect ratio is 440px x 440px
Last updated