# Off-Chain Interface

## Overview

The Airlift API provides programmatic access to available\
routes for bridging assets across chains, fee quotes for transfers, and transaction status.\
It supports fetching transaction metadata, querying available routes, and\
estimating costs for operations like bridging.

Base URL: <https://airlift.prod.glacis-api.network/v1/>

## 🔐 Authentication

Endpoints require authentication, pass your API key in the request header:

```http
x-apikey: YOUR_API_KEY
```

## 📘 Endpoints

### Get Routes

**Endpoint:** GET /routes

**Security:** API key

**Query Parameters:**

* `isEnabled` (boolean, optional): Filter by enabled routes.
* `limit` (integer, optional): Number of results per page. Default is 100.
* `offset` (integer, optional): Pagination offset. Default is 0.

**Response:**

Returns a list of supported routes with fields such as:

* `fromChainName`, `toChainName`
* `standard` (bridge protocol)
* `estimatedGas`, `estimatedDuration`
* `minTransferSize`, `maxTransferSize`
* Token info (`tokenName`, `tokenId`)

**Example:** List Routes

```shell
curl -H "x-apikey: YOUR_API_KEY" "https://airlift.prod.glacis-api.network/v1/routes?limit=1&offset=0"
```

The request above responds with:

```json
{
  "paging": {
    "self": "https://airlift.prod.glacis-api.network/v1/routes?limit=1&offset=0",
    "next": "https://airlift.prod.glacis-api.network/v1/routes?limit=1&offset=1"
  },
  "data": [
    {
      "tokenId": "ANGLE",
      "tokenName": "ANGLE",
      "fromAddress": "0x31429d1856aD1377A8A0079410B297e1a9e214c2",
      "toAddress": "0x58441E37255b09F9f545e9Dc957F1C41658ff665",
      "fromChainId": "1",
      "fromChainName": "Ethereum",
      "toChainId": "10",
      "toChainName": "OP Mainnet",
      "minTransferSize": "0",
      "maxTransferSize": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
      "decimals": 18,
      "estimatedDuration": 210,
      "estimatedGas": 341457,
      "standard": "LayerZeroV1OFTV1-ANGLE",
      "isEnabled": true
    }
  ]
}
```

**Pagination**

For `/routes` endpoint, pagination metadata is included in the `paging` object:

* `prev`: URI for previous page
* `next`: URI for next page
* `self`: URI for current page

### Get Fee Quote

**Endpoint:** `POST /quote`

**Security:** API key

**Query Parameters:**

* `fromChain` (string, required): Chain ID of source chain (e.g. 10).
* `toChain` (string, required): Chain ID of destination chain (e.g. 42161).
* `fromToken` (string, required): Source token address (e.g. 0x...).
* `fromAmount` (string, required): Amount to transfer (e.g. 100000000000000000).

**Response:**

Returns an object with the following fields:

* `toAmount`: Net amount after fees.
* `estimatedGas`: Estimated gas usage.
* `estimatedDuration`: Duration in seconds.
* `feeCosts`: Breakdown of bridgeFee and airliftFee (both nativeFee and tokenFee).

**Example:** Get a Quote

```shell
curl -X POST \
  -H "x-apikey: YOUR_API_KEY" \
  "https://airlift.prod.glacis-api.network/v1/quote?fromChain=10&toChain=42161&fromToken=0xB153FB3d196A8eB25522705560ac152eeEc57901&fromAmount=100000000000000000"
```

The request above responds with:

```json
{
  "data": {
    "toAmount": "99500000000000000",
    "estimatedDuration": 49,
    "estimatedGas": 328258,
    "feeCosts": {
      "bridgeFee": {
        "tokenFee": "0",
        "nativeFee": "185295726153960"
      },
      "airliftFee": {
        "tokenFee": "500000000000000",
        "nativeFee": "0"
      }
    }
  }
}
```

### Get Transaction Status by Hash

**Endpoint:** `GET /transactions/{txHash}`

**Security:** API key

**Path Parameters:**

* `txHash` (string, required): The transaction hash (must match the pattern  `^0x[0-9a-fA-F]{64}$`).

**Response:**\
Returns the transaction status, which can be one of:

* `PENDING`
* `DONE`
* `FAILED`
* `NOT_FOUND`

Each status has specific substatus values.

**Example:** Fetch Transaction Status

```shell
curl "x-apikey: YOUR_API_KEY" "https://airlift.prod.glacis-api.network/v1/transactions/0xff6e703eb0880718bd44d85715fc9344171ca60b98db90ac9c43315f54b70e84"
```

The request above responds with:

```json
{
  "data": {
    "status": "DONE",
    "substatus": "COMPLETED",
    "sourceTx": "0xff6e703eb0880718bd44d85715fc9344171ca60b98db90ac9c43315f54b70e84",
    "destinationTx": "0x0ac82765ad624ac157ba9740372a37a14535e8f5f7aa593a8227e11b1519ebbb",
    "explorerLink": "https://layerzeroscan.com/tx/0xff6e703eb0880718bd44d85715fc9344171ca60b98db90ac9c43315f54b70e84"
  }
}
```

**🧾 Transaction Status Reference**

Status: `PENDING`

* Substatus values:
  * `WAIT_SOURCE_CONFIRMATIONS`
  * `WAIT_DESTINATION_TRANSACTION`
  * `BRIDGE_NOT_AVAILABLE`
  * `CHAIN_NOT_AVAILABLE`
  * `REFUND_IN_PROGRESS`
  * `UNKNOWN_ERROR`

Status: `DONE`

* Substatus values:
  * `COMPLETED`
  * `PARTIAL`
  * `REFUNDED`

Status: `FAILED`

* Substatus values:
  * `NOT_PROCESSABLE_REFUND_NEEDED`
  * `OUT_OF_GAS`
  * `SLIPPAGE_EXCEEDED`
  * `INSUFFICIENT_ALLOWANCE`
  * `INSUFFICIENT_BALANCE`
  * `UNKNOWN_ERROR`
  * `EXPIRED`

## ❗ Error Responses

| Code | Description           |
| ---- | --------------------- |
| 400  | Bad Request           |
| 404  | Not Found             |
| 500  | Internal Server Error |
| 503  | Server Unavailable    |

Error format:

```json
{
  "error": "Bad Request"
}
```

## 🧩 Token Standards Supported

The standard field in routes refers to one of:

* `CCT`
* `LayerZero V1 and V2 OFTs`
* `NTT`
* `M0LitePortal`
* `WarpRoute`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glacislabs.com/architecture-overview/off-chain-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
