# Ingestion API

## Ingestion API

### 1. Initiating a Transaction

#### **`POST /uxlink/account/v1/transactions`**

**Request Parameters:**

<table><thead><tr><th width="155">Parameter</th><th width="84">Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>executeData</td><td>Object</td><td>Required</td><td>Data to be executed, including contract address, execution method, and parameters</td></tr></tbody></table>

**Request Body Example:**

```vim
executeData: {
  to: "0x.....", // Address of the business contract to be called
  data: "...", // Encoded string containing the function name to be executed in the contract and the arguments passed to this function. Method for creating executeData will be provided below.
},
```

**Response:**

```vim
{
    "success": true,
    "msg": "ok",
    "code": 200,
    "data": {
        "orderId": "1233", // ID of this transaction, which can be used to query the transaction result.
    }
}
```

### 2. Querying Transaction Result

#### **`POST /uxlink/account/v1/transactions/query`**

**Request Parameters:**

<table><thead><tr><th width="155">Parameter</th><th width="84">Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>transactionId</td><td>string</td><td>Required</td><td>ID returned upon submitting execution data</td></tr></tbody></table>

**Response:**

```vim
// Success:
{
    "transactionHash": "tx_00123456789",
    "status": "completed",
    "amount": 100.00,
    "currency": "USD",
    "recipientAccount": "1234567890",
    "description": "Payment for order #1234",
    "createdAt": "2024-11-17T12:00:00Z",
    "completedAt": "2024-11-17T12:05:00Z",
    "metadata": {
        "orderId": "1234",
        "customerNote": "Thanks for your service!"
    }
   
}

// Error:
{
  "errorCode": "TRANSACTION_NOT_FOUND",
  "message": "The transaction ID 'tx_00123456789' does not exist."
}
```

### 3. Querying Account Balance

#### **`POST /uxlink/account/v1/balance`**

**Request Parameters:**

<table><thead><tr><th width="155">Parameter</th><th width="84">Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>accountId</td><td>string</td><td>Yes</td><td>The unique identifier of the account.</td></tr><tr><td>currency</td><td>string</td><td>No</td><td>The currency to query balance in (default to primary currency).</td></tr></tbody></table>

**Request Body:**

```vim
{
    "accountId": "1234567890",
    "currency": [], // ["USDT",""]
}
```

**Response:**

```vim
{
    data: [
        {
            "accountId": "1234567890",
            "balance": 5000.75,
            "currency": "USD",
            "lastUpdated": "2024-11-17T12:00:00Z"
        },
        {
            "accountId": "0987654321",
            "balance": 250.00,
            "currency": "USD",
            "lastUpdated": "2024-11-17T11:30:00Z"
        }
        ...
    ]
}
```

These adjustments provide a more professional and structured presentation of the API endpoints for developers working on the project.
