> ## Documentation Index
> Fetch the complete documentation index at: https://developers.squads.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit Transaction

> Submit a previously prepared transaction with required signatures

This endpoint submits a previously prepared transaction to the blockchain after verifying the required signatures from Grid Account authorization keys.

<Warning>
  Using the Grid API directly requires **advanced configurations**. Grid SDK is the recommended
  way to submit transactions. It handles transaction preparation, signing, automatic failover, and
  submission. Learn more about the Grid SDK in the [Grid SDK](/grid/v1/sdk-reference) guide.
</Warning>

<Info>
  This endpoint requires a **prepared transaction** and **valid signatures**. Use transaction
  preparation endpoints first, then sign the KMS payload with your decrypted authorization key
  before calling this endpoint.
</Info>

## Account Type Signing Flows

Grid supports two types of accounts with different signing requirements. Choose the appropriate flow based on how your account was created:

<AccordionGroup>
  <Accordion title="Email-based Account Signing Flow" icon="mail">
    For accounts created with email authentication (using Privy):

    ### High-Level Process

    1. **Prepare Transaction**: Call transaction preparation endpoints (payments, transfers, etc.)
    2. **Receive KMS Payload**: Extract the `kms_payload` from the preparation response
    3. **Sign Payload**: Use your decrypted Privy authorization key to sign the canonical JSON
    4. **Submit Transaction**: Call this endpoint with the signature and transaction data

    ### Key Requirements

    * **Authorization keys** from email account creation/authentication
    * **JSON canonicalization** of the KMS payload (recursive key sorting)
    * **ECDSA P-256 SHA-256** signature algorithm

    ### Complete Implementation Guide

    For detailed implementation including HPKE keypair generation, authorization key decryption, JSON canonicalization, payload signing, and language-agnostic examples, see the [Primary Provider Integration](/grid/v1/api-reference/advanced/privy-signing) guide.
  </Accordion>

  <Accordion title="Signer-based Account Signing Flow" icon="key">
    For accounts created with Ed25519 public keys:

    ### Signing Process

    1. **Prepare Transaction**: Call transaction preparation endpoints (payments, transfers, etc.)
    2. **Receive Transaction**: Extract the prepared Solana transaction from the response
    3. **Sign Transaction**: Use your Ed25519 private keys with standard Solana transaction signing (e.g., web3.js)
    4. **Submit Transaction**: Call this endpoint with the signed transaction

    ### Signature Requirements

    * **Ed25519 private keys** corresponding to the public keys specified during account creation
    * **Threshold signatures** meeting the account's signing threshold
    * **Standard Solana transaction signing** (no KMS payload or JSON canonicalization required)

    <Note>
      Signer-based accounts use regular Solana transaction signing with libraries like
      web3.js. No KMS payload processing or JSON canonicalization is required.
    </Note>

    The signed transaction proves you have access to the required number of Grid Account signing keys and authorizes the transaction execution.

    ### Implementation with web3.js

    ```typescript theme={null}
    import { Transaction } from '@solana/web3.js';
    import { Keypair } from '@solana/web3.js';

    // Extract prepared transaction from API response
    const preparedTransaction = Transaction.from(
      Buffer.from(response.transaction, 'base64')
    );

    // Sign with your Ed25519 keypairs (threshold signatures required)
    const signers = [keypair1, keypair2]; // Your Ed25519 keypairs
    preparedTransaction.sign(...signers);

    // Submit the signed transaction
    const signedTransaction = preparedTransaction.serialize();
    ```
  </Accordion>
</AccordionGroup>

## KMS Payload Schema

The `kms_payloads` field contains the signed KMS payloads from your key management provider. Each payload has a `provider` and a `kms_signed_payload` whose shape depends on the provider. See the auto-generated request body schema below for full field details.

<Warning>
  Turnkey accounts **must** use `kms_signed_payload`. The top-level `signature` field is only
  supported for Privy as a legacy fallback.
</Warning>

### Request Examples

<AccordionGroup>
  <Accordion title="Single Transaction (Privy)">
    ```json theme={null}
    {
      "transaction": "<base64_encoded_transaction>",
      "kms_payloads": [
        {
          "provider": "privy",
          "kms_signed_payload": {
            "signature": "<base64_der_ecdsa_signature>"
          }
        }
      ]
    }
    ```
  </Accordion>

  <Accordion title="Single Transaction (Turnkey)">
    ```json theme={null}
    {
      "transaction": "<base64_encoded_transaction>",
      "kms_payloads": [
        {
          "provider": "turnkey",
          "kms_signed_payload": {
            "public_key": "<hex_p256_public_key>",
            "signature": "<hex_signature>",
            "timestamp_ms": "<unix_timestamp_ms>"
          }
        }
      ]
    }
    ```
  </Accordion>

  <Accordion title="Multiple Transactions">
    When submitting multiple transactions, use `transactions` (plural) and nest `kms_payloads` as an array of arrays — one inner array per transaction:

    ```json theme={null}
    {
      "transactions": ["<base64_tx_1>", "<base64_tx_2>"],
      "kms_payloads": [
        [
          {
            "provider": "privy",
            "kms_signed_payload": {
              "signature": "<signature_for_tx_1>"
            }
          }
        ],
        [
          {
            "provider": "privy",
            "kms_signed_payload": {
              "signature": "<signature_for_tx_2>"
            }
          }
        ]
      ]
    }
    ```
  </Accordion>

  <Accordion title="Legacy Format (Privy only, backward-compatible)">
    This format places the signature at the top level instead of inside `kms_signed_payload`. It is supported for backward compatibility with Privy accounts only.

    ```json theme={null}
    {
      "transaction": "<base64_encoded_transaction>",
      "kms_payloads": [
        {
          "provider": "privy",
          "signature": "<base64_der_ecdsa_signature>"
        }
      ]
    }
    ```
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml POST /api/grid/v1/accounts/{address}/submit
openapi: 3.1.0
info:
  title: Grid v1 API
  description: Grid v1 REST API for Solana-based smart account system
  contact:
    name: Grid API Support
    url: https://squads.so
    email: support@squads.so
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://grid.squads.xyz
    description: Production server
security:
  - bearer_auth: []
tags:
  - name: accounts
    description: Smart account management operations
  - name: spending-limits
    description: Spending limit management
  - name: standing-orders
    description: Standing order operations
  - name: transactions
    description: Transaction management
  - name: trade
    description: Trade operations and management
  - name: payments
    description: Payment intent operations
  - name: passkeys
    description: Passkey management
  - name: kyc
    description: Know Your Customer operations
  - name: external-accounts
    description: External bank account management
  - name: virtual-accounts
    description: Virtual account management
  - name: auth
    description: Authentication operations
  - name: proposals
    description: Proposal management for multi-sig operations
  - name: compliance
    description: Compliance entity management and KYB/KYC operations
paths:
  /api/grid/v1/accounts/{address}/submit:
    post:
      tags:
        - transactions
      operationId: handler
      parameters:
        - name: address
          in: path
          description: Smart account address (Solana public key)
          required: true
          schema:
            type: string
        - name: x-grid-environment
          in: header
          description: Solana network environment (sandbox, devnet, mainnet)
          required: true
          schema:
            type: string
          example: sandbox
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitTransactionRequestPayload'
        required: true
      responses:
        '200':
          description: Transaction submitted successfully
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GridApiResponse_SubmitTransactionResponsePayload
        '400':
          description: Invalid transaction or signatures
        '403':
          description: Forbidden - insufficient permissions
        '404':
          description: Smart account not found
        '500':
          description: Internal server error
      security:
        - bearer_auth: []
components:
  schemas:
    SubmitTransactionRequestPayload:
      oneOf:
        - type: object
          description: Multiple transactions format
          required:
            - transactions
            - kms_payloads
          properties:
            kms_payloads:
              type: array
              items:
                type: array
                items:
                  $ref: '#/components/schemas/SubmitTransactionKmsPayload'
              description: Signed KMS payloads, one inner array per transaction
            transactions:
              type: array
              items:
                type: string
              description: Base64-encoded serialized Solana transactions
        - type: object
          description: Single transaction format (legacy, backward compatible)
          required:
            - transaction
          properties:
            kms_payloads:
              type: array
              items:
                $ref: '#/components/schemas/SubmitTransactionKmsPayload'
              description: Signed KMS payloads for this transaction
            transaction:
              type: string
              description: Base64-encoded serialized Solana transaction
      description: Request payload — supports single or multiple transaction submission
    GridApiResponse_SubmitTransactionResponsePayload:
      type: object
      required:
        - data
        - metadata
      properties:
        data:
          oneOf:
            - $ref: '#/components/schemas/MultipleTransactionsResponse'
              description: Multiple transactions response (new format)
            - $ref: '#/components/schemas/SingleTransactionResponse'
              description: >-
                Single transaction response (legacy format for backward
                compatibility)
          description: >-
            Response payload - supports both legacy single-transaction and new
            multi-transaction formats
        metadata:
          $ref: '#/components/schemas/Metadata'
    SubmitTransactionKmsPayload:
      type: object
      description: Signed payload from a key management provider
      required:
        - provider
      properties:
        kms_signed_payload:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/KmsSignedPayload'
              description: >-
                Provider-specific signed payload. Required for Turnkey.
                Recommended for Privy.
        provider:
          $ref: '#/components/schemas/GridMPCProvider'
          description: 'Key management provider: "privy" or "turnkey"'
        signature:
          type:
            - string
            - 'null'
          description: >-
            Legacy signature field (Privy only, backward-compatible). Prefer
            kms_signed_payload instead.
    MultipleTransactionsResponse:
      type: object
      description: New response format for multiple transaction submissions
      required:
        - results
      properties:
        partial_failure:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PartialFailureInfo'
        results:
          type: array
          items:
            $ref: '#/components/schemas/TransactionResult'
    SingleTransactionResponse:
      type: object
      description: Legacy response format for single transaction submissions
      required:
        - transaction_signature
        - confirmed_at
      properties:
        confirmed_at:
          type: string
          format: date-time
        transaction_signature:
          type: string
    Metadata:
      type: object
      required:
        - request_id
        - timestamp
      properties:
        request_id:
          type: string
        timestamp:
          type: string
          format: date-time
    KmsSignedPayload:
      oneOf:
        - $ref: '#/components/schemas/TurnkeyKmsPayload'
          description: Turnkey signed payload
        - $ref: '#/components/schemas/PrivyKmsPayload'
          description: Privy signed payload
      description: Provider-specific signed payload
    GridMPCProvider:
      type: string
      enum:
        - privy
        - dynamic
        - passkey
        - turnkey
        - external
    PartialFailureInfo:
      type: object
      required:
        - failed_at_index
        - error_message
        - error_code
      properties:
        error_code:
          type: string
        error_message:
          type: string
        failed_at_index:
          type: integer
          minimum: 0
    TransactionResult:
      type: object
      required:
        - transaction_signature
        - confirmed_at
        - index
      properties:
        confirmed_at:
          type: string
          format: date-time
        index:
          type: integer
          minimum: 0
        transaction_signature:
          type: string
    TurnkeyKmsPayload:
      type: object
      description: Turnkey KMS signed payload
      required:
        - public_key
        - signature
        - timestamp_ms
      properties:
        public_key:
          type: string
          description: Hex-encoded P-256 public key used for signing
        signature:
          type: string
          description: Hex-encoded ECDSA P-256 signature
        timestamp_ms:
          type: string
          description: Unix timestamp in milliseconds when the signature was created
      additionalProperties: false
    PrivyKmsPayload:
      type: object
      description: Privy KMS signed payload
      required:
        - signature
      properties:
        signature:
          type: string
          description: >-
            Base64-encoded DER ECDSA P-256 SHA-256 signature of the
            canonicalized KMS payload
      additionalProperties: false
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: Your Grid API key from the Grid Dashboard

````