Licensed photo and video search
POST /api/licensed-media-searchFind photos and videos you can reuse, with the license on every result.
Details
Searches Wikimedia Commons and returns up to 20 files per call, each with its file link, preview, size, author, license, license link and a credit line ready to paste. Filter to public domain files, or to files with no share-alike condition, and by minimum width. Files marked as showing nudity or sexual acts are left out. Author and license are what each file page records; read the page before you publish. Not affiliated with or endorsed by the Wikimedia Foundation.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | yes | What the photo or video shows, in a few words. Also accepted as query, search, term, keyword. Up to 200 characters. The example sends lighthouse sunset. |
type | string (one of: photo, video) | no | photo (JPEG files, the default; some are scans or paintings) or video. One of photo, video. |
license | string (one of: any, no-share-alike, public-domain) | no | any (the default), no-share-alike (public domain or credit only) or public-domain. One of any, no-share-alike, public-domain. |
minWidth | integer (1-20000) | no | Smallest width in pixels. From 1 to 20000. |
limit | integer (1-20) | no | Files to return (default 10, at most 20). From 1 to 20. The example sends 2. |
offset | integer (0-1000) | no | Where to start: the nextOffset of the answer before. From 0 to 1000. |
Example request
curl -i -X POST https://agent402.tools/api/licensed-media-search \
-H "Content-Type: application/json" \
-d '{"q":"lighthouse sunset","limit":2}'Watch a call get paid
POST /api/licensed-media-search$0.005 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"query": "lighthouse sunset",
"type": "photo",
"license": "any",
"files": [
{
"title": "Cape May Lighthouse September 2020 002",
"type": "photo",
"contentType": "image/jpeg",
"url": "https://upload.wikimedia.org/wikipedia/commons/a/a3/Cape_May_Lighthouse_September_2020_002.jpg",
"previewUrl": "https://thumb.wikimedia.org/wikipedia/commons/thumb/a/a3/Cape_May_Lighthouse_September_2020_002.jpg/960px-Cape_May_Lighthouse_September_2020_002.jpg",
"pageUrl": "https://commons.wikimedia.org/wiki/File:Cape_May_Lighthouse_September_2020_002.jpg",
"width": 5700,
"height": 3800,
"bytes": 5217122,
"author": "King of Hearts",
"license": "CC BY-SA 4.0",
"licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0",
"licenseFamily": "share-alike",
"creditRequired": true,
"creditLine": "\"Cape May Lighthouse September 2020 002\" by King of Hearts, CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0), via Wikimedia Commons",
"restrictions": []
}
],
"returned": 1,
"matched": 2,
"complete": false,
"truncated": true,
"matchedIsLowerBound": true,
"nextOffset": 1,
"filesRead": 1,
"explicitLeftOut": 0,
"source": {
"name": "Wikimedia Commons",
"url": "https://commons.wikimedia.org"
},
"readAt": "2026-12-04T15:20:32.106Z",
"note": "Author, license and restrictions are what each file page records. Read the file page before you publish: people, trademarks and buildings in a picture can need permission of their own."
}| Field | Type | Always present | In the example |
|---|---|---|---|
query | string | yes | lighthouse sunset |
type | string | yes | photo |
license | string | yes | any |
files | array of objects | yes | 1 item in the example |
returned | number | yes | 1 |
matched | number | yes | 2 |
complete | boolean | yes | false |
truncated | boolean | yes | true |
matchedIsLowerBound | boolean | yes | true |
nextOffset | number | yes | 1 |
filesRead | number | yes | 1 |
explicitLeftOut | number | yes | 0 |
source | object | yes | 2 fields: name, url |
readAt | string | yes | 2026-12-04T15:20:32.106Z |
note | string | yes | Author, license and restrictions are what each file page records. Read the fi... |
From an MCP client
catalog.call {
"slug": "licensed-media-search",
"params": {
"q": "lighthouse sunset",
"limit": 2
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.20.1): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.005 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
q; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/licensed-media-search", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"q": "lighthouse sunset",
"limit": 2
}),
});Get a wallet or run npx -y agent402-mcp@0.20.1 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/licensed-media-search", method="POST", data="{\"q\":\"lighthouse sunset\",\"limit\":2}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units