API DOCUMENTATION

Introduction

Welcome to the documentation for the NOSGPU API. This documentation serves as a comprehensive guide for developers looking to integrate with our platform. By leveraging our API, developers can seamlessly integrate NOSGPU functionalities into their applications.

Getting Started

To begin utilizing our API, developers need to familiarize themselves with the endpoints and authentication mechanisms provided. Below, you'll find essential information to get started:

  • Sandbox API base URL: https://api.nosgpu.ch/sandbox/v1
  • Production API base URL: https://api.nosgpu.ch/v1

The examples use the production API. To use the sandbox, replace the production base URL with the sandbox base URL.

Authentication

To access the NOSGPU API, authentication via API KEY is required. Follow the steps below to obtain your API KEY:

  1. Log in and navigate to the API section. You can find here:/dashboard/api.
  2. Click on the "new API-KEY" button.
  3. Provide a name for your API KEY and confirm.
  4. We strongly recommend protecting your API key by enabling the IP allowlist feature. This will restrict access to your API key to only the specified IP addresses, enhancing its security.
  5. Once obtained, the API key can be used in every API request by adding it as a Bearer Authorization header to the HTTPS request.

It is essential to make API requests server-to-server. Using the API from the front-end can expose your API key to the public.

SSH keys: website setup

SSH public keys can only be added through the website, not through the public API. Register your key before creating an instance with the API.

  1. Log in to the website with the account that owns your API key and open Dashboard / Account / SSH keys.
  2. Click "ADD NEW KEY", enter a key name and paste the contents of your SSH public key (.pub file) into "Public Key". Use the public key only; never paste your private key.
  3. Click "ADD KEY". After saving, copy the number shown in the "ID" column of the SSH keys list.
  4. Use that number as ssh_key_id in the instance creation request. The API request takes the saved key ID, not the key name or public key text.

Account balance

Retrieve current wallet balance and currency.


const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/account/balance';

fetch(URL, {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    }
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Balance:', data.balance);
    console.log('Currency:', data.currency);
})
.catch((error) => {
    console.error('Error fetching balance:', error.message);
});

Request

Method:

GET

API URL: https://api.nosgpu.ch/v1/account/balance

Headers:

Authorization: required - Bearer token

Content-Type: optional - application/json

Response

Status Code: 200

Response success

            
{
  // current user balance
  "balance": number,

  "currency": {
    // currency code
    "code": 'USD'|'EUR'|'GBP'|'CHF',
    // currency symbol
    "symbol": '$'|'€'|'£'|'CHF'|null
  }
}

          
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Catalog instances

This API returns all rentable instance packages grouped by category, including availability, hardware resources, operating systems, templates and prices.


const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/catalog/packages';

fetch(URL, {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    }
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Categories:', data.categories);
    console.log('Currency:', data.currency);
})
.catch((error) => {
    console.error('Error fetching catalog packages:', error.message);
});

Request

Method:

GET

API URL: https://api.nosgpu.ch/v1/catalog/packages

Headers:

Authorization: required - Bearer token

Content-Type: optional - application/json

Response

Status Code: 200

Response success

            
{
  "categories": {
    "vm_gpu_dedicated": {
      "packages": [
        {
          // package id
          "id": number,
          "availability": {
            // 1 if package is available, 0 otherwise
            "available": 0|1,
            // availability reason if not available
            "reason": string|null
          },
          "cpu": {
            // cpu brand
            "brand": string|null,
            // cpu model name
            "name": string|null,
            // number of cpu cores
            "cores": number|null
          },
          "ram": {
            // ram quantity
            "quantity": string|null,
            // ram unit
            "unit": 'GB'
          },
          "disk": {
            // disk type
            "type": string|null,
            // disk quantity
            "quantity": number|null,
            // disk unit
            "unit": 'GB'
          },
          "gpu": {
            // gpu brand
            "brand": string|null,
            // gpu model name
            "name": string|null,
            // gpu vram quantity
            "vram_quantity": string|null,
            // gpu vram unit
            "vram_unit": 'GB',
            // dedicated gpu quantity for dedicated packages
            "quantity"?: number,
            // shared gpu slice quantity for shared packages
            "slice_quantity"?: number,
            // total slice quantity available on source gpu
            "slice_quantity_of"?: number|null,
            // source gpu total vram quantity for shared packages
            "vram_quantity_of"?: string|null
          },
          "os": [
            {
              // operating system brand
              "brand": string,
              // operating system version
              "version": string,
              "templates": [
                {
                  // image id used when creating an instance
                  "image_id": number,
                  // template name
                  "name": string
                }
              ]
            }
          ],
          // package tag
          "tag": string,
          "price": {
            // billing unit
            "unit": 'h'|'m',
            // billing amount
            "amount": number
          }
        }
      ]
    },
    "vm_gpu_shared": {
      "packages": array
    },
    "bare_metal": {
      "packages": array
    },
    "cold_storage": {
      "packages": array
    },
    "ai_storage": {
      "packages": array
    }
  },
  "currency": {
    // account currency code
    "code": 'EUR'|'CHF'|'USD',
    // currency symbol
    "symbol": string|null
  }
}

          
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Rent instance

This API creates a new GPU instance using the selected package, image and SSH key.


const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/instances/create';

fetch(URL, {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        package_id: 1, // API GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].id
        image_id: 1, // API GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].os[].templates[].image_id (selected package)
        ssh_key_id: 1 // Website only: add your public key at https://www.nosgpu.ch/dashboard/account/ssh-key and copy its ID
    })
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    // Success
    console.log('Instance created:', data.instance);
    console.log('My updated wallet balance:', data.wallet);
})
.catch((error) => {
    console.error('Error during creation:', error.message);
});

Request

Method:

POST

API URL: https://api.nosgpu.ch/v1/instances/create

Headers:

Authorization: required - Bearer token

Content-Type: required - application/json

Body:

package_id: required - package ID from the JSON response to GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].id.

image_id: required - OS template ID from the same catalog response: categories[category].packages[].os[].templates[].image_id. Choose a template belonging to the selected package.

ssh_key_id: required - saved SSH key ID from the website's SSH keys page. Add the public key on that page first, then copy its ID as described in SSH keys: website setup.

Here, category is a category name from the response (for example vm_gpu_dedicated), and [] means an element of an array. These are paths inside the JSON response, not URLs. The value 1 in the examples is a placeholder for each ID.

Response

Status Code: 200

Response success

              
  {
    "instance": {
      // your account id  
      "user_id": number,
      // package id
      "package_id": number,
      // hypervisor id
      "hypervisor_id": number,
      // template id
      "image_id": number,
      // instance type id
      "type": number,
      // instance status code
      "status": 'provisioning'|'running'|'stopped'|'error'|'deleting'|'deleted'|'expired',
      // UTC date time
      "updated_at": string,
      // UTC date time
      "created_at": string,
      // instance id
      "id": number,
      // instance name
      "name": string
    },
    "wallet": {
      // your credit after instance creation
      "balance": number,
      "currency": {
        // account/user currency code 
        "code": 'EUR'|'CHF'|'USD',
        // currency symbol if available
        "symbol": string|null
      }
    }
  }

            
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Status Code: 402

Payment Required- Insufficient wallet balance or credits

Status Code: 422

Validation Error- Invalid request body parameters

List my instances

This API returns the paginated list of my instances for the authenticated user with filters for category, status and date range, including cost monitoring data.


const API_KEY = 'YOUR_BEARER_API_KEY';
const LIMIT = 5;
const SKIP = 0;
const URL = 'https://api.nosgpu.ch/v1/instances/list/' + LIMIT + '/' + SKIP;

fetch(URL, {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        category: 'all',
        status: 'active',
        date_from: '2026-02-24',
        date_to: '2026-06-05'
    })
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Instances:', data.instances);
    console.log('Total:', data.tot);
    console.log('Currency:', data.currency);
})
.catch((error) => {
    console.error('Error fetching instances list:', error.message);
});

Request

Method:

POST

API URL: https://api.nosgpu.ch/v1/instances/list/{limit}/{skip}

Headers:

Authorization: required - Bearer token

Content-Type: required - application/json

Path parameters:

limit: required - maximum number of instances to return

skip: required - number of records to skip for pagination

Body:

category: required - category filter, all, vm_gpu_shared, vm_gpu_dedicated, bare_metal, ai_storage, cold_storage, all_storage, all_vm

status: required - status filter, active, all, stopped, running, delete

date_from: optional - start date filter in format YYYY-MM-DD

date_to: optional - end date filter in format YYYY-MM-DD

Response

Status Code: 200

Response success

              
{
  "instances": [
    {
      // instance id
      "id": number,
      // generated instance name
      "name": string,
      // instance type id
      "type": number,
      // instance category
      "category": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
      // current instance status
      "status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
      // total accumulated cost
      "total_cost": number,
      // partial cost in selected filter range
      "partial_cost": number,
      "price": {
        // billing unit
        "unit": string,
        // price amount for billing unit
        "amount": number
      }
    }
  ],
  // total number of instances matching current filters
  "tot": number,
  "currency": {
    // account currency code
    "code": 'EUR'|'CHF'|'USD',
    // currency symbol
    "symbol": string|null
  }
}

            
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Status Code: 422

Validation Error- Invalid filters or pagination parameters

Instance details

This API returns full details for a specific GPU instance, including status, billing, package resources, network access and authentication info.


const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID + '/details';

fetch(URL, {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    }
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Instance details:', data.instance);
    console.log('Currency:', data.currency);
})
.catch((error) => {
    console.error('Error fetching instance details:', error.message);
});

Request

Method:

GET

API URL: https://api.nosgpu.ch/v1/instances/{instance_id}/details

Headers:

Authorization: required - Bearer token

Content-Type: optional - application/json

Path parameters:

instance_id: required - instance id

Response

Status Code: 200

Response success

              
    {
      "instance": {
        // instance id
        "id": number,
        // instance name
        "name": string,
        // instance type id
        "type": number,
        // category label
        "category": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
        // instance status code
        "status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
        // current task state if available
        "task_state": string,
        // UTC date time when instance started
        "started_at": string|null,
        "price": {
          // billing unit
          "unit": string,
          // amount for billing unit
          "amount": number
        },
        // accumulated total instance cost
        "total_cost": number,
        "address": {
          // public ip address
          "public_ip": string,
          // exposed service interface port if available
          "interface_port": string|null
        },
        "auth": {
          // auth method
          "type": 'ssh',
          "value": {
            // SSH public key content
            "public_key": string,
            // SSH key id
            "id": number|null,
            // SSH key name
            "name": string|null
          },
          // default ssh username if available
          "username": string|null
        },
        "billing": [
          {
            // negative or positive billing amount
            "amount": number,
            // UTC date time of billing record
            "created_at": string
          }
        ],
        "metrics": {
          // current metrics snapshot
          "current": object|null,
          // metrics history list
          "history": array
        },
        "package": {
          // package id snapshot
          "id": number,
          "cpu": {
            "brand": string,
            "name": string,
            "cores": number
          },
          "ram": {
            "quantity": string,
            "unit": 'GB'
          },
          "disk": {
            "type": string,
            "quantity": number,
            "unit": 'GB'
          },
          "gpu": {
            "brand": string,
            "name": string,
            "vram_quantity": string,
            "vram_unit": 'GB',
            "slice_quantity": number,
            "slice_quantity_of": number|null,
            "vram_quantity_of": number|null
          },
          "os": {
            "brand": string,
            "version": string,
            "template": {
              "image_id": number,
              "name": string
            }
          },
          "tag": string
        }
      },
      "currency": {
        // account/user currency code
        "code": 'EUR'|'CHF'|'USD',
        // currency symbol if available
        "symbol": string|null
      }
    }
    
            
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Status Code: 404

Not Found- Instance not found

Instance actions

This API executes an action on a specific instance. Supported actions are start, stop and reboot.


const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const ACTION = 'start'; // start | stop | reboot
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID + '/' + ACTION;

fetch(URL, {
    method: 'PATCH',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    }
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Instance action result:', data.instance);
})
.catch((error) => {
    console.error('Error executing instance action:', error.message);
});

Request

Method:

PATCH

API URL: https://api.nosgpu.ch/v1/instances/{instance_id}/{action}

Headers:

Authorization: required - Bearer token

Content-Type: optional - application/json

Path parameters:

instance_id: required - instance id

action: required - supported values are start, stopand reboot

Response

Status Code: 200

Response success

      
{
  "instance": {
    // instance id
    "id": number,
    // generated instance name
    "name": string,
    // instance category/type label
    "type": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
    // current instance status after action
    "status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
    // instance start datetime in UTC if available
    "started_at": string|null
  }
}

    
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Status Code: 404

Not Found- Instance not found

Status Code: 409

Conflict- Instance is not ready for this action

Delete instance

This API deletes a specific instance and returns the updated instance status.

Warning: deleting an instance permanently destroys the machine and all data stored on it. This action cannot be undone. Back up any data you need before proceeding.

Deleting the instance stops further credit charges for that instance.


const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID;

fetch(URL, {
    method: 'DELETE',
    headers: {
        'Authorization': 'Bearer ' + API_KEY,
        'Content-Type': 'application/json'
    }
})
.then(async (response) => {
    const data = await response.json();

    if (!response.ok) {
        throw new Error(JSON.stringify(data));
    }

    console.log('Instance delete result:', data.instance);
})
.catch((error) => {
    console.error('Error deleting instance:', error.message);
});

Request

Method:

DELETE

API URL: https://api.nosgpu.ch/v1/instances/{instance_id}

Headers:

Authorization: required - Bearer token

Content-Type: optional - application/json

Path parameters:

instance_id: required - instance id

Response

Status Code: 200

Response success

      
{
  "instance": {
    // instance id
    "id": number,
    // generated instance name
    "name": string,
    // instance category/type label
    "type": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
    // current instance status after delete action
    "status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
    // instance start datetime in UTC if available
    "started_at": string|null
  }
}

    
Status Code: 401

Unauthorized- Verify that your bearer token is correct

Status Code: 404

Not Found- Instance not found

Support

If you encounter any issues or have questions regarding the NOSGPU API, don't hesitate to reach out to our support team.