Docs menu

Credit balance

Beta GET /v1/account/credits

GET /v1/account/credits

The credits left for the team behind the key. Free.

  • Cost: Free
  • Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
  • Cache: Not cached.

Parameters#

This endpoint takes no parameters of its own.

Example request#

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

curl
curl "https://api.socialscrape.io/v1/account/credits" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY"
Python
import os
import requests

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

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const res = await fetch("https://api.socialscrape.io/v1/account/credits", {
  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 Credit balance",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/account/credits",
        "sendQuery": false,
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

Example response#

This is a sample with illustrative values. Status 200.

{
  "ok": true,
  "credits_charged": 0,
  "credits_remaining": 5000,
  "cached": false,
  "cached_at": null,
  "request_id": "req_b0923da04322d1de219dc51e",
  "data": {
    "object": "credit_balance",
    "credits_remaining": 5000,
    "team_id": "team_01example"
  },
  "cursor": null,
  "has_more": null
}

Response#

A CreditBalance 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.

CodeHTTPRetryMeaning

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

Also served at#

These paths answer the same request, so code written for other APIs keeps working: /v1/account/credit-balance. See Switching from ScrapeCreators.