API Introduction
What is Heavstal APIs
Section titled “What is Heavstal APIs”Heavstal API is a suite of high-performance REST APIs designed for applications of any type. From conversational AI to cryptographic security to entertainment and more, these endpoints are built for speed, reliability, and ease of use.
Why Heavstal API over traditional scraping
Section titled “Why Heavstal API over traditional scraping”Traditional web scraping is difficult and unreliable due to advanced security measures (such as Cloudflare) and frequent website structure changes. Use Heavstal APIs to eliminate maintenance overhead. Heavstal handles the complexities of data ingestion and protection, ensuring a stable, reliable data stream with a 90% guaranteed uptime.
Why Heavstal APIs over other API Providers
Section titled “Why Heavstal APIs over other API Providers”Heavstal Tech provides a cohesive ecosystem of APIs. Instead of making requests to multiple different API providers, you can route your requests through Heavstal servers that are built to handle production workloads.
Beyond this consolidated approach, Heavstal APIs offer several key advantages:
- Complimentary Weekly Tokens: Every Sunday, users receive 1,000 free tokens. For applications with moderate traffic, this allocation is often sufficient to run your services entirely at no cost.
- Lightweight SDK Integration: For JavaScript developers, Heavstal offers the @heavstal/api SDK. This zero-dependency, lightweight library allows you to interact with Heavstal services efficiently without managing direct HTTP requests.
- Competitive Pricing: For high-volume applications that exceed the free weekly quota, Heavstal offers flexible, cost-effective scaling. You can purchase additional capacity starting at 1,000 tokens for ₦3,000 (approximately $3), scaling up to 100,000 tokens for ₦300,000 (approximately $300).
- Graceful Rate-Limiting: To ensure service continuity, Heavstal implements a buffer system. Before enforcing strict rate limits, Heavstal provides a grace period of 10 additional requests and triggers a notification email, giving you the opportunity to upgrade your plan and avoid service interruptions.
Getting Started
Section titled “Getting Started”To use Heavstal APIs, you need an API Key. Heavstal APIs also provide an SDK for easy integration into your application.
Step 1: Getting your API key
Section titled “Step 1: Getting your API key”All API requests require an API Key. Generate one by following the steps below:
- Go to Heavstal API Key Manager.
- Select Generate Secret Key.
- Add a name for your API key.
- (Optional) Add a description.
- (Optional) Turn on Strict Mode.
- (Optional) Enter Authorized IP Addresses (CIDR & range support included).
- (Optional) Enter Authorized Origins.
- (Optional) Enter Authorized User-Agents.
- (Optional) Select Allowed APIs the API key can access.
Step 2: Testing your API Key
Section titled “Step 2: Testing your API Key”Test your API key in the API Playground to verify authentication and view expected response structures.
Code and Examples
Section titled “Code and Examples”Base URL
Section titled “Base URL”All endpoints live under:
https://heavstal.com.ng/api/v1Pass the API key via the x-api-key header to authenticate your requests. If you are using the Heavstal SDK, you can pass a configuration object directly. Refer to the Heavstal API SDK Documentation for more details.
Making a Request
Section titled “Making a Request”curl -X POST https://heavstal.com.ng/api/v1/ai \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"prompt": "Hello"}'const response = await fetch('https://heavstal.com.ng/api/v1/ai', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ prompt: "Explain quantum physics like I'm 5", persona: "You're a 21st century Quantum physicist" })});
const res = await response.json();console.log(res.data);import { ai } from '@heavstal/api';
const chat = await ai.chat( "Explain quantum physics like I'm 5", "A 21th century Physicists with 5 PhDs");
console.log(chat.response);import requests
url = "https://heavstal.com.ng/api/v1/ai"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "prompt": "Explain quantum physics like I'm 5", "persona": "You're a 21st century Quantum physicist"}
response = requests.post(url, headers=headers, json=payload)res = response.json()print(res["data"])Typical Responses
Section titled “Typical Responses”{ "status": "success", "creator": "Heavstal Tech", "data": { ... }}{ "status": "error", "error": "...",}For more information on specific APIs and their exact responses, refer to their individual documentation pages.
Frequently Asked Questions (FAQ)
Section titled “Frequently Asked Questions (FAQ)”How to generate an API Key?
Follow the steps below to generate an API key:
- Go to Heavstal API Key Manager.
- Select Generate Secret Key to open the configuration page.
- Add a name to the API key under the API Key Details section.
- (Optional) Turn on Strict Mode and set Authorized User-Agents, Origins, IP Address & Allowed API Endpoints.
- Select Generate API Key.
- Verify the CAPTCHA and copy the API key from the pop-up window.
How to activate an API key’s Web Application Firewall (WAF)?
The Web Application Firewall is located in the WAF section of the Heavstal API key Manager.
Follow the steps below to activate your API Key’s WAF:
- Go to Heavstal API key Manager.
- Horizontally scroll to the key you want to configure and select View Key.
- Vertically scroll to the Web Application Firewall (WAF) section.
- At the top right of the WAF section, turn on Strict Mode.
- Select + Add IP and enter the IP address that your requests will be sent from. You can add up to 5 IP addresses (CIDR ranges are supported). Using the wildcard IP
0.0.0.0/0will allow requests from all IP addresses. - Under Authorized Origins, add up to 5 domains from which requests are expected to originate.
- Under Authorized User-Agents, add up to 5 specific User-Agents using the same method.
- Under Allowed APIs, select the specific API endpoints the key is allowed to access. (By default, keys can access all APIs).
- Select Save Changes and verify the CAPTCHA.
How can I unblock a blocked IP, User-Agent, or Origin?
Follow the steps below to unblock an entity:
- Go to Heavstal API key Manager.
- Under the WAF Section, scroll down to WAF Security Detection.
- Find the blocked IP, User-Agent, or Origin.
- Select Whitelist this IP/UA/Origin and confirm.
::note
If your whitelist has already reached its limit of 5 entries, you will be unable to whitelist newly blocked entities until you remove an existing one. :::
What happens if my API Key gets accidentally exposed?
If your API key is exposed, Heavstal automatically helps minimize the impact through secret scanning and credential revocation. The affected keys are automatically revoked, and you will be notified via email so you can generate a new key.
How do I manually rotate my API Key?
To rotate your API key manually:
- Go to Heavstal API Manager.
- Select Roll Key.
- Confirm the rotation.
How do I manually revoke my API Key?
To revoke your API key manually:
- Go to Heavstal API Manager.
- Select Revoke Key.
- Confirm the revocation.
What happens when I hit my rate limit?
Rate limits are monitored closely, and users receive multiple notifications as they approach their quota. Should you exceed your limit, you will receive an email warning detailing a 20-request grace period. Failure to address 429 Too Many Requests errors during this period will result in the permanent revocation of your API key.
API Policy
Section titled “API Policy”Developer Fair Use API Policy: This policy governs fair and responsible usage of all Heavstal APIs.
-
Rate Limits Free-tier users are restricted to a moderate request volume of 1,000 requests per week.
-
Prohibited Usage The following activities are strictly prohibited:
- DDoS attacks or scraping
- Account farming
- Token sharing
- Unauthorized resale
Violations of these policies may lead to API Key termination without notice. For further information, refer to the API Policy.