Skip to main content
Obtiene el estado y detalles de un intent.

Endpoint

GET https://api.pan.dev/v1/intents/:intentId

Autenticacion

API Key o X402

Parametros de URL

ParametroTipoDescripcion
intentIdstringID del intent

Response

200 OK - Ejecutando

{
  "id": "intent_xyz789abc123",
  "walletId": "pan_wallet_abc123",
  "status": "executing",
  "action": "lend",
  "amount": 1000,
  "asset": "USDC",
  "executionPlan": {
    "strategy": "single-bridge",
    "steps": [
      {
        "type": "bridge",
        "sequence": 1,
        "from": "arbitrum",
        "to": "base",
        "status": "completed"
      },
      {
        "type": "deposit",
        "sequence": 2,
        "chain": "base",
        "protocol": "aave",
        "status": "executing"
      }
    ]
  },
  "results": {
    "completedSteps": 1,
    "transactions": [
      {
        "type": "bridge",
        "txHash": "0x123abc...",
        "chain": "arbitrum",
        "gasUsed": "150000",
        "gasCostUsd": 1.50
      }
    ]
  },
  "createdAt": "2024-01-15T10:40:00Z",
  "updatedAt": "2024-01-15T10:43:00Z"
}

200 OK - Completado

{
  "id": "intent_xyz789abc123",
  "walletId": "pan_wallet_abc123",
  "status": "completed",
  "action": "lend",
  "amount": 1000,
  "asset": "USDC",
  "executionPlan": {
    "strategy": "single-bridge",
    "steps": [...]
  },
  "results": {
    "completedSteps": 2,
    "transactions": [
      {
        "type": "bridge",
        "txHash": "0x123abc...",
        "chain": "arbitrum",
        "gasUsed": "150000",
        "gasCostUsd": 1.50
      },
      {
        "type": "deposit",
        "txHash": "0x456def...",
        "chain": "base",
        "gasUsed": "200000",
        "gasCostUsd": 0.80
      }
    ],
    "totalGasUsed": "350000",
    "totalGasCostUsd": 2.30,
    "finalAmount": "998.50",
    "apy": 8.52
  },
  "createdAt": "2024-01-15T10:40:00Z",
  "completedAt": "2024-01-15T10:45:30Z"
}

200 OK - Fallido

{
  "id": "intent_xyz789abc123",
  "walletId": "pan_wallet_abc123",
  "status": "failed",
  "action": "lend",
  "amount": 1000,
  "asset": "USDC",
  "error": {
    "code": "BRIDGE_FAILED",
    "message": "Bridge operation failed",
    "details": {
      "step": 1,
      "reason": "Fill timeout exceeded"
    }
  },
  "executionPlan": {
    "steps": [...]
  },
  "results": {
    "completedSteps": 0,
    "failedStep": 1
  },
  "createdAt": "2024-01-15T10:40:00Z",
  "failedAt": "2024-01-15T10:50:00Z"
}

Errores

CodigoErrorDescripcion
401UNAUTHORIZEDAPI key invalida
404INTENT_NOT_FOUNDIntent no existe

Ejemplos

curl -X GET "https://api.pan.dev/v1/intents/intent_xyz789abc123" \
  -H "Authorization: Bearer $PAN_API_KEY"

Polling

async function esperarIntent(intentId) {
  while (true) {
    const intent = await pan.getIntent(intentId);

    if (intent.status === 'completed') {
      return intent;
    }

    if (intent.status === 'failed') {
      throw new Error(intent.error.message);
    }

    await new Promise(r => setTimeout(r, 5000));
  }
}
Intervalo de polling recomendado: 5-10 segundos