Skip to main content
POST
/
accounts
/
{address}
/
proposals
/
{proposal_address}
/
vote-and-execute
cURL
curl --request POST \
  --url https://grid.squads.xyz/api/grid/v1/accounts/{address}/proposals/{proposal_address}/vote-and-execute \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-grid-environment: <x-grid-environment>' \
  --data '
{
  "signers": [
    "<string>"
  ],
  "feeConfig": "<unknown>"
}
'
{
  "data": {
    "signers": [
      "<string>"
    ],
    "transactions": [
      "<string>"
    ]
  },
  "metadata": {
    "request_id": "<string>",
    "timestamp": "2023-11-07T05:31:56Z"
  }
}
Combines voting and execution into a single operation. More efficient than separate vote and execute calls when you want to finalize a proposal immediately.
At least one signer must have CAN_EXECUTE permission (mask includes value 4). Unlike the vote endpoint, this is required.

How It Works

  1. Validates proposal is Active or Approved
  2. Filters signers who already approved
  3. Selects minimum signers needed to reach threshold
  4. First signer with CAN_EXECUTE becomes the executor
  5. Returns transaction(s) for signing

When Threshold Is Already Met

If the proposal already has enough approvals, the voting step becomes a no-op—only execution occurs.
// Proposal has 2/2 approvals (Approved status)
const response = await grid.voteAndExecute(accountAddress, proposalAddress, {
  signers: [executorKey]  // Only needs CAN_EXECUTE
});
// Returns execute transaction only

Permission Requirements

  • All signers need CAN_VOTE (2)
  • At least one signer needs CAN_EXECUTE (4)

Transaction Output

Returns 1-2 transactions depending on size:
  • Single transaction: Vote + execute fit within 1232 bytes
  • Two transactions: Submit vote first, then execute
const response = await grid.voteAndExecute(accountAddress, proposalAddress, {
  signers: [signerWithExecute],
  fee_config: { currency: "SOL", payer_address: payerKey }
});

// Sign and submit in order
for (const tx of response.transactions) {
  await signAndSubmit(tx);
}

When to Use Vote vs Vote-and-Execute

Use CaseEndpoint
Approve and execute immediatelyVote-and-Execute
Approve without executingVote
Reject or cancelVote
No CAN_EXECUTE signer availableVote

Authorizations

Authorization
string
header
required

Your Grid API key from the Grid Dashboard

Headers

x-grid-environment
string
required

Target Solana environment

Path Parameters

address
string
required

Smart account address (Solana public key)

proposal_address
string
required

Proposal address (Solana public key)

Body

application/json
signers
string[]
required
feeConfig
object

Response

Vote and execute transaction(s) created successfully

data
object
required
metadata
object
required