Cosmos search API
Cosmos visual search: elements matching a query, 40 a page.
GET /v1/cosmos/search1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/cosmos/search?q=brutalist%20architecture",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "data": [ { "__typename": "MediaElementTile", "id": 1417681282, "createdAt": "2025-12-11T12:52:52.653173Z", "shareUrl": "https://www.cosmos.so/e/1417681282", "ownerId": 117077536, "owner": { "username": "semele03", "fullName": "Samuele" }, "generatedCaption": { "text": "The <n>Brutalist</n> <n>Toblerone Building</n> in Belgrade, a source of inspiration for designer <n>Roksanda Ilinčić</n>…" }, "source": { "url": "https://www.instagram.com/p/DOTTroaiBM-/", "isPublicDomain": false, "author": { "username": "roksandailincic", "fullName": "ROKSANDA", "profileUrl": "https://www.instagram.com/roksandailincic" } }, "media": { "__typename": "StaticImage", "url": "https://cdn.cosmos.so/09ed901e-2223-4db3-894c-fdadc88722c9", "width": 675, "height": 900, "aiGenerated": false }, "product": null, "hasMoreMedia": false, "multipleMedia": [] }, { "__typename": "MediaElementTile", "id": 1200360134, "createdAt": "2026-02-09T17:49:00.40184Z", "shareUrl": "https://www.cosmos.so/e/1200360134", "ownerId": null, "owner": null, "generatedCaption": { "text": "<n>Kisho Kurokawa</n>'s <n>Nakagin Capsule Tower</n> in Tokyo, a landmark of Japanese <n>Metabolist</n> architecture. Ph…" }, "source": { "url": "https://www.instagram.com/p/DUZkljUDPRv/?img_index=2&igsh=MWt6ZmIydTdob2w1ag==", "isPublicDomain": false, "author": { "username": "brutalismappreciation", "fullName": "Brutalism Appreciation Society", "profileUrl": "https://www.instagram.com/brutalismappreciation" } }, "media": { "__typename": "StaticImage", "url": "https://cdn.cosmos.so/736631f7-cd86-43e9-9438-bbb5344a3e82", "width": 1080, "height": 1350, "aiGenerated": false }, "product": null, "hasMoreMedia": false, "multipleMedia": [] }, "… 38 more" ], "meta": { "result_count": 40, "count": 500, "next_token": "cursor://recsys/search?user_id=0&profile=search__dual70_nouser_recql&query=brutalist-architecture&last=39&count=500" }}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | Search terms. Example: brutalist architecture. |
afterquery | string | The previous page’s meta.next_token. |
Response fields
200 with a CosmosElements, in Cosmos’s own JSON.
| Field | Type | Description |
|---|---|---|
data | CosmosElement[] | |
meta | object |
Status codes
| Status | Meaning |
|---|---|
200 | A page of elements. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The user, element or collection does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Cosmos is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
How deep?
Several hundred results per query.
Cosmos is a trademark of Cosmos. We are not affiliated with or endorsed by Cosmos.