Documentation

SwitchHero API and integration guides

Getting Started

Follow these steps to start using the SwitchHero API:

Obtaining an API Key

You can create your API key from the control panel:

curl -X POST https://api.switchhero.com/v1/auth/token \
    -H "Content-Type: application/json" \
    -d '{"email": "[email protected]", "password": "your_password"}'

Your First Request

To list your switches:

GET /v1/switches
curl -X GET https://api.switchhero.com/v1/switches \
    -H "Authorization: Bearer YOUR_API_KEY"

Authentication

All API requests must use a Bearer token:

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expires_in": 3600
}

Switch Management

Add a Switch

POST /v1/switches
{
    "ip": "192.168.1.1",
    "name": "Core Switch 1",
    "model": "Cisco Catalyst 9300",
    "credentials": {
        "username": "admin",
        "password": "secure_password"
    }
}

Parameters

Parameter Type Required Description
ip string Yes Switch IP address
name string Yes Switch display name
model string No Switch model

Port Management

Port Status

GET /v1/switches/{switch_id}/ports
{
    "ports": [
        {
            "id": 1,
            "name": "GigabitEthernet1/0/1",
            "status": "up",
            "speed": "1000",
            "duplex": "full",
            "vlan": 1
        }
    ]
}