Comprehensive API Documentation

Developer Documentation

Everything you need to integrate with ApiNest. Simple, powerful, and reliable APIs for your applications with comprehensive examples and error handling.

Quick Start Guide

Get up and running with ApiNest in under 5 minutes

1

Create Account & API Key

Sign up for free and generate your first API key in the dashboard. No credit card required.

Create API Key
2

Make Your First Call

Test the API with a simple request. Copy and paste the example below.

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/joke
3

Integrate & Scale

Use our SDKs and examples to integrate into your application. Monitor usage in real-time.

View SDKs
Authentication & Security

Secure API access with industry-standard authentication

API Key Authentication

All API requests require authentication using your API key in the request header. Include your API key in every request:

# Required header for all requests
x-api-key: your_api_key_here

# Alternative: Query parameter (not recommended for production)
?api_key=your_api_key_here

Security Best Practices

Keep Keys Secure

Never expose API keys in client-side code or public repositories

Use Environment Variables

Store keys in environment variables or secure configuration

Rotate Keys Regularly

Generate new keys periodically and deactivate old ones

API Endpoints Reference

Complete reference for all available APIs with examples and parameters

GET/api/v1/meme1 point

Returns a random XKCD comic with title, image URL, alt text, and publication metadata.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/meme

Response Example

{
  "title": "Compiling",
  "img": "https://imgs.xkcd.com/comics/compiling.png",
  "alt": "Are you compiling? 'My code's compiling.' https://xkcd.com/303/",
  "num": 303,
  "day": "28",
  "month": "9",
  "year": "2007",
  "link": "",
  "news": "",
  "safe_title": "Compiling",
  "transcript": "",
  "permalink": "https://xkcd.com/303/"
}
Response Fields
title - Comic title
img - Direct image URL
alt - Alt text/tooltip
num - Comic number
day/month/year - Publication date
permalink - XKCD URL
GET/api/v1/dad-joke1 point

Returns a random dad joke with safe, family-friendly humor and metadata.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/dad-joke

Response Example

{
  "joke": "Why don't scientists trust atoms? Because they make up everything!",
  "id": 1,
  "category": "dad",
  "type": "single",
  "safe": true,
  "lang": "en",
  "timestamp": "2024-01-15T10:30:00.000Z"
}
Response Fields
joke - The dad joke text
id - Unique joke identifier
category - Always "dad"
type - Always "single"
safe - Always true (family-friendly)
timestamp - Response timestamp
GET/api/v1/would-you-rather1 point

Returns a random "Would You Rather" question with two choices for games and icebreakers.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/would-you-rather

Response Example

{
  "question": "Would you rather have the ability to fly or be invisible?",
  "optionA": "Have the ability to fly",
  "optionB": "Be invisible",
  "id": 1,
  "category": "superpowers",
  "difficulty": "easy",
  "timestamp": "2024-01-15T10:30:00.000Z"
}
Response Fields
question - Full question text
optionA - First choice option
optionB - Second choice option
id - Unique question identifier
category - Question category
difficulty - Question difficulty level
GET/api/v1/joke1 point

Returns a random family-friendly joke with category and safety information.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/joke

Response Example

{
  "joke": "Why don't scientists trust atoms? Because they make up everything!",
  "category": "science",
  "safe": true,
  "id": 12345,
  "type": "single"
}
Response Fields
joke - The joke text
category - Joke category (science, programming, etc.)
safe - Boolean indicating family-friendly content
id - Unique joke identifier
GET/api/v1/advice1 point

Returns a random piece of helpful life advice with categorization.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://sky-pix.xyz/api/v1/advice

Response Example

{
  "advice": "Take time to make your soul happy.",
  "id": 42,
  "category": "wellness",
  "author": "anonymous"
}
GET/api/v1/fact2 points

Returns a random interesting fact with verification status and source information.

Request Example

curl -H "x-api-key: YOUR_KEY" \
  https://apinest.com/api/v1/fact

Response Example

{
  "fact": "Octopuses have three hearts and blue blood.",
  "category": "animals",
  "verified": true,
  "source": "marine_biology",
  "tags": ["ocean", "biology", "animals"]
}
Error Handling & Status Codes

Complete guide to API errors, status codes, and troubleshooting

ApiNest uses conventional HTTP response codes to indicate the success or failure of an API request. All errors include detailed messages and error codes for easy debugging.

Authentication Errors

401Missing API Key
{
  "error": "MISSING_API_KEY",
  "message": "API key is required"
}

Solution: Include your API key in the x-api-key header

401Invalid API Key
{
  "error": "INVALID_API_KEY",
  "message": "Invalid or inactive API key"
}

Solution: Check your API key is correct and active in the dashboard

Rate Limiting

429Rate Limited
{
  "error": "RATE_LIMIT_MINUTE",
  "message": "Rate limit exceeded. Try again in a minute.",
  "retryAfter": 60
}

Solution: Wait for the specified time or upgrade your plan

429Daily Limit
{
  "error": "RATE_LIMIT_DAY",
  "message": "Daily rate limit exceeded. Try again tomorrow.",
  "retryAfter": 86400
}

Solution: Wait until tomorrow or upgrade to a higher plan

Billing & Points

402Insufficient Points
{
  "error": "INSUFFICIENT_POINTS",
  "message": "Insufficient points. Required: 5, Available: 2",
  "required": 5,
  "available": 2,
  "plan": "free"
}

Solution: Upgrade your plan or wait for monthly reset

402Premium Required
{
  "error": "PREMIUM_REQUIRED",
  "message": "This API requires a premium subscription.",
  "requiredPlan": "premium",
  "currentPlan": "free"
}

Solution: Upgrade to premium plan to access this API

Server & API Errors

404API Not Found
{
  "error": "API_NOT_FOUND",
  "message": "API endpoint not found"
}

Solution: Check the API endpoint URL and version

503API Offline
{
  "error": "API_OFFLINE",
  "message": "API is temporarily offline for maintenance",
  "api": "ai-image",
  "version": 1
}

Solution: Check our status page or try again later

Error Handling Best Practices

Always Check Status Codes
if (response.status !== 200) {
  const error = await response.json();
  console.error('API Error:', error.message);
  // Handle specific error types
  switch(error.error) {
    case 'INSUFFICIENT_POINTS':
      // Show upgrade prompt
      break;
    case 'RATE_LIMIT_MINUTE':
      // Implement retry logic
      break;
  }
}
Implement Retry Logic
async function apiCall(url, options, retries = 3) {
  for (let i = 0; i < retries; i++) {
    try {
      const response = await fetch(url, options);
      if (response.status === 429) {
        const delay = Math.pow(2, i) * 1000;
        await new Promise(r => setTimeout(r, delay));
        continue;
      }
      return response;
    } catch (error) {
      if (i === retries - 1) throw error;
    }
  }
}
Rate Limits & Pricing

Transparent pricing with generous free tier and flexible scaling

Free Plan

Perfect for getting started

1,000 points/month - Resets monthly
Basic APIs (Joke, Advice, Facts, Memes)
60 requests/minute rate limit
Community support
API documentation access
Most Popular

Premium Plan

For serious developers

10,000 points/month + extra points system
All APIs including AI & Premium features
300 requests/minute rate limit
Priority support & faster response times
Advanced analytics & usage insights

Point System & API Costs

Different APIs consume different amounts of points based on computational complexity and resource usage:

1
Point
Joke, Advice APIs
2-3
Points
Fact, Translation APIs
5
Points
AI Text Generation
10
Points
AI Image Generation
SDKs & Code Examples

Ready-to-use code examples in popular programming languages

While you can use any HTTP client, here are comprehensive examples in popular languages with error handling and best practices:

Modern JavaScript (Fetch API)

// Basic API call with error handling
async function callApiNest(endpoint, apiKey) {
  try {
    const response = await fetch(`https://apinest.com/api/v1/${endpoint}`, {
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      }
    });

    if (!response.ok) {
      const error = await response.json();
      throw new Error(`API Error: ${error.message}`);
    }

    return await response.json();
  } catch (error) {
    console.error('ApiNest Error:', error.message);
    throw error;
  }
}

// Usage examples
const apiKey = process.env.APINEST_API_KEY;

// Get a joke
const joke = await callApiNest('joke', apiKey);
console.log(joke.joke);

// Generate AI text
const aiText = await callApiNest('ai-text?q=Write a haiku about coding', apiKey);
console.log(aiText.text);

// Get Pokemon data
const pokemon = await callApiNest('pokemon?name=pikachu', apiKey);
console.log(`${pokemon.name} is a ${pokemon.types.join('/')} type Pokemon`);

Node.js with Axios

const axios = require('axios');

// Create an axios instance with default config
const apiNest = axios.create({
  baseURL: 'https://apinest.com/api/v1',
  headers: {
    'x-api-key': process.env.APINEST_API_KEY
  },
  timeout: 30000 // 30 second timeout
});

// Add response interceptor for error handling
apiNest.interceptors.response.use(
  response => response.data,
  error => {
    if (error.response) {
      console.error('API Error:', error.response.data.message);
      throw new Error(error.response.data.message);
    }
    throw error;
  }
);

// Usage examples
try {
  const joke = await apiNest.get('/joke');
  console.log(joke.joke);

  const advice = await apiNest.get('/advice');
  console.log(advice.advice);

  const translation = await apiNest.get('/ai-translate', {
    params: { q: 'Hello world', target: 'es' }
  });
  console.log(translation.translated);
} catch (error) {
  console.error('Failed to call API:', error.message);
}
Support & Resources

Get help and stay updated with ApiNest

Documentation

Comprehensive guides, tutorials, and API references

Community Support

Join our community for help, tips, and discussions

Status Page

Real-time API status and incident reports

Need Premium Support?

Get priority support, faster response times, and dedicated assistance with our Premium plan.