API Reference

Complete REST API documentation for integrating OAS into your applications.

Base URL

https://api.omniasset.io/v1

All API requests must be made over HTTPS.

Authentication

API Key Authentication

Include your API key in the request headers:

curl https://api.omniasset.io/v1/assets \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

OAuth 2.0

For user-authenticated requests, use OAuth 2.0 flow:

// Authorization URL
const authUrl = 'https://auth.omniasset.io/oauth/authorize?' +
  'client_id=YOUR_CLIENT_ID&' +
  'redirect_uri=YOUR_REDIRECT_URI&' +
  'response_type=code&' +
  'scope=read:assets write:assets';

// Exchange code for token
const tokenResponse = await fetch('https://auth.omniasset.io/oauth/token', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    grant_type: 'authorization_code',
    client_id: 'YOUR_CLIENT_ID',
    client_secret: 'YOUR_CLIENT_SECRET',
    code: 'AUTHORIZATION_CODE',
    redirect_uri: 'YOUR_REDIRECT_URI'
  })
});

Assets

POST /assets

Create Asset

Creates a new tokenized asset.

Request Body

{
  "name": "Luxury Apartment NYC",
  "symbol": "APT-NYC-001",
  "type": "real_estate",
  "totalSupply": 1000000,
  "pricePerToken": 100,
  "metadata": {
    "location": "Manhattan, New York",
    "sqft": 2500,
    "bedrooms": 3
  },
  "compliance": {
    "kycRequired": true,
    "jurisdictions": ["US", "UK"]
  }
}

Response

{
  "id": "asset_1234567890",
  "tokenAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb8",
  "name": "Luxury Apartment NYC",
  "symbol": "APT-NYC-001",
  "totalSupply": 1000000,
  "availableSupply": 1000000,
  "pricePerToken": 100,
  "status": "active",
  "createdAt": "2024-01-15T10:00:00Z"
}
GET /assets/:id

Get Asset

Retrieves details of a specific asset.

Path Parameters

id - The asset ID or token address

Response

{
  "id": "asset_1234567890",
  "tokenAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb8",
  "name": "Luxury Apartment NYC",
  "symbol": "APT-NYC-001",
  "type": "real_estate",
  "totalSupply": 1000000,
  "circulatingSupply": 750000,
  "holders": 234,
  "pricePerToken": 102.50,
  "marketCap": 102500000,
  "status": "active",
  "metadata": {
    "location": "Manhattan, New York",
    "sqft": 2500,
    "bedrooms": 3,
    "lastValuation": "2024-01-01",
    "documents": ["deed.pdf", "appraisal.pdf"]
  }
}
GET /assets

List Assets

Returns a paginated list of assets.

Query Parameters

type - Filter by asset type (real_estate, bond, invoice, etc.)

status - Filter by status (active, paused, completed)

limit - Number of results (default: 20, max: 100)

offset - Pagination offset

Response

{
  "data": [
    {
      "id": "asset_1234567890",
      "name": "Luxury Apartment NYC",
      "symbol": "APT-NYC-001",
      "type": "real_estate",
      "pricePerToken": 102.50,
      "marketCap": 102500000
    }
  ],
  "pagination": {
    "total": 156,
    "limit": 20,
    "offset": 0,
    "hasMore": true
  }
}
PATCH /assets/:id

Update Asset

Updates asset metadata and settings.

Request Body

{
  "pricePerToken": 105,
  "metadata": {
    "lastRenovation": "2024-01-01",
    "newAmenities": ["gym", "pool"]
  },
  "compliance": {
    "jurisdictions": ["US", "UK", "EU"]
  }
}

Transactions

POST /transactions/transfer

Transfer Tokens

Transfer tokens between addresses.

Request Body

{
  "assetId": "asset_1234567890",
  "from": "0x123...",
  "to": "0x456...",
  "amount": 100,
  "memo": "Investment transfer"
}

Response

{
  "transactionId": "tx_9876543210",
  "hash": "0xabc123...",
  "status": "pending",
  "confirmations": 0,
  "gasUsed": 45000,
  "timestamp": "2024-01-15T10:00:00Z"
}
POST /transactions/mint

Mint Tokens

Mint new tokens (requires admin permissions).

{
  "assetId": "asset_1234567890",
  "to": "0x456...",
  "amount": 10000,
  "reason": "Additional capital raise"
}
POST /transactions/burn

Burn Tokens

Permanently remove tokens from circulation.

{
  "assetId": "asset_1234567890",
  "from": "0x123...",
  "amount": 1000,
  "reason": "Buyback and burn"
}
POST /transactions/dividends

Distribute Dividends

Distribute dividends to token holders.

{
  "assetId": "asset_1234567890",
  "amount": 100000,
  "currency": "USDC",
  "period": "Q1-2024",
  "paymentDate": "2024-04-15",
  "snapshotDate": "2024-03-31"
}

Webhooks

Webhook Setup

Configure webhooks to receive real-time event notifications:

// Register webhook endpoint
const webhook = await oas.webhooks.create({
  url: 'https://your-app.com/webhooks/oas',
  events: [
    'asset.created',
    'asset.updated',
    'transaction.completed',
    'dividend.distributed'
  ],
  secret: 'your-webhook-secret'
});

// Verify webhook signature
const isValid = oas.webhooks.verify(
  payload,
  headers['x-oas-signature'],
  'your-webhook-secret'
);

Webhook Events

Available webhook event types:

Asset Events

  • asset.created - New asset tokenized
  • asset.updated - Asset metadata updated
  • asset.paused - Trading paused
  • asset.resumed - Trading resumed

Transaction Events

  • transaction.pending - Transaction submitted
  • transaction.completed - Transaction confirmed
  • transaction.failed - Transaction failed
  • dividend.distributed - Dividend payment complete

Compliance Events

  • kyc.approved - KYC verification approved
  • kyc.rejected - KYC verification rejected
  • compliance.alert - Compliance issue detected

Event Payload Example

{
  "event": "asset.created",
  "timestamp": "2024-01-15T10:00:00Z",
  "data": {
    "assetId": "asset_1234567890",
    "tokenAddress": "0x742d35Cc...",
    "name": "Luxury Apartment NYC",
    "totalSupply": 1000000
  }
}

Rate Limits

API rate limits vary by plan:

Developer

100

requests/minute

Professional

1,000

requests/minute

Enterprise

Unlimited

Custom limits

Rate limit information is included in response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1642248000

Error Codes

200 OK
Request successful
201 Created
Resource created
400 Bad Request
Invalid parameters
401 Unauthorized
Invalid API key
403 Forbidden
Insufficient permissions
404 Not Found
Resource not found
429 Too Many Requests
Rate limit exceeded
500 Internal Server Error
Server error

Error Response Format

{
  "error": {
    "code": "invalid_parameter",
    "message": "The 'amount' field must be a positive number",
    "field": "amount",
    "requestId": "req_abc123"
  }
}