X PROTOCOL API Documentation

Comprehensive API interface for interacting with the X PROTOCOL platform.

1. Authentication

All API requests must be authenticated using API Keys. Users can generate and manage their API keys through the X PROTOCOL dashboard.

Header: Authorization: Bearer YOUR_API_KEY

2. API Endpoints

1. Dashboard

Retrieve Dashboard Overview

Endpoint: /api/v1/dashboard

Method: GET

Description: Fetches an overview of the user's dashboard data including holdings, liquidity, etc.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "total_value": 125000.01,
    "yield_earned": 0.009931,
    "usdx_balance": 100000.007945,
    "wusdx_balance": 250.000000,
    "token_prices": {
        "USDX": 1.00,
        "wUSDX": 100.000008
    },
    "reward_multiplier": 1.00000008,
    "last_updated": "2024-11-19T15:05:27Z"
}

2. Holdings

Get User Holdings

Endpoint: /api/v1/holdings

Method: GET

Description: Retrieves detailed holdings of the user.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "holdings": [
        {
            "asset": "USDX",
            "balance": 100000.007945,
            "token_price": 1.00
        },
        {
            "asset": "wUSDX",
            "balance": 250.000000,
            "token_price": 100.000008
        }
    ]
}

3. Liquidity

Get Liquidity Information

Endpoint: /api/v1/liquidity

Method: GET

Description: Provides information about the platform's liquidity.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "total_liquidity": 5000000.00,
    "available_liquidity": 3000000.00,
    "locked_liquidity": 2000000.00
}

4. Technology

Get Platform Technology Details

Endpoint: /api/v1/technology

Method: GET

Description: Retrieves information about the technology stack and infrastructure.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "blockchain": "Ethereum",
    "smart_contracts": ["USDX Contract", "wUSDX Contract"],
    "security_protocols": ["SSL", "2FA", "Encryption"],
    "uptime": "99.99%"
}

5. Resources

Get Available Resources

Endpoint: /api/v1/resources

Method: GET

Description: Lists available resources such as documentation, tutorials, etc.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "resources": [
        {
            "type": "Documentation",
            "link": "https://xprotocol.com/docs"
        },
        {
            "type": "Tutorial",
            "link": "https://xprotocol.com/tutorials"
        },
        {
            "type": "API Reference",
            "link": "https://xprotocol.com/api"
        }
    ]
}

6. Terms

Get Platform Terms and Conditions

Endpoint: /api/v1/terms

Method: GET

Description: Retrieves the latest terms and conditions.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "version": "1.2.3",
    "last_updated": "2024-01-15",
    "content": "Full terms and conditions text..."
}

7. Status

Get Platform Status

Endpoint: /api/v1/status

Method: GET

Description: Provides the current operational status of the platform.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "status": "operational",
    "services": {
        "dashboard": "online",
        "trading": "online",
        "api": "online",
        "support": "online"
    },
    "message": "All systems operational."
}

8. Support

Create a Support Ticket

Endpoint: /api/v1/support/tickets

Method: POST

Description: Allows users to create support tickets.

Headers:

Authorization: Bearer {api_key}
Content-Type: application/json

Request Body:

{
    "subject": "Issue with USDX Deposit",
    "description": "Detailed description of the issue...",
    "priority": "high"
}

Response:

{
    "ticket_id": "ABC123456",
    "status": "open",
    "created_at": "2024-11-19T15:10:00Z"
}

9. XFT Short-Term US Government Securities Fund

Get Fund Details

Endpoint: /api/v1/fund/xft

Method: GET

Description: Retrieves details about the XFT Short-Term US Government Securities Fund.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "fund_name": "XFT Short-Term US Government Securities Fund",
    "total_value": 125000.01,
    "yield_earned": 0.009931,
    "last_updated": "2024-11-19T15:05:27Z"
}

10. Deposit Fiat & Mint USDX

Deposit Fiat and Mint USDX

Endpoint: /api/v1/usdx/mint

Method: POST

Description: Allows users to deposit fiat currency and mint USDX tokens.

Headers:

Authorization: Bearer {api_key}
Content-Type: application/json

Request Body:

{
    "currency": "USD",  // Allowed values: USD, EUR, GBP
    "amount": 1000.00
}

Response:

{
    "transaction_id": "TXN789012",
    "deposited_amount": 1000.00,
    "usdx_received": 1000.00,
    "estimated_daily_yield": 0.01,
    "status": "pending"
}

11. USDX/wUSDX Management

Wrap USDX to wUSDX

Endpoint: /api/v1/usdx/wrap

Method: POST

Description: Wraps USDX tokens into wUSDX.

Headers:

Authorization: Bearer {api_key}
Content-Type: application/json

Request Body:

{
    "amount": 5000.00
}

Response:

{
    "transaction_id": "TXN345678",
    "usdx_wrapped": 5000.00,
    "wusdx_received": 50.00,
    "status": "completed"
}

Unwrap wUSDX to USDX

Endpoint: /api/v1/usdx/unwrap

Method: POST

Description: Unwraps wUSDX tokens back into USDX.

Headers:

Authorization: Bearer {api_key}
Content-Type: application/json

Request Body:

{
    "amount": 50.00
}

Response:

{
    "transaction_id": "TXN901234",
    "wusdx_unwrapped": 50.00,
    "usdx_received": 5000.00,
    "status": "completed"
}

Get USDX/wUSDX Management Details

Endpoint: /api/v1/usdx/management

Method: GET

Description: Retrieves current USDX and wUSDX balances along with projected yield differences.

Headers:

Authorization: Bearer {api_key}

Response:

{
    "usdx_balance": 100000.007945,
    "wusdx_balance": 250.000000,
    "token_prices": {
        "USDX": 1.00,
        "wUSDX": 100.000008
    },
    "reward_multiplier": 1.00000008,
    "projected_yield_difference": "0.00%"
}

12. Global Payments

Process Global Payments

Endpoint: /api/v1/payments/global

Method: POST

Description: Handles global payment transactions.

Headers:

Authorization: Bearer {api_key}
Content-Type: application/json

Request Body:

{
    "recipient": "recipient_wallet_address",
    "amount": 2500.00,
    "currency": "USDX",
    "memo": "Payment for services"
}

Response:

{
    "payment_id": "PAY123456",
    "recipient": "recipient_wallet_address",
    "amount": 2500.00,
    "currency": "USDX",
    "status": "processed",
    "processed_at": "2024-11-19T15:20:00Z"
}

Error Handling

The API uses standard HTTP status codes to indicate success or failure of API requests.

Error Response Format:

{
    "error": {
        "code": 400,
        "message": "Invalid currency type.",
        "details": "Supported currencies are USD, EUR, GBP."
    }
}

Rate Limiting

To ensure fair usage, the API enforces rate limits:

Upon exceeding the rate limit, the API returns a 429 Too Many Requests status code.

Rate Limit Response:

{
    "error": {
        "code": 429,
        "message": "Rate limit exceeded. Try again in 3600 seconds."
    }
}

Sample Request & Response

Sample: Deposit Fiat & Mint USDX

Request:

POST /api/v1/usdx/mint HTTP/1.1
Host: api.xprotocol.com
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
    "currency": "USD",
    "amount": 1000.00
}

Response:

{
    "transaction_id": "TXN789012",
    "deposited_amount": 1000.00,
    "usdx_received": 1000.00,
    "estimated_daily_yield": 0.01,
    "status": "pending"
}