Docs menu

Cosmos search

Beta 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
  • Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
  • 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).

curl
curl -G "https://api.socialscrape.io/v1/cosmos/search" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "query=architecture"
Python
import os
import requests

params = {
    "query": "architecture",
}
res = requests.get(
    "https://api.socialscrape.io/v1/cosmos/search",
    headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
    params=params,
)
body = res.json()

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/cosmos/search");
url.search = new URLSearchParams({
  "query": "architecture"
}).toString();
const res = await fetch(url, {
  headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();

if (body.ok) {
  console.log(body.data);
} else {
  console.error(body.error.code, body.error.message);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape Cosmos search",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/cosmos/search",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "architecture"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

Example response#

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

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_1dddbdb2ecd88a8b5f162ecc",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "post",
        "platform": "cosmos",
        "id": "547956585",
        "url": "https://www.cosmos.so/e/547956585",
        "type": "carousel",
        "author": {
          "id": "2059029120",
          "handle": "joris.kahl",
          "name": "Joris Kahl",
          "url": "https://www.cosmos.so/joris.kahl",
          "avatar_url": "https://cdn.cosmos.so/29346e3f-2124-4aa2-a1a3-cff02cd1ce56",
          "verified": false
        },
        "title": null,
        "text": "An architectural poster created using Midjourney v7.",
        "published_at": "2025-06-19T12:57:19.994842Z",
        "duration_seconds": null,
        "language": null,
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": null,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",
          "video_url": null,
          "audio_url": null,
          "image_urls": [
            "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",
            "https://cdn.cosmos.so/4c815d2f-c297-4bee-89f3-bdc8e952440f",
            "https://cdn.cosmos.so/6399cf64-a4ee-4388-b9f9-6622bbc6d743"
          ],
          "width": 928,
          "height": 1232
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "caption_generated": "An architectural poster created using Midjourney v7.",
          "content_accessibility": "ACCESSIBLE",
          "has_more_media": true,
          "is_featured": false,
          "media": [
            {
              "ai_generated": false,
              "height": 1232,
              "id": "589cdf02-9abf-4d94-88ef-809734ca5444",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/e00a12d4-1e19-45de-9649-b42e9c9f724a",
              "width": 928
            },
            {
              "ai_generated": false,
              "height": 1232,
              "id": "0e2ebb91-84fc-4700-b076-7c772289b9c7",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/4c815d2f-c297-4bee-89f3-bdc8e952440f",
              "width": 928
            },
            {
              "ai_generated": false,
              "height": 1232,
              "id": "e496cd28-ebe1-4b31-b699-ad97c94c66ed",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/6399cf64-a4ee-4388-b9f9-6622bbc6d743",
              "width": 928
            }
          ],
          "original_collection_id": 2023556596,
          "processing_state": "FINISHED",
          "source": {
            "author": {
              "name": "AI Architecture",
              "profile_url": "https://www.instagram.com/ai_architecture_awards",
              "username": "ai_architecture_awards"
            },
            "is_public_domain": false,
            "url": "https://www.instagram.com/p/DK2wZxvMsbf/?igsh=MW9ubmc3NzRucHBkNg=="
          }
        }
      },
      {
        "object": "post",
        "platform": "cosmos",
        "id": "448317524",
        "url": "https://www.cosmos.so/e/448317524",
        "type": "carousel",
        "author": {
          "id": "876856709",
          "handle": "markbraydon91",
          "name": "Mark",
          "url": "https://www.cosmos.so/markbraydon91",
          "avatar_url": "https://cdn.cosmos.so/52a1b35c-7f63-4432-8e85-a5bf63ecfafb",
          "verified": false
        },
        "title": null,
        "text": null,
        "published_at": "2026-04-20T22:32:26.886048Z",
        "duration_seconds": null,
        "language": null,
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": null,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",
          "video_url": null,
          "audio_url": null,
          "image_urls": [
            "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",
            "https://cdn.cosmos.so/06377029-11c3-4ab6-a276-a051ce44b0cd",
            "https://cdn.cosmos.so/b3d60de8-444f-460c-8887-525329f32fa3"
          ],
          "width": 640,
          "height": 800
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "content_accessibility": "ACCESSIBLE",
          "has_more_media": true,
          "is_featured": false,
          "media": [
            {
              "ai_generated": false,
              "height": 800,
              "id": "f064daec-8e14-49c4-a0f8-318833b0dc4f",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/b350c21f-3abd-483b-8e0d-168d9d96015c",
              "width": 640
            },
            {
              "ai_generated": false,
              "height": 800,
              "id": "f85f72e7-1922-41ac-9215-62a0afda42e5",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/06377029-11c3-4ab6-a276-a051ce44b0cd",
              "width": 639
            },
            {
              "ai_generated": false,
              "height": 801,
              "id": "7157e864-c5f8-4506-a3dc-987fc7d31b25",
              "nsfw_status": "SAFE",
              "type": "StaticImage",
              "url": "https://cdn.cosmos.so/b3d60de8-444f-460c-8887-525329f32fa3",
              "width": 639
            }
          ],
          "original_collection_id": 1698392581,
          "processing_state": "FINISHED",
          "source": {
            "author": {
              "name": "Architecture Wave",
              "profile_url": "https://www.instagram.com/architecture.wave",
              "username": "architecture.wave"
            },
            "is_public_domain": false,
            "url": "https://www.instagram.com/p/DXHVrtXj95A/?img_index=5&igsh=MWE0aGZtd2VqMXJnOQ=="
          }
        }
      }
    ],
    "cursor": "cursor://recsys/search?user_id=0&profile=search__dual70_nouser_recql&query=architecture&last=39&count=500",
    "has_more": true,
    "parent": null
  },
  "cursor": "cursor://recsys/search?user_id=0&profile=search__dual70_nouser_recql&query=architecture&last=39&count=500",
  "has_more": true
}

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.