# Add New Asset

### **Description**

Registers a new asset in the system using a valid CoinGecko ID or manually defined asset.\
The endpoint enriches the asset with metadata and auto-discovers associated DEX pools and CEX markets. The new asset becomes queryable via other endpoints (e.g. ticker, pool state) within 30 seconds to 3 minutes.

### **URL**

```bash
POST https://pricing.aleno.ai/v1/assets
```

### **Headers**

```http
x-api-key: your-api-key
Content-Type: application/json
```

### **Request Body**

| Field       | Type   | Required | Description                                                                                                               |
| ----------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| coingeckoId | string | Optional | CoinGecko ID of the asset (e.g. `bitcoin`, `wrapped-bitcoin`). This ID is used to fetch token metadata and platform info. |
| asset       | object | Optional | <p>Manually defined asset. see example below<br><br><br><br></p>                                                          |

### **Example Query**&#x20;

**With coingecko ID**

```bash
curl -X POST https://pricing.aleno.ai/v1/assets \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "coingeckoId": "flare-networks"
  }'
```

**With manually defined asset (sylbol and tokenMapping)**

```bash
curl -X POST https://pricing.aleno.ai/v1/assets \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "symbol": "USDE",
    "tokenMapping": [
      {
        "address": "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
        "chainId": "eth"
      },
      {
        "address": "DEkqHyPN7GMRJ5cArtQFAWefqbZb33Hyf6s5iCwjEonT",
        "chainId": "solana"
      }
    ]
  }'
```

### **Responses**

**✅ Success (HTTP 200)**

Asset was added successfully, along with newly discovered pools and/or CEX data.

```json
{
  "status": "success",
  "successMessage": "SUCCESS: new asset WBTC successfully added and should be available within 30 seconds for API. New pools for this assets: 12. New CEX data for this asset: 1."
}
```

**✅ Accepted (HTTP 202)**

If process is taking more than 20 seconds, you will receive a message that indicates your request is still being processed.

```json
{
  "status": "pending",
  "successMessage": "PENDING: Your request to add a new asset is being processed. Adding a new asset can take up to 3 minutes in worst case, you can check at https://pricing.aleno.ai/v1/assets to see available assets and check if requested asset has been added."
}

```

**⚠️ Conflict (HTTP 409)**

The asset already exists in the system.

```json
{
  "status": "failed",
  "errorMessage": "FAILED: Asset WBTC already exists."
}
```

**❌ Validation Error (HTTP 400)**

Missing or invalid `coingeckoId`.

```json
{
  "status": "failed",
  "errorMessage": "FAILED: \"coingeckoId\" is required"
}
```

**❌ External API Failure / Internal Error (HTTP 500)**

CoinGecko fetch failed, pool discovery failed, or internal logic failed.

```json
{
  "status": "failed",
  "errorMessage": "FAILED: failed to get coingecko coin for id: wrapped-bitcoin. Coingecko API returned HTTP status code 404"
}
```

or

```json
{
  "status": "failed",
  "errorMessage": "FAILED: attempt to add new asset WBTC failed: failed to find pools for this token and no centralized exchange data found for this asset."
}
```
