Cosmos search API
  1. Docs
  2. Cosmos
  3. Cosmos search API

Cosmos search API

Search public Cosmos posts by keyword.

GET /v1/cosmos/search

GET /v1/cosmos/search

Search public Cosmos posts by keyword. Cosmos may return related posts without an exact match.

  • Cost: 1 credit
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
querystringyesSearch terms. Also accepted as keyword, q.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

1curl -G "https://api.socialscrape.dev/v1/cosmos/search" \2  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3  --data-urlencode "query=architecture"

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

200 OKSample response
1{2  "ok": true,3  "credits_charged": 1,4  "credits_remaining": 4999,5  "cached": false,6  "cached_at": null,7  "request_id": "req_1dddbdb2ecd88a8b5f162ecc",8  "data": {9    "object": "list",10    "items": [11      {12        "object": "post",13        "platform": "cosmos",14        "id": "547956585",15        "url": "https://www.cosmos.so/e/547956585",16        "type": "carousel",17        "author": {18          "id": "2059029120",19          "handle": "joris.kahl",20          "name": "Joris Kahl",21          "url": "https://www.cosmos.so/joris.kahl",22          "avatar_url": "https://cdn.cosmos.so/29346e3f-2124-4aa2-a1a3-cff02cd1ce56",23          "verified": false24        },25        "title": null,26        "text": "An architectural poster created using Midjourney v7.",27        "published_at": "2025-06-19T12:57:19.994842Z",28        "duration_seconds": null,29        "language": null,30        "hashtags": null,31        "mentions": null,32        "stats": {33          "views": null,34          "likes": null,35          "comments": null,36          "shares": null,37          "saves": null,38          "dislikes": null39        },40        "media": {41          "thumbnail_url": "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",42          "video_url": null,43          "audio_url": null,44          "image_urls": [45            "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",46            "https://cdn.cosmos.so/4c815d2f-c297-4bee-89f3-bdc8e952440f",47            "https://cdn.cosmos.so/6399cf64-a4ee-4388-b9f9-6622bbc6d743"48          ],49          "width": 928,50          "height": 123251        },52        "song": null,53        "location": null,54        "is_pinned": null,55        "is_sponsored": null,56        "extra": {57          "caption_generated": "An architectural poster created using Midjourney v7.",58          "content_accessibility": "ACCESSIBLE",59          "has_more_media": true,60          "is_featured": false,61          "media": [62            {63              "ai_generated": false,64              "height": 1232,65              "id": "589cdf02-9abf-4d94-88ef-809734ca5444",66              "nsfw_status": "SAFE",67              "type": "StaticImage",68              "url": "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",69              "width": 92870            },71            {72              "ai_generated": false,73              "height": 1232,74              "id": "0e2ebb91-84fc-4700-b076-7c772289b9c7",75              "nsfw_status": "SAFE",76              "type": "StaticImage",77              "url": "https://cdn.cosmos.so/4c815d2f-c297-4bee-89f3-bdc8e952440f",78              "width": 92879            },80            {81              "ai_generated": false,82              "height": 1232,83              "id": "e496cd28-ebe1-4b31-b699-ad97c94c66ed",84              "nsfw_status": "SAFE",85              "type": "StaticImage",86              "url": "https://cdn.cosmos.so/6399cf64-a4ee-4388-b9f9-6622bbc6d743",87              "width": 92888            }89          ],90          "original_collection_id": 2023556596,91          "processing_state": "FINISHED",92          "source": {93            "author": {94              "name": "AI Architecture",95              "profile_url": "https://www.instagram.com/ai_architecture_awards",96              "username": "ai_architecture_awards"97            },98            "is_public_domain": false,99            "url": "https://www.instagram.com/p/DK2wZxvMsbf/?igsh=MW9ubmc3NzRucHBkNg=="100          }101        }102      },103      {104        "object": "post",105        "platform": "cosmos",106        "id": "448317524",107        "url": "https://www.cosmos.so/e/448317524",108        "type": "carousel",109        "author": {110          "id": "876856709",111          "handle": "markbraydon91",112          "name": "Mark",113          "url": "https://www.cosmos.so/markbraydon91",114          "avatar_url": "https://cdn.cosmos.so/52a1b35c-7f63-4432-8e85-a5bf63ecfafb",115          "verified": false116        },117        "title": null,118        "text": null,119        "published_at": "2026-04-20T22:32:26.886048Z",120        "duration_seconds": null,121        "language": null,122        "hashtags": null,123        "mentions": null,124        "stats": {125          "views": null,126          "likes": null,127          "comments": null,128          "shares": null,129          "saves": null,130          "dislikes": null131        },132        "media": {133          "thumbnail_url": "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",134          "video_url": null,135          "audio_url": null,136          "image_urls": [137            "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",138            "https://cdn.cosmos.so/06377029-11c3-4ab6-a276-a051ce44b0cd",139            "https://cdn.cosmos.so/b3d60de8-444f-460c-8887-525329f32fa3"140          ],141          "width": 640,142          "height": 800143        },144        "song": null,145        "location": null,146        "is_pinned": null,147        "is_sponsored": null,148        "extra": {149          "content_accessibility": "ACCESSIBLE",150          "has_more_media": true,151          "is_featured": false,152          "media": [153            {154              "ai_generated": false,155              "height": 800,156              "id": "f064daec-8e14-49c4-a0f8-318833b0dc4f",157              "nsfw_status": "SAFE",158              "type": "StaticImage",159              "url": "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",160              "width": 640161            },162            {163              "ai_generated": false,164              "height": 800,165              "id": "f85f72e7-1922-41ac-9215-62a0afda42e5",166              "nsfw_status": "SAFE",167              "type": "StaticImage",168              "url": "https://cdn.cosmos.so/06377029-11c3-4ab6-a276-a051ce44b0cd",169              "width": 639170            },171            {172              "ai_generated": false,173              "height": 801,174              "id": "7157e864-c5f8-4506-a3dc-987fc7d31b25",175              "nsfw_status": "SAFE",176              "type": "StaticImage",177              "url": "https://cdn.cosmos.so/b3d60de8-444f-460c-8887-525329f32fa3",178              "width": 639179            }180          ],181          "original_collection_id": 1698392581,182          "processing_state": "FINISHED",183          "source": {184            "author": {185              "name": "Architecture Wave",186              "profile_url": "https://www.instagram.com/architecture.wave",187              "username": "architecture.wave"188            },189            "is_public_domain": false,190            "url": "https://www.instagram.com/p/DXHVrtXj95A/?img_index=5&igsh=MWE0aGZtd2VqMXJnOQ=="191          }192        }193      }194    ],195    "cursor": "cursor://recsys/search?user_id=0&profile=search__dual70_nouser_recql&query=architecture&last=39&count=500",196    "has_more": true,197    "parent": null198  },199  "cursor": "cursor://recsys/search?user_id=0&profile=search__dual70_nouser_recql&query=architecture&last=39&count=500",200  "has_more": true201}

Response#

A list of Post objects in data.items, with data.cursor and data.has_more.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.