ActivityImage API Documentation

Welcome to the ActivityImage API! Our RESTful API provides programmatic access to thousands of educational images, each available in 4 optimized sizes perfect for web apps, PDF generation, and digital content.

Base URL: https://activityimage.com/api/v1

What You Can Build

Authentication

ActivityImage API uses API keys to authenticate requests. You can obtain an API key by signing up for an account.

Keep your API key secure! Do not share it in publicly accessible areas such as GitHub, client-side code, etc.

How to Authenticate

Include your API key in the request header:

Authorization Header
Authorization: Bearer YOUR_API_KEY

Or pass it as a query parameter:

Query Parameter
GET /api/v1/search?q=cat&api_key=YOUR_API_KEY

Rate Limiting

API requests are limited based on your subscription plan:

Plan Requests per Minute Monthly Limit
Free 10 1,000
Professional 100 50,000
Enterprise Custom Unlimited

Rate Limit Headers

Every API response includes rate limit information:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Quick Start

Get started with the ActivityImage API in under 5 minutes:

1. Search for Images

Request
curl https://activityimage.com/api/v1/search?q=cat \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "success": true,
  "data": [
    {
      "id": 123,
      "title": "Cute Cat Illustration",
      "slug": "cute-cat-illustration-abc123",
      "description": "A friendly orange cat",
      "category": {
        "name": "Animals",
        "slug": "animals"
      },
      "urls": {
        "hq_print": "https://activityimage.com/uploads/hq-print/cat-abc.png",
        "standard": "https://activityimage.com/uploads/standard/cat-abc.png",
        "web": "https://activityimage.com/uploads/web/cat-abc.png",
        "thumbnail": "https://activityimage.com/uploads/thumbnails/cat-abc.jpg"
      },
      "dimensions": {
        "hq_print": {"width": 2000, "height": 2000},
        "standard": {"width": 1000, "height": 1000},
        "web": {"width": 500, "height": 500},
        "thumbnail": {"width": 200, "height": 200}
      }
    }
  ],
  "pagination": {
    "total": 50,
    "page": 1,
    "per_page": 20,
    "total_pages": 3
  }
}

Random Images

GET
/api/v1/random
Get random images, optionally filtered by category, keyword, tag, or format

Query Parameters

Parameter Type Required Description
count integer OPTIONAL Number of random images to return (default: 1, max: 50)
q string OPTIONAL Keyword filter — returns random images matching this term (singular/plural forms are matched automatically)
category string OPTIONAL Filter by category slug (e.g., "animals", "shapes")
category_id integer OPTIONAL Filter by category ID
tag string OPTIONAL Filter by tag slug
formats string OPTIONAL Comma-separated formats to include (png, jpg, svg, gif)

Response

Returns a data array of randomly ordered images plus a total_matching count showing how many images matched your filters in total.

Examples

Basic — 5 random images from Shapes
GET /api/v1/random?count=5&category=shapes
Keyword filter — 3 random vegetable images
GET /api/v1/random?count=3&q=vegetable
Response
{
  "count": 3,
  "total_matching": 24,
  "data": [
    {
      "id": 87,
      "title": "Broccoli Illustration",
      ...
    }
  ]
}

Get Image by ID

GET
/api/v1/images/{id}
Retrieve a specific image by its ID or slug

Example

Request
GET /api/v1/images/123
GET /api/v1/images/cute-cat-illustration-abc123

Batch Retrieve

GET
/api/v1/batch
Retrieve multiple images by IDs in a single request

Query Parameters

Parameter Type Required Description
ids string REQUIRED Comma-separated image IDs (max: 100)

Example

Request
GET /api/v1/batch?ids=123,456,789

Categories

GET
/api/v1/categories
List all available image categories with their slug, description, and image count

Query Parameters

Parameter Type Required Description
min_images integer OPTIONAL Only return categories with at least this many images. Default: 0 (returns all categories). Use min_images=1 to hide empty categories.

Available Categories

Name Slug Images
Animalsanimals38
Birdsbirds24
Colorscolors15
Flagsflags27
Flowersflowers12
Foodfood24
Fruitsfruits28
Part of bodypart-of-body12
Shapesshapes13
Transporttransport18
Vegetablesvegetables29
Tip: Always fetch categories dynamically using the API rather than hardcoding slugs — image counts update as new content is added.

Examples

All categories (including empty)
GET /api/v1/categories
Only categories with images
GET /api/v1/categories?min_images=1

Example Response

{
  "success": true,
  "count": 17,
  "data": [
    {
      "id": 1,
      "name": "Animals",
      "slug": "animals",
      "description": "Mammals, birds, reptiles, insects, and sea creatures",
      "image_count": 38
    },
    {
      "id": 13,
      "name": "Birds",
      "slug": "birds",
      "description": "",
      "image_count": 24
    }
  ]
}

Using Categories with Search & Random

Use the slug from this endpoint as the category parameter in Search or Random requests:

JavaScript — fetch categories then load images
// Step 1 — get category list
const cats = await fetch('/api/v1/categories?min_images=1').then(r => r.json());

// Step 2 — use a slug to filter images
const slug = cats.data[0].slug; // e.g. "animals"

// Search images in that category
const images = await fetch(`/api/v1/search?category=${slug}&per_page=20`).then(r => r.json());

// Or get random images from that category
const random = await fetch(`/api/v1/random?category=${slug}&count=6`).then(r => r.json());

Image Sizes

Every image is automatically available in 4 optimized sizes:

Size Dimensions Format Use Case
HQ Print 2000 x 2000 PNG PDF worksheets, high-quality printables
Standard 1000 x 1000 PNG Digital content, presentations
Web 500 x 500 PNG Web applications, previews
Thumbnail 200 x 200 JPG Galleries, search results
Aspect Ratio: Images maintain their original aspect ratio. Dimensions represent maximum width/height.

Error Codes

The API uses standard HTTP status codes:

Code Status Description
200 OK Request successful
400 Bad Request Invalid parameters
401 Unauthorized Invalid or missing API key
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error

Error Response Format

{
  "success": false,
  "error": "Invalid API key"
}

Code Examples

PHP

<?php
$apiKey = 'YOUR_API_KEY';
$url = 'https://activityimage.com/api/v1/search?q=cat&per_page=10';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $apiKey
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
foreach ($data['data'] as $image) {
    echo $image['title'] . "\n";
    echo $image['urls']['web'] . "\n\n";
}
?>

Node.js

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://activityimage.com/api/v1';

async function searchImages(query) {
  try {
    const response = await axios.get(`${BASE_URL}/search`, {
      params: { q: query, per_page: 10 },
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    });

    return response.data.data;
  } catch (error) {
    console.error('API Error:', error.response.data);
  }
}

// Usage
searchImages('animals').then(images => {
  images.forEach(img => {
    console.log(img.title, img.urls.web);
  });
});

React Hook

import { useState, useEffect } from 'react';

function useActivityImages(query) {
  const [images, setImages] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const fetchImages = async () => {
      setLoading(true);
      const response = await fetch(
        `https://activityimage.com/api/v1/search?q=${query}`,
        {
          headers: {
            'Authorization': 'Bearer YOUR_API_KEY'
          }
        }
      );
      const data = await response.json();
      setImages(data.data);
      setLoading(false);
    };

    if (query) fetchImages();
  }, [query]);

  return { images, loading };
}

// Component
function ImageGallery() {
  const { images, loading } = useActivityImages('cats');

  if (loading) return <div>Loading...</div>;

  return (
    <div className="gallery">
      {images.map(img => (
        <img key={img.id} src={img.urls.web} alt={img.alt_text} />
      ))}
    </div>
  );
}

Changelog

Version 1.0.0 - January 2026

Initial Release

Need Help?

Check out our Live API Tester or contact support at support@activityimage.com

© 2026 ActivityImage. All rights reserved.