Narwhal Cloud V2.0 API Documentation & Usage Guide
"Learn how to use Narwhal Cloud V2.0 open APIs to automate your cloud resource management."
Developer Guide: Automating Your Workflow with APIs
Narwhal Cloud V2.0 offers more than just a beautiful Web UI; we provide a comprehensive set of Open APIs for developers. With these APIs, you can write scripts to automate the purchase, management, and monitoring of your Virtual Machines (VMs).
1. Accessing Online API Documentation
We have documented our APIs using the OpenAPI 3.0 standard. You can view, search, and debug the APIs directly online:
👉 Online API Documentation (Swagger UI)
In this documentation, you will find:
- Detailed parameter descriptions for every endpoint.
- Structure definitions for response data.
- An interactive “Try it out” feature for online testing.
2. Obtaining an API Key
Before calling any API, you need to generate an authentication credential:
- Log in to the Narwhal Cloud V2.0 Control Panel.
- Go to the [Account Settings] page.
- Scroll down to the API Key section.
- Click the [Generate Key] button.
- Copy the generated UUID string. Keep it secure and never share it.
3. Authentication Mechanism
Narwhal Cloud V2.0 API uses a unified Bearer authentication scheme. Simply add the Authorization field to your HTTP request headers.
Format:
Authorization: Bearer <YOUR_API_KEY>
Tip: The system automatically detects whether the value following “Bearer” is a traditional JWT Token or an API Key. For programmatic access, we strongly recommend using the API Key.
4. Usage Examples (cURL)
Here are some common API call examples:
Get Account Profile
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.fuckip.me/api/v1/user/me
List All My VMs
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.fuckip.me/api/v1/vms
Start a VM
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
https://api.fuckip.me/api/v1/vms/{vm_id}/start
5. Error Handling
API responses follow a unified envelope format:
{
"code": 0,
"msg": "ok",
"data": { ... }
}
- A
codeof0indicates success. - If
codeis non-zero, themsgfield will contain specific error details.
Conclusion
Open APIs bring infinite scalability to Narwhal Cloud V2.0. Whether you want to integrate with your own management systems or write scripts for auto-renewal and auto-scaling, our APIs have you covered.
If you have any questions during integration, feel free to contact us via the support ticket system.