Cosmos profile
Beta GET /v1/cosmos/profile
GET /v1/cosmos/profile
A public Cosmos profile: bio, links and follower counts.
- 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_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
handle | string | yes | Cosmos username, without a profile URL. Also accepted as username. |
Every request also accepts:
trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.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/profile" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode "handle=design"Python
import os
import requests
params = {
"handle": "design",
}
res = requests.get(
"https://api.socialscrape.io/v1/cosmos/profile",
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/profile");
url.search = new URLSearchParams({
"handle": "design"
}).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 profile",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/cosmos/profile",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "handle",
"value": "design"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Example response#
This is a sample from a recorded response. Status 200.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_0304466741894cf49031423a",
"data": {
"object": "profile",
"platform": "cosmos",
"id": "234172146",
"handle": "design",
"name": "Design",
"headline": null,
"url": "https://www.cosmos.so/design",
"kind": "person",
"bio": "where systems learn to speak to people",
"avatar_url": "https://cdn.cosmos.so/e39a4934-53ae-4536-95a3-18ccd4d052a0",
"banner_url": null,
"verified": false,
"is_private": null,
"external_url": null,
"links": null,
"location": null,
"category": null,
"created_at": null,
"stats": {
"followers": 1003,
"following": 1,
"posts": 25,
"likes": null,
"views": null
},
"extra": {
"collection_count": 70,
"is_premium": true
}
},
"cursor": null,
"has_more": null
}Response#
A Profile object in data.
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.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
not_found | 404 | no | The 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.
Example error:
{
"ok": false,
"error": {
"code": "not_found",
"message": "The platform says this profile, post or item does not exist.",
"retryable": false
},
"credits_charged": 0,
"request_id": "req_aa120d8cad9431302017a2cf"
}Related endpoints#
- Cosmos profile posts (
GET /v1/cosmos/profile/posts) - Cosmos profile collections (
GET /v1/cosmos/profile/collections) - Cosmos post (
GET /v1/cosmos/post) - Cosmos collection (
GET /v1/cosmos/collection) - Cosmos collection posts (
GET /v1/cosmos/collection/posts) - Cosmos search (
GET /v1/cosmos/search)