Skip to main content

Base URL

EnvironmentURL
Productionhttps://api.alpha.dev/api/v1
Developmenthttps://dev.alpha.dev/api/v1

Authentication

All endpoints except health check and internal cluster endpoints require a JWT Bearer token:
Authorization: Bearer <jwt_token>
Contact support for API access credentials.

Endpoints

MethodPathDescriptionAuth
POST/api/v1/execute-intentExecute or register a trading intentYes
POST/api/v1/normalize-intentNormalize intent for auto-approvalYes
POST/api/v1/trades/simulateSimulate a trade without executionNo
GET/api/v1/tokens/resolveResolve token symbols to addressesNo
GET/api/v1/transactionsTransaction historyYes

POST /api/v1/execute-intent

Execute an on-chain swap, register a conditional rule, or close a position.

Request

{
  "intent": "<intent><type>IMMEDIATE</type><chain_id>solana:mainnet-beta</chain_id>...</intent>"
}
FieldTypeRequiredDescription
intentstringYesTIM intent as XML string. See intent format.

Response

{
  "intent_id": "550e8400-e29b-41d4-a716-446655440000",
  "transaction_hash": "5UfD...",
  "status": "EXECUTION_STATUS_CONFIRMED",
  "details": "Swap executed successfully",
  "system_message": "...",
  "position_id": "pos_abc123",
  "exit_orders": {
    "take_profit_order_id": "ord_tp_1",
    "stop_loss_order_id": "ord_sl_1"
  },
  "rule_id": null,
  "wait_hint": {
    "type": "transaction",
    "tx_hash": "5UfD...",
    "chain_id": "solana:mainnet-beta",
    "commitment": "finalized",
    "poll_interval_ms": 2000,
    "timeout_ms": 60000,
    "system_message": "..."
  }
}
FieldTypeDescription
intent_idstringUnique identifier for this intent
transaction_hashstring or nullBlockchain transaction hash. Present for IMMEDIATE swaps, absent for rules.
statusstringExecution status (see below)
detailsstringHuman-readable status message
system_messagestringMessage with balance verification and block explorer link
position_idstring or nullPosition ID if exit strategy was configured or for CLOSE_POSITION
exit_ordersobject or nullTake-profit and stop-loss order IDs
rule_idstring or nullRule ID for CONDITIONAL_ENTRY intents
cancelled_ordersarray or nullCancelled order IDs (for CLOSE_POSITION)
realized_pnlobject or nullRealized PnL with pnl_percent and pnl_usd (for CLOSE_POSITION)
prerequisiteobject or nullPrerequisite action required before execution (e.g., funding)
continuationobject or nullFollow-up intent to execute after prerequisite completes
wait_hintobject or nullPolling hint for transaction confirmation

Execution status values

StatusMeaning
EXECUTION_STATUS_PENDINGTransaction submitted, awaiting confirmation
EXECUTION_STATUS_CONFIRMEDTransaction confirmed on-chain
EXECUTION_STATUS_FAILEDExecution failed
EXECUTION_STATUS_CANCELLEDIntent was cancelled
FUNDING_REQUIREDInsufficient funds — check prerequisite field

POST /api/v1/normalize-intent

Parse and enrich an intent XML with resolved token addresses and USD values. Use this to preview what TIM will execute before submitting.

Request

{
  "intent": "<intent>...</intent>"
}

Response

{
  "intent": "{\"type\":\"IMMEDIATE\",\"chain_id\":\"solana:mainnet-beta\",...}"
}
The response intent field contains the normalized intent as a JSON string with resolved addresses and computed values.

POST /api/v1/trades/simulate

Simulate a trade to check token liquidity and price impact without executing.

Request

{
  "chain_id": "eip155:1",
  "token_address": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
  "amount_usd": 1000
}
FieldTypeRequiredDescription
chain_idstringYesCAIP-2 chain identifier
token_addressstringYesToken contract/mint address
amount_usdnumberYesTrade size in USD (must be > 0)

Response (success)

{
  "success": true,
  "chain_id": "eip155:1",
  "token_address": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
  "quote_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "amount_usd": 1000.0,
  "expected_output": "15131564379480771843325952",
  "price_impact_bps": 0,
  "simulated_at": "2026-01-07T20:14:54.715394844+00:00"
}

Response (failure)

{
  "success": false,
  "chain_id": "eip155:1",
  "token_address": "0x...",
  "quote_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "amount_usd": 1000.0,
  "error_code": "insufficient_liquidity",
  "error_message": "Token has insufficient liquidity for requested amount",
  "simulated_at": "2026-01-07T20:14:54.715394844+00:00"
}
FieldTypeDescription
successbooleanWhether the simulation succeeded
quote_tokenstringQuote token used (chain’s default stablecoin)
expected_outputstring or nullExpected token output in smallest units
price_impact_bpsnumber or nullPrice impact in basis points (50 = 0.5%)
error_codestring or nullError code if simulation failed
error_messagestring or nullError description if simulation failed
simulated_atstringISO 8601 timestamp

Simulation error codes

CodeDescriptionRetryable
insufficient_liquidityLiquidity below thresholdYes
token_not_foundToken not found on chainNo
no_route_foundNo swap route availableYes
high_price_impactPrice impact exceeds thresholdYes
simulation_failedRPC or aggregator errorYes

GET /api/v1/tokens/resolve

Resolve a token symbol to contract addresses across chains.

Query parameters

ParameterRequiredDescription
queryYesToken symbol to resolve (e.g., USDC, SOL)
chain_idsNoComma-separated CAIP-2 chain IDs. Defaults to all configured chains.

Response

{
  "query": "USDC",
  "results": [
    {
      "chain_id": "solana:mainnet-beta",
      "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "symbol": "USDC",
      "name": "USD Coin",
      "decimals": 6
    }
  ],
  "errors": [
    {
      "chain_id": "eip155:56",
      "code": "TOKEN_NOT_FOUND",
      "message": "Token not found on chain"
    }
  ]
}
FieldTypeDescription
results[].chain_idstringCAIP-2 chain identifier
results[].addressstringToken contract address
results[].symbolstringToken symbol
results[].namestringToken display name
results[].decimalsnumberToken decimal places
errors[].chain_idstringChain where resolution failed
errors[].codestringError code (TOKEN_NOT_FOUND, API_ERROR)
errors[].messagestringError description

GET /api/v1/transactions

List transaction history for the authenticated user.

Query parameters

ParameterRequiredDefaultDescription
chain_idNosolana:mainnet-betaChain to query
correlation_idNoFilter by correlation ID
context_queryNoFilter by context label
result_codeNoFilter by result codes (comma-separated)
pageNo0Page number (0-indexed)
limitNo20Items per page (max 100)

Error format

All errors follow this structure:
{
  "error": {
    "code": "INVALID_INTENT",
    "message": "Failed to parse intent XML",
    "details": { ... }
  }
}

Common error codes

CodeDescription
INVALID_INTENTMalformed or invalid intent XML
TOKEN_NOT_FOUNDToken symbol could not be resolved
TXN_FAILEDTransaction execution failed
TRANSACTION_SIGNING_FAILEDSigning operation failed
TRANSACTION_SUBMISSION_FAILEDBlockchain submission failed
INVALID_CHAIN_IDChain ID not configured
INVALID_AMOUNTAmount must be a positive number

MCP Hub alternative

MCP Hub wraps TIM with the same capabilities via MCP tool calling. If you are building an AI agent that supports MCP, you can use genalpha_tim_execute_intent through the MCP Hub API instead of calling the HTTP API directly. Both accept the same intent format and return equivalent responses.