Image Tagging API

Version 2.197 (Release Notes ↗)

Description

The TAGIMG API endpoint analyzes an image and returns confidence-scored labels that describe the visible content. It is useful for search indexing, catalog metadata, asset organization, moderation pipelines, accessibility tooling, and internal review workflows that need fast visual classification.

Each response contains a ranked list of tags with associated confidence values, making it easy to filter low-confidence labels or combine the output with downstream rules. Developers can use the endpoint to enrich product images, organize media libraries, or feed visual metadata into business systems and developer tools.

HTTP Methods

GET, POST

HTTP Parameters

Required

Fields Type Description
img URL Input image URL. If you want to upload an image directly from your app, submit a multipart/form-data POST request.
key String Your PixLab API Key ↗. You can also send the key in the WWW-Authenticate HTTP header and omit this parameter.

POST Request Body

Use this section when you want to send the request with POST instead of a simple GET call.

Allowed Content-Types:

  • multipart/form-data
  • application/json

Use multipart/form-data if you want to upload an image directly from your app. Refer to the REST API code samples or the PixLab GitHub Repository ↗ for a working example. If you're using application/json, pass a public image URL or a previously stored asset reference in img. The store endpoint can help when you want to upload an image before invoking this endpoint.

HTTP Response

application/json

This endpoint returns a JSON response containing image tag data. The tags array contains detected labels with their name & confidence values. Response fields include:
Fields Type Description
status Integer HTTP 200 indicates success. Any other code indicates failure.
tags Array Contains detected image labels with name & confidence values.
error String Error details returned when status != 200.

Code Samples


import requests
import json

# Tag an image based on detected visual content.

# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the REST API code samples for more info.
img = 'https://pixlab.io/assets/images/nature31.jpg' 

key = 'PIXLAB_API_KEY' # Get your API key from https://console.pixlab.io/

req = requests.get('https://api.pixlab.io/tagimg',params={'img':img,'key':key})
reply = req.json()
if reply['status'] != 200:
	print (reply['error'])
else:
    total = len(reply['tags'])  # Total tags
    print(f"Total tags: {total}")
    for tag in reply['tags']:
        print(f"Tag: {tag['name']} - Confidence: {tag['confidence']}")
← Return to API Endpoint Listing