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

# Sign a Solana transaction for an agent

> <!-- relayer:auth-badge:start -->
> **Auth: agent HMAC.** Called by the agent SDK at runtime with `x-agent-id`, `x-agent-auth`, `x-request-timestamp` headers. **Not callable from backend ApiKey.** See [Authentication → Agent HMAC](/get-started/authentication).
<!-- relayer:auth-badge:end -->



## OpenAPI

````yaml /api-reference/openapi.json post /agents/{id}/sign-transaction
openapi: 3.0.0
info:
  title: Relayer
  description: >-
    Relayer API — Kit-based crypto infrastructure for OTC exchange, wallet
    signing, payouts, and widget actions.
  version: '1.0'
  contact: {}
servers:
  - url: https://testnet.relayer.fi/v1
    description: Sandbox (testnet wallets, no real fiat)
  - url: https://api.relayer.fi/v1
    description: Production (mainnet wallets, regulated fiat rails)
security:
  - api-key: []
tags:
  - name: 'Action: Builders'
    description: Transaction metadata builders
  - name: 'Action: Directory'
    description: Widget directory
  - name: 'Action: Execute'
  - name: 'Action: Tokens'
    description: Token lists per chain/protocol
  - name: Addresses
  - name: Agents
  - name: App
    description: Application endpoints
  - name: 'Payout: Accounts'
    description: Payment execution
  - name: 'Payout: Off-ramp'
  - name: 'Payout: On-ramp'
  - name: 'Payout: Orders'
  - name: 'Payout: Recipients'
    description: Beneficiary management
  - name: Signing - Passkeys
  - name: Signing - Recovery
  - name: Signing Approvals
    description: Transaction signing approvals
  - name: Signing Policies
    description: Signing policy management
  - name: Transactions
    description: Transaction signing and broadcasting
  - name: Wallets
    description: Wallet and address management
paths:
  /agents/{id}/sign-transaction:
    post:
      tags:
        - Agents
      summary: Sign a Solana transaction for an agent
      description: >-
        <!-- relayer:auth-badge:start -->

        > **Auth: agent HMAC.** Called by the agent SDK at runtime with
        `x-agent-id`, `x-agent-auth`, `x-request-timestamp` headers. **Not
        callable from backend ApiKey.** See [Authentication → Agent
        HMAC](/get-started/authentication).

        <!-- relayer:auth-badge:end -->
      operationId: AgentController_signTransaction
      parameters:
        - name: id
          required: true
          in: path
          description: Agent ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignTransactionDto'
      responses:
        '200':
          description: Transaction signed and broadcast (below threshold)
        '202':
          description: Transaction queued for approval (above threshold)
        '403':
          description: Budget exceeded or agent not active
      security:
        - bearer: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            # Agent endpoints require HMAC-SHA256 signing. See

            # /get-started/authentication for the full payload + headers spec,
            or use

            # the @relayerfi/agent-sdk which signs automatically.


            curl -X POST
            https://api.relayer.fi/v1/agents/$AGENT_ID/sign-transaction \
              -H "x-agent-id: $AGENT_ID" \
              -H "x-agent-auth: $HMAC_SIGNATURE_HEX" \
              -H "x-request-timestamp: $UNIX_TS" \
              -H "Content-Type: application/json" \
              -d '{
                "unsignedTx": "<base64-solana-tx>"
              }'
        - lang: TypeScript
          label: Node.js (SDK)
          source: >-
            import { RelayerSDK } from "@relayerfi/agent-sdk";


            const sdk = new RelayerSDK({
              agentId: process.env.RELAYER_AGENT_ID!,
              agentSecret: process.env.RELAYER_AGENT_SECRET!,
              apiUrl: "https://api.relayer.fi",
            });


            const response = await sdk.http.request("POST",
            `/agents/${sdk.agentId}/sign-transaction`, {
              unsignedTx: base64SolanaTx,
            });

            // response.signature — base64 signature ready to submit to Solana
            RPC
components:
  schemas:
    SignTransactionDto:
      type: object
      properties:
        action_type:
          type: string
          description: Action type (e.g., "payment", "transfer")
        amount:
          type: string
          description: Amount in smallest unit (e.g., USDC micro-units as string)
        destination:
          type: string
          description: Destination wallet address
        token_mint:
          type: string
          description: SPL token mint address
        cluster:
          type: string
          description: Solana cluster (devnet or mainnet-beta)
          default: devnet
      required:
        - action_type
        - amount
        - destination
        - token_mint
        - cluster
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use this format: `ApiKey <your_api_key>`'

````