add_commons_photos
Add Wikimedia Commons photos to a spot or chapter.
/v1/photos/commonsUp to 4 photos by their Commons file titles (search_commons), in the order given, to one spot or one chapter. Each file is read again from Commons (licence and size checked again), copied at 1920 px through the photo optimizer and stored with the author and licence as credit, the file page as source and creditUrl, and alt text when Commons has one. A photo the owner holds already is skipped. failed lists files that could not be added, with the reason.
curl -X POST "https://sceniq.earth/api/v1/photos/commons" \
-H "Authorization: Bearer $SCENIQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"spotId": "k1709e2vj4sk8q6x0d3m5r7t9w1y3b5c",
"titles": [
"File:Grand Prismatic Spring 2013.jpg",
"File:Grand Prismatic Spring and Midway Geyser Basin from above.jpg"
]
}'Body parameters
- titlesarray of stringsrequired
Commons file titles from
search_commons(File:...jpg), 1 to 4. - collectionIdstring · chapter idoptional
The chapter that gets the photos (kind chapter; for its pages).
- spotIdstring · spot idoptional
The spot that gets the photos. Send
spotIdorcollectionId, not both.
Returns
201 Created with PhotosAdded: The result of adding found photos to a spot or chapter.
- addednumberrequired
Photos added by this call.
- skippednumberrequired
Photos the spot or chapter held already, not added twice.
- failedarray of objectsrequired
Photos that could not be added.
Show 2 fieldsHide fields
- idstringrequired
The photo id or file title that failed.
- messagestringrequired
Why, in plain words.
- mediaIdsarray of strings · photo idrequired
The rows of every requested photo the spot or chapter now holds, in request order (added and skipped ones).
{
"added": 1,
"skipped": 1,
"failed": [],
"mediaIds": [
"kg7j2l4n6q8s0u2w4y6a8c0e2g4i6k8n",
"kg7p2p4j6v8y0t2r4e6w8q0a2s4d6f8g"
]
}Errors
Every error is { error: { code, message } }. Act on the code.
- 400invalid_argumentA required field is missing, a field is unknown, or a value does not match its type (the Convex validator's path and value are in the message).
- 400invalid_requestA writer refused a value: a map link on a host that is not allowed, a title that is too long, a date that does not exist, too many items in a list. The message is the writer's own sentence.
- 401unauthenticatedThe request carries no key. Send it as Authorization: Bearer sk_sceniq_... (or X-Api-Key).
- 401invalid_api_keyThe key is unknown, revoked or expired.
- 403api_scope_requiredA read-only key called a write operation, or a key without the publish option called publish_changes.
- 403forbiddenThe key belongs to a creator account that is no longer active.
- 404not_foundThe id does not exist or belongs to another creator. The two answers are identical on purpose, so ids never reveal what exists.
- 400photo_source_failedWikimedia Commons was busy or silent during a search or an add.
- 413payload_too_largeA JSON body over 2 MB, an image over 6 MB, a batch upload over 19 MB, or an MCP message over 2 MB.
- 429rate_limitedOver a limit: requests per key per minute, per creator per hour, uploads per key per minute, or check_links per guide per hour.
- 500internal_errorAn unexpected failure. The message is hidden on purpose.