Backtick

A Product of Backtick Labs

API Documentation

Complete reference for OceanLinux API v1

Base URL

oceanlinux.com/api/v1

Authentication

Bearer Token

Rate Limit

1000/month

Security

HTTPS Only

Getting Started

Learn how to quickly get started with the OceanLinux API

1. Get Your API Key

First, you need to create an API key from your dashboard.

Create API Key

2. Set Up Authentication

Include your API key in the Authorization header of every request.

bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     https://oceanlinux.com/api/v1/wallet

3. Check Your Wallet

Before purchasing servers, ensure you have sufficient wallet balance.

Authentication

Secure your API requests with proper authentication

API Key Authentication

All API requests must include a valid API key in the Authorization header using Bearer token format.

http
Authorization: Bearer ol_1234567890abcdef...

Permissions

API keys can have different permission levels:

servers:read

View server information

Read

servers:write

Purchase and manage servers

Write

wallet:read

View wallet balance

Read

Wallet Management

Manage your wallet balance for API-based server purchases

GET /v1/wallet

Retrieve your current wallet balance and recent transactions.

bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://oceanlinux.com/api/v1/wallet

Response

json
{
  "balance": 2500.00,
  "currency": "INR",
  "totalCredits": 5000.00,
  "totalDebits": 2500.00,
  "transactions": [
    {
      "_id": "64f8a5b2c1234567890abcde",
      "type": "debit",
      "amount": 1200.00,
      "description": "Server purchase - Mumbai",
      "balanceBefore": 3700.00,
      "balanceAfter": 2500.00,
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "isActive": true
}

Server Operations

Purchase and manage servers using your wallet balance

GET /v1/servers

List all available servers for purchase.

bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://oceanlinux.com/api/v1/servers

Query Parameters

locationFilter by location
min_ramMinimum RAM (GB)
max_priceMaximum price

Error Handling

Understanding API error responses and status codes

HTTP Status Codes

200
Success
Request successful
400
Bad Request
Invalid request parameters
401
Unauthorized
Invalid or missing API key
403
Forbidden
Insufficient permissions
429
Rate Limited
API rate limit exceeded

Error Response Format

json
{
  "error": "Insufficient wallet balance",
  "message": "Your wallet balance (₹500) is insufficient for this purchase (₹1200)",
  "code": "INSUFFICIENT_BALANCE",
  "required": 1200.00,
  "available": 500.00,
  "timestamp": "2024-01-15T10:30:00Z"
}

Code Examples

Ready-to-use code snippets in different languages

Complete examples for common API operations

View All Examples

Purchase Server (Node.js)

javascript
const axios = require('axios');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://oceanlinux.com/api/v1';

async function purchaseServer() {
  try {
    // Check wallet balance first
    const wallet = await axios.get(`${BASE_URL}/wallet`, {
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    });

    console.log('Wallet Balance:', wallet.data.balance);

    // Purchase server
    const purchase = await axios.post(`${BASE_URL}/servers/purchase`, {
      serverId: '64f8a5b2c1234567890abcde',
      duration: 3,
      specifications: {
        os: 'Ubuntu 22.04',
        hostname: 'my-api-server'
      }
    }, {
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    });

    console.log('Purchase successful:', purchase.data);
    return purchase.data;

  } catch (error) {
    if (error.response?.status === 400) {
      console.error('Insufficient balance:', error.response.data);
    } else {
      console.error('Purchase failed:', error.message);
    }
    throw error;
  }
}

purchaseServer();