AUTHENTICATION

API Authentication

Learn how to authenticate your requests to the 0xHost API

Overview

The 0xHost API uses API keys to secure your requests. All API requests must include your API key in the request header.

Security Note: Always keep your API keys secure and never expose them in client-side code.

Generating Your API Key

1
Log in to Your Account

Access your 0xHost client area by logging in at https://0xhost.net

2
Navigate to API Keys Section

Go to the API Keys management page at:
https://0xhost.net/keys/

This page is accessible only when you are logged in to your account.
3
Generate New API Key

Click on the "Generate New API Key" button and configure the following settings:

  • Key Name: Give your key a descriptive name (e.g., "Production Server", "Development App")
  • IP Restrictions (Optional): Limit key usage to specific IP addresses for enhanced security
  • Expiration (Optional): Set an expiration date for temporary access
4
Copy and Secure Your Key

Once generated, copy your API key immediately. For security reasons, the key will only be shown once.

5
Use Your API Key

Include your API key in the x-api-key header of all your API requests.

API Key Authentication

Required for all API requests

Use API keys for all API communication. Generate keys from your client area with specific permissions.

Headers:
x-api-key: your_api_key_here
Content-Type: application/json
  • No session management required
  • Perfect for automated scripts and server-to-server communication
  • Can be restricted by IP address
  • Simple and secure authentication method

Implementation Examples

JavaScript (Fetch)
// Using API Key
const response = await fetch('https://0xhost.net/API/endpoint', {
    method: 'GET',
    headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/json'
    }
});
PHP (cURL)
// Using API Key
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://0xhost.net/API/endpoint');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'x-api-key: your_api_key_here',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

Security Best Practices

Store Keys Securely

Never commit API keys to version control. Use environment variables or secure secret management.

Use IP Restrictions

Restrict API keys to specific IP addresses when possible to prevent unauthorized use.

Rotate Keys Regularly

Regularly rotate your API keys and update them in your applications.

Use HTTPS Only

Always make API requests over HTTPS to encrypt data in transit.