FortiBlox LogoFortiBlox Docs
NexusGetting Started

Quick Start Guide

Get your first FortiBlox Nexus API call working in 5 minutes

Quick Start Guide

Get up and running with FortiBlox Nexus in just 5 minutes. This guide will walk you through creating an account, generating your first API key, and making your first RPC call.

Prerequisites

  • A Google, GitHub, or email account for sign-up
  • Basic knowledge of JavaScript, Python, or Rust (optional)
  • Command-line access (for cURL examples)

Step 1: Create Your Account

  1. Visit https://nexus.fortiblox.com
  2. Click "Sign Up" in the top right
  3. Choose your preferred authentication method:
    • Google - One-click OAuth
    • GitHub - Developer-friendly OAuth
    • Email - Traditional email/password

No credit card required for the Free tier. Start building immediately!

Step 2: Generate Your First API Key

After signing in, you'll be redirected to the Developer Portal dashboard.

  1. Navigate to API Keys in the sidebar
  2. Click "Create New API Key"
  3. Fill in the details:
    • Name: e.g., "My First App"
    • Environment: Development
    • Services: Check "RPC Access"
  4. Click "Generate Key"

Important: Copy your API key immediately! For security reasons, you won't be able to see it again. Store it securely in your password manager or environment variables.

Your API key will look like this:

fbx_e2372852b2fbfcfa89a9f2d77d71c80d39f46298af8f0fdd24a75c17c7b508ee

For development/testing, keys use the fbx_test_ prefix.

Step 3: Secure Your API Key

Never hardcode your API key in your source code! Always use environment variables.

On macOS/Linux:

# Add to ~/.bashrc or ~/.zshrc
export FORTIBLOX_API_KEY="fbx_YOUR_KEY_HERE"

# Reload your shell
source ~/.bashrc  # or source ~/.zshrc

On Windows (PowerShell):

# Add to your PowerShell profile
$env:FORTIBLOX_API_KEY="fbx_YOUR_KEY_HERE"

# Or use System Environment Variables
[System.Environment]::SetEnvironmentVariable('FORTIBLOX_API_KEY', 'fbx_YOUR_KEY_HERE', 'User')
# .env
FORTIBLOX_API_KEY=fbx_YOUR_KEY_HERE

Don't forget: Add .env to your .gitignore file!

Step 4: Make Your First Request

Choose your preferred language and make your first API call:

curl -X POST https://nexus.fortiblox.com/rpc \
  -H "X-API-Key: $FORTIBLOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getHealth"
  }'

Expected response:

{
  "jsonrpc": "2.0",
  "result": "ok",
  "id": 1
}
// Install: npm install axios dotenv
const axios = require('axios');
require('dotenv').config();

async function main() {
  const API_KEY = process.env.FORTIBLOX_API_KEY;
  const endpoint = 'https://nexus.fortiblox.com/rpc';

  // Get cluster health
  const healthResponse = await axios.post(endpoint, {
    jsonrpc: '2.0',
    id: 1,
    method: 'getHealth'
  }, {
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json'
    }
  });
  console.log('Cluster health:', healthResponse.data.result);

  // Get current slot
  const slotResponse = await axios.post(endpoint, {
    jsonrpc: '2.0',
    id: 2,
    method: 'getSlot'
  }, {
    headers: { 'X-API-Key': API_KEY }
  });
  console.log('Current slot:', slotResponse.data.result);

  // Get recent blockhash
  const blockhashResponse = await axios.post(endpoint, {
    jsonrpc: '2.0',
    id: 3,
    method: 'getLatestBlockhash'
  }, {
    headers: { 'X-API-Key': API_KEY }
  });
  console.log('Latest blockhash:', blockhashResponse.data.result.value.blockhash);
}

main().catch(console.error);

Run it:

node index.js
# Install: pip install requests python-dotenv
import requests
from dotenv import load_dotenv
import os

load_dotenv()

def main():
    api_key = os.getenv('FORTIBLOX_API_KEY')
    endpoint = 'https://nexus.fortiblox.com/rpc'
    headers = {
        'X-API-Key': api_key,
        'Content-Type': 'application/json'
    }

    # Get cluster health
    health_response = requests.post(endpoint, json={
        'jsonrpc': '2.0',
        'id': 1,
        'method': 'getHealth'
    }, headers=headers)
    print(f"Cluster health: {health_response.json()['result']}")

    # Get current slot
    slot_response = requests.post(endpoint, json={
        'jsonrpc': '2.0',
        'id': 2,
        'method': 'getSlot'
    }, headers=headers)
    print(f"Current slot: {slot_response.json()['result']}")

    # Get recent blockhash
    blockhash_response = requests.post(endpoint, json={
        'jsonrpc': '2.0',
        'id': 3,
        'method': 'getLatestBlockhash'
    }, headers=headers)
    print(f"Latest blockhash: {blockhash_response.json()['result']['value']['blockhash']}")

if __name__ == "__main__":
    main()

Run it:

python main.py
// Add to Cargo.toml:
// [dependencies]
// reqwest = { version = "0.11", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1.0"
// dotenv = "0.15"

use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE};
use serde_json::json;
use std::env;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    dotenv::dotenv().ok();

    let api_key = env::var("FORTIBLOX_API_KEY")?;
    let endpoint = "https://nexus.fortiblox.com/rpc";

    let mut headers = HeaderMap::new();
    headers.insert("X-API-Key", HeaderValue::from_str(&api_key)?);
    headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));

    let client = reqwest::Client::new();

    // Get cluster health
    let health_resp = client
        .post(endpoint)
        .headers(headers.clone())
        .json(&json!({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getHealth"
        }))
        .send()
        .await?
        .json::<serde_json::Value>()
        .await?;
    println!("Cluster health: {}", health_resp["result"]);

    // Get current slot
    let slot_resp = client
        .post(endpoint)
        .headers(headers.clone())
        .json(&json!({
            "jsonrpc": "2.0",
            "id": 2,
            "method": "getSlot"
        }))
        .send()
        .await?
        .json::<serde_json::Value>()
        .await?;
    println!("Current slot: {}", slot_resp["result"]);

    Ok(())
}

Run it:

cargo run

Step 5: Verify in Dashboard

  1. Go back to the Developer Portal
  2. Navigate to AnalyticsAPI Usage
  3. You should see your recent API calls logged

The dashboard shows:

  • Request count by endpoint
  • Response times
  • Error rates
  • Credit usage

Next Steps

Congratulations! You've successfully made your first FortiBlox Nexus API call. Here's what to explore next:

Common Issues

Issue: "Invalid API key" error

Solution: Make sure:

  • You copied the entire API key (starts with fbx_ or fbx_test_)
  • No extra spaces before/after the key
  • The key is active in your dashboard
  • You're using the correct environment variable name
  • You're using the X-API-Key header (not query parameter)

Issue: CORS errors in browser

Solution:

  • API keys in query strings expose your key to anyone viewing network traffic
  • Use our RPC Proxy tool for browser applications
  • Or set up domain restrictions in the Developer Portal

Issue: Rate limit exceeded

Solution:

  • Free tier: 10 requests/second
  • Check your current usage in the dashboard
  • Consider upgrading to a paid tier
  • Implement request caching

Getting Help